Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <accessiblecell.hxx>
31 : :
32 : : #include "svx/DescriptionGenerator.hxx"
33 : :
34 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
35 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36 : :
37 : : #include <vcl/svapp.hxx>
38 : :
39 : : #include <unotools/accessiblestatesethelper.hxx>
40 : :
41 : : #include <editeng/outlobj.hxx>
42 : : #include <svx/unoshtxt.hxx>
43 : : #include <svx/svdotext.hxx>
44 : :
45 : : using ::rtl::OUString;
46 : : using namespace ::sdr::table;
47 : : using namespace ::com::sun::star;
48 : : using namespace ::com::sun::star::uno;
49 : : using namespace ::com::sun::star::accessibility;
50 : : using namespace ::com::sun::star::lang;
51 : : using namespace ::com::sun::star::container;
52 : :
53 : : namespace accessibility {
54 : :
55 : : // --------------------------------------------------------------------
56 : : // AccessibleCell
57 : : // --------------------------------------------------------------------
58 : :
59 : 0 : AccessibleCell::AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo )
60 : : : AccessibleCellBase( rxParent, AccessibleRole::TABLE_CELL )
61 : : , maShapeTreeInfo( rShapeTreeInfo )
62 : : , mnIndexInParent( nIndex )
63 : : , mpText( NULL )
64 [ # # ][ # # ]: 0 : , mxCell( rCell )
[ # # ]
65 : : {
66 : 0 : }
67 : :
68 : : // --------------------------------------------------------------------
69 : :
70 [ # # ][ # # ]: 0 : AccessibleCell::~AccessibleCell (void)
[ # # ]
71 : : {
72 : : DBG_ASSERT( mpText == 0, "svx::AccessibleCell::~AccessibleCell(), not disposed!?" );
73 [ # # ]: 0 : }
74 : :
75 : : // --------------------------------------------------------------------
76 : :
77 : 0 : void AccessibleCell::Init (void)
78 : : {
79 : 0 : SdrView* pView = maShapeTreeInfo.GetSdrView();
80 : 0 : const Window* pWindow = maShapeTreeInfo.GetWindow ();
81 [ # # ][ # # ]: 0 : if( (pView != NULL) && (pWindow != NULL) && mxCell.is())
[ # # ][ # # ]
82 : : {
83 : 0 : OutlinerParaObject* pOutlinerParaObject = mxCell->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active
84 : :
85 : 0 : bool bOwnParaObject = pOutlinerParaObject != 0;
86 : :
87 [ # # ]: 0 : if( !pOutlinerParaObject )
88 : 0 : pOutlinerParaObject = mxCell->GetOutlinerParaObject();
89 : :
90 : : // create AccessibleTextHelper to handle this shape's text
91 [ # # ]: 0 : if( pOutlinerParaObject )
92 : : {
93 : : // non-empty text -> use full-fledged edit source right away
94 [ # # ][ # # ]: 0 : ::std::auto_ptr<SvxEditSource> pEditSource( new SvxTextEditSource( mxCell->GetObject(), mxCell.get(), *pView, *pWindow) );
95 [ # # ][ # # ]: 0 : mpText = new AccessibleTextHelper( pEditSource );
[ # # ]
96 [ # # ][ # # ]: 0 : mpText->SetEventSource(this);
[ # # ]
97 : : }
98 : :
99 [ # # ]: 0 : if( bOwnParaObject)
100 [ # # ]: 0 : delete pOutlinerParaObject;
101 : : }
102 : 0 : }
103 : :
104 : : // --------------------------------------------------------------------
105 : :
106 : 0 : sal_Bool AccessibleCell::SetState (sal_Int16 aState)
107 : : {
108 : 0 : sal_Bool bStateHasChanged = sal_False;
109 : :
110 [ # # ][ # # ]: 0 : if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
111 : : {
112 : : // Offer FOCUSED state to edit engine and detect whether the state
113 : : // changes.
114 : 0 : sal_Bool bIsFocused = mpText->HaveFocus ();
115 : 0 : mpText->SetFocus (sal_True);
116 : 0 : bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
117 : : }
118 : : else
119 : 0 : bStateHasChanged = AccessibleContextBase::SetState (aState);
120 : :
121 : 0 : return bStateHasChanged;
122 : : }
123 : :
124 : : // --------------------------------------------------------------------
125 : :
126 : 0 : sal_Bool AccessibleCell::ResetState (sal_Int16 aState)
127 : : {
128 : 0 : sal_Bool bStateHasChanged = sal_False;
129 : :
130 [ # # ][ # # ]: 0 : if (aState == AccessibleStateType::FOCUSED && mpText != NULL)
131 : : {
132 : : // Try to remove FOCUSED state from the edit engine and detect
133 : : // whether the state changes.
134 : 0 : sal_Bool bIsFocused = mpText->HaveFocus ();
135 : 0 : mpText->SetFocus (sal_False);
136 : 0 : bStateHasChanged = (bIsFocused != mpText->HaveFocus ());
137 : : }
138 : : else
139 : 0 : bStateHasChanged = AccessibleContextBase::ResetState (aState);
140 : :
141 : 0 : return bStateHasChanged;
142 : : }
143 : :
144 : : //-----------------------------------------------------------------------------
145 : :
146 : 0 : bool AccessibleCell::operator== (const AccessibleCell& rAccessibleCell)
147 : : {
148 : 0 : return this == &rAccessibleCell;
149 : : }
150 : :
151 : : //-----------------------------------------------------------------------------
152 : : // XInterface
153 : : //-----------------------------------------------------------------------------
154 : :
155 : 0 : Any SAL_CALL AccessibleCell::queryInterface( const Type& aType ) throw (RuntimeException)
156 : : {
157 : 0 : return AccessibleCellBase::queryInterface( aType );
158 : : }
159 : :
160 : : //-----------------------------------------------------------------------------
161 : :
162 : 0 : void SAL_CALL AccessibleCell::acquire( ) throw ()
163 : : {
164 : 0 : AccessibleCellBase::acquire();
165 : 0 : }
166 : :
167 : : //-----------------------------------------------------------------------------
168 : :
169 : 0 : void SAL_CALL AccessibleCell::release( ) throw ()
170 : : {
171 : 0 : AccessibleCellBase::release();
172 : 0 : }
173 : :
174 : : // --------------------------------------------------------------------
175 : : // XAccessibleContext
176 : : // --------------------------------------------------------------------
177 : :
178 : : /** The children of this cell come from the paragraphs of text.
179 : : */
180 : 0 : sal_Int32 SAL_CALL AccessibleCell::getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException)
181 : : {
182 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
183 [ # # ]: 0 : ThrowIfDisposed ();
184 [ # # ][ # # ]: 0 : return mpText != NULL ? mpText->GetChildCount () : 0;
[ # # ]
185 : : }
186 : :
187 : : // --------------------------------------------------------------------
188 : :
189 : : /** Forward the request to the shape. Return the requested shape or throw
190 : : an exception for a wrong index.
191 : : */
192 : 0 : Reference<XAccessible> SAL_CALL AccessibleCell::getAccessibleChild (sal_Int32 nIndex) throw (IndexOutOfBoundsException, RuntimeException)
193 : : {
194 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
195 [ # # ]: 0 : ThrowIfDisposed ();
196 : :
197 : : // todo: does GetChild throw IndexOutOfBoundsException?
198 [ # # ][ # # ]: 0 : return mpText->GetChild (nIndex);
199 : : }
200 : :
201 : : // --------------------------------------------------------------------
202 : :
203 : : /** Return a copy of the state set.
204 : : Possible states are:
205 : : ENABLED
206 : : SHOWING
207 : : VISIBLE
208 : : */
209 : 0 : Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet (void) throw (RuntimeException)
210 : : {
211 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
212 [ # # ]: 0 : ::osl::MutexGuard aGuard (maMutex);
213 : 0 : Reference<XAccessibleStateSet> xStateSet;
214 : :
215 [ # # ][ # # ]: 0 : if (rBHelper.bDisposed || mpText == NULL)
216 : : {
217 : : // Return a minimal state set that only contains the DEFUNC state.
218 [ # # ][ # # ]: 0 : xStateSet = AccessibleContextBase::getAccessibleStateSet ();
219 : : }
220 : : else
221 : : {
222 [ # # ][ # # ]: 0 : ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
223 : :
224 [ # # ]: 0 : if(pStateSet)
225 : : {
226 : : // Merge current FOCUSED state from edit engine.
227 [ # # ]: 0 : if (mpText != NULL)
228 : : {
229 [ # # ][ # # ]: 0 : if (mpText->HaveFocus())
230 [ # # ]: 0 : pStateSet->AddState (AccessibleStateType::FOCUSED);
231 : : else
232 [ # # ]: 0 : pStateSet->RemoveState (AccessibleStateType::FOCUSED);
233 : : }
234 : :
235 : : // Create a copy of the state set that may be modified by the
236 : : // caller without affecting the current state set.
237 [ # # ][ # # ]: 0 : xStateSet = Reference<XAccessibleStateSet>(new ::utl::AccessibleStateSetHelper (*pStateSet));
[ # # ][ # # ]
238 : : }
239 : : }
240 : :
241 [ # # ][ # # ]: 0 : return xStateSet;
242 : : }
243 : :
244 : : // --------------------------------------------------------------------
245 : : // XAccessibleComponent
246 : : // --------------------------------------------------------------------
247 : :
248 : 0 : sal_Bool SAL_CALL AccessibleCell::containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException)
249 : : {
250 : 0 : return AccessibleComponentBase::containsPoint( aPoint );
251 : : }
252 : :
253 : : /** The implementation below is at the moment straightforward. It iterates
254 : : over all children (and thereby instances all children which have not
255 : : been already instatiated) until a child covering the specifed point is
256 : : found.
257 : : This leaves room for improvement. For instance, first iterate only over
258 : : the already instantiated children and only if no match is found
259 : : instantiate the remaining ones.
260 : : */
261 : 0 : Reference<XAccessible > SAL_CALL AccessibleCell::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw(RuntimeException)
262 : : {
263 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
264 [ # # ]: 0 : ::osl::MutexGuard aGuard (maMutex);
265 : :
266 [ # # ]: 0 : sal_Int32 nChildCount = getAccessibleChildCount ();
267 [ # # ]: 0 : for (sal_Int32 i=0; i<nChildCount; ++i)
268 : : {
269 [ # # ]: 0 : Reference<XAccessible> xChild (getAccessibleChild (i));
270 [ # # ]: 0 : if (xChild.is())
271 : : {
272 [ # # ][ # # ]: 0 : Reference<XAccessibleComponent> xChildComponent (xChild->getAccessibleContext(), uno::UNO_QUERY);
[ # # ]
273 [ # # ]: 0 : if (xChildComponent.is())
274 : : {
275 [ # # ][ # # ]: 0 : awt::Rectangle aBBox (xChildComponent->getBounds());
276 [ # # ][ # # ]: 0 : if ( (aPoint.X >= aBBox.X)
[ # # ][ # # ]
277 : : && (aPoint.Y >= aBBox.Y)
278 : : && (aPoint.X < aBBox.X+aBBox.Width)
279 : : && (aPoint.Y < aBBox.Y+aBBox.Height) )
280 : 0 : return xChild;
281 [ # # ]: 0 : }
282 : : }
283 [ # # ]: 0 : }
284 : :
285 : : // Have not found a child under the given point. Returning empty
286 : : // reference to indicate this.
287 [ # # ][ # # ]: 0 : return uno::Reference<XAccessible>();
288 : : }
289 : :
290 : : // --------------------------------------------------------------------
291 : :
292 : 0 : ::com::sun::star::awt::Rectangle SAL_CALL AccessibleCell::getBounds(void) throw(RuntimeException)
293 : : {
294 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
295 [ # # ]: 0 : ::osl::MutexGuard aGuard (maMutex);
296 : :
297 [ # # ]: 0 : ThrowIfDisposed ();
298 : 0 : ::com::sun::star::awt::Rectangle aBoundingBox;
299 [ # # ]: 0 : if( mxCell.is() )
300 : : {
301 : : // Get the cell's bounding box in internal coordinates (in 100th of mm)
302 : 0 : const ::Rectangle aCellRect( mxCell->getCellRect() );
303 : :
304 : : // Transform coordinates from internal to pixel.
305 [ # # ][ # # ]: 0 : if (maShapeTreeInfo.GetViewForwarder() == NULL)
306 [ # # ][ # # ]: 0 : throw uno::RuntimeException (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleCell has no valid view forwarder")),static_cast<uno::XWeak*>(this));
[ # # ]
307 : :
308 [ # # ][ # # ]: 0 : ::Size aPixelSize( maShapeTreeInfo.GetViewForwarder()->LogicToPixel(::Size(aCellRect.GetWidth(), aCellRect.GetHeight())) );
[ # # ][ # # ]
309 [ # # ][ # # ]: 0 : ::Point aPixelPosition( maShapeTreeInfo.GetViewForwarder()->LogicToPixel( aCellRect.TopLeft() ));
310 : :
311 : : // Clip the shape's bounding box with the bounding box of its parent.
312 [ # # ][ # # ]: 0 : Reference<XAccessibleComponent> xParentComponent ( getAccessibleParent(), uno::UNO_QUERY);
313 [ # # ]: 0 : if (xParentComponent.is())
314 : : {
315 : : // Make the coordinates relative to the parent.
316 [ # # ][ # # ]: 0 : awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
317 : 0 : int x = aPixelPosition.getX() - aParentLocation.X;
318 : 0 : int y = aPixelPosition.getY() - aParentLocation.Y;
319 : :
320 : : // Clip with parent (with coordinates relative to itself).
321 [ # # ]: 0 : ::Rectangle aBBox ( x, y, x + aPixelSize.getWidth(), y + aPixelSize.getHeight());
322 [ # # ][ # # ]: 0 : awt::Size aParentSize (xParentComponent->getSize());
323 [ # # ]: 0 : ::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
324 [ # # ]: 0 : aBBox = aBBox.GetIntersection (aParentBBox);
325 : 0 : aBoundingBox = awt::Rectangle ( aBBox.getX(), aBBox.getY(), aBBox.getWidth(), aBBox.getHeight());
326 : : }
327 : : else
328 : : {
329 : : OSL_TRACE ("parent does not support component");
330 : 0 : aBoundingBox = awt::Rectangle (aPixelPosition.getX(), aPixelPosition.getY(),aPixelSize.getWidth(), aPixelSize.getHeight());
331 : 0 : }
332 : : }
333 : :
334 [ # # ][ # # ]: 0 : return aBoundingBox;
335 : : }
336 : :
337 : : // --------------------------------------------------------------------
338 : :
339 : 0 : ::com::sun::star::awt::Point SAL_CALL AccessibleCell::getLocation(void) throw (RuntimeException)
340 : : {
341 [ # # ]: 0 : ThrowIfDisposed ();
342 [ # # ]: 0 : ::com::sun::star::awt::Rectangle aBoundingBox(getBounds());
343 : 0 : return ::com::sun::star::awt::Point(aBoundingBox.X, aBoundingBox.Y);
344 : : }
345 : :
346 : : // --------------------------------------------------------------------
347 : :
348 : 0 : ::com::sun::star::awt::Point SAL_CALL AccessibleCell::getLocationOnScreen(void) throw(RuntimeException)
349 : : {
350 [ # # ]: 0 : ThrowIfDisposed ();
351 : :
352 : : // Get relative position...
353 [ # # ]: 0 : ::com::sun::star::awt::Point aLocation(getLocation ());
354 : :
355 : : // ... and add absolute position of the parent.
356 [ # # ][ # # ]: 0 : Reference<XAccessibleComponent> xParentComponent( getAccessibleParent(), uno::UNO_QUERY);
357 [ # # ]: 0 : if(xParentComponent.is())
358 : : {
359 [ # # ][ # # ]: 0 : ::com::sun::star::awt::Point aParentLocation(xParentComponent->getLocationOnScreen());
360 : 0 : aLocation.X += aParentLocation.X;
361 : 0 : aLocation.Y += aParentLocation.Y;
362 : : }
363 : : else
364 : : {
365 : : OSL_TRACE ("getLocation: parent does not support XAccessibleComponent");
366 : : }
367 : :
368 : 0 : return aLocation;
369 : : }
370 : :
371 : : // --------------------------------------------------------------------
372 : :
373 : 0 : awt::Size SAL_CALL AccessibleCell::getSize (void) throw (RuntimeException)
374 : : {
375 [ # # ]: 0 : ThrowIfDisposed ();
376 [ # # ]: 0 : awt::Rectangle aBoundingBox (getBounds());
377 : 0 : return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
378 : : }
379 : :
380 : : // --------------------------------------------------------------------
381 : :
382 : 0 : void SAL_CALL AccessibleCell::addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException)
383 : : {
384 : 0 : AccessibleComponentBase::addFocusListener( xListener );
385 : 0 : }
386 : :
387 : : // --------------------------------------------------------------------
388 : :
389 : 0 : void SAL_CALL AccessibleCell::removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
390 : : {
391 : 0 : AccessibleComponentBase::removeFocusListener( xListener );
392 : 0 : }
393 : :
394 : : // --------------------------------------------------------------------
395 : :
396 : 0 : void SAL_CALL AccessibleCell::grabFocus (void) throw (::com::sun::star::uno::RuntimeException)
397 : : {
398 : 0 : AccessibleComponentBase::grabFocus();
399 : 0 : }
400 : :
401 : : // --------------------------------------------------------------------
402 : :
403 : 0 : sal_Int32 SAL_CALL AccessibleCell::getForeground(void) throw (RuntimeException)
404 : : {
405 : 0 : ThrowIfDisposed ();
406 : 0 : sal_Int32 nColor (0x0ffffffL);
407 : :
408 : : // todo
409 : 0 : return nColor;
410 : : }
411 : :
412 : : // --------------------------------------------------------------------
413 : :
414 : 0 : sal_Int32 SAL_CALL AccessibleCell::getBackground (void) throw (RuntimeException)
415 : : {
416 : 0 : ThrowIfDisposed ();
417 : 0 : sal_Int32 nColor (0L);
418 : :
419 : : // todo
420 : 0 : return nColor;
421 : : }
422 : :
423 : : // --------------------------------------------------------------------
424 : : // XAccessibleExtendedComponent
425 : : // --------------------------------------------------------------------
426 : :
427 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL AccessibleCell::getFont (void) throw (::com::sun::star::uno::RuntimeException)
428 : : {
429 : : //todo
430 : 0 : return AccessibleComponentBase::getFont();
431 : : }
432 : :
433 : : // --------------------------------------------------------------------
434 : :
435 : 0 : ::rtl::OUString SAL_CALL AccessibleCell::getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException)
436 : : {
437 : 0 : return AccessibleComponentBase::getTitledBorderText();
438 : : }
439 : :
440 : : // --------------------------------------------------------------------
441 : :
442 : 0 : ::rtl::OUString SAL_CALL AccessibleCell::getToolTipText (void) throw (::com::sun::star::uno::RuntimeException)
443 : : {
444 : 0 : return AccessibleComponentBase::getToolTipText();
445 : : }
446 : :
447 : : // --------------------------------------------------------------------
448 : : // XAccessibleEventBroadcaster
449 : : // --------------------------------------------------------------------
450 : :
451 : 0 : void SAL_CALL AccessibleCell::addEventListener( const Reference<XAccessibleEventListener >& rxListener) throw (RuntimeException)
452 : : {
453 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
454 [ # # ]: 0 : ::osl::MutexGuard aGuard (maMutex);
455 [ # # ][ # # ]: 0 : if (rBHelper.bDisposed || rBHelper.bInDispose)
456 : : {
457 [ # # ]: 0 : Reference<XInterface> xSource( static_cast<XComponent *>(this) );
458 [ # # ]: 0 : lang::EventObject aEventObj(xSource);
459 [ # # ][ # # ]: 0 : rxListener->disposing(aEventObj);
[ # # ]
460 : : }
461 : : else
462 : : {
463 [ # # ]: 0 : AccessibleContextBase::addEventListener (rxListener);
464 [ # # ]: 0 : if (mpText != NULL)
465 [ # # ]: 0 : mpText->AddEventListener (rxListener);
466 [ # # ][ # # ]: 0 : }
467 : 0 : }
468 : :
469 : : // --------------------------------------------------------------------
470 : :
471 : 0 : void SAL_CALL AccessibleCell::removeEventListener( const Reference<XAccessibleEventListener >& rxListener) throw (RuntimeException)
472 : : {
473 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
474 [ # # ]: 0 : AccessibleContextBase::removeEventListener(rxListener);
475 [ # # ]: 0 : if (mpText != NULL)
476 [ # # ][ # # ]: 0 : mpText->RemoveEventListener (rxListener);
477 : 0 : }
478 : :
479 : : // --------------------------------------------------------------------
480 : : // XServiceInfo
481 : : // --------------------------------------------------------------------
482 : :
483 : 0 : OUString SAL_CALL AccessibleCell::getImplementationName(void) throw (RuntimeException)
484 : : {
485 : 0 : return OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleCell"));
486 : : }
487 : :
488 : : // --------------------------------------------------------------------
489 : :
490 : 0 : Sequence<OUString> SAL_CALL AccessibleCell::getSupportedServiceNames(void) throw (RuntimeException)
491 : : {
492 : 0 : ThrowIfDisposed ();
493 : :
494 : : // Get list of supported service names from base class...
495 : 0 : uno::Sequence<OUString> aServiceNames = AccessibleContextBase::getSupportedServiceNames();
496 : 0 : sal_Int32 nCount (aServiceNames.getLength());
497 : :
498 : : // ...and add additional names.
499 [ # # ]: 0 : aServiceNames.realloc (nCount + 1);
500 [ # # ][ # # ]: 0 : static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.AccessibleCell"));
[ # # ][ # # ]
501 [ # # ]: 0 : aServiceNames[nCount] = sAdditionalServiceName;
502 : :
503 : 0 : return aServiceNames;
504 : : }
505 : :
506 : : // --------------------------------------------------------------------
507 : : // IAccessibleViewForwarderListener
508 : : // --------------------------------------------------------------------
509 : :
510 : 0 : void AccessibleCell::ViewForwarderChanged (ChangeType /*aChangeType*/, const IAccessibleViewForwarder* /*pViewForwarder*/)
511 : : {
512 : : // Inform all listeners that the graphical representation (i.e. size
513 : : // and/or position) of the shape has changed.
514 [ # # ]: 0 : CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
515 : :
516 : : // update our children that our screen position might have changed
517 [ # # ]: 0 : if( mpText )
518 : 0 : mpText->UpdateChildren();
519 : 0 : }
520 : :
521 : : // --------------------------------------------------------------------
522 : : // protected
523 : : // --------------------------------------------------------------------
524 : :
525 : 0 : void AccessibleCell::disposing (void)
526 : : {
527 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
528 [ # # ]: 0 : ::osl::MutexGuard aGuard (maMutex);
529 : :
530 : : // Make sure to send an event that this object looses the focus in the
531 : : // case that it has the focus.
532 [ # # ][ # # ]: 0 : ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
533 [ # # ]: 0 : if (pStateSet != NULL)
534 [ # # ]: 0 : pStateSet->RemoveState(AccessibleStateType::FOCUSED);
535 : :
536 [ # # ]: 0 : if (mpText != NULL)
537 : : {
538 [ # # ]: 0 : mpText->Dispose();
539 [ # # ][ # # ]: 0 : delete mpText;
540 : 0 : mpText = NULL;
541 : : }
542 : :
543 : : // Cleanup. Remove references to objects to allow them to be
544 : : // destroyed.
545 : 0 : mxCell.clear();
546 [ # # ][ # # ]: 0 : maShapeTreeInfo = AccessibleShapeTreeInfo();
[ # # ]
547 : :
548 : : // Call base classes.
549 [ # # ][ # # ]: 0 : AccessibleContextBase::dispose ();
[ # # ]
550 : 0 : }
551 : :
552 : 0 : sal_Int32 SAL_CALL AccessibleCell::getAccessibleIndexInParent (void) throw (RuntimeException)
553 : : {
554 : 0 : ThrowIfDisposed ();
555 : 0 : return mnIndexInParent;
556 : : }
557 : :
558 : 0 : ::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
559 : : {
560 [ # # ]: 0 : ThrowIfDisposed ();
561 [ # # ]: 0 : SolarMutexGuard aSolarGuard;
562 : :
563 [ # # ]: 0 : if( mxCell.is() )
564 [ # # ]: 0 : return mxCell->getName();
565 : :
566 [ # # ][ # # ]: 0 : return AccessibleCellBase::getAccessibleName();
567 : : }
568 : :
569 : : } // end of namespace accessibility
570 : :
571 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|