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