Update ooo320-m1
[ooovba.git] / sd / source / ui / accessibility / AccessiblePresentationShape.cxx
blobeb95257f48f2b0344a9dcb53a0a60d15719a72cd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessiblePresentationShape.cxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include "AccessiblePresentationShape.hxx"
35 #include "SdShapeTypes.hxx"
37 #include <svx/DescriptionGenerator.hxx>
38 #include <rtl/ustring.h>
40 using namespace ::rtl;
41 using namespace ::com::sun::star;
42 using namespace ::com::sun::star::accessibility;
44 namespace accessibility {
46 //===== internal ============================================================
48 AccessiblePresentationShape::AccessiblePresentationShape (
49 const AccessibleShapeInfo& rShapeInfo,
50 const AccessibleShapeTreeInfo& rShapeTreeInfo)
51 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
58 AccessiblePresentationShape::~AccessiblePresentationShape (void)
65 //===== XServiceInfo ========================================================
67 ::rtl::OUString SAL_CALL
68 AccessiblePresentationShape::getImplementationName (void)
69 throw (::com::sun::star::uno::RuntimeException)
71 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape"));
77 /// Set this object's name if is different to the current name.
78 ::rtl::OUString
79 AccessiblePresentationShape::CreateAccessibleBaseName (void)
80 throw (::com::sun::star::uno::RuntimeException)
82 ::rtl::OUString sName;
84 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
85 switch (nShapeType)
87 case PRESENTATION_TITLE:
88 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle"));
89 break;
90 case PRESENTATION_OUTLINER:
91 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner"));
92 break;
93 case PRESENTATION_SUBTITLE:
94 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle"));
95 break;
96 case PRESENTATION_PAGE:
97 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage"));
98 break;
99 case PRESENTATION_NOTES:
100 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes"));
101 break;
102 case PRESENTATION_HANDOUT:
103 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout"));
104 break;
105 case PRESENTATION_HEADER:
106 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader"));
107 break;
108 case PRESENTATION_FOOTER:
109 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter"));
110 break;
111 case PRESENTATION_DATETIME:
112 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime"));
113 break;
114 case PRESENTATION_PAGENUMBER:
115 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber"));
116 break;
117 default:
118 sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
119 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
120 if (xDescriptor.is())
121 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
122 + xDescriptor->getShapeType();
125 return sName;
131 ::rtl::OUString
132 AccessiblePresentationShape::CreateAccessibleDescription (void)
133 throw (::com::sun::star::uno::RuntimeException)
135 // return createAccessibleName ();
136 DescriptionGenerator aDG (mxShape);
137 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
138 switch (nShapeType)
140 case PRESENTATION_TITLE:
141 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape"));
142 break;
143 case PRESENTATION_OUTLINER:
144 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape"));
145 break;
146 case PRESENTATION_SUBTITLE:
147 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape"));
148 break;
149 case PRESENTATION_PAGE:
150 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape"));
151 break;
152 case PRESENTATION_NOTES:
153 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape"));
154 break;
155 case PRESENTATION_HANDOUT:
156 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape"));
157 break;
158 case PRESENTATION_HEADER:
159 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape"));
160 break;
161 case PRESENTATION_FOOTER:
162 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape"));
163 break;
164 case PRESENTATION_DATETIME:
165 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape"));
166 break;
167 case PRESENTATION_PAGENUMBER:
168 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape"));
169 break;
170 default:
171 aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape"));
172 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
173 if (xDescriptor.is())
175 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
176 aDG.AppendString (xDescriptor->getShapeType());
180 return aDG();
183 } // end of namespace accessibility