Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "AccessiblePresentationShape.hxx"
21 :
22 : #include "SdShapeTypes.hxx"
23 :
24 : #include "accessibility.hrc"
25 : #include "sdresid.hxx"
26 : #include <svx/DescriptionGenerator.hxx>
27 : #include <rtl/ustring.h>
28 :
29 : using namespace ::rtl;
30 : using namespace ::com::sun::star;
31 : using namespace ::com::sun::star::accessibility;
32 :
33 : namespace accessibility {
34 :
35 : //===== internal ============================================================
36 :
37 0 : AccessiblePresentationShape::AccessiblePresentationShape (
38 : const AccessibleShapeInfo& rShapeInfo,
39 : const AccessibleShapeTreeInfo& rShapeTreeInfo)
40 0 : : AccessibleShape (rShapeInfo, rShapeTreeInfo)
41 : {
42 0 : }
43 :
44 :
45 :
46 :
47 0 : AccessiblePresentationShape::~AccessiblePresentationShape (void)
48 : {
49 0 : }
50 :
51 :
52 :
53 :
54 : //===== XServiceInfo ========================================================
55 :
56 : OUString SAL_CALL
57 0 : AccessiblePresentationShape::getImplementationName (void)
58 : throw (::com::sun::star::uno::RuntimeException, std::exception)
59 : {
60 0 : return OUString("AccessiblePresentationShape");
61 : }
62 :
63 :
64 :
65 :
66 : /// Set this object's name if is different to the current name.
67 0 : OUString AccessiblePresentationShape::CreateAccessibleBaseName (void)
68 : throw (::com::sun::star::uno::RuntimeException)
69 : {
70 0 : OUString sName;
71 :
72 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
73 0 : switch (nShapeType)
74 : {
75 : case PRESENTATION_TITLE:
76 0 : sName = SdResId(SID_SD_A11Y_P_TITLE_N);
77 0 : break;
78 : case PRESENTATION_OUTLINER:
79 0 : sName = SdResId(SID_SD_A11Y_P_OUTLINER_N);
80 0 : break;
81 : case PRESENTATION_SUBTITLE:
82 0 : sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N);
83 0 : break;
84 : case PRESENTATION_PAGE:
85 0 : sName = SdResId(SID_SD_A11Y_P_PAGE_N);
86 0 : break;
87 : case PRESENTATION_NOTES:
88 0 : sName = SdResId(SID_SD_A11Y_P_NOTES_N);
89 0 : break;
90 : case PRESENTATION_HANDOUT:
91 0 : sName = SdResId(SID_SD_A11Y_P_HANDOUT_N);
92 0 : break;
93 : case PRESENTATION_HEADER:
94 0 : sName = SdResId(SID_SD_A11Y_P_HEADER_N);
95 0 : break;
96 : case PRESENTATION_FOOTER:
97 0 : sName = SdResId(SID_SD_A11Y_P_FOOTER_N);
98 0 : break;
99 : case PRESENTATION_DATETIME:
100 0 : sName = SdResId(SID_SD_A11Y_P_DATE_N);
101 0 : break;
102 : case PRESENTATION_PAGENUMBER:
103 0 : sName = SdResId(SID_SD_A11Y_P_NUMBER_N);
104 0 : break;
105 : default:
106 0 : sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N);
107 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
108 0 : if (xDescriptor.is())
109 0 : sName += ": " + xDescriptor->getShapeType();
110 : }
111 :
112 0 : return sName;
113 : }
114 :
115 :
116 :
117 :
118 : OUString
119 0 : AccessiblePresentationShape::CreateAccessibleDescription (void)
120 : throw (::com::sun::star::uno::RuntimeException)
121 : {
122 : // return createAccessibleName ();
123 0 : DescriptionGenerator aDG (mxShape);
124 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
125 0 : switch (nShapeType)
126 : {
127 : case PRESENTATION_TITLE:
128 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_TITLE_D));
129 0 : break;
130 : case PRESENTATION_OUTLINER:
131 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_OUTLINER_D));
132 0 : break;
133 : case PRESENTATION_SUBTITLE:
134 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_SUBTITLE_D));
135 0 : break;
136 : case PRESENTATION_PAGE:
137 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_PAGE_D));
138 0 : break;
139 : case PRESENTATION_NOTES:
140 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_NOTES_D));
141 0 : break;
142 : case PRESENTATION_HANDOUT:
143 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_HANDOUT_D));
144 0 : break;
145 : case PRESENTATION_HEADER:
146 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_HEADER_D));
147 0 : break;
148 : case PRESENTATION_FOOTER:
149 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_FOOTER_D));
150 0 : break;
151 : case PRESENTATION_DATETIME:
152 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_DATE_D));
153 0 : break;
154 : case PRESENTATION_PAGENUMBER:
155 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_NUMBER_D));
156 0 : break;
157 : default:
158 0 : aDG.Initialize (SdResId(SID_SD_A11Y_P_UNKNOWN_D));
159 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
160 0 : if (xDescriptor.is())
161 : {
162 0 : aDG.AppendString ("service name=");
163 0 : aDG.AppendString (xDescriptor->getShapeType());
164 0 : }
165 : }
166 :
167 0 : return aDG();
168 : }
169 :
170 0 : OUString AccessiblePresentationShape::GetStyle()
171 : {
172 0 : OUString sName;
173 :
174 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
175 0 : switch (nShapeType)
176 : {
177 : case PRESENTATION_TITLE:
178 0 : sName = SdResId(SID_SD_A11Y_P_TITLE_N_STYLE);
179 0 : break;
180 : case PRESENTATION_OUTLINER:
181 0 : sName = SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE);
182 0 : break;
183 : case PRESENTATION_SUBTITLE:
184 0 : sName = SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE);
185 0 : break;
186 : case PRESENTATION_PAGE:
187 0 : sName = SdResId(SID_SD_A11Y_P_PAGE_N_STYLE);
188 0 : break;
189 : case PRESENTATION_NOTES:
190 0 : sName = SdResId(SID_SD_A11Y_P_NOTES_N_STYLE);
191 0 : break;
192 : case PRESENTATION_HANDOUT:
193 0 : sName = SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE);
194 0 : break;
195 : case PRESENTATION_FOOTER:
196 0 : sName = SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE);
197 0 : break;
198 : case PRESENTATION_HEADER:
199 0 : sName = SdResId(SID_SD_A11Y_P_HEADER_N_STYLE);
200 0 : break;
201 : case PRESENTATION_DATETIME:
202 0 : sName = SdResId(SID_SD_A11Y_P_DATE_N_STYLE);
203 0 : break;
204 : case PRESENTATION_PAGENUMBER:
205 0 : sName = SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE);
206 0 : break;
207 : default:
208 0 : sName = SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE);
209 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
210 0 : if (xDescriptor.is())
211 0 : sName += ": " + xDescriptor->getShapeType();
212 : }
213 :
214 0 : return sName;
215 :
216 : }
217 : } // end of namespace accessibility
218 :
219 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|