From fe09f12d83d934287c58f507a99b693212a84c79 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 18 Mar 2022 11:46:46 +0100 Subject: [PATCH] chart a11y: Drop bSendGlobally param from AccessibleBase::BroadcastAccEvent Setting it didn't have any effect in practice: If set to `true`, it resulted in `vcl::unohelper::NotifyAccessibleStateEventGlobally` getting called, which calls `XExtendedToolkit::fireFocusGained` or `XExtendedToolkit::fireFocusLost`, but the only implementations in `VCLXToolkit` do nothing. Interestingly, the documentation for `XExtendedToolkit` in `offapi/com/sun/star/awt/XExtendedToolkit.idl` says: > @deprecated > This interface was only implemented in an intermediate developer > release anyway. > > @since OOo 1.1.2 but the interface is still used in various places across the code base... Change-Id: I4681c28c9d18cf1953be5127765f4aa94563662d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131735 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../accessibility/AccessibleBase.cxx | 23 ++++++------------- .../source/controller/inc/AccessibleBase.hxx | 6 +---- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index f419ba7f7942..904c91e99365 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -123,7 +123,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId AddState( AccessibleStateType::FOCUSED ); aSelected <<= AccessibleStateType::FOCUSED; - BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty, true ); + BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty ); SAL_INFO("chart2.accessibility", "Selection acquired by: " << getAccessibleName()); } @@ -136,7 +136,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId AddState( AccessibleStateType::FOCUSED ); aSelected <<= AccessibleStateType::FOCUSED; - BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected, true ); + BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected ); SAL_INFO("chart2.accessibility", "Selection lost by: " << getAccessibleName()); } break; @@ -343,32 +343,24 @@ awt::Point AccessibleBase::GetUpperLeftOnScreen() const void AccessibleBase::BroadcastAccEvent( sal_Int16 nId, const Any & rNew, - const Any & rOld, - bool bSendGlobally ) const + const Any & rOld ) const { ClearableMutexGuard aGuard( m_aMutex ); - if ( !m_nEventNotifierId && !bSendGlobally ) + if ( !m_nEventNotifierId ) return; // if we don't have a client id for the notifier, then we don't have listeners, then // we don't need to notify anything - //except SendGlobally for focus handling? // the const cast is needed, because UNO parameters are never const const AccessibleEventObject aEvent( const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )), nId, rNew, rOld ); - if ( m_nEventNotifierId ) // let the notifier handle this event - ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent ); + // let the notifier handle this event + ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent ); aGuard.clear(); - - // send event to global message queue - if( bSendGlobally ) - { - vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent ); - } } void AccessibleBase::KillAllChildren() @@ -405,8 +397,7 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo ) { KillAllChildren(); } - BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any(), - true /* global notification */ ); + BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any()); } // ________ (XComponent::dispose) ________ diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index 4bd51c342678..44f326f2a4f1 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -185,14 +185,10 @@ protected: /** This method creates an AccessibleEventObject and sends it to all listeners that are currently listening to this object - - If bSendGlobally is true, the event is also broadcast via - vcl::unohelper::NotifyAccessibleStateEventGlobally() */ void BroadcastAccEvent( sal_Int16 nId, const css::uno::Any & rNew, - const css::uno::Any & rOld, - bool bSendGlobally = false ) const; + const css::uno::Any & rOld ) const; /** Removes all children from the internal lists and broadcasts child remove events.