1dde7d3faSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3dde7d3faSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4dde7d3faSAndrew Rist * or more contributor license agreements. See the NOTICE file 5dde7d3faSAndrew Rist * distributed with this work for additional information 6dde7d3faSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7dde7d3faSAndrew Rist * to you under the Apache License, Version 2.0 (the 8dde7d3faSAndrew Rist * "License"); you may not use this file except in compliance 9dde7d3faSAndrew Rist * with the License. You may obtain a copy of the License at 10dde7d3faSAndrew Rist * 11dde7d3faSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12dde7d3faSAndrew Rist * 13dde7d3faSAndrew Rist * Unless required by applicable law or agreed to in writing, 14dde7d3faSAndrew Rist * software distributed under the License is distributed on an 15dde7d3faSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16dde7d3faSAndrew Rist * KIND, either express or implied. See the License for the 17dde7d3faSAndrew Rist * specific language governing permissions and limitations 18dde7d3faSAndrew Rist * under the License. 19dde7d3faSAndrew Rist * 20dde7d3faSAndrew Rist *************************************************************/ 21dde7d3faSAndrew Rist 22dde7d3faSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_comphelper.hxx" 26cdf0e10cSrcweir #include "comphelper/accessiblewrapper.hxx" 27cdf0e10cSrcweir #include <com/sun/star/reflection/XProxyFactory.hpp> 28cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <algorithm> 32cdf0e10cSrcweir 33cdf0e10cSrcweir using namespace ::comphelper; 34cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 35cdf0e10cSrcweir using namespace ::com::sun::star::uno; 36cdf0e10cSrcweir using namespace ::com::sun::star::lang; 37cdf0e10cSrcweir 38cdf0e10cSrcweir //............................................................................. 39cdf0e10cSrcweir namespace comphelper 40cdf0e10cSrcweir { 41cdf0e10cSrcweir //............................................................................. 42cdf0e10cSrcweir 43cdf0e10cSrcweir //========================================================================= 44cdf0e10cSrcweir //= OWrappedAccessibleChildrenManager 45cdf0e10cSrcweir //========================================================================= 46cdf0e10cSrcweir //-------------------------------------------------------------------- 47cdf0e10cSrcweir struct RemoveEventListener 48cdf0e10cSrcweir : public ::std::unary_function< AccessibleMap::value_type, void > 49cdf0e10cSrcweir { 50cdf0e10cSrcweir private: 51cdf0e10cSrcweir Reference< XEventListener > m_xListener; 52cdf0e10cSrcweir 53cdf0e10cSrcweir public: RemoveEventListenercomphelper::RemoveEventListener54cdf0e10cSrcweir RemoveEventListener( const Reference< XEventListener >& _rxListener ) 55cdf0e10cSrcweir :m_xListener( _rxListener ) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir } 58cdf0e10cSrcweir operator ()comphelper::RemoveEventListener59cdf0e10cSrcweir void operator()( const AccessibleMap::value_type& _rMapEntry ) const 60cdf0e10cSrcweir { 61cdf0e10cSrcweir Reference< XComponent > xComp( _rMapEntry.first, UNO_QUERY ); 62cdf0e10cSrcweir if ( xComp.is() ) 63cdf0e10cSrcweir xComp->removeEventListener( m_xListener ); 64cdf0e10cSrcweir } 65cdf0e10cSrcweir }; 66cdf0e10cSrcweir 67cdf0e10cSrcweir //-------------------------------------------------------------------- 68cdf0e10cSrcweir struct DisposeMappedChild 69cdf0e10cSrcweir : public ::std::unary_function< AccessibleMap::value_type, void > 70cdf0e10cSrcweir { operator ()comphelper::DisposeMappedChild71cdf0e10cSrcweir void operator()( const AccessibleMap::value_type& _rMapEntry ) const 72cdf0e10cSrcweir { 73cdf0e10cSrcweir Reference< XComponent > xContextComponent; 74cdf0e10cSrcweir if ( _rMapEntry.second.is() ) 75cdf0e10cSrcweir xContextComponent = xContextComponent.query( _rMapEntry.second->getAccessibleContext() ); 76cdf0e10cSrcweir if ( xContextComponent.is() ) 77cdf0e10cSrcweir xContextComponent->dispose(); 78cdf0e10cSrcweir } 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir //------------------------------------------------------------------------- OWrappedAccessibleChildrenManager(const Reference<XMultiServiceFactory> & _rxORB)82cdf0e10cSrcweir OWrappedAccessibleChildrenManager::OWrappedAccessibleChildrenManager( const Reference< XMultiServiceFactory >& _rxORB ) 83cdf0e10cSrcweir :m_xORB( _rxORB ) 84cdf0e10cSrcweir ,m_bTransientChildren( sal_True ) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir } 87cdf0e10cSrcweir 88cdf0e10cSrcweir //------------------------------------------------------------------------- ~OWrappedAccessibleChildrenManager()89cdf0e10cSrcweir OWrappedAccessibleChildrenManager::~OWrappedAccessibleChildrenManager( ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir //------------------------------------------------------------------------- setTransientChildren(sal_Bool _bSet)94cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::setTransientChildren( sal_Bool _bSet ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir m_bTransientChildren = _bSet; 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir //------------------------------------------------------------------------- setOwningAccessible(const Reference<XAccessible> & _rxAcc)100cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::setOwningAccessible( const Reference< XAccessible >& _rxAcc ) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir OSL_ENSURE( !m_aOwningAccessible.get().is(), "OWrappedAccessibleChildrenManager::setOwningAccessible: to be called only once!" ); 103cdf0e10cSrcweir m_aOwningAccessible = WeakReference< XAccessible >( _rxAcc ); 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir //------------------------------------------------------------------------- removeFromCache(const Reference<XAccessible> & _rxKey)107cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::removeFromCache( const Reference< XAccessible >& _rxKey ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir AccessibleMap::iterator aRemovedPos = m_aChildrenMap.find( _rxKey ); 110cdf0e10cSrcweir if ( m_aChildrenMap.end() != aRemovedPos ) 111cdf0e10cSrcweir { // it was cached 112cdf0e10cSrcweir // remove ourself as event listener 113cdf0e10cSrcweir RemoveEventListener aOperator( this ); 114cdf0e10cSrcweir aOperator( *aRemovedPos ); 115cdf0e10cSrcweir // and remove the entry from the map 116cdf0e10cSrcweir m_aChildrenMap.erase( aRemovedPos ); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir //------------------------------------------------------------------------- invalidateAll()121cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::invalidateAll( ) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir // remove as event listener from the map elements 124cdf0e10cSrcweir ::std::for_each( m_aChildrenMap.begin(), m_aChildrenMap.end(), RemoveEventListener( this ) ); 125cdf0e10cSrcweir // clear the map 126cdf0e10cSrcweir AccessibleMap aMap; 127cdf0e10cSrcweir m_aChildrenMap.swap( aMap ); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir //------------------------------------------------------------------------- getAccessibleWrapperFor(const Reference<XAccessible> & _rxKey,sal_Bool _bCreate)131cdf0e10cSrcweir Reference< XAccessible > OWrappedAccessibleChildrenManager::getAccessibleWrapperFor( 132cdf0e10cSrcweir const Reference< XAccessible >& _rxKey, sal_Bool _bCreate ) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir Reference< XAccessible > xValue; 135cdf0e10cSrcweir 136cdf0e10cSrcweir if( !_rxKey.is() ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir // fprintf( stderr, "It was this path that was crashing stuff\n" ); 139cdf0e10cSrcweir return xValue; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142*4e167d9cSJohn Bampton // do we have this child in the cache? 143cdf0e10cSrcweir AccessibleMap::const_iterator aPos = m_aChildrenMap.find( _rxKey ); 144cdf0e10cSrcweir if ( m_aChildrenMap.end() != aPos ) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir xValue = aPos->second; 147cdf0e10cSrcweir } 148cdf0e10cSrcweir else if ( _bCreate ) 149cdf0e10cSrcweir { // not found in the cache, and allowed to create 150cdf0e10cSrcweir // -> new wrapper 151cdf0e10cSrcweir xValue = new OAccessibleWrapper( m_xORB, _rxKey, (Reference< XAccessible >)m_aOwningAccessible ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir // see if we do cache children 154cdf0e10cSrcweir if ( !m_bTransientChildren ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir if (!m_aChildrenMap.insert( 157cdf0e10cSrcweir AccessibleMap::value_type( _rxKey, xValue ) ).second) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir OSL_ENSURE( 160cdf0e10cSrcweir false, 161cdf0e10cSrcweir "OWrappedAccessibleChildrenManager::" 162cdf0e10cSrcweir "getAccessibleWrapperFor: element was already" 163cdf0e10cSrcweir " inserted!" ); 164cdf0e10cSrcweir } 165cdf0e10cSrcweir 166cdf0e10cSrcweir // listen for disposals of inner children - this may happen when the inner context 167cdf0e10cSrcweir // is the owner for the inner children (it will dispose these children, and of course 168cdf0e10cSrcweir // not our wrapper for these children) 169cdf0e10cSrcweir Reference< XComponent > xComp( _rxKey, UNO_QUERY ); 170cdf0e10cSrcweir if ( xComp.is() ) 171cdf0e10cSrcweir xComp->addEventListener( this ); 172cdf0e10cSrcweir } 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir return xValue; 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir //------------------------------------------------------------------------- dispose()179cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::dispose() 180cdf0e10cSrcweir { 181cdf0e10cSrcweir // dispose our children 182cdf0e10cSrcweir ::std::for_each( m_aChildrenMap.begin(), m_aChildrenMap.end(), RemoveEventListener( this ) ); 183cdf0e10cSrcweir ::std::for_each( m_aChildrenMap.begin(), m_aChildrenMap.end(), DisposeMappedChild( ) ); 184cdf0e10cSrcweir // clear our children 185cdf0e10cSrcweir AccessibleMap aMap; 186cdf0e10cSrcweir m_aChildrenMap.swap( aMap ); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir //-------------------------------------------------------------------- implTranslateChildEventValue(const Any & _rInValue,Any & _rOutValue)190cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::implTranslateChildEventValue( const Any& _rInValue, Any& _rOutValue ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir _rOutValue.clear(); 193cdf0e10cSrcweir Reference< XAccessible > xChild; 194cdf0e10cSrcweir if ( _rInValue >>= xChild ) 195cdf0e10cSrcweir _rOutValue <<= getAccessibleWrapperFor( xChild, sal_True ); 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir //------------------------------------------------------------------------- translateAccessibleEvent(const AccessibleEventObject & _rEvent,AccessibleEventObject & _rTranslatedEvent)199cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::translateAccessibleEvent( const AccessibleEventObject& _rEvent, AccessibleEventObject& _rTranslatedEvent ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir // just in case we can't translate some of the values: 202cdf0e10cSrcweir _rTranslatedEvent.NewValue = _rEvent.NewValue; 203cdf0e10cSrcweir _rTranslatedEvent.OldValue = _rEvent.OldValue; 204cdf0e10cSrcweir 205cdf0e10cSrcweir switch ( _rEvent.EventId ) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir case AccessibleEventId::CHILD: 208cdf0e10cSrcweir case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED: 209cdf0e10cSrcweir case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED: 210cdf0e10cSrcweir case AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED: 211cdf0e10cSrcweir case AccessibleEventId::LABEL_FOR_RELATION_CHANGED: 212cdf0e10cSrcweir case AccessibleEventId::LABELED_BY_RELATION_CHANGED: 213cdf0e10cSrcweir case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED: 214cdf0e10cSrcweir case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED: 215cdf0e10cSrcweir // these are events where both the old and the new value contain child references 216cdf0e10cSrcweir implTranslateChildEventValue( _rEvent.OldValue, _rTranslatedEvent.OldValue ); 217cdf0e10cSrcweir implTranslateChildEventValue( _rEvent.NewValue, _rTranslatedEvent.NewValue ); 218cdf0e10cSrcweir break; 219cdf0e10cSrcweir 220cdf0e10cSrcweir case AccessibleEventId::NAME_CHANGED: 221cdf0e10cSrcweir case AccessibleEventId::DESCRIPTION_CHANGED: 222cdf0e10cSrcweir case AccessibleEventId::ACTION_CHANGED: 223cdf0e10cSrcweir case AccessibleEventId::STATE_CHANGED: 224cdf0e10cSrcweir case AccessibleEventId::BOUNDRECT_CHANGED: 225cdf0e10cSrcweir case AccessibleEventId::INVALIDATE_ALL_CHILDREN: 226cdf0e10cSrcweir case AccessibleEventId::SELECTION_CHANGED: 227cdf0e10cSrcweir case AccessibleEventId::VISIBLE_DATA_CHANGED: 228cdf0e10cSrcweir case AccessibleEventId::VALUE_CHANGED: 229cdf0e10cSrcweir case AccessibleEventId::MEMBER_OF_RELATION_CHANGED: 230cdf0e10cSrcweir case AccessibleEventId::CARET_CHANGED: 231cdf0e10cSrcweir case AccessibleEventId::TEXT_CHANGED: 232cdf0e10cSrcweir case AccessibleEventId::HYPERTEXT_CHANGED: 233cdf0e10cSrcweir case AccessibleEventId::TABLE_CAPTION_CHANGED: 234cdf0e10cSrcweir case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED: 235cdf0e10cSrcweir case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED: 236cdf0e10cSrcweir case AccessibleEventId::TABLE_MODEL_CHANGED: 237cdf0e10cSrcweir case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED: 238cdf0e10cSrcweir case AccessibleEventId::TABLE_ROW_HEADER_CHANGED: 239cdf0e10cSrcweir case AccessibleEventId::TABLE_SUMMARY_CHANGED: 240cdf0e10cSrcweir // --> PB 2006-03-21 #130798# EventId TEXT_SELECTION_CHANGED was missed 241cdf0e10cSrcweir // these Ids are also missed: SUB_WINDOW_OF_RELATION_CHANGED & TEXT_ATTRIBUTE_CHANGED 242cdf0e10cSrcweir case AccessibleEventId::TEXT_SELECTION_CHANGED: 243cdf0e10cSrcweir // <-- 244cdf0e10cSrcweir // nothing to translate 245cdf0e10cSrcweir break; 246cdf0e10cSrcweir 247cdf0e10cSrcweir default: 248cdf0e10cSrcweir OSL_ENSURE( sal_False, "OWrappedAccessibleChildrenManager::translateAccessibleEvent: unknown (or unexpected) event id!" ); 249cdf0e10cSrcweir break; 250cdf0e10cSrcweir } 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir //------------------------------------------------------------------------- handleChildNotification(const AccessibleEventObject & _rEvent)254cdf0e10cSrcweir void OWrappedAccessibleChildrenManager::handleChildNotification( const AccessibleEventObject& _rEvent ) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir if ( AccessibleEventId::INVALIDATE_ALL_CHILDREN == _rEvent.EventId ) 257cdf0e10cSrcweir { // clear our child map 258cdf0e10cSrcweir invalidateAll( ); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir else if ( AccessibleEventId::CHILD == _rEvent.EventId ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir // check if the removed or replaced element is cached 263cdf0e10cSrcweir Reference< XAccessible > xRemoved; 264cdf0e10cSrcweir if ( _rEvent.OldValue >>= xRemoved ) 265cdf0e10cSrcweir removeFromCache( xRemoved ); 266cdf0e10cSrcweir } 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir //-------------------------------------------------------------------- disposing(const EventObject & _rSource)270cdf0e10cSrcweir void SAL_CALL OWrappedAccessibleChildrenManager::disposing( const EventObject& _rSource ) throw (RuntimeException) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir // this should come from one of the inner XAccessible's of our children 273cdf0e10cSrcweir Reference< XAccessible > xSource( _rSource.Source, UNO_QUERY ); 274cdf0e10cSrcweir AccessibleMap::iterator aDisposedPos = m_aChildrenMap.find( xSource ); 275cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 276cdf0e10cSrcweir if ( m_aChildrenMap.end() == aDisposedPos ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir OSL_ENSURE( sal_False, 279cdf0e10cSrcweir "OWrappedAccessibleChildrenManager::disposing: where did this come from?" ); 280*4e167d9cSJohn Bampton // helper for diagnostics 281cdf0e10cSrcweir Reference< XAccessible > xOwningAccessible( m_aOwningAccessible ); 282cdf0e10cSrcweir Reference< XAccessibleContext > xContext; 283cdf0e10cSrcweir try 284cdf0e10cSrcweir { 285cdf0e10cSrcweir if ( xOwningAccessible.is() ) 286cdf0e10cSrcweir xContext = xOwningAccessible->getAccessibleContext(); 287cdf0e10cSrcweir if ( xContext.is() ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir ::rtl::OUString sName = xContext->getAccessibleName(); 290cdf0e10cSrcweir ::rtl::OUString sDescription = xContext->getAccessibleDescription(); 291cdf0e10cSrcweir // sal_Int32 nPlaceYourBreakpointHere = 0; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir catch( const Exception& /*e*/ ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir // silent this, it's only diagnostics which failed 297cdf0e10cSrcweir } 298cdf0e10cSrcweir } 299cdf0e10cSrcweir #endif 300cdf0e10cSrcweir if ( m_aChildrenMap.end() != aDisposedPos ) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir m_aChildrenMap.erase( aDisposedPos ); 303cdf0e10cSrcweir } 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir //========================================================================= 307cdf0e10cSrcweir //= OAccessibleWrapper (implementation) 308cdf0e10cSrcweir //========================================================================= 309cdf0e10cSrcweir //------------------------------------------------------------------------- OAccessibleWrapper(const Reference<XMultiServiceFactory> & _rxORB,const Reference<XAccessible> & _rxInnerAccessible,const Reference<XAccessible> & _rxParentAccessible)310cdf0e10cSrcweir OAccessibleWrapper::OAccessibleWrapper( const Reference< XMultiServiceFactory >& _rxORB, 311cdf0e10cSrcweir const Reference< XAccessible >& _rxInnerAccessible, const Reference< XAccessible >& _rxParentAccessible ) 312cdf0e10cSrcweir :OAccessibleWrapper_Base( ) 313cdf0e10cSrcweir ,OComponentProxyAggregation( _rxORB, Reference< XComponent >( _rxInnerAccessible, UNO_QUERY ) ) 314cdf0e10cSrcweir ,m_xParentAccessible( _rxParentAccessible ) 315cdf0e10cSrcweir ,m_xInnerAccessible( _rxInnerAccessible ) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir } 318cdf0e10cSrcweir 319cdf0e10cSrcweir //-------------------------------------------------------------------- ~OAccessibleWrapper()320cdf0e10cSrcweir OAccessibleWrapper::~OAccessibleWrapper( ) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir if ( !m_rBHelper.bDisposed ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir acquire(); // to prevent duplicate dtor calls 325cdf0e10cSrcweir dispose(); 326cdf0e10cSrcweir } 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XTYPEPROVIDER2(OAccessibleWrapper,OComponentProxyAggregation,OAccessibleWrapper_Base)330cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleWrapper, OComponentProxyAggregation, OAccessibleWrapper_Base ) 331cdf0e10cSrcweir IMPLEMENT_FORWARD_REFCOUNT( OAccessibleWrapper, OComponentProxyAggregation ) 332cdf0e10cSrcweir 333cdf0e10cSrcweir //-------------------------------------------------------------------- 334cdf0e10cSrcweir Any OAccessibleWrapper::queryInterface( const Type& _rType ) throw (RuntimeException) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir // #111089# instead of the inner XAccessible the proxy XAccessible must be returned 337cdf0e10cSrcweir Any aReturn = OAccessibleWrapper_Base::queryInterface( _rType ); 338cdf0e10cSrcweir if ( !aReturn.hasValue() ) 339cdf0e10cSrcweir aReturn = OComponentProxyAggregation::queryInterface( _rType ); 340cdf0e10cSrcweir 341cdf0e10cSrcweir return aReturn; 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir //-------------------------------------------------------------------- getContextNoCreate() const345cdf0e10cSrcweir Reference< XAccessibleContext > OAccessibleWrapper::getContextNoCreate( ) const 346cdf0e10cSrcweir { 347cdf0e10cSrcweir return (Reference< XAccessibleContext >)m_aContext; 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir //-------------------------------------------------------------------- createAccessibleContext(const Reference<XAccessibleContext> & _rxInnerContext)351cdf0e10cSrcweir OAccessibleContextWrapper* OAccessibleWrapper::createAccessibleContext( const Reference< XAccessibleContext >& _rxInnerContext ) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir return new OAccessibleContextWrapper( getORB(), _rxInnerContext, this, m_xParentAccessible ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleContext()357cdf0e10cSrcweir Reference< XAccessibleContext > SAL_CALL OAccessibleWrapper::getAccessibleContext( ) throw (RuntimeException) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir // see if the context is still alive (we cache it) 360cdf0e10cSrcweir Reference< XAccessibleContext > xContext = (Reference< XAccessibleContext >)m_aContext; 361cdf0e10cSrcweir if ( !xContext.is() ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir // create a new context 364cdf0e10cSrcweir Reference< XAccessibleContext > xInnerContext = m_xInnerAccessible->getAccessibleContext( ); 365cdf0e10cSrcweir if ( xInnerContext.is() ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir xContext = createAccessibleContext( xInnerContext ); 368cdf0e10cSrcweir // cache it 369cdf0e10cSrcweir m_aContext = WeakReference< XAccessibleContext >( xContext ); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir return xContext; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir //========================================================================= 377cdf0e10cSrcweir //= OAccessibleWrapper (implementation) 378cdf0e10cSrcweir //========================================================================= 379cdf0e10cSrcweir //------------------------------------------------------------------------- OAccessibleContextWrapperHelper(const Reference<XMultiServiceFactory> & _rxORB,::cppu::OBroadcastHelper & _rBHelper,const Reference<XAccessibleContext> & _rxInnerAccessibleContext,const Reference<XAccessible> & _rxOwningAccessible,const Reference<XAccessible> & _rxParentAccessible)380cdf0e10cSrcweir OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper( 381cdf0e10cSrcweir const Reference< XMultiServiceFactory >& _rxORB, 382cdf0e10cSrcweir ::cppu::OBroadcastHelper& _rBHelper, 383cdf0e10cSrcweir const Reference< XAccessibleContext >& _rxInnerAccessibleContext, 384cdf0e10cSrcweir const Reference< XAccessible >& _rxOwningAccessible, 385cdf0e10cSrcweir const Reference< XAccessible >& _rxParentAccessible ) 386cdf0e10cSrcweir :OComponentProxyAggregationHelper( _rxORB, _rBHelper ) 387cdf0e10cSrcweir ,m_xInnerContext( _rxInnerAccessibleContext ) 388cdf0e10cSrcweir ,m_xOwningAccessible( _rxOwningAccessible ) 389cdf0e10cSrcweir ,m_xParentAccessible( _rxParentAccessible ) 390cdf0e10cSrcweir ,m_pChildMapper( NULL ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir // initialize the mapper for our children 393cdf0e10cSrcweir m_pChildMapper = new OWrappedAccessibleChildrenManager( getORB() ); 394cdf0e10cSrcweir m_pChildMapper->acquire(); 395cdf0e10cSrcweir 396cdf0e10cSrcweir // determine if we're allowed to cache children 397cdf0e10cSrcweir Reference< XAccessibleStateSet > xStates( m_xInnerContext->getAccessibleStateSet( ) ); 398cdf0e10cSrcweir OSL_ENSURE( xStates.is(), "OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper: no inner state set!" ); 399cdf0e10cSrcweir m_pChildMapper->setTransientChildren( !xStates.is() || xStates->contains( AccessibleStateType::MANAGES_DESCENDANTS) ); 400cdf0e10cSrcweir 401cdf0e10cSrcweir m_pChildMapper->setOwningAccessible( m_xOwningAccessible ); 402cdf0e10cSrcweir } 403cdf0e10cSrcweir 404cdf0e10cSrcweir //-------------------------------------------------------------------- aggregateProxy(oslInterlockedCount & _rRefCount,::cppu::OWeakObject & _rDelegator)405cdf0e10cSrcweir void OAccessibleContextWrapperHelper::aggregateProxy( oslInterlockedCount& _rRefCount, ::cppu::OWeakObject& _rDelegator ) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir Reference< XComponent > xInnerComponent( m_xInnerContext, UNO_QUERY ); 408cdf0e10cSrcweir OSL_ENSURE( xInnerComponent.is(), "OComponentProxyAggregation::aggregateProxy: accessible is no XComponent!" ); 409cdf0e10cSrcweir if ( xInnerComponent.is() ) 410cdf0e10cSrcweir componentAggregateProxyFor( xInnerComponent, _rRefCount, _rDelegator ); 411cdf0e10cSrcweir 412cdf0e10cSrcweir // add as event listener to the inner context, because we want to multiplex the AccessibleEvents 413cdf0e10cSrcweir osl_incrementInterlockedCount( &_rRefCount ); 414cdf0e10cSrcweir { 415cdf0e10cSrcweir Reference< XAccessibleEventBroadcaster > xBroadcaster( m_xInner, UNO_QUERY ); 416cdf0e10cSrcweir if ( xBroadcaster.is() ) 417cdf0e10cSrcweir xBroadcaster->addEventListener( this ); 418cdf0e10cSrcweir } 419cdf0e10cSrcweir osl_decrementInterlockedCount( &_rRefCount ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir //-------------------------------------------------------------------- ~OAccessibleContextWrapperHelper()423cdf0e10cSrcweir OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper( ) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir OSL_ENSURE( m_rBHelper.bDisposed, "OAccessibleContextWrapperHelper::~OAccessibleContextWrapperHelper: you should ensure (in your dtor) that the object is disposed!" ); 426cdf0e10cSrcweir 427cdf0e10cSrcweir m_pChildMapper->release(); 428cdf0e10cSrcweir m_pChildMapper = NULL; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir //-------------------------------------------------------------------- queryInterface(const Type & _rType)432cdf0e10cSrcweir Any SAL_CALL OAccessibleContextWrapperHelper::queryInterface( const Type& _rType ) throw (RuntimeException) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir Any aReturn = OComponentProxyAggregationHelper::queryInterface( _rType ); 435cdf0e10cSrcweir if ( !aReturn.hasValue() ) 436cdf0e10cSrcweir aReturn = OAccessibleContextWrapperHelper_Base::queryInterface( _rType ); 437cdf0e10cSrcweir return aReturn; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XTYPEPROVIDER2(OAccessibleContextWrapperHelper,OComponentProxyAggregationHelper,OAccessibleContextWrapperHelper_Base)441cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleContextWrapperHelper, OComponentProxyAggregationHelper, OAccessibleContextWrapperHelper_Base ) 442cdf0e10cSrcweir 443cdf0e10cSrcweir //-------------------------------------------------------------------- 444cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleContextWrapperHelper::getAccessibleChildCount( ) throw (RuntimeException) 445cdf0e10cSrcweir { 446cdf0e10cSrcweir return m_xInnerContext->getAccessibleChildCount(); 447cdf0e10cSrcweir } 448cdf0e10cSrcweir 449cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChild(sal_Int32 i)450cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleContextWrapperHelper::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir // get the child of the wrapped component 453cdf0e10cSrcweir Reference< XAccessible > xInnerChild = m_xInnerContext->getAccessibleChild( i ); 454cdf0e10cSrcweir return m_pChildMapper->getAccessibleWrapperFor( xInnerChild ); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRelationSet()458cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL OAccessibleContextWrapperHelper::getAccessibleRelationSet( ) throw (RuntimeException) 459cdf0e10cSrcweir { 460cdf0e10cSrcweir return m_xInnerContext->getAccessibleRelationSet(); 461cdf0e10cSrcweir // TODO: if this relation set would contain relations to siblings, we would normally need 462cdf0e10cSrcweir // to wrap them, too .... 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir //-------------------------------------------------------------------- notifyEvent(const AccessibleEventObject & _rEvent)466cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapperHelper::notifyEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 469cdf0e10cSrcweir if ( AccessibleEventId::STATE_CHANGED == _rEvent.EventId ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir sal_Bool bChildTransienceChanged = sal_False; 472cdf0e10cSrcweir sal_Int16 nChangeState = 0; 473cdf0e10cSrcweir if ( _rEvent.OldValue >>= nChangeState ) 474cdf0e10cSrcweir bChildTransienceChanged = bChildTransienceChanged || AccessibleStateType::MANAGES_DESCENDANTS == nChangeState; 475cdf0e10cSrcweir if ( _rEvent.NewValue >>= nChangeState ) 476cdf0e10cSrcweir bChildTransienceChanged = bChildTransienceChanged || AccessibleStateType::MANAGES_DESCENDANTS == nChangeState; 477cdf0e10cSrcweir OSL_ENSURE( !bChildTransienceChanged, "OAccessibleContextWrapperHelper::notifyEvent: MANAGES_DESCENDANTS is not expected to change during runtime!" ); 478cdf0e10cSrcweir // if this asserts, then we would need to update our m_bTransientChildren flag here, 479cdf0e10cSrcweir // as well as (potentially) our child cache 480cdf0e10cSrcweir } 481cdf0e10cSrcweir #endif 482cdf0e10cSrcweir AccessibleEventObject aTranslatedEvent( _rEvent ); 483cdf0e10cSrcweir 484cdf0e10cSrcweir { 485cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_rBHelper.rMutex ); 486cdf0e10cSrcweir 487cdf0e10cSrcweir // translate the event 488cdf0e10cSrcweir queryInterface( ::getCppuType( static_cast< Reference< XInterface >* >( NULL ) ) ) >>= aTranslatedEvent.Source; 489cdf0e10cSrcweir m_pChildMapper->translateAccessibleEvent( _rEvent, aTranslatedEvent ); 490cdf0e10cSrcweir 491cdf0e10cSrcweir // see if any of these notifications affect our child manager 492cdf0e10cSrcweir m_pChildMapper->handleChildNotification( _rEvent ); 493cdf0e10cSrcweir 494cdf0e10cSrcweir if ( aTranslatedEvent.NewValue == m_xInner ) 495cdf0e10cSrcweir aTranslatedEvent.NewValue = makeAny(aTranslatedEvent.Source); 496cdf0e10cSrcweir if ( aTranslatedEvent.OldValue == m_xInner ) 497cdf0e10cSrcweir aTranslatedEvent.OldValue = makeAny(aTranslatedEvent.Source); 498cdf0e10cSrcweir } 499cdf0e10cSrcweir 500cdf0e10cSrcweir notifyTranslatedEvent( aTranslatedEvent ); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir 503cdf0e10cSrcweir //-------------------------------------------------------------------- dispose()504cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapperHelper::dispose() throw( RuntimeException ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_rBHelper.rMutex ); 507cdf0e10cSrcweir 508cdf0e10cSrcweir // stop multiplexing events 509cdf0e10cSrcweir Reference< XAccessibleEventBroadcaster > xBroadcaster( m_xInner, UNO_QUERY ); 510cdf0e10cSrcweir OSL_ENSURE( xBroadcaster.is(), "OAccessibleContextWrapperHelper::disposing(): inner context is no broadcaster!" ); 511cdf0e10cSrcweir if ( xBroadcaster.is() ) 512cdf0e10cSrcweir xBroadcaster->removeEventListener( this ); 513cdf0e10cSrcweir 514cdf0e10cSrcweir // dispose the child cache/map 515cdf0e10cSrcweir m_pChildMapper->dispose(); 516cdf0e10cSrcweir 517cdf0e10cSrcweir // let the base class dispose the inner component 518cdf0e10cSrcweir OComponentProxyAggregationHelper::dispose(); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir 521cdf0e10cSrcweir //-------------------------------------------------------------------- disposing(const EventObject & _rEvent)522cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapperHelper::disposing( const EventObject& _rEvent ) throw (RuntimeException) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir // simply disambiguate this 525cdf0e10cSrcweir OComponentProxyAggregationHelper::disposing( _rEvent ); 526cdf0e10cSrcweir } 527cdf0e10cSrcweir 528cdf0e10cSrcweir //==================================================================== 529cdf0e10cSrcweir //= OAccessibleContextWrapper 530cdf0e10cSrcweir //==================================================================== 531cdf0e10cSrcweir //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XINTERFACE2(OAccessibleContextWrapper,OAccessibleContextWrapper_CBase,OAccessibleContextWrapperHelper)532cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleContextWrapper, OAccessibleContextWrapper_CBase, OAccessibleContextWrapperHelper ) 533cdf0e10cSrcweir 534cdf0e10cSrcweir //-------------------------------------------------------------------- 535cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleContextWrapper, OAccessibleContextWrapper_CBase, OAccessibleContextWrapperHelper ) 536cdf0e10cSrcweir 537cdf0e10cSrcweir //-------------------------------------------------------------------- 538cdf0e10cSrcweir OAccessibleContextWrapper::OAccessibleContextWrapper( const Reference< XMultiServiceFactory >& _rxORB, 539cdf0e10cSrcweir const Reference< XAccessibleContext >& _rxInnerAccessibleContext, const Reference< XAccessible >& _rxOwningAccessible, 540cdf0e10cSrcweir const Reference< XAccessible >& _rxParentAccessible ) 541cdf0e10cSrcweir :OAccessibleContextWrapper_CBase( m_aMutex ) 542cdf0e10cSrcweir ,OAccessibleContextWrapperHelper( _rxORB, rBHelper, _rxInnerAccessibleContext, _rxOwningAccessible, _rxParentAccessible ) 543cdf0e10cSrcweir ,m_nNotifierClient( 0 ) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir aggregateProxy( m_refCount, *this ); 546cdf0e10cSrcweir } 547cdf0e10cSrcweir 548cdf0e10cSrcweir //-------------------------------------------------------------------- ~OAccessibleContextWrapper()549cdf0e10cSrcweir OAccessibleContextWrapper::~OAccessibleContextWrapper() 550cdf0e10cSrcweir { 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChildCount()554cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleContextWrapper::getAccessibleChildCount( ) throw (RuntimeException) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir return OAccessibleContextWrapperHelper::getAccessibleChildCount(); 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChild(sal_Int32 i)560cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleContextWrapper::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir return OAccessibleContextWrapperHelper::getAccessibleChild( i ); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleParent()566cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleContextWrapper::getAccessibleParent( ) throw (RuntimeException) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir return m_xParentAccessible; 569cdf0e10cSrcweir } 570cdf0e10cSrcweir 571cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleIndexInParent()572cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleContextWrapper::getAccessibleIndexInParent( ) throw (RuntimeException) 573cdf0e10cSrcweir { 574cdf0e10cSrcweir return m_xInnerContext->getAccessibleIndexInParent(); 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRole()578cdf0e10cSrcweir sal_Int16 SAL_CALL OAccessibleContextWrapper::getAccessibleRole( ) throw (RuntimeException) 579cdf0e10cSrcweir { 580cdf0e10cSrcweir return m_xInnerContext->getAccessibleRole(); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir 583cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleDescription()584cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAccessibleContextWrapper::getAccessibleDescription( ) throw (RuntimeException) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir return m_xInnerContext->getAccessibleDescription(); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir 589cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleName()590cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAccessibleContextWrapper::getAccessibleName( ) throw (RuntimeException) 591cdf0e10cSrcweir { 592cdf0e10cSrcweir return m_xInnerContext->getAccessibleName(); 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRelationSet()596cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL OAccessibleContextWrapper::getAccessibleRelationSet( ) throw (RuntimeException) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir return OAccessibleContextWrapperHelper::getAccessibleRelationSet(); 599cdf0e10cSrcweir } 600cdf0e10cSrcweir 601cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleStateSet()602cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL OAccessibleContextWrapper::getAccessibleStateSet( ) throw (RuntimeException) 603cdf0e10cSrcweir { 604cdf0e10cSrcweir return m_xInnerContext->getAccessibleStateSet(); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir //-------------------------------------------------------------------- getLocale()608cdf0e10cSrcweir Locale SAL_CALL OAccessibleContextWrapper::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir return m_xInnerContext->getLocale(); 611cdf0e10cSrcweir } 612cdf0e10cSrcweir 613cdf0e10cSrcweir //-------------------------------------------------------------------- notifyTranslatedEvent(const AccessibleEventObject & _rEvent)614cdf0e10cSrcweir void OAccessibleContextWrapper::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir if ( m_nNotifierClient ) 617cdf0e10cSrcweir AccessibleEventNotifier::addEvent( m_nNotifierClient, _rEvent ); 618cdf0e10cSrcweir } 619cdf0e10cSrcweir 620cdf0e10cSrcweir //-------------------------------------------------------------------- addEventListener(const Reference<XAccessibleEventListener> & _rxListener)621cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapper::addEventListener( const Reference< XAccessibleEventListener >& _rxListener ) throw (RuntimeException) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 624cdf0e10cSrcweir if ( !m_nNotifierClient ) 625cdf0e10cSrcweir m_nNotifierClient = AccessibleEventNotifier::registerClient( ); 626cdf0e10cSrcweir AccessibleEventNotifier::addEventListener( m_nNotifierClient, _rxListener ); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir //-------------------------------------------------------------------- removeEventListener(const Reference<XAccessibleEventListener> & _rxListener)630cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapper::removeEventListener( const Reference< XAccessibleEventListener >& _rxListener ) throw (RuntimeException) 631cdf0e10cSrcweir { 632cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 633cdf0e10cSrcweir if ( m_nNotifierClient ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir if ( 0 == AccessibleEventNotifier::removeEventListener( m_nNotifierClient, _rxListener ) ) 636cdf0e10cSrcweir { 637cdf0e10cSrcweir AccessibleEventNotifier::TClientId nId( m_nNotifierClient ); 638cdf0e10cSrcweir m_nNotifierClient = 0; 639cdf0e10cSrcweir AccessibleEventNotifier::revokeClient( nId ); 640cdf0e10cSrcweir } 641cdf0e10cSrcweir } 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir //-------------------------------------------------------------------- disposing()645cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapper::disposing() throw (RuntimeException) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir AccessibleEventNotifier::TClientId nClientId( 0 ); 648cdf0e10cSrcweir 649cdf0e10cSrcweir // --- <mutex lock> ----------------------------------------- 650cdf0e10cSrcweir { 651cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 652cdf0e10cSrcweir 653cdf0e10cSrcweir // prepare notifying our AccessibleListeners 654cdf0e10cSrcweir if ( m_nNotifierClient ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir nClientId = m_nNotifierClient; 657cdf0e10cSrcweir m_nNotifierClient = 0; 658cdf0e10cSrcweir } 659cdf0e10cSrcweir } 660cdf0e10cSrcweir // --- </mutex lock> ----------------------------------------- 661cdf0e10cSrcweir 662cdf0e10cSrcweir // let the base class do 663cdf0e10cSrcweir OAccessibleContextWrapperHelper::dispose(); 664cdf0e10cSrcweir 665cdf0e10cSrcweir // notify the disposal 666cdf0e10cSrcweir if ( nClientId ) 667cdf0e10cSrcweir AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, *this ); 668cdf0e10cSrcweir } 669cdf0e10cSrcweir 670cdf0e10cSrcweir //-------------------------------------------------------------------- dispose()671cdf0e10cSrcweir void SAL_CALL OAccessibleContextWrapper::dispose() throw( RuntimeException ) 672cdf0e10cSrcweir { 673cdf0e10cSrcweir // simply disambiguate 674cdf0e10cSrcweir OComponentProxyAggregation_CBase::dispose(); 675cdf0e10cSrcweir } 676cdf0e10cSrcweir 677cdf0e10cSrcweir //............................................................................. 678cdf0e10cSrcweir } // namespace accessibility 679cdf0e10cSrcweir //............................................................................. 680