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