xref: /AOO41X/main/sd/source/ui/accessibility/AccessiblePresentationShape.cxx (revision 3ea0c3d5cfef7203d1d18b0d5fde9ed31f4a4181)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir #include "AccessiblePresentationShape.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include "SdShapeTypes.hxx"
29cdf0e10cSrcweir 
30*0deba7fbSSteve Yin #include "accessibility.hrc"
31*0deba7fbSSteve Yin #include "sdresid.hxx"
32*0deba7fbSSteve Yin #include <tools/string.hxx>
33cdf0e10cSrcweir #include <svx/DescriptionGenerator.hxx>
34cdf0e10cSrcweir #include <rtl/ustring.h>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace ::rtl;
37cdf0e10cSrcweir using namespace ::com::sun::star;
38cdf0e10cSrcweir using namespace	::com::sun::star::accessibility;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace accessibility {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //=====  internal  ============================================================
43cdf0e10cSrcweir 
AccessiblePresentationShape(const AccessibleShapeInfo & rShapeInfo,const AccessibleShapeTreeInfo & rShapeTreeInfo)44cdf0e10cSrcweir AccessiblePresentationShape::AccessiblePresentationShape (
45cdf0e10cSrcweir     const AccessibleShapeInfo& rShapeInfo,
46cdf0e10cSrcweir     const AccessibleShapeTreeInfo& rShapeTreeInfo)
47cdf0e10cSrcweir     : AccessibleShape (rShapeInfo, rShapeTreeInfo)
48cdf0e10cSrcweir {
49cdf0e10cSrcweir }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
~AccessiblePresentationShape(void)54cdf0e10cSrcweir AccessiblePresentationShape::~AccessiblePresentationShape (void)
55cdf0e10cSrcweir {
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //=====  XServiceInfo  ========================================================
62cdf0e10cSrcweir 
63cdf0e10cSrcweir ::rtl::OUString SAL_CALL
getImplementationName(void)64cdf0e10cSrcweir     AccessiblePresentationShape::getImplementationName (void)
65cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape"));
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir ///	Set this object's name if is different to the current name.
74cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleBaseName(void)75cdf0e10cSrcweir     AccessiblePresentationShape::CreateAccessibleBaseName (void)
76cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir     ::rtl::OUString sName;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
81cdf0e10cSrcweir     switch (nShapeType)
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         case PRESENTATION_TITLE:
84*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N)));
85cdf0e10cSrcweir             break;
86cdf0e10cSrcweir         case PRESENTATION_OUTLINER:
87*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N)));
88cdf0e10cSrcweir             break;
89cdf0e10cSrcweir         case PRESENTATION_SUBTITLE:
90*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N)));
91cdf0e10cSrcweir             break;
92cdf0e10cSrcweir         case PRESENTATION_PAGE:
93*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N)));
94cdf0e10cSrcweir             break;
95cdf0e10cSrcweir         case PRESENTATION_NOTES:
96*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N)));
97cdf0e10cSrcweir             break;
98cdf0e10cSrcweir         case PRESENTATION_HANDOUT:
99*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N)));
100cdf0e10cSrcweir             break;
101cdf0e10cSrcweir 		case PRESENTATION_HEADER:
102*0deba7fbSSteve Yin 	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N)) );
103cdf0e10cSrcweir             break;
104cdf0e10cSrcweir 		case PRESENTATION_FOOTER:
105*0deba7fbSSteve Yin 	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N)) );
106cdf0e10cSrcweir             break;
107cdf0e10cSrcweir 		case PRESENTATION_DATETIME:
108*0deba7fbSSteve Yin 	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N)) );
109cdf0e10cSrcweir             break;
110cdf0e10cSrcweir 		case PRESENTATION_PAGENUMBER:
111*0deba7fbSSteve Yin 	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N)) );
112cdf0e10cSrcweir             break;
113cdf0e10cSrcweir         default:
114*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N)));
115cdf0e10cSrcweir             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
116cdf0e10cSrcweir             if (xDescriptor.is())
117cdf0e10cSrcweir                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
118cdf0e10cSrcweir                     + xDescriptor->getShapeType();
119cdf0e10cSrcweir     }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     return sName;
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir ::rtl::OUString
CreateAccessibleDescription(void)128cdf0e10cSrcweir     AccessiblePresentationShape::CreateAccessibleDescription (void)
129cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir     //    return createAccessibleName ();
132*0deba7fbSSteve Yin     ::rtl::OUString sDescription;
133cdf0e10cSrcweir     DescriptionGenerator aDG (mxShape);
134cdf0e10cSrcweir     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
135cdf0e10cSrcweir     switch (nShapeType)
136cdf0e10cSrcweir     {
137cdf0e10cSrcweir         case PRESENTATION_TITLE:
138*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_TITLE_D)) );
139*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);
140cdf0e10cSrcweir             break;
141cdf0e10cSrcweir         case PRESENTATION_OUTLINER:
142*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_OUTLINER_D)) );
143*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationOutlinerShape
144cdf0e10cSrcweir             break;
145cdf0e10cSrcweir         case PRESENTATION_SUBTITLE:
146cdf0e10cSrcweir             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape"));
147*0deba7fbSSteve Yin  	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_SUBTITLE_D)) );
148*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationSubtitleShape
149cdf0e10cSrcweir             break;
150cdf0e10cSrcweir         case PRESENTATION_PAGE:
151cdf0e10cSrcweir             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape"));
152*0deba7fbSSteve Yin             sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_PAGE_D)) );
153*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationPageShape
154cdf0e10cSrcweir             break;
155cdf0e10cSrcweir         case PRESENTATION_NOTES:
156cdf0e10cSrcweir             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape"));
157*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NOTES_D)) );
158*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationNotesShape
159cdf0e10cSrcweir             break;
160cdf0e10cSrcweir         case PRESENTATION_HANDOUT:
161cdf0e10cSrcweir             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape"));
162*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HANDOUT_D)) );
163*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationHandoutShape
164cdf0e10cSrcweir             break;
165cdf0e10cSrcweir 		case PRESENTATION_HEADER:
166*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_D)) );
167*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationHeaderShape
168cdf0e10cSrcweir             break;
169cdf0e10cSrcweir 		case PRESENTATION_FOOTER:
170*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_D)) );
171*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationFooterShape
172cdf0e10cSrcweir             break;
173cdf0e10cSrcweir 		case PRESENTATION_DATETIME:
174*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_D)) );
175*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationDateShape
176cdf0e10cSrcweir             break;
177cdf0e10cSrcweir 		case PRESENTATION_PAGENUMBER:
178*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_D)) );
179*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//PresentationNumberShape
180cdf0e10cSrcweir             break;
181cdf0e10cSrcweir         default:
182*0deba7fbSSteve Yin 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_UNKNOWN_D)) );
183*0deba7fbSSteve Yin 	    aDG.Initialize (sDescription);				//Unknown accessible presentation shape
184cdf0e10cSrcweir             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
185cdf0e10cSrcweir             if (xDescriptor.is())
186cdf0e10cSrcweir             {
187cdf0e10cSrcweir                 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
188cdf0e10cSrcweir                 aDG.AppendString (xDescriptor->getShapeType());
189cdf0e10cSrcweir             }
190cdf0e10cSrcweir     }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir     return aDG();
193cdf0e10cSrcweir }
GetStyle()194*0deba7fbSSteve Yin ::rtl::OUString AccessiblePresentationShape::GetStyle()
195*0deba7fbSSteve Yin {
196*0deba7fbSSteve Yin     ::rtl::OUString sName;
197cdf0e10cSrcweir 
198*0deba7fbSSteve Yin     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
199*0deba7fbSSteve Yin     switch (nShapeType)
200*0deba7fbSSteve Yin     {
201*0deba7fbSSteve Yin         case PRESENTATION_TITLE:
202*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N_STYLE)));
203*0deba7fbSSteve Yin             break;
204*0deba7fbSSteve Yin         case PRESENTATION_OUTLINER:
205*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE)));
206*0deba7fbSSteve Yin             break;
207*0deba7fbSSteve Yin         case PRESENTATION_SUBTITLE:
208*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE)));
209*0deba7fbSSteve Yin             break;
210*0deba7fbSSteve Yin         case PRESENTATION_PAGE:
211*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N_STYLE)));
212*0deba7fbSSteve Yin             break;
213*0deba7fbSSteve Yin         case PRESENTATION_NOTES:
214*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N_STYLE)));
215*0deba7fbSSteve Yin             break;
216*0deba7fbSSteve Yin         case PRESENTATION_HANDOUT:
217*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE)));
218*0deba7fbSSteve Yin             break;
219*0deba7fbSSteve Yin         case PRESENTATION_FOOTER:
220*0deba7fbSSteve Yin 		sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE)) );
221*0deba7fbSSteve Yin             break;
222*0deba7fbSSteve Yin 	case PRESENTATION_HEADER:
223*0deba7fbSSteve Yin 		sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N_STYLE)) );
224*0deba7fbSSteve Yin             break;
225*0deba7fbSSteve Yin         case PRESENTATION_DATETIME:
226*0deba7fbSSteve Yin 			sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N_STYLE)) );
227*0deba7fbSSteve Yin             break;
228*0deba7fbSSteve Yin         case PRESENTATION_PAGENUMBER:
229*0deba7fbSSteve Yin 			sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE)) );
230*0deba7fbSSteve Yin             break;
231*0deba7fbSSteve Yin         default:
232*0deba7fbSSteve Yin             sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE)));
233*0deba7fbSSteve Yin             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
234*0deba7fbSSteve Yin             if (xDescriptor.is())
235*0deba7fbSSteve Yin                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
236*0deba7fbSSteve Yin                     + xDescriptor->getShapeType();
237*0deba7fbSSteve Yin     }
238*0deba7fbSSteve Yin 
239*0deba7fbSSteve Yin     return sName;
240*0deba7fbSSteve Yin 
241*0deba7fbSSteve Yin }
242cdf0e10cSrcweir } // end of namespace accessibility
243