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 <svx/DescriptionGenerator.hxx>
25 : #include <rtl/ustring.h>
26 :
27 : using namespace ::rtl;
28 : using namespace ::com::sun::star;
29 : using namespace ::com::sun::star::accessibility;
30 :
31 : namespace accessibility {
32 :
33 : //===== internal ============================================================
34 :
35 0 : AccessiblePresentationShape::AccessiblePresentationShape (
36 : const AccessibleShapeInfo& rShapeInfo,
37 : const AccessibleShapeTreeInfo& rShapeTreeInfo)
38 0 : : AccessibleShape (rShapeInfo, rShapeTreeInfo)
39 : {
40 0 : }
41 :
42 :
43 :
44 :
45 0 : AccessiblePresentationShape::~AccessiblePresentationShape (void)
46 : {
47 0 : }
48 :
49 :
50 :
51 :
52 : //===== XServiceInfo ========================================================
53 :
54 : ::rtl::OUString SAL_CALL
55 0 : AccessiblePresentationShape::getImplementationName (void)
56 : throw (::com::sun::star::uno::RuntimeException)
57 : {
58 0 : return ::rtl::OUString("AccessiblePresentationShape");
59 : }
60 :
61 :
62 :
63 :
64 : /// Set this object's name if is different to the current name.
65 : ::rtl::OUString
66 0 : AccessiblePresentationShape::CreateAccessibleBaseName (void)
67 : throw (::com::sun::star::uno::RuntimeException)
68 : {
69 0 : ::rtl::OUString sName;
70 :
71 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
72 0 : switch (nShapeType)
73 : {
74 : case PRESENTATION_TITLE:
75 0 : sName = "ImpressTitle";
76 : break;
77 : case PRESENTATION_OUTLINER:
78 0 : sName = "ImpressOutliner";
79 : break;
80 : case PRESENTATION_SUBTITLE:
81 0 : sName = "ImpressSubtitle";
82 : break;
83 : case PRESENTATION_PAGE:
84 0 : sName = "ImpressPage";
85 : break;
86 : case PRESENTATION_NOTES:
87 0 : sName = "ImpressNotes";
88 : break;
89 : case PRESENTATION_HANDOUT:
90 0 : sName = "ImpressHandout";
91 : break;
92 : case PRESENTATION_HEADER:
93 0 : sName = "ImpressHeader";
94 : break;
95 : case PRESENTATION_FOOTER:
96 0 : sName = "ImpressFooter";
97 : break;
98 : case PRESENTATION_DATETIME:
99 0 : sName = "ImpressDateAndTime";
100 : break;
101 : case PRESENTATION_PAGENUMBER:
102 0 : sName = "ImpressPageNumber";
103 : break;
104 : default:
105 0 : sName = "UnknownAccessibleImpressShape";
106 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
107 0 : if (xDescriptor.is())
108 0 : sName += ": " + xDescriptor->getShapeType();
109 : }
110 :
111 0 : return sName;
112 : }
113 :
114 :
115 :
116 :
117 : ::rtl::OUString
118 0 : AccessiblePresentationShape::CreateAccessibleDescription (void)
119 : throw (::com::sun::star::uno::RuntimeException)
120 : {
121 : // return createAccessibleName ();
122 0 : DescriptionGenerator aDG (mxShape);
123 0 : ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
124 0 : switch (nShapeType)
125 : {
126 : case PRESENTATION_TITLE:
127 0 : aDG.Initialize ("PresentationTitleShape");
128 : break;
129 : case PRESENTATION_OUTLINER:
130 0 : aDG.Initialize ("PresentationOutlinerShape");
131 : break;
132 : case PRESENTATION_SUBTITLE:
133 0 : aDG.Initialize ("PresentationSubtitleShape");
134 : break;
135 : case PRESENTATION_PAGE:
136 0 : aDG.Initialize ("PresentationPageShape");
137 : break;
138 : case PRESENTATION_NOTES:
139 0 : aDG.Initialize ("PresentationNotesShape");
140 : break;
141 : case PRESENTATION_HANDOUT:
142 0 : aDG.Initialize ("PresentationHandoutShape");
143 : break;
144 : case PRESENTATION_HEADER:
145 0 : aDG.Initialize ("PresentationHeaderShape");
146 : break;
147 : case PRESENTATION_FOOTER:
148 0 : aDG.Initialize ("PresentationFooterShape");
149 : break;
150 : case PRESENTATION_DATETIME:
151 0 : aDG.Initialize ("PresentationDateAndTimeShape");
152 : break;
153 : case PRESENTATION_PAGENUMBER:
154 0 : aDG.Initialize ("PresentationPageNumberShape");
155 : break;
156 : default:
157 0 : aDG.Initialize ("Unknown accessible presentation shape");
158 0 : uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
159 0 : if (xDescriptor.is())
160 : {
161 0 : aDG.AppendString ("service name=");
162 0 : aDG.AppendString (xDescriptor->getShapeType());
163 0 : }
164 : }
165 :
166 0 : return aDG();
167 : }
168 :
169 : } // end of namespace accessibility
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|