comphelper/source/misc/accessiblecomponenthelper.cxx |    4 
 include/comphelper/accessiblecomponenthelper.hxx     |    3 
 svtools/source/control/valueacc.cxx                  |  268 -------------------
 svtools/source/control/valueimp.hxx                  |   60 ----
 4 files changed, 31 insertions(+), 304 deletions(-)

New commits:
commit e7dc7ebc9e14447a4ab75502a378f632a910c394
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 25 12:14:24 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 08:09:39 2025 +0100

    valueset a11y: Use OAccessibleComponentHelper for ValueItemAcc
    
    Similar to how
    
    Change-Id: I59643f970a54a585c9ec1f8a5ca915014f1e2991
    Author: Michael Weghorn <m.wegh...@posteo.de>
    Date:   Tue Feb 25 11:51:40 2025 +0100
    
        valueset a11y: Use OAccessibleComponentHelper for ValueSetAcc
    
    did for ValueSetAcc, also derive
    from OAccessibleComponentHelper for ValueItemAcc
    to make use of the logic already implemented there
    instead of having to implement all the XAccessibleComponent
    and XAccessibleEventBroadcaster methods manually.
    
    ValueItemAcc::getBounds implements what is needed
    to implement OAccessibleComponentHelper::implGetBounds,
    so rename the method (and drop the mutex guard from that
    method, as callers of that method in the base class take
    care of that).
    
    Drop all of the other overrides that are no longer
    needed as the implementation is now provided by
    the OAccessibleComponentHelper base class.
    
    No change in behavior intended or observed initially
    when testing this with Accerciser and Orca and the qt6
    VCL plugin for the scenario described in
    
        commit cfe63bf67f4a2c9943f5089781d5f26f78266913
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Feb 24 17:17:34 2025 +0100
    
            valueset a11y: Fix reported position
    
    However, when closing LO, this now triggers an assertion:
    
        soffice.bin: 
/home/michi/development/git/libreoffice/comphelper/source/misc/accessibleeventnotifier.cxx:142:
 bool (anonymous namespace)::implLookupClient(const 
AccessibleEventNotifier::TClientId, ClientMap::iterator &): Assertion 
`rClients.end() != rPos && "AccessibleEventNotifier::implLookupClient: invalid 
client id " "(did you register your client?)!"' failed.
    
    This is due to a preexisting issue that ValuItemAcc
    objects are not disposed that will be fixed separately
    in upcoming commit
    
        Change-Id: Ifa7e18393edcc1889bcb390fa453c611d9345bdc
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Tue Feb 25 12:33:21 2025 +0100
    
            valueset a11y: Dispose ValueItemAcc objects
    
    The issue didn't trigger a crash on exit before
    this commit because AccessibleEventNotifier and
    the static `ClientMap gaClients` it uses weren't
    used before with ValueSetAcc's custom a11y event
    handling.
    (Considering to get rid of the static client map
    might be something to further consider in the future,
    but I think that makes most sense once more classes
    currently using AccessibleEventNotifier directly
    have been refactored to use OAccessibleComponentHelper).
    
    The fact that Orca currently doesn't announce the
    valueset items when moving focus between them is independent
    of this commit. Suggested upstream fix to make it work:
    https://gitlab.gnome.org/GNOME/orca/-/merge_requests/236
    
    Change-Id: If448008b3a6dc7b22a06b6ed551b08a40b2d5de3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182173
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index 5876e091bbe9..a6b85777bb6b 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -73,7 +73,7 @@ ValueItemAcc::~ValueItemAcc()
 
 void ValueItemAcc::ValueSetItemDestroyed()
 {
-    std::scoped_lock aGuard( maMutex );
+    const SolarMutexGuard aSolarGuard;
     mpValueSetItem = nullptr;
 }
 
@@ -233,63 +233,14 @@ lang::Locale SAL_CALL ValueItemAcc::getLocale()
     return aRet;
 }
 
-
-void SAL_CALL ValueItemAcc::addAccessibleEventListener( const uno::Reference< 
accessibility::XAccessibleEventListener >& rxListener )
-{
-    std::scoped_lock aGuard( maMutex );
-
-    if( !rxListener.is() )
-           return;
-
-    bool bFound = false;
-
-    for (auto const& eventListener : mxEventListeners)
-    {
-        if(eventListener == rxListener)
-        {
-            bFound = true;
-            break;
-        }
-    }
-
-    if (!bFound)
-        mxEventListeners.push_back( rxListener );
-}
-
-
-void SAL_CALL ValueItemAcc::removeAccessibleEventListener( const 
uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
-{
-    std::scoped_lock aGuard( maMutex );
-
-    if( rxListener.is() )
-    {
-        ::std::vector< uno::Reference< accessibility::XAccessibleEventListener 
> >::iterator aIter =
-            std::find(mxEventListeners.begin(), mxEventListeners.end(), 
rxListener);
-
-        if (aIter != mxEventListeners.end())
-            mxEventListeners.erase(aIter);
-    }
-}
-
-
-sal_Bool SAL_CALL ValueItemAcc::containsPoint( const awt::Point& aPoint )
-{
-    const awt::Rectangle    aRect( getBounds() );
-    const Point             aSize( aRect.Width, aRect.Height );
-    const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
-
-    return tools::Rectangle( aNullPoint, aSize ).Contains( aTestPoint );
-}
-
 uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueItemAcc::getAccessibleAtPoint( const awt::Point& )
 {
     uno::Reference< accessibility::XAccessible > xRet;
     return xRet;
 }
 
-awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
+awt::Rectangle ValueItemAcc::implGetBounds()
 {
-    const SolarMutexGuard aSolarGuard;
     awt::Rectangle      aRet;
 
     if (mpValueSetItem)
@@ -308,46 +259,6 @@ awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
     return aRet;
 }
 
-awt::Point SAL_CALL ValueItemAcc::getLocation()
-{
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Point              aRet;
-
-    aRet.X = aRect.X;
-    aRet.Y = aRect.Y;
-
-    return aRet;
-}
-
-awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen()
-{
-    const SolarMutexGuard aSolarGuard;
-    awt::Point          aRet;
-
-    if (mpValueSetItem)
-    {
-        const Point aPos = 
mpValueSetItem->mrParent.GetItemRect(mpValueSetItem->mnId).TopLeft();
-        const Point aScreenPos(
-            
mpValueSetItem->mrParent.GetDrawingArea()->get_accessible_location_on_screen());
-
-        aRet.X = aPos.X() + aScreenPos.X();
-        aRet.Y = aPos.Y() + aScreenPos.Y();
-    }
-
-    return aRet;
-}
-
-awt::Size SAL_CALL ValueItemAcc::getSize()
-{
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Size               aRet;
-
-    aRet.Width = aRect.Width;
-    aRet.Height = aRect.Height;
-
-    return aRet;
-}
-
 void SAL_CALL ValueItemAcc::grabFocus()
 {
     // nothing to do
@@ -371,27 +282,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getBackground(  )
 
 void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& 
rOldValue, const uno::Any& rNewValue )
 {
-    if( !nEventId )
-        return;
-
-    std::vector<uno::Reference<accessibility::XAccessibleEventListener>> 
aTmpListeners;
-
-    {
-        std::scoped_lock aGuard(maMutex);
-        aTmpListeners = mxEventListeners;
-    }
-
-    accessibility::AccessibleEventObject aEvtObject;
-
-    aEvtObject.EventId = nEventId;
-    aEvtObject.Source = getXWeak();
-    aEvtObject.NewValue = rNewValue;
-    aEvtObject.OldValue = rOldValue;
-
-    for (auto const& tmpListener : aTmpListeners)
-    {
-        tmpListener->notifyEvent( aEvtObject );
-    }
+    NotifyAccessibleEvent(nEventId, rOldValue, rNewValue);
 }
 
 ValueSetAcc::ValueSetAcc(ValueSet* pValueSet) :
diff --git a/svtools/source/control/valueimp.hxx 
b/svtools/source/control/valueimp.hxx
index f34ab72d3323..f5fc3b5460f1 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -162,16 +162,10 @@ private:
     bool HasNoneField() const;
 };
 
-class ValueItemAcc : public ::cppu::WeakImplHelper< 
css::accessibility::XAccessible,
-                                                     
css::accessibility::XAccessibleEventBroadcaster,
-                                                     
css::accessibility::XAccessibleContext,
-                                                     
css::accessibility::XAccessibleComponent >
+class ValueItemAcc : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                                        
css::accessibility::XAccessible>
 {
 private:
-
-    ::std::vector< css::uno::Reference<
-        css::accessibility::XAccessibleEventListener > >                
mxEventListeners;
-    std::mutex                                                          
maMutex;
     ValueSetItem*                                                       
mpValueSetItem;
 
 public:
@@ -188,10 +182,6 @@ public:
     // XAccessible
     virtual css::uno::Reference< css::accessibility::XAccessibleContext > 
SAL_CALL getAccessibleContext(  ) override;
 
-    // XAccessibleEventBroadcaster
-    virtual void SAL_CALL addAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override;
-    virtual void SAL_CALL removeAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override;
-
     // XAccessibleContext
     virtual sal_Int64 SAL_CALL getAccessibleChildCount(  ) override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleChild( sal_Int64 i ) override;
@@ -204,13 +194,11 @@ public:
     virtual sal_Int64 SAL_CALL getAccessibleStateSet(  ) override;
     virtual css::lang::Locale SAL_CALL getLocale(  ) override;
 
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
+
     // XAccessibleComponent
-    virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) 
override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
-    virtual css::awt::Rectangle SAL_CALL getBounds(  ) override;
-    virtual css::awt::Point SAL_CALL getLocation(  ) override;
-    virtual css::awt::Point SAL_CALL getLocationOnScreen(  ) override;
-    virtual css::awt::Size SAL_CALL getSize(  ) override;
     virtual void SAL_CALL grabFocus(  ) override;
     virtual sal_Int32 SAL_CALL getForeground(  ) override;
     virtual sal_Int32 SAL_CALL getBackground(  ) override;
commit b5d197cf4b4fc5f4e6aca5e01e2cc9757293c63e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 25 11:51:40 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 08:09:34 2025 +0100

    valueset a11y: Use OAccessibleComponentHelper for ValueSetAcc
    
    Similar to how
    
        commit 7107db3fe773629cc511eb5922bc9c28c9c5c60a
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Jan 24 18:57:58 2025 +0100
    
            toolkit a11y: Use OAccessibleComponentHelper for grid control
    
    did for AccessibleGridControlBase, also derive
    from OAccessibleComponentHelper for ValueSetAcc
    to make use of the logic already implemented there
    instead of having to implement all the XAccessibleComponent
    and XAccessibleEventBroadcaster methods manually.
    
    ValueSetAcc::getBounds implements what is needed
    to implement OAccessibleComponentHelper::implGetBounds,
    so rename the method (and drop the mutex guard from that
    method, as callers of that method in the base class take
    care of that).
    
    Drop all of the other overrides that are no longer
    needed as the implementation is now provided by
    the OAccessibleComponentHelper base class.
    
    No change in behavior intended or observed when
    testing this with Accerciser and Orca and the qt6
    VCL plugin for the scenario described in
    
        commit cfe63bf67f4a2c9943f5089781d5f26f78266913
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Feb 24 17:17:34 2025 +0100
    
            valueset a11y: Fix reported position
    
    Change-Id: I59643f970a54a585c9ec1f8a5ca915014f1e2991
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182158
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index cebc5af5beb4..5876e091bbe9 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -408,28 +408,12 @@ ValueSetAcc::~ValueSetAcc()
 
 void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& 
rOldValue, const uno::Any& rNewValue )
 {
-    if( !nEventId )
-        return;
-
-    ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > 
                 aTmpListeners( mxEventListeners );
-    accessibility::AccessibleEventObject                                       
                 aEvtObject;
-
-    aEvtObject.EventId = nEventId;
-    aEvtObject.Source = getXWeak();
-    aEvtObject.NewValue = rNewValue;
-    aEvtObject.OldValue = rOldValue;
-    aEvtObject.IndexHint = -1;
+    NotifyAccessibleEvent(nEventId, rOldValue, rNewValue);
+}
 
-    for (auto const& tmpListener : aTmpListeners)
-    {
-        try
-        {
-            tmpListener->notifyEvent( aEvtObject );
-        }
-        catch(const uno::Exception&)
-        {
-        }
-    }
+bool ValueSetAcc::HasAccessibleListeners() const
+{
+    return comphelper::OAccessibleComponentHelper::hasAccessibleListeners();
 }
 
 void ValueSetAcc::GetFocus()
@@ -618,58 +602,6 @@ lang::Locale SAL_CALL ValueSetAcc::getLocale()
     return aRet;
 }
 
-
-void SAL_CALL ValueSetAcc::addAccessibleEventListener( const uno::Reference< 
accessibility::XAccessibleEventListener >& rxListener )
-{
-    ThrowIfDisposed(false);
-    std::unique_lock aGuard (m_aMutex);
-
-    if( !rxListener.is() )
-           return;
-
-    bool bFound = false;
-
-    for (auto const& eventListener : mxEventListeners)
-    {
-        if(eventListener == rxListener)
-        {
-            bFound = true;
-            break;
-        }
-    }
-
-    if (!bFound)
-        mxEventListeners.push_back( rxListener );
-}
-
-
-void SAL_CALL ValueSetAcc::removeAccessibleEventListener( const 
uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
-{
-    ThrowIfDisposed(false);
-    std::unique_lock aGuard (m_aMutex);
-
-    if( rxListener.is() )
-    {
-        ::std::vector< uno::Reference< accessibility::XAccessibleEventListener 
> >::iterator aIter =
-            std::find(mxEventListeners.begin(), mxEventListeners.end(), 
rxListener);
-
-        if (aIter != mxEventListeners.end())
-            mxEventListeners.erase(aIter);
-    }
-}
-
-
-sal_Bool SAL_CALL ValueSetAcc::containsPoint( const awt::Point& aPoint )
-{
-    ThrowIfDisposed();
-    const awt::Rectangle    aRect( getBounds() );
-    const Point             aSize( aRect.Width, aRect.Height );
-    const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
-
-    return tools::Rectangle( aNullPoint, aSize ).Contains( aTestPoint );
-}
-
-
 uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
 {
     ThrowIfDisposed();
@@ -691,12 +623,8 @@ uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueSetAcc::getAccessible
     return xRet;
 }
 
-
-awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
+awt::Rectangle ValueSetAcc::implGetBounds()
 {
-    ThrowIfDisposed();
-    const SolarMutexGuard aSolarGuard;
-
     weld::DrawingArea* pDrawingArea = mpValueSet->GetDrawingArea();
     if (!pDrawingArea)
         return css::awt::Rectangle();
@@ -721,42 +649,6 @@ awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
     return vcl::unohelper::ConvertToAWTRect(aBounds);
 }
 
-awt::Point SAL_CALL ValueSetAcc::getLocation()
-{
-    ThrowIfDisposed();
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Point              aRet;
-
-    aRet.X = aRect.X;
-    aRet.Y = aRect.Y;
-
-    return aRet;
-}
-
-awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen()
-{
-    ThrowIfDisposed();
-    const SolarMutexGuard aSolarGuard;
-
-    weld::DrawingArea* pDrawingArea = mpValueSet->GetDrawingArea();
-    if (!pDrawingArea)
-        return css::awt::Point();
-
-    return 
vcl::unohelper::ConvertToAWTPoint(pDrawingArea->get_accessible_location_on_screen());
-}
-
-awt::Size SAL_CALL ValueSetAcc::getSize()
-{
-    ThrowIfDisposed();
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Size               aRet;
-
-    aRet.Width = aRect.Width;
-    aRet.Height = aRect.Height;
-
-    return aRet;
-}
-
 void SAL_CALL ValueSetAcc::grabFocus()
 {
     ThrowIfDisposed();
@@ -883,31 +775,6 @@ void ValueSetAcc::Invalidate()
     mpValueSet = nullptr;
 }
 
-void ValueSetAcc::disposing(std::unique_lock<std::mutex>& rGuard)
-{
-    // Make a copy of the list and clear the original.
-    ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > 
aListenerListCopy = std::move(mxEventListeners);
-
-    if (aListenerListCopy.empty())
-        return;
-
-    rGuard.unlock();
-    // Inform all listeners that this objects is disposing.
-    lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
-    for (auto const& listenerCopy : aListenerListCopy)
-    {
-        try
-        {
-            listenerCopy->disposing (aEvent);
-        }
-        catch(const uno::Exception&)
-        {
-            // Ignore exceptions.
-        }
-    }
-}
-
-
 sal_uInt16 ValueSetAcc::getItemCount() const
 {
     sal_uInt16 nCount = mpValueSet->ImplGetVisibleItemCount();
@@ -940,13 +807,7 @@ ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) 
const
 
 void ValueSetAcc::ThrowIfDisposed(bool bCheckValueSet)
 {
-    if (m_bDisposed)
-    {
-        SAL_WARN("svx", "Calling disposed object. Throwing exception:");
-        throw lang::DisposedException (
-            u"object has been already disposed"_ustr,
-            getXWeak());
-    }
+    ensureAlive();
 
     if (bCheckValueSet && !mpValueSet)
     {
diff --git a/svtools/source/control/valueimp.hxx 
b/svtools/source/control/valueimp.hxx
index ce4e32627b9a..f34ab72d3323 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -22,12 +22,10 @@
 #include <tools/color.hxx>
 #include <vcl/image.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <comphelper/compbase.hxx>
 #include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 
 #include <mutex>
 #include <vector>
@@ -64,15 +62,10 @@ struct ValueSetItem
     const rtl::Reference< ValueItemAcc > & GetAccessible();
 };
 
-typedef comphelper::WeakComponentImplHelper<
-    css::accessibility::XAccessible,
-    css::accessibility::XAccessibleEventBroadcaster,
-    css::accessibility::XAccessibleContext,
-    css::accessibility::XAccessibleComponent,
-    css::accessibility::XAccessibleSelection >
-    ValueSetAccComponentBase;
-
-class ValueSetAcc final : public ValueSetAccComponentBase
+class ValueSetAcc final
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                         css::accessibility::XAccessible,
+                                         
css::accessibility::XAccessibleSelection>
 {
 public:
 
@@ -80,7 +73,7 @@ public:
     virtual ~ValueSetAcc() override;
 
     void                FireAccessibleEvent( short nEventId, const 
css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
-    bool                HasAccessibleListeners() const { return( 
mxEventListeners.size() > 0 ); }
+    bool                HasAccessibleListeners() const;
 
 public:
 
@@ -100,10 +93,6 @@ public:
     // XAccessible
     virtual css::uno::Reference< css::accessibility::XAccessibleContext > 
SAL_CALL getAccessibleContext(  ) override;
 
-    // XAccessibleEventBroadcaster
-    virtual void SAL_CALL addAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override;
-    virtual void SAL_CALL removeAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override;
-
     // XAccessibleContext
     virtual sal_Int64 SAL_CALL getAccessibleChildCount(  ) override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleChild( sal_Int64 i ) override;
@@ -116,13 +105,11 @@ public:
     virtual sal_Int64 SAL_CALL getAccessibleStateSet(  ) override;
     virtual css::lang::Locale SAL_CALL getLocale(  ) override;
 
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
+
     // XAccessibleComponent
-    virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) 
override;
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
-    virtual css::awt::Rectangle SAL_CALL getBounds(  ) override;
-    virtual css::awt::Point SAL_CALL getLocation(  ) override;
-    virtual css::awt::Point SAL_CALL getLocationOnScreen(  ) override;
-    virtual css::awt::Size SAL_CALL getSize(  ) override;
     virtual void SAL_CALL grabFocus(  ) override;
     virtual sal_Int32 SAL_CALL getForeground(  ) override;
     virtual sal_Int32 SAL_CALL getBackground(  ) override;
@@ -137,17 +124,10 @@ public:
     virtual void SAL_CALL deselectAccessibleChild( sal_Int64 
nSelectedChildIndex ) override;
 
 private:
-    ::std::vector< css::uno::Reference<
-        css::accessibility::XAccessibleEventListener > >                
mxEventListeners;
     ValueSet* mpValueSet;
     /// The current FOCUSED state.
     bool mbIsFocused;
 
-    /** Tell all listeners that the object is dying.  This callback is
-        usually called from the WeakComponentImplHelper class.
-    */
-    virtual void disposing(std::unique_lock<std::mutex>&) override;
-
     /** Return the number of items.  This takes the None-Item into account.
     */
     sal_uInt16 getItemCount() const;
commit 2f534f9dc9e0e7bdcf2407193e77f790d95d1e3f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 25 11:29:43 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 08:09:26 2025 +0100

    a11y: Introduce OCommonAccessibleComponent::hasAccessibleListeners
    
    The method returns whether any accessible listeners are registered.
    
    The main motivation is to to have an equivalent for the current
    ValueSetAcc::HasAccessibleListeners implementation, in preparation
    of making ValueSetAcc an OAccessibleComponentHelper subclass (to
    reuse existing OAccessibleComponentHelper logic instead of having
    yet another custom implementation in ValueSetAcc).
    
    Change-Id: Id3ad3ba06a9d4daaa259e18641d8ad4492edfb63
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182157
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx 
b/comphelper/source/misc/accessiblecomponenthelper.cxx
index de523cbbda55..de7af60228da 100644
--- a/comphelper/source/misc/accessiblecomponenthelper.cxx
+++ b/comphelper/source/misc/accessiblecomponenthelper.cxx
@@ -127,6 +127,10 @@ namespace comphelper
         AccessibleEventNotifier::addEvent( m_nClientId, aEvent );
     }
 
+    bool OCommonAccessibleComponent::hasAccessibleListeners() const
+    {
+        return m_nClientId != 0;
+    }
 
     bool OCommonAccessibleComponent::isAlive() const
     {
diff --git a/include/comphelper/accessiblecomponenthelper.hxx 
b/include/comphelper/accessiblecomponenthelper.hxx
index 55cb5703d596..f40e78c6c0ab 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -111,6 +111,9 @@ namespace comphelper
                     sal_Int32 nIndexHint = -1
                 );
 
+        /// returns whether any accessible listeners are registered
+        bool hasAccessibleListeners() const;
+
         // life time control
         /// checks whether the object is alive (returns <TRUE/> then) or 
disposed
         bool    isAlive() const;

Reply via email to