chart a11y: Avoid const_cast

AccessibleBase::BroadcastAccEvent is only called from non-const
methods, so there is no need for it to be const itself.

Drop the const qualifier and the now no longer needed const_cast
of `this` inside the method.

Change-Id: I9e8bb74d761135b1f22525fa79912f4694ca7654
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182121
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-02-24 22:09:15 +01:00
parent cceed7e86a
commit bdc21628d2
2 changed files with 3 additions and 9 deletions

View File

@@ -325,10 +325,7 @@ awt::Point AccessibleBase::GetUpperLeftOnScreen() const
return aResult;
}
void AccessibleBase::BroadcastAccEvent(
sal_Int16 nId,
const Any & rNew,
const Any & rOld ) const
void AccessibleBase::BroadcastAccEvent(sal_Int16 nId, const Any& rNew, const Any& rOld)
{
ClearableMutexGuard aGuard( m_aMutex );
@@ -337,10 +334,7 @@ void AccessibleBase::BroadcastAccEvent(
// 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
// 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, -1 );
const AccessibleEventObject aEvent(static_cast<uno::XWeak*>(this), nId, rNew, rOld, -1);
// let the notifier handle this event
::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent );

View File

@@ -186,7 +186,7 @@ protected:
*/
void BroadcastAccEvent( sal_Int16 nId,
const css::uno::Any & rNew,
const css::uno::Any & rOld ) const;
const css::uno::Any & rOld );
/** Removes all children from the internal lists and broadcasts child remove
events.