diff options
author | Stephan Schäfer <ssa@openoffice.org> | 2002-05-30 11:35:57 +0000 |
---|---|---|
committer | Stephan Schäfer <ssa@openoffice.org> | 2002-05-30 11:35:57 +0000 |
commit | b65265bcf9bd76fc6ea74c5d4ad61815dc7f0008 (patch) | |
tree | 6835d9cfba7b928992c14531ccc6b9a7f17d5ecc | |
parent | 1086d70db67da1190a1d91a143f8f7ab31f1b6d7 (diff) |
#99526# send create/destroy in show/hide events
-rw-r--r-- | toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx | 6 | ||||
-rw-r--r-- | toolkit/source/awt/vclxaccessiblecomponent.cxx | 80 |
2 files changed, 80 insertions, 6 deletions
diff --git a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx index 34e4b4625397..b5136cc18074 100644 --- a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.hxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: tbe $ $Date: 2002-05-17 15:27:33 $ + * last change: $Author: ssa $ $Date: 2002-05-30 12:35:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -122,8 +122,10 @@ private: protected: DECL_LINK( WindowEventListener, VclSimpleEvent* ); + DECL_LINK( WindowChildEventListener, VclSimpleEvent* ); virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); public: diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 1c4a1ad37a01..ef1f9123cf56 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -2,9 +2,9 @@ * * $RCSfile: vclxaccessiblecomponent.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: tbe $ $Date: 2002-05-17 15:27:59 $ + * last change: $Author: ssa $ $Date: 2002-05-30 12:35:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -151,7 +151,10 @@ VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow ) DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" ); if ( pVCLXindow->GetWindow() ) + { pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); + pVCLXindow->GetWindow()->AddChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); + } // announce the XAccessible of our creator to the base class lateInit( pVCLXindow ); @@ -162,7 +165,10 @@ VCLXAccessibleComponent::~VCLXAccessibleComponent() ensureDisposed(); if ( mpVCLXindow && mpVCLXindow->GetWindow() ) + { mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); + mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); + } delete m_pSolarLock; m_pSolarLock = NULL; @@ -188,6 +194,56 @@ IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent return 0; } +IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent ) +{ + DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); + if ( pEvent && pEvent->ISA( VclWindowEvent ) ) + { + DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" ); + ProcessWindowChildEvent( *(VclWindowEvent*)pEvent ); + } + return 0; +} + +void VCLXAccessibleComponent::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) +{ + uno::Any aOldValue, aNewValue; + uno::Reference< accessibility::XAccessible > xAcc; + + //Window* pWindow = ((VclWindowEvent*)pEvent)->GetWindow(); + //DBG_ASSERT( pWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" ); + + switch ( rVclWindowEvent.GetId() ) + { + case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children + { + Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); + DBG_ASSERT( pChildWindow, "VCLEVENT_WINDOW_SHOW - Window=?" ); + if( pChildWindow ) + xAcc = pChildWindow->GetAccessible(); + if( xAcc.is() && GetWindow() == pChildWindow->GetAccessibleParentWindow() ) + { + aNewValue <<= xAcc; + NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_CHILD_EVENT, aOldValue, aNewValue ); + } + } + break; + case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children + { + Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); + DBG_ASSERT( pChildWindow, "VCLEVENT_WINDOW_HIDE - Window=?" ); + if( pChildWindow ) + xAcc = pChildWindow->GetAccessible(); + if( xAcc.is() && GetWindow() == pChildWindow->GetAccessibleParentWindow() ) + { + aOldValue <<= xAcc; + NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_CHILD_EVENT, aOldValue, aNewValue ); + } + } + break; + } +} + void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { uno::Any aOldValue, aNewValue; @@ -197,22 +253,34 @@ void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWind switch ( rVclWindowEvent.GetId() ) { + // + // dont handle CHILDCREATED events here + // they are handled separately as child events, see ProcessWindowChildEvent above + // + /* case VCLEVENT_WINDOW_CHILDCREATED: { Window* pWindow = (Window*) rVclWindowEvent.GetData(); DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDCREATED - Window=?" ); -// aNewValue <<= pWindow->GetAccessible(); + aNewValue <<= pWindow->GetAccessible(); NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_CHILD_EVENT, aOldValue, aNewValue ); } break; + */ case VCLEVENT_WINDOW_CHILDDESTROYED: { Window* pWindow = (Window*) rVclWindowEvent.GetData(); DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDDESTROYED - Window=?" ); -// aOldValue <<= pWindow->GetAccessible(); + aOldValue <<= pWindow->GetAccessible(); NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_CHILD_EVENT, aOldValue, aNewValue ); } break; + + // + // show and hide will be handled as child events only and are + // responsible for sending create/destroy events, see ProcessWindowChildEvent above + // + /* case VCLEVENT_WINDOW_SHOW: { aNewValue <<= accessibility::AccessibleStateType::VISIBLE; @@ -239,6 +307,7 @@ void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWind NotifyAccessibleEvent( accessibility::AccessibleEventId::ACCESSIBLE_STATE_EVENT, aOldValue, aNewValue ); } break; + */ case VCLEVENT_WINDOW_ACTIVATE: { aNewValue <<= accessibility::AccessibleStateType::ACTIVE; @@ -273,7 +342,10 @@ void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWind void VCLXAccessibleComponent::disposing() { if ( mpVCLXindow && mpVCLXindow->GetWindow() ) + { mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) ); + mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) ); + } VCLXAccessibleComponentBase::disposing(); |