1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 #include "AccessiblePresentationShape.hxx"
27 
28 #include "SdShapeTypes.hxx"
29 
30 #include <svx/DescriptionGenerator.hxx>
31 #include <rtl/ustring.h>
32 
33 using namespace ::rtl;
34 using namespace ::com::sun::star;
35 using namespace	::com::sun::star::accessibility;
36 
37 namespace accessibility {
38 
39 //=====  internal  ============================================================
40 
41 AccessiblePresentationShape::AccessiblePresentationShape (
42     const AccessibleShapeInfo& rShapeInfo,
43     const AccessibleShapeTreeInfo& rShapeTreeInfo)
44     : AccessibleShape (rShapeInfo, rShapeTreeInfo)
45 {
46 }
47 
48 
49 
50 
51 AccessiblePresentationShape::~AccessiblePresentationShape (void)
52 {
53 }
54 
55 
56 
57 
58 //=====  XServiceInfo  ========================================================
59 
60 ::rtl::OUString SAL_CALL
61     AccessiblePresentationShape::getImplementationName (void)
62     throw (::com::sun::star::uno::RuntimeException)
63 {
64 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape"));
65 }
66 
67 
68 
69 
70 ///	Set this object's name if is different to the current name.
71 ::rtl::OUString
72     AccessiblePresentationShape::CreateAccessibleBaseName (void)
73     throw (::com::sun::star::uno::RuntimeException)
74 {
75     ::rtl::OUString sName;
76 
77     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
78     switch (nShapeType)
79     {
80         case PRESENTATION_TITLE:
81             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle"));
82             break;
83         case PRESENTATION_OUTLINER:
84             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner"));
85             break;
86         case PRESENTATION_SUBTITLE:
87             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle"));
88             break;
89         case PRESENTATION_PAGE:
90             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage"));
91             break;
92         case PRESENTATION_NOTES:
93             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes"));
94             break;
95         case PRESENTATION_HANDOUT:
96             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout"));
97             break;
98 		case PRESENTATION_HEADER:
99             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader"));
100             break;
101 		case PRESENTATION_FOOTER:
102             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter"));
103             break;
104 		case PRESENTATION_DATETIME:
105             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime"));
106             break;
107 		case PRESENTATION_PAGENUMBER:
108             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber"));
109             break;
110         default:
111             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
112             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
113             if (xDescriptor.is())
114                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
115                     + xDescriptor->getShapeType();
116     }
117 
118     return sName;
119 }
120 
121 
122 
123 
124 ::rtl::OUString
125     AccessiblePresentationShape::CreateAccessibleDescription (void)
126     throw (::com::sun::star::uno::RuntimeException)
127 {
128     //    return createAccessibleName ();
129     DescriptionGenerator aDG (mxShape);
130     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
131     switch (nShapeType)
132     {
133         case PRESENTATION_TITLE:
134             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape"));
135             break;
136         case PRESENTATION_OUTLINER:
137             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape"));
138             break;
139         case PRESENTATION_SUBTITLE:
140             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape"));
141             break;
142         case PRESENTATION_PAGE:
143             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape"));
144             break;
145         case PRESENTATION_NOTES:
146             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape"));
147             break;
148         case PRESENTATION_HANDOUT:
149             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape"));
150             break;
151 		case PRESENTATION_HEADER:
152             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape"));
153             break;
154 		case PRESENTATION_FOOTER:
155             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape"));
156             break;
157 		case PRESENTATION_DATETIME:
158             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape"));
159             break;
160 		case PRESENTATION_PAGENUMBER:
161             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape"));
162             break;
163         default:
164             aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape"));
165             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
166             if (xDescriptor.is())
167             {
168                 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
169                 aDG.AppendString (xDescriptor->getShapeType());
170             }
171     }
172 
173     return aDG();
174 }
175 
176 } // end of namespace accessibility
177