bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / accessibility / AccessiblePresentationShape.cxx
blob8d03f8ad967a3499b2072f37288163520877622e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "AccessiblePresentationShape.hxx"
22 #include "SdShapeTypes.hxx"
24 #include "accessibility.hrc"
25 #include "sdresid.hxx"
26 #include <svx/DescriptionGenerator.hxx>
27 #include <rtl/ustring.h>
29 using namespace ::com::sun::star;
30 using namespace ::com::sun::star::accessibility;
32 namespace accessibility {
34 //===== internal ============================================================
36 AccessiblePresentationShape::AccessiblePresentationShape (
37 const AccessibleShapeInfo& rShapeInfo,
38 const AccessibleShapeTreeInfo& rShapeTreeInfo)
39 : AccessibleShape (rShapeInfo, rShapeTreeInfo)
43 AccessiblePresentationShape::~AccessiblePresentationShape()
47 // XServiceInfo
49 OUString SAL_CALL
50 AccessiblePresentationShape::getImplementationName()
51 throw (::com::sun::star::uno::RuntimeException, std::exception)
53 return OUString("AccessiblePresentationShape");
56 /// Set this object's name if is different to the current name.
57 OUString AccessiblePresentationShape::CreateAccessibleBaseName()
58 throw (::com::sun::star::uno::RuntimeException)
60 OUString sName;
62 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
63 switch (nShapeType)
65 case PRESENTATION_TITLE:
66 sName = SdResId(SID_SD_A11Y_P_TITLE_N);
67 break;
68 case PRESENTATION_OUTLINER:
69 sName = SdResId(SID_SD_A11Y_P_OUTLINER_N);
70 break;
71 case PRESENTATION_SUBTITLE:
72 sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N);
73 break;
74 case PRESENTATION_PAGE:
75 sName = SdResId(SID_SD_A11Y_P_PAGE_N);
76 break;
77 case PRESENTATION_NOTES:
78 sName = SdResId(SID_SD_A11Y_P_NOTES_N);
79 break;
80 case PRESENTATION_HANDOUT:
81 sName = SdResId(SID_SD_A11Y_P_HANDOUT_N);
82 break;
83 case PRESENTATION_HEADER:
84 sName = SdResId(SID_SD_A11Y_P_HEADER_N);
85 break;
86 case PRESENTATION_FOOTER:
87 sName = SdResId(SID_SD_A11Y_P_FOOTER_N);
88 break;
89 case PRESENTATION_DATETIME:
90 sName = SdResId(SID_SD_A11Y_P_DATE_N);
91 break;
92 case PRESENTATION_PAGENUMBER:
93 sName = SdResId(SID_SD_A11Y_P_NUMBER_N);
94 break;
95 default:
96 sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N);
97 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
98 if (xDescriptor.is())
99 sName += ": " + xDescriptor->getShapeType();
102 return sName;
105 OUString
106 AccessiblePresentationShape::CreateAccessibleDescription()
107 throw (::com::sun::star::uno::RuntimeException)
109 // return createAccessibleName ();
110 DescriptionGenerator aDG (mxShape);
111 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
112 switch (nShapeType)
114 case PRESENTATION_TITLE:
115 aDG.Initialize (SdResId(SID_SD_A11Y_P_TITLE_D));
116 break;
117 case PRESENTATION_OUTLINER:
118 aDG.Initialize (SdResId(SID_SD_A11Y_P_OUTLINER_D));
119 break;
120 case PRESENTATION_SUBTITLE:
121 aDG.Initialize (SdResId(SID_SD_A11Y_P_SUBTITLE_D));
122 break;
123 case PRESENTATION_PAGE:
124 aDG.Initialize (SdResId(SID_SD_A11Y_P_PAGE_D));
125 break;
126 case PRESENTATION_NOTES:
127 aDG.Initialize (SdResId(SID_SD_A11Y_P_NOTES_D));
128 break;
129 case PRESENTATION_HANDOUT:
130 aDG.Initialize (SdResId(SID_SD_A11Y_P_HANDOUT_D));
131 break;
132 case PRESENTATION_HEADER:
133 aDG.Initialize (SdResId(SID_SD_A11Y_P_HEADER_D));
134 break;
135 case PRESENTATION_FOOTER:
136 aDG.Initialize (SdResId(SID_SD_A11Y_P_FOOTER_D));
137 break;
138 case PRESENTATION_DATETIME:
139 aDG.Initialize (SdResId(SID_SD_A11Y_P_DATE_D));
140 break;
141 case PRESENTATION_PAGENUMBER:
142 aDG.Initialize (SdResId(SID_SD_A11Y_P_NUMBER_D));
143 break;
144 default:
145 aDG.Initialize (SdResId(SID_SD_A11Y_P_UNKNOWN_D));
146 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
147 if (xDescriptor.is())
149 aDG.AppendString ("service name=");
150 aDG.AppendString (xDescriptor->getShapeType());
154 return aDG();
157 OUString AccessiblePresentationShape::GetStyle()
159 OUString sName;
161 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
162 switch (nShapeType)
164 case PRESENTATION_TITLE:
165 sName = SdResId(SID_SD_A11Y_P_TITLE_N_STYLE);
166 break;
167 case PRESENTATION_OUTLINER:
168 sName = SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE);
169 break;
170 case PRESENTATION_SUBTITLE:
171 sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE);
172 break;
173 case PRESENTATION_PAGE:
174 sName = SdResId(SID_SD_A11Y_P_PAGE_N_STYLE);
175 break;
176 case PRESENTATION_NOTES:
177 sName = SdResId(SID_SD_A11Y_P_NOTES_N_STYLE);
178 break;
179 case PRESENTATION_HANDOUT:
180 sName = SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE);
181 break;
182 case PRESENTATION_FOOTER:
183 sName = SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE);
184 break;
185 case PRESENTATION_HEADER:
186 sName = SdResId(SID_SD_A11Y_P_HEADER_N_STYLE);
187 break;
188 case PRESENTATION_DATETIME:
189 sName = SdResId(SID_SD_A11Y_P_DATE_N_STYLE);
190 break;
191 case PRESENTATION_PAGENUMBER:
192 sName = SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE);
193 break;
194 default:
195 sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE);
196 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
197 if (xDescriptor.is())
198 sName += ": " + xDescriptor->getShapeType();
201 return sName;
204 } // end of namespace accessibility
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */