1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessiblewrapper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_comphelper.hxx"
33 #include "comphelper/accessiblewrapper.hxx"
34 #include <com/sun/star/reflection/XProxyFactory.hpp>
35 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
40 using namespace ::comphelper
;
41 using namespace ::com::sun::star::accessibility
;
42 using namespace ::com::sun::star::uno
;
43 using namespace ::com::sun::star::lang
;
45 //.............................................................................
48 //.............................................................................
50 //=========================================================================
51 //= OWrappedAccessibleChildrenManager
52 //=========================================================================
53 //--------------------------------------------------------------------
54 struct RemoveEventListener
55 : public ::std::unary_function
< AccessibleMap::value_type
, void >
58 Reference
< XEventListener
> m_xListener
;
61 RemoveEventListener( const Reference
< XEventListener
>& _rxListener
)
62 :m_xListener( _rxListener
)
66 void operator()( const AccessibleMap::value_type
& _rMapEntry
) const
68 Reference
< XComponent
> xComp( _rMapEntry
.first
, UNO_QUERY
);
70 xComp
->removeEventListener( m_xListener
);
74 //--------------------------------------------------------------------
75 struct DisposeMappedChild
76 : public ::std::unary_function
< AccessibleMap::value_type
, void >
78 void operator()( const AccessibleMap::value_type
& _rMapEntry
) const
80 Reference
< XComponent
> xContextComponent
;
81 if ( _rMapEntry
.second
.is() )
82 xContextComponent
= xContextComponent
.query( _rMapEntry
.second
->getAccessibleContext() );
83 if ( xContextComponent
.is() )
84 xContextComponent
->dispose();
88 //-------------------------------------------------------------------------
89 OWrappedAccessibleChildrenManager::OWrappedAccessibleChildrenManager( const Reference
< XMultiServiceFactory
>& _rxORB
)
91 ,m_bTransientChildren( sal_True
)
95 //-------------------------------------------------------------------------
96 OWrappedAccessibleChildrenManager::~OWrappedAccessibleChildrenManager( )
100 //-------------------------------------------------------------------------
101 void OWrappedAccessibleChildrenManager::setTransientChildren( sal_Bool _bSet
)
103 m_bTransientChildren
= _bSet
;
106 //-------------------------------------------------------------------------
107 void OWrappedAccessibleChildrenManager::setOwningAccessible( const Reference
< XAccessible
>& _rxAcc
)
109 OSL_ENSURE( !m_aOwningAccessible
.get().is(), "OWrappedAccessibleChildrenManager::setOwningAccessible: to be called only once!" );
110 m_aOwningAccessible
= WeakReference
< XAccessible
>( _rxAcc
);
113 //-------------------------------------------------------------------------
114 void OWrappedAccessibleChildrenManager::removeFromCache( const Reference
< XAccessible
>& _rxKey
)
116 AccessibleMap::iterator aRemovedPos
= m_aChildrenMap
.find( _rxKey
);
117 if ( m_aChildrenMap
.end() != aRemovedPos
)
119 // remove ourself as event listener
120 RemoveEventListener
aOperator( this );
121 aOperator( *aRemovedPos
);
122 // and remove the entry from the map
123 m_aChildrenMap
.erase( aRemovedPos
);
127 //-------------------------------------------------------------------------
128 void OWrappedAccessibleChildrenManager::invalidateAll( )
130 // remove as event listener from the map elements
131 ::std::for_each( m_aChildrenMap
.begin(), m_aChildrenMap
.end(), RemoveEventListener( this ) );
134 m_aChildrenMap
.swap( aMap
);
137 //-------------------------------------------------------------------------
138 Reference
< XAccessible
> OWrappedAccessibleChildrenManager::getAccessibleWrapperFor(
139 const Reference
< XAccessible
>& _rxKey
, sal_Bool _bCreate
)
141 Reference
< XAccessible
> xValue
;
145 // fprintf( stderr, "It was this path that was crashing stuff\n" );
149 // do we have this child in the cahce?
150 AccessibleMap::const_iterator aPos
= m_aChildrenMap
.find( _rxKey
);
151 if ( m_aChildrenMap
.end() != aPos
)
153 xValue
= aPos
->second
;
156 { // not found in the cache, and allowed to create
158 xValue
= new OAccessibleWrapper( m_xORB
, _rxKey
, (Reference
< XAccessible
>)m_aOwningAccessible
);
160 // see if we do cache children
161 if ( !m_bTransientChildren
)
163 if (!m_aChildrenMap
.insert(
164 AccessibleMap::value_type( _rxKey
, xValue
) ).second
)
168 "OWrappedAccessibleChildrenManager::"
169 "getAccessibleWrapperFor: element was already"
173 // listen for disposals of inner children - this may happen when the inner context
174 // is the owner for the inner children (it will dispose these children, and of course
175 // not our wrapper for these children)
176 Reference
< XComponent
> xComp( _rxKey
, UNO_QUERY
);
178 xComp
->addEventListener( this );
185 //-------------------------------------------------------------------------
186 void OWrappedAccessibleChildrenManager::dispose()
188 // dispose our children
189 ::std::for_each( m_aChildrenMap
.begin(), m_aChildrenMap
.end(), RemoveEventListener( this ) );
190 ::std::for_each( m_aChildrenMap
.begin(), m_aChildrenMap
.end(), DisposeMappedChild( ) );
191 // clear our children
193 m_aChildrenMap
.swap( aMap
);
196 //--------------------------------------------------------------------
197 void OWrappedAccessibleChildrenManager::implTranslateChildEventValue( const Any
& _rInValue
, Any
& _rOutValue
)
200 Reference
< XAccessible
> xChild
;
201 if ( _rInValue
>>= xChild
)
202 _rOutValue
<<= getAccessibleWrapperFor( xChild
, sal_True
);
205 //-------------------------------------------------------------------------
206 void OWrappedAccessibleChildrenManager::translateAccessibleEvent( const AccessibleEventObject
& _rEvent
, AccessibleEventObject
& _rTranslatedEvent
)
208 // just in case we can't translate some of the values:
209 _rTranslatedEvent
.NewValue
= _rEvent
.NewValue
;
210 _rTranslatedEvent
.OldValue
= _rEvent
.OldValue
;
212 switch ( _rEvent
.EventId
)
214 case AccessibleEventId::CHILD
:
215 case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED
:
216 case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED
:
217 case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED
:
218 case AccessibleEventId::LABEL_FOR_RELATION_CHANGED
:
219 case AccessibleEventId::LABELED_BY_RELATION_CHANGED
:
220 case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED
:
221 case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED
:
222 // these are events where both the old and the new value contain child references
223 implTranslateChildEventValue( _rEvent
.OldValue
, _rTranslatedEvent
.OldValue
);
224 implTranslateChildEventValue( _rEvent
.NewValue
, _rTranslatedEvent
.NewValue
);
227 case AccessibleEventId::NAME_CHANGED
:
228 case AccessibleEventId::DESCRIPTION_CHANGED
:
229 case AccessibleEventId::ACTION_CHANGED
:
230 case AccessibleEventId::STATE_CHANGED
:
231 case AccessibleEventId::BOUNDRECT_CHANGED
:
232 case AccessibleEventId::INVALIDATE_ALL_CHILDREN
:
233 case AccessibleEventId::SELECTION_CHANGED
:
234 case AccessibleEventId::VISIBLE_DATA_CHANGED
:
235 case AccessibleEventId::VALUE_CHANGED
:
236 case AccessibleEventId::MEMBER_OF_RELATION_CHANGED
:
237 case AccessibleEventId::CARET_CHANGED
:
238 case AccessibleEventId::TEXT_CHANGED
:
239 case AccessibleEventId::HYPERTEXT_CHANGED
:
240 case AccessibleEventId::TABLE_CAPTION_CHANGED
:
241 case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED
:
242 case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED
:
243 case AccessibleEventId::TABLE_MODEL_CHANGED
:
244 case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED
:
245 case AccessibleEventId::TABLE_ROW_HEADER_CHANGED
:
246 case AccessibleEventId::TABLE_SUMMARY_CHANGED
:
247 // --> PB 2006-03-21 #130798# EventId TEXT_SELECTION_CHANGED was missed
248 // these Ids are also missed: SUB_WINDOW_OF_RELATION_CHANGED & TEXT_ATTRIBUTE_CHANGED
249 case AccessibleEventId::TEXT_SELECTION_CHANGED
:
251 // nothing to translate
255 OSL_ENSURE( sal_False
, "OWrappedAccessibleChildrenManager::translateAccessibleEvent: unknown (or unexpected) event id!" );
260 //-------------------------------------------------------------------------
261 void OWrappedAccessibleChildrenManager::handleChildNotification( const AccessibleEventObject
& _rEvent
)
263 if ( AccessibleEventId::INVALIDATE_ALL_CHILDREN
== _rEvent
.EventId
)
264 { // clear our child map
267 else if ( AccessibleEventId::CHILD
== _rEvent
.EventId
)
269 // check if the removed or replaced element is cached
270 Reference
< XAccessible
> xRemoved
;
271 if ( _rEvent
.OldValue
>>= xRemoved
)
272 removeFromCache( xRemoved
);
276 //--------------------------------------------------------------------
277 void SAL_CALL
OWrappedAccessibleChildrenManager::disposing( const EventObject
& _rSource
) throw (RuntimeException
)
279 // this should come from one of the inner XAccessible's of our children
280 Reference
< XAccessible
> xSource( _rSource
.Source
, UNO_QUERY
);
281 AccessibleMap::iterator aDisposedPos
= m_aChildrenMap
.find( xSource
);
282 #if OSL_DEBUG_LEVEL > 0
283 if ( m_aChildrenMap
.end() == aDisposedPos
)
285 OSL_ENSURE( sal_False
,
286 "OWrappedAccessibleChildrenManager::disposing: where did this come from?" );
287 // helper for dignostics
288 Reference
< XAccessible
> xOwningAccessible( m_aOwningAccessible
);
289 Reference
< XAccessibleContext
> xContext
;
292 if ( xOwningAccessible
.is() )
293 xContext
= xOwningAccessible
->getAccessibleContext();
296 ::rtl::OUString sName
= xContext
->getAccessibleName();
297 ::rtl::OUString sDescription
= xContext
->getAccessibleDescription();
298 // sal_Int32 nPlaceYourBreakpointHere = 0;
301 catch( const Exception
& /*e*/ )
303 // silent this, it's only diagnostics which failed
307 if ( m_aChildrenMap
.end() != aDisposedPos
)
309 m_aChildrenMap
.erase( aDisposedPos
);
313 //=========================================================================
314 //= OAccessibleWrapper (implementation)
315 //=========================================================================
316 //-------------------------------------------------------------------------
317 OAccessibleWrapper::OAccessibleWrapper( const Reference
< XMultiServiceFactory
>& _rxORB
,
318 const Reference
< XAccessible
>& _rxInnerAccessible
, const Reference
< XAccessible
>& _rxParentAccessible
)
319 :OAccessibleWrapper_Base( )
320 ,OComponentProxyAggregation( _rxORB
, Reference
< XComponent
>( _rxInnerAccessible
, UNO_QUERY
) )
321 ,m_xParentAccessible( _rxParentAccessible
)
322 ,m_xInnerAccessible( _rxInnerAccessible
)
326 //--------------------------------------------------------------------
327 OAccessibleWrapper::~OAccessibleWrapper( )
329 if ( !m_rBHelper
.bDisposed
)
331 acquire(); // to prevent duplicate dtor calls
336 //--------------------------------------------------------------------
337 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleWrapper
, OComponentProxyAggregation
, OAccessibleWrapper_Base
)
338 IMPLEMENT_FORWARD_REFCOUNT( OAccessibleWrapper
, OComponentProxyAggregation
)
340 //--------------------------------------------------------------------
341 Any
OAccessibleWrapper::queryInterface( const Type
& _rType
) throw (RuntimeException
)
343 // #111089# instead of the inner XAccessible the proxy XAccessible must be returned
344 Any aReturn
= OAccessibleWrapper_Base::queryInterface( _rType
);
345 if ( !aReturn
.hasValue() )
346 aReturn
= OComponentProxyAggregation::queryInterface( _rType
);
351 //--------------------------------------------------------------------
352 Reference
< XAccessibleContext
> OAccessibleWrapper::getContextNoCreate( ) const
354 return (Reference
< XAccessibleContext
>)m_aContext
;
357 //--------------------------------------------------------------------
358 OAccessibleContextWrapper
* OAccessibleWrapper::createAccessibleContext( const Reference
< XAccessibleContext
>& _rxInnerContext
)
360 return new OAccessibleContextWrapper( getORB(), _rxInnerContext
, this, m_xParentAccessible
);
363 //--------------------------------------------------------------------
364 Reference
< XAccessibleContext
> SAL_CALL
OAccessibleWrapper::getAccessibleContext( ) throw (RuntimeException
)
366 // see if the context is still alive (we cache it)
367 Reference
< XAccessibleContext
> xContext
= (Reference
< XAccessibleContext
>)m_aContext
;
368 if ( !xContext
.is() )
370 // create a new context
371 Reference
< XAccessibleContext
> xInnerContext
= m_xInnerAccessible
->getAccessibleContext( );
372 if ( xInnerContext
.is() )
374 xContext
= createAccessibleContext( xInnerContext
);
376 m_aContext
= WeakReference
< XAccessibleContext
>( xContext
);
383 //=========================================================================
384 //= OAccessibleWrapper (implementation)
385 //=========================================================================
386 //-------------------------------------------------------------------------
387 OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper(
388 const Reference
< XMultiServiceFactory
>& _rxORB
,
389 ::cppu::OBroadcastHelper
& _rBHelper
,
390 const Reference
< XAccessibleContext
>& _rxInnerAccessibleContext
,
391 const Reference
< XAccessible
>& _rxOwningAccessible
,
392 const Reference
< XAccessible
>& _rxParentAccessible
)
393 :OComponentProxyAggregationHelper( _rxORB
, _rBHelper
)
394 ,m_xInnerContext( _rxInnerAccessibleContext
)
395 ,m_xOwningAccessible( _rxOwningAccessible
)
396 ,m_xParentAccessible( _rxParentAccessible
)
397 ,m_pChildMapper( NULL
)
399 // initialize the mapper for our children
400 m_pChildMapper
= new OWrappedAccessibleChildrenManager( getORB() );
401 m_pChildMapper
->acquire();
403 // determine if we're allowed to cache children
404 Reference
< XAccessibleStateSet
> xStates( m_xInnerContext
->getAccessibleStateSet( ) );
405 OSL_ENSURE( xStates
.is(), "OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper: no inner state set!" );
406 m_pChildMapper
->setTransientChildren( !xStates
.is() || xStates
->contains( AccessibleStateType::MANAGES_DESCENDANTS
) );
408 m_pChildMapper
->setOwningAccessible( m_xOwningAccessible
);
411 //--------------------------------------------------------------------
412 void OAccessibleContextWrapperHelper::aggregateProxy( oslInterlockedCount
& _rRefCount
, ::cppu::OWeakObject
& _rDelegator
)
414 Reference
< XComponent
> xInnerComponent( m_xInnerContext
, UNO_QUERY
);
415 OSL_ENSURE( xInnerComponent
.is(), "OComponentProxyAggregation::aggregateProxy: accessible is no XComponent!" );
416 if ( xInnerComponent
.is() )
417 componentAggregateProxyFor( xInnerComponent
, _rRefCount
, _rDelegator
);
419 // add as event listener to the inner context, because we want to multiplex the AccessibleEvents
420 osl_incrementInterlockedCount( &_rRefCount
);
422 Reference
< XAccessibleEventBroadcaster
> xBroadcaster( m_xInner
, UNO_QUERY
);
423 if ( xBroadcaster
.is() )
424 xBroadcaster
->addEventListener( this );
426 osl_decrementInterlockedCount( &_rRefCount
);
429 //--------------------------------------------------------------------
430 OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper( )
432 OSL_ENSURE( m_rBHelper
.bDisposed
, "OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper: you should ensure (in your dtor) that the object is disposed!" );
434 m_pChildMapper
->release();
435 m_pChildMapper
= NULL
;
438 //--------------------------------------------------------------------
439 Any SAL_CALL
OAccessibleContextWrapperHelper::queryInterface( const Type
& _rType
) throw (RuntimeException
)
441 Any aReturn
= OComponentProxyAggregationHelper::queryInterface( _rType
);
442 if ( !aReturn
.hasValue() )
443 aReturn
= OAccessibleContextWrapperHelper_Base::queryInterface( _rType
);
447 //--------------------------------------------------------------------
448 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleContextWrapperHelper
, OComponentProxyAggregationHelper
, OAccessibleContextWrapperHelper_Base
)
450 //--------------------------------------------------------------------
451 sal_Int32 SAL_CALL
OAccessibleContextWrapperHelper::getAccessibleChildCount( ) throw (RuntimeException
)
453 return m_xInnerContext
->getAccessibleChildCount();
456 //--------------------------------------------------------------------
457 Reference
< XAccessible
> SAL_CALL
OAccessibleContextWrapperHelper::getAccessibleChild( sal_Int32 i
) throw (IndexOutOfBoundsException
, RuntimeException
)
459 // get the child of the wrapped component
460 Reference
< XAccessible
> xInnerChild
= m_xInnerContext
->getAccessibleChild( i
);
461 return m_pChildMapper
->getAccessibleWrapperFor( xInnerChild
);
464 //--------------------------------------------------------------------
465 Reference
< XAccessibleRelationSet
> SAL_CALL
OAccessibleContextWrapperHelper::getAccessibleRelationSet( ) throw (RuntimeException
)
467 return m_xInnerContext
->getAccessibleRelationSet();
468 // TODO: if this relation set would contain relations to siblings, we would normally need
469 // to wrap them, too ....
472 //--------------------------------------------------------------------
473 void SAL_CALL
OAccessibleContextWrapperHelper::notifyEvent( const AccessibleEventObject
& _rEvent
) throw (RuntimeException
)
475 #if OSL_DEBUG_LEVEL > 0
476 if ( AccessibleEventId::STATE_CHANGED
== _rEvent
.EventId
)
478 sal_Bool bChildTransienceChanged
= sal_False
;
479 sal_Int16 nChangeState
= 0;
480 if ( _rEvent
.OldValue
>>= nChangeState
)
481 bChildTransienceChanged
= bChildTransienceChanged
|| AccessibleStateType::MANAGES_DESCENDANTS
== nChangeState
;
482 if ( _rEvent
.NewValue
>>= nChangeState
)
483 bChildTransienceChanged
= bChildTransienceChanged
|| AccessibleStateType::MANAGES_DESCENDANTS
== nChangeState
;
484 OSL_ENSURE( !bChildTransienceChanged
, "OAccessibleContextWrapperHelper::notifyEvent: MANAGES_DESCENDANTS is not expected to change during runtime!" );
485 // if this asserts, then we would need to update our m_bTransientChildren flag here,
486 // as well as (potentially) our child cache
489 AccessibleEventObject
aTranslatedEvent( _rEvent
);
492 ::osl::MutexGuard
aGuard( m_rBHelper
.rMutex
);
494 // translate the event
495 queryInterface( ::getCppuType( static_cast< Reference
< XInterface
>* >( NULL
) ) ) >>= aTranslatedEvent
.Source
;
496 m_pChildMapper
->translateAccessibleEvent( _rEvent
, aTranslatedEvent
);
498 // see if any of these notifications affect our child manager
499 m_pChildMapper
->handleChildNotification( _rEvent
);
501 if ( aTranslatedEvent
.NewValue
== m_xInner
)
502 aTranslatedEvent
.NewValue
= makeAny(aTranslatedEvent
.Source
);
503 if ( aTranslatedEvent
.OldValue
== m_xInner
)
504 aTranslatedEvent
.OldValue
= makeAny(aTranslatedEvent
.Source
);
507 notifyTranslatedEvent( aTranslatedEvent
);
510 //--------------------------------------------------------------------
511 void SAL_CALL
OAccessibleContextWrapperHelper::dispose() throw( RuntimeException
)
513 ::osl::MutexGuard
aGuard( m_rBHelper
.rMutex
);
515 // stop multiplexing events
516 Reference
< XAccessibleEventBroadcaster
> xBroadcaster( m_xInner
, UNO_QUERY
);
517 OSL_ENSURE( xBroadcaster
.is(), "OAccessibleContextWrapperHelper::disposing(): inner context is no broadcaster!" );
518 if ( xBroadcaster
.is() )
519 xBroadcaster
->removeEventListener( this );
521 // dispose the child cache/map
522 m_pChildMapper
->dispose();
524 // let the base class dispose the inner component
525 OComponentProxyAggregationHelper::dispose();
528 //--------------------------------------------------------------------
529 void SAL_CALL
OAccessibleContextWrapperHelper::disposing( const EventObject
& _rEvent
) throw (RuntimeException
)
531 // simply disambiguate this
532 OComponentProxyAggregationHelper::disposing( _rEvent
);
535 //====================================================================
536 //= OAccessibleContextWrapper
537 //====================================================================
538 //--------------------------------------------------------------------
539 IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleContextWrapper
, OAccessibleContextWrapper_CBase
, OAccessibleContextWrapperHelper
)
541 //--------------------------------------------------------------------
542 IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleContextWrapper
, OAccessibleContextWrapper_CBase
, OAccessibleContextWrapperHelper
)
544 //--------------------------------------------------------------------
545 OAccessibleContextWrapper::OAccessibleContextWrapper( const Reference
< XMultiServiceFactory
>& _rxORB
,
546 const Reference
< XAccessibleContext
>& _rxInnerAccessibleContext
, const Reference
< XAccessible
>& _rxOwningAccessible
,
547 const Reference
< XAccessible
>& _rxParentAccessible
)
548 :OAccessibleContextWrapper_CBase( m_aMutex
)
549 ,OAccessibleContextWrapperHelper( _rxORB
, rBHelper
, _rxInnerAccessibleContext
, _rxOwningAccessible
, _rxParentAccessible
)
550 ,m_nNotifierClient( 0 )
552 aggregateProxy( m_refCount
, *this );
555 //--------------------------------------------------------------------
556 OAccessibleContextWrapper::~OAccessibleContextWrapper()
560 //--------------------------------------------------------------------
561 sal_Int32 SAL_CALL
OAccessibleContextWrapper::getAccessibleChildCount( ) throw (RuntimeException
)
563 return OAccessibleContextWrapperHelper::getAccessibleChildCount();
566 //--------------------------------------------------------------------
567 Reference
< XAccessible
> SAL_CALL
OAccessibleContextWrapper::getAccessibleChild( sal_Int32 i
) throw (IndexOutOfBoundsException
, RuntimeException
)
569 return OAccessibleContextWrapperHelper::getAccessibleChild( i
);
572 //--------------------------------------------------------------------
573 Reference
< XAccessible
> SAL_CALL
OAccessibleContextWrapper::getAccessibleParent( ) throw (RuntimeException
)
575 return m_xParentAccessible
;
578 //--------------------------------------------------------------------
579 sal_Int32 SAL_CALL
OAccessibleContextWrapper::getAccessibleIndexInParent( ) throw (RuntimeException
)
581 return m_xInnerContext
->getAccessibleIndexInParent();
584 //--------------------------------------------------------------------
585 sal_Int16 SAL_CALL
OAccessibleContextWrapper::getAccessibleRole( ) throw (RuntimeException
)
587 return m_xInnerContext
->getAccessibleRole();
590 //--------------------------------------------------------------------
591 ::rtl::OUString SAL_CALL
OAccessibleContextWrapper::getAccessibleDescription( ) throw (RuntimeException
)
593 return m_xInnerContext
->getAccessibleDescription();
596 //--------------------------------------------------------------------
597 ::rtl::OUString SAL_CALL
OAccessibleContextWrapper::getAccessibleName( ) throw (RuntimeException
)
599 return m_xInnerContext
->getAccessibleName();
602 //--------------------------------------------------------------------
603 Reference
< XAccessibleRelationSet
> SAL_CALL
OAccessibleContextWrapper::getAccessibleRelationSet( ) throw (RuntimeException
)
605 return OAccessibleContextWrapperHelper::getAccessibleRelationSet();
608 //--------------------------------------------------------------------
609 Reference
< XAccessibleStateSet
> SAL_CALL
OAccessibleContextWrapper::getAccessibleStateSet( ) throw (RuntimeException
)
611 return m_xInnerContext
->getAccessibleStateSet();
614 //--------------------------------------------------------------------
615 Locale SAL_CALL
OAccessibleContextWrapper::getLocale( ) throw (IllegalAccessibleComponentStateException
, RuntimeException
)
617 return m_xInnerContext
->getLocale();
620 //--------------------------------------------------------------------
621 void OAccessibleContextWrapper::notifyTranslatedEvent( const AccessibleEventObject
& _rEvent
) throw (RuntimeException
)
623 if ( m_nNotifierClient
)
624 AccessibleEventNotifier::addEvent( m_nNotifierClient
, _rEvent
);
627 //--------------------------------------------------------------------
628 void SAL_CALL
OAccessibleContextWrapper::addEventListener( const Reference
< XAccessibleEventListener
>& _rxListener
) throw (RuntimeException
)
630 ::osl::MutexGuard
aGuard( m_aMutex
);
631 if ( !m_nNotifierClient
)
632 m_nNotifierClient
= AccessibleEventNotifier::registerClient( );
633 AccessibleEventNotifier::addEventListener( m_nNotifierClient
, _rxListener
);
636 //--------------------------------------------------------------------
637 void SAL_CALL
OAccessibleContextWrapper::removeEventListener( const Reference
< XAccessibleEventListener
>& _rxListener
) throw (RuntimeException
)
639 ::osl::MutexGuard
aGuard( m_aMutex
);
640 if ( m_nNotifierClient
)
642 if ( 0 == AccessibleEventNotifier::removeEventListener( m_nNotifierClient
, _rxListener
) )
644 AccessibleEventNotifier::TClientId
nId( m_nNotifierClient
);
645 m_nNotifierClient
= 0;
646 AccessibleEventNotifier::revokeClient( nId
);
651 //--------------------------------------------------------------------
652 void SAL_CALL
OAccessibleContextWrapper::disposing() throw (RuntimeException
)
654 AccessibleEventNotifier::TClientId
nClientId( 0 );
656 // --- <mutex lock> -----------------------------------------
658 ::osl::MutexGuard
aGuard( m_aMutex
);
660 // prepare notifying our AccessibleListeners
661 if ( m_nNotifierClient
)
663 nClientId
= m_nNotifierClient
;
664 m_nNotifierClient
= 0;
667 // --- </mutex lock> -----------------------------------------
669 // let the base class do
670 OAccessibleContextWrapperHelper::dispose();
672 // notify the disposal
674 AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId
, *this );
677 //--------------------------------------------------------------------
678 void SAL_CALL
OAccessibleContextWrapper::dispose() throw( RuntimeException
)
680 // simply disambiguate
681 OComponentProxyAggregation_CBase::dispose();
684 //.............................................................................
685 } // namespace accessibility
686 //.............................................................................