Branch data 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 : :
21 : : #include "AccessibleChartShape.hxx"
22 : : #include "ObjectHierarchy.hxx"
23 : : #include "ObjectIdentifier.hxx"
24 : :
25 : : #include <toolkit/helper/vclunohelper.hxx>
26 : : #include <svx/ShapeTypeHandler.hxx>
27 : : #include <svx/AccessibleShape.hxx>
28 : : #include <svx/AccessibleShapeInfo.hxx>
29 : :
30 : : using namespace ::com::sun::star;
31 : : using namespace ::com::sun::star::accessibility;
32 : :
33 : : using ::com::sun::star::uno::Reference;
34 : : using ::com::sun::star::uno::RuntimeException;
35 : :
36 : :
37 : : namespace chart
38 : : {
39 : :
40 : 0 : AccessibleChartShape::AccessibleChartShape(
41 : : const AccessibleElementInfo& rAccInfo,
42 : : bool bMayHaveChildren, bool bAlwaysTransparent )
43 : : :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent )
44 [ # # ]: 0 : ,m_pAccShape( NULL )
45 : : {
46 [ # # ][ # # ]: 0 : if ( rAccInfo.m_aOID.isAdditionalShape() )
47 : : {
48 [ # # ]: 0 : Reference< drawing::XShape > xShape( rAccInfo.m_aOID.getAdditionalShape() );
49 : 0 : Reference< XAccessible > xParent;
50 [ # # ]: 0 : if ( rAccInfo.m_pParent )
51 : : {
52 [ # # ][ # # ]: 0 : xParent.set( rAccInfo.m_pParent );
53 : : }
54 : 0 : sal_Int32 nIndex = -1;
55 [ # # ]: 0 : if ( rAccInfo.m_spObjectHierarchy )
56 : : {
57 [ # # ]: 0 : nIndex = rAccInfo.m_spObjectHierarchy->getIndexInParent( rAccInfo.m_aOID );
58 : : }
59 [ # # ]: 0 : ::accessibility::AccessibleShapeInfo aShapeInfo( xShape, xParent, nIndex );
60 : :
61 [ # # ]: 0 : m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView );
62 [ # # ][ # # ]: 0 : m_aShapeTreeInfo.SetController( NULL );
63 [ # # ][ # # ]: 0 : m_aShapeTreeInfo.SetWindow( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) );
[ # # ]
64 [ # # ]: 0 : m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder );
65 : :
66 [ # # ]: 0 : ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
67 [ # # ]: 0 : m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo );
68 [ # # ]: 0 : if ( m_pAccShape )
69 : : {
70 : 0 : m_pAccShape->acquire();
71 [ # # ]: 0 : m_pAccShape->Init();
72 [ # # ]: 0 : }
73 : : }
74 : 0 : }
75 : :
76 [ # # ]: 0 : AccessibleChartShape::~AccessibleChartShape()
77 : : {
78 : : OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
79 : :
80 [ # # ]: 0 : if ( m_pAccShape )
81 : : {
82 [ # # ]: 0 : m_pAccShape->dispose();
83 : 0 : m_pAccShape->release();
84 : : }
85 [ # # ]: 0 : }
86 : :
87 : : // ________ XServiceInfo ________
88 : 0 : ::rtl::OUString AccessibleChartShape::getImplementationName()
89 : : throw (RuntimeException)
90 : : {
91 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartShape" ) );
92 : : }
93 : :
94 : : // ________ XAccessibleContext ________
95 : 0 : sal_Int32 AccessibleChartShape::getAccessibleChildCount()
96 : : throw (RuntimeException)
97 : : {
98 : 0 : sal_Int32 nCount(0);
99 [ # # ]: 0 : if ( m_pAccShape )
100 : : {
101 : 0 : nCount = m_pAccShape->getAccessibleChildCount();
102 : : }
103 : 0 : return nCount;
104 : : }
105 : :
106 : 0 : Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
107 : : throw (lang::IndexOutOfBoundsException, RuntimeException)
108 : : {
109 : 0 : Reference< XAccessible > xChild;
110 [ # # ]: 0 : if ( m_pAccShape )
111 : : {
112 [ # # ][ # # ]: 0 : xChild = m_pAccShape->getAccessibleChild( i );
113 : : }
114 : 0 : return xChild;
115 : : }
116 : :
117 : 0 : sal_Int16 AccessibleChartShape::getAccessibleRole()
118 : : throw (RuntimeException)
119 : : {
120 : 0 : sal_Int16 nRole(0);
121 [ # # ]: 0 : if ( m_pAccShape )
122 : : {
123 : 0 : nRole = m_pAccShape->getAccessibleRole();
124 : : }
125 : 0 : return nRole;
126 : : }
127 : :
128 : 0 : ::rtl::OUString AccessibleChartShape::getAccessibleDescription()
129 : : throw (::com::sun::star::uno::RuntimeException)
130 : : {
131 : 0 : ::rtl::OUString aDescription;
132 [ # # ]: 0 : if ( m_pAccShape )
133 : : {
134 [ # # ]: 0 : aDescription = m_pAccShape->getAccessibleDescription();
135 : : }
136 : 0 : return aDescription;
137 : : }
138 : :
139 : 0 : ::rtl::OUString AccessibleChartShape::getAccessibleName()
140 : : throw (::com::sun::star::uno::RuntimeException)
141 : : {
142 : 0 : ::rtl::OUString aName;
143 [ # # ]: 0 : if ( m_pAccShape )
144 : : {
145 [ # # ]: 0 : aName = m_pAccShape->getAccessibleName();
146 : : }
147 : 0 : return aName;
148 : : }
149 : :
150 : : // ________ XAccessibleComponent ________
151 : 0 : sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint )
152 : : throw (uno::RuntimeException)
153 : : {
154 : 0 : sal_Bool bReturn = sal_False;
155 [ # # ]: 0 : if ( m_pAccShape )
156 : : {
157 : 0 : bReturn = m_pAccShape->containsPoint( aPoint );
158 : : }
159 : 0 : return bReturn;
160 : : }
161 : :
162 : 0 : Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint )
163 : : throw (uno::RuntimeException)
164 : : {
165 : 0 : Reference< XAccessible > xResult;
166 [ # # ]: 0 : if ( m_pAccShape )
167 : : {
168 [ # # ][ # # ]: 0 : xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) );
169 : : }
170 : 0 : return xResult;
171 : : }
172 : :
173 : 0 : awt::Rectangle AccessibleChartShape::getBounds()
174 : : throw (uno::RuntimeException)
175 : : {
176 : 0 : awt::Rectangle aBounds;
177 [ # # ]: 0 : if ( m_pAccShape )
178 : : {
179 : 0 : aBounds = m_pAccShape->getBounds();
180 : : }
181 : 0 : return aBounds;
182 : : }
183 : :
184 : 0 : awt::Point AccessibleChartShape::getLocation()
185 : : throw (uno::RuntimeException)
186 : : {
187 : 0 : awt::Point aLocation;
188 [ # # ]: 0 : if ( m_pAccShape )
189 : : {
190 : 0 : aLocation = m_pAccShape->getLocation();
191 : : }
192 : 0 : return aLocation;
193 : : }
194 : :
195 : 0 : awt::Point AccessibleChartShape::getLocationOnScreen()
196 : : throw (uno::RuntimeException)
197 : : {
198 : 0 : awt::Point aLocation;
199 [ # # ]: 0 : if ( m_pAccShape )
200 : : {
201 : 0 : aLocation = m_pAccShape->getLocationOnScreen();
202 : : }
203 : 0 : return aLocation;
204 : : }
205 : :
206 : 0 : awt::Size AccessibleChartShape::getSize()
207 : : throw (uno::RuntimeException)
208 : : {
209 : 0 : awt::Size aSize;
210 [ # # ]: 0 : if ( m_pAccShape )
211 : : {
212 : 0 : aSize = m_pAccShape->getSize();
213 : : }
214 : 0 : return aSize;
215 : : }
216 : :
217 : 0 : void AccessibleChartShape::grabFocus()
218 : : throw (uno::RuntimeException)
219 : : {
220 : 0 : return AccessibleBase::grabFocus();
221 : : }
222 : :
223 : 0 : sal_Int32 AccessibleChartShape::getForeground()
224 : : throw (uno::RuntimeException)
225 : : {
226 : 0 : sal_Int32 nColor(0);
227 [ # # ]: 0 : if ( m_pAccShape )
228 : : {
229 : 0 : nColor = m_pAccShape->getForeground();
230 : : }
231 : 0 : return nColor;
232 : : }
233 : :
234 : 0 : sal_Int32 AccessibleChartShape::getBackground()
235 : : throw (uno::RuntimeException)
236 : : {
237 : 0 : sal_Int32 nColor(0);
238 [ # # ]: 0 : if ( m_pAccShape )
239 : : {
240 : 0 : nColor = m_pAccShape->getBackground();
241 : : }
242 : 0 : return nColor;
243 : : }
244 : :
245 : : // ________ XAccessibleExtendedComponent ________
246 : 0 : Reference< awt::XFont > AccessibleChartShape::getFont()
247 : : throw (uno::RuntimeException)
248 : : {
249 : 0 : Reference< awt::XFont > xFont;
250 [ # # ]: 0 : if ( m_pAccShape )
251 : : {
252 [ # # ][ # # ]: 0 : xFont.set( m_pAccShape->getFont() );
253 : : }
254 : 0 : return xFont;
255 : : }
256 : :
257 : 0 : ::rtl::OUString AccessibleChartShape::getTitledBorderText()
258 : : throw (uno::RuntimeException)
259 : : {
260 : 0 : ::rtl::OUString aText;
261 [ # # ]: 0 : if ( m_pAccShape )
262 : : {
263 [ # # ]: 0 : aText = m_pAccShape->getTitledBorderText();
264 : : }
265 : 0 : return aText;
266 : : }
267 : :
268 : 0 : ::rtl::OUString AccessibleChartShape::getToolTipText()
269 : : throw (::com::sun::star::uno::RuntimeException)
270 : : {
271 : 0 : ::rtl::OUString aText;
272 [ # # ]: 0 : if ( m_pAccShape )
273 : : {
274 [ # # ]: 0 : aText = m_pAccShape->getToolTipText();
275 : : }
276 : 0 : return aText;
277 : : }
278 : :
279 : : } // namespace chart
280 : :
281 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|