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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2022-03-18 11:46:46 +01:00
parent 38bc4742af
commit fe09f12d83
2 changed files with 8 additions and 21 deletions

View File

@@ -123,7 +123,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId
AddState( AccessibleStateType::FOCUSED ); AddState( AccessibleStateType::FOCUSED );
aSelected <<= 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()); SAL_INFO("chart2.accessibility", "Selection acquired by: " << getAccessibleName());
} }
@@ -136,7 +136,7 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId
AddState( AccessibleStateType::FOCUSED ); AddState( AccessibleStateType::FOCUSED );
aSelected <<= 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()); SAL_INFO("chart2.accessibility", "Selection lost by: " << getAccessibleName());
} }
break; break;
@@ -343,32 +343,24 @@ awt::Point AccessibleBase::GetUpperLeftOnScreen() const
void AccessibleBase::BroadcastAccEvent( void AccessibleBase::BroadcastAccEvent(
sal_Int16 nId, sal_Int16 nId,
const Any & rNew, const Any & rNew,
const Any & rOld, const Any & rOld ) const
bool bSendGlobally ) const
{ {
ClearableMutexGuard aGuard( m_aMutex ); ClearableMutexGuard aGuard( m_aMutex );
if ( !m_nEventNotifierId && !bSendGlobally ) if ( !m_nEventNotifierId )
return; return;
// if we don't have a client id for the notifier, then we don't have listeners, then // 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 // we don't need to notify anything
//except SendGlobally for focus handling?
// the const cast is needed, because UNO parameters are never const // the const cast is needed, because UNO parameters are never const
const AccessibleEventObject aEvent( const AccessibleEventObject aEvent(
const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )), const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )),
nId, rNew, rOld ); nId, rNew, rOld );
if ( m_nEventNotifierId ) // let the notifier handle this event // let the notifier handle this event
::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent ); ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent );
aGuard.clear(); aGuard.clear();
// send event to global message queue
if( bSendGlobally )
{
vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent );
}
} }
void AccessibleBase::KillAllChildren() void AccessibleBase::KillAllChildren()
@@ -405,8 +397,7 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo )
{ {
KillAllChildren(); KillAllChildren();
} }
BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any(), BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any());
true /* global notification */ );
} }
// ________ (XComponent::dispose) ________ // ________ (XComponent::dispose) ________

View File

@@ -185,14 +185,10 @@ protected:
/** This method creates an AccessibleEventObject and sends it to all /** This method creates an AccessibleEventObject and sends it to all
listeners that are currently listening to this object 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, void BroadcastAccEvent( sal_Int16 nId,
const css::uno::Any & rNew, const css::uno::Any & rNew,
const css::uno::Any & rOld, const css::uno::Any & rOld ) const;
bool bSendGlobally = false ) const;
/** Removes all children from the internal lists and broadcasts child remove /** Removes all children from the internal lists and broadcasts child remove
events. events.