include/sfx2/thumbnailviewitem.hxx           |    2 
 sfx2/source/control/thumbnailview.cxx        |   10 -
 sfx2/source/control/thumbnailviewacc.cxx     |  178 +--------------------------
 sfx2/source/control/thumbnailviewacc.hxx     |   45 +-----
 sfx2/source/control/thumbnailviewitem.cxx    |    4 
 sfx2/source/control/thumbnailviewitemacc.cxx |   87 -------------
 sfx2/source/control/thumbnailviewitemacc.hxx |   29 +---
 7 files changed, 36 insertions(+), 319 deletions(-)

New commits:
commit 299f205898f102034a3d3800b5ad726f4e6bb354
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 26 11:25:49 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 20:09:44 2025 +0100

    thumbnailview a11y: Dispose ThumbnailViewItemAcc objects
    
    This is the ThumbnailViewItemAcc variant of
    
        commit b3c460980c34d2d9f91120823bb525ece7bc2fac
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Tue Feb 25 12:33:21 2025 +0100
    
            valueset a11y: Dispose ValueItemAcc objects
    
    and fixes the problem/assert described in
    
        Change-Id: Ie4e5c300ff6bdb160e756e7173c45c0f143fac69
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Wed Feb 26 11:14:04 2025 +0100
    
            thumbnailview a11y: Use OAccessibleComponentHelper for 
ThumbnailViewItemAcc
    
    in the same way as the above-mentioned commit
    b3c460980c34d2d9f91120823bb525ece7bc2fac fixed it
    for the corresponding ValueItemAcc issue mentioned in
    its commit message.
    
    Change-Id: Id2ec7a3bd6311ea63f718f5136f68f2ea94be5f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182226
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/sfx2/thumbnailviewitem.hxx 
b/include/sfx2/thumbnailviewitem.hxx
index 7d4897482d81..834955082c0d 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -110,7 +110,7 @@ public:
 
     void setTitle (const OUString& rTitle);
 
-    rtl::Reference<ThumbnailViewItemAcc> const & GetAccessible();
+    rtl::Reference<ThumbnailViewItemAcc> const & GetAccessible(bool bCreate = 
true);
 
     void setDrawArea (const tools::Rectangle &area);
 
diff --git a/sfx2/source/control/thumbnailview.cxx 
b/sfx2/source/control/thumbnailview.cxx
index 488264fccdbc..3bcbfb648568 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -165,12 +165,12 @@ 
ThumbnailView::ThumbnailView(std::unique_ptr<weld::ScrolledWindow> xWindow, std:
 
 ThumbnailView::~ThumbnailView()
 {
+    ImplDeleteItems();
+
     if (mxAccessible.is())
         mxAccessible->dispose();
 
     mpItemAttrs.reset();
-
-    ImplDeleteItems();
 }
 
 bool ThumbnailView::MouseMove(const MouseEvent& rMEvt)
@@ -290,12 +290,14 @@ void ThumbnailView::ImplDeleteItems()
             // fire accessible event???
         }
 
-        if ( pItem->isVisible() && ImplHasAccessibleListeners() )
+        rtl::Reference<ThumbnailViewItemAcc> xItemAcc = 
pItem->GetAccessible(false);
+        if (xItemAcc.is())
         {
             css::uno::Any aOldAny, aNewAny;
-
             aOldAny <<= 
css::uno::Reference<css::accessibility::XAccessible>(pItem->GetAccessible());
             ImplFireAccessibleEvent( 
css::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny );
+
+            xItemAcc->dispose();
         }
 
         mItemList[i].reset();
diff --git a/sfx2/source/control/thumbnailviewitem.cxx 
b/sfx2/source/control/thumbnailviewitem.cxx
index 9827b2a62669..8deaa8897df5 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -111,9 +111,9 @@ void ThumbnailViewItem::setTitle (const OUString& rTitle)
         maTitle = rTitle;
 }
 
-const rtl::Reference< ThumbnailViewItemAcc > & 
ThumbnailViewItem::GetAccessible()
+const rtl::Reference<ThumbnailViewItemAcc>& 
ThumbnailViewItem::GetAccessible(bool bCreate)
 {
-    if( !mxAcc.is() )
+    if (!mxAcc.is() && bCreate)
         mxAcc = new ThumbnailViewItemAcc(this);
 
     return mxAcc;
commit 1c3d0bc25f1a8bc506fecca7bf39d78f7f817ad3
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 26 11:14:04 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 20:09:38 2025 +0100

    thumbnailview a11y: Use OAccessibleComponentHelper for ThumbnailViewItemAcc
    
    Similar to how
    
        commit e7dc7ebc9e14447a4ab75502a378f632a910c394
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Tue Feb 25 12:14:24 2025 +0100
    
            valueset a11y: Use OAccessibleComponentHelper for ValueItemAcc
    
    did for ValueItemAcc, also derive
    from OAccessibleComponentHelper for ThumbnailViewItemAcc
    to make use of the logic already implemented there
    instead of having to implement all the XAccessibleComponent
    and XAccessibleEventBroadcaster methods manually.
    
    ThumbnailViewItemAcc::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 the ThumbnailView for "Recent Documents"
    in the LO Start Center with Accerciser and Orca and the qt6
    VCL plugin.
    
    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 the same preexisting issue as already described
    in more detail for ValueItemAcc in the above-mentioned
    commit (items don't get disposed) and will be addressed
    in an upcoming commit.
    
    Change-Id: Ie4e5c300ff6bdb160e756e7173c45c0f143fac69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182225
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sfx2/source/control/thumbnailviewitemacc.cxx 
b/sfx2/source/control/thumbnailviewitemacc.cxx
index 3b22f82141d1..3e6f3406b2dd 100644
--- a/sfx2/source/control/thumbnailviewitemacc.cxx
+++ b/sfx2/source/control/thumbnailviewitemacc.cxx
@@ -192,58 +192,13 @@ lang::Locale SAL_CALL ThumbnailViewItemAcc::getLocale()
     return aRet;
 }
 
-void SAL_CALL ThumbnailViewItemAcc::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 ThumbnailViewItemAcc::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 ThumbnailViewItemAcc::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 
ThumbnailViewItemAcc::getAccessibleAtPoint( const awt::Point& )
 {
     uno::Reference< accessibility::XAccessible > xRet;
     return xRet;
 }
 
-awt::Rectangle SAL_CALL ThumbnailViewItemAcc::getBounds()
+awt::Rectangle ThumbnailViewItemAcc::implGetBounds()
 {
     const SolarMutexGuard aSolarGuard;
     awt::Rectangle      aRet;
@@ -276,46 +231,6 @@ awt::Rectangle SAL_CALL ThumbnailViewItemAcc::getBounds()
     return aRet;
 }
 
-awt::Point SAL_CALL ThumbnailViewItemAcc::getLocation()
-{
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Point              aRet;
-
-    aRet.X = aRect.X;
-    aRet.Y = aRect.Y;
-
-    return aRet;
-}
-
-awt::Point SAL_CALL ThumbnailViewItemAcc::getLocationOnScreen()
-{
-    const SolarMutexGuard aSolarGuard;
-    awt::Point          aRet;
-
-    if (mpThumbnailViewItem)
-    {
-        const Point aPos = mpThumbnailViewItem->getDrawArea().TopLeft();
-        const Point aScreenPos(
-            
mpThumbnailViewItem->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 ThumbnailViewItemAcc::getSize()
-{
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Size               aRet;
-
-    aRet.Width = aRect.Width;
-    aRet.Height = aRect.Height;
-
-    return aRet;
-}
-
 void SAL_CALL ThumbnailViewItemAcc::grabFocus()
 {
     // nothing to do
diff --git a/sfx2/source/control/thumbnailviewitemacc.hxx 
b/sfx2/source/control/thumbnailviewitemacc.hxx
index ff342f698675..bd5aac054404 100644
--- a/sfx2/source/control/thumbnailviewitemacc.hxx
+++ b/sfx2/source/control/thumbnailviewitemacc.hxx
@@ -19,25 +19,17 @@
 
 #pragma once
 
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <cppuhelper/implbase.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/XAccessibleEventBroadcaster.hpp>
-
-#include <vector>
 
 class ThumbnailViewItem;
-class ThumbnailViewItemAcc : public ::cppu::WeakImplHelper< 
css::accessibility::XAccessible,
-                                                     
css::accessibility::XAccessibleEventBroadcaster,
-                                                     
css::accessibility::XAccessibleContext,
-                                                     
css::accessibility::XAccessibleComponent>
+class ThumbnailViewItemAcc
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                         css::accessibility::XAccessible>
 {
 private:
-
-    ::std::vector< css::uno::Reference< 
css::accessibility::XAccessibleEventListener > >
-                                                                        
mxEventListeners;
     std::mutex                                                          
maMutex;
     ThumbnailViewItem*                                                  
mpThumbnailViewItem;
 
@@ -52,10 +44,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;
@@ -68,13 +56,12 @@ 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 9b70943c2837bbdd68b6120df1a26ed15e92670c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 26 10:50:22 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 26 20:09:30 2025 +0100

    thumbnailview a11y: Use OAccessibleComponentHelper for ThumbnailViewAcc
    
    Similar to how
    
        commit b5d197cf4b4fc5f4e6aca5e01e2cc9757293c63e
        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 ThumbnailViewAcc
    to make use of the logic already implemented there
    instead of having to implement all the XAccessibleComponent
    and XAccessibleEventBroadcaster methods manually.
    
    ThumbnailViewAcc::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
    with the ThumbnailView for "Recent Documents" in the
    LO Start Center.
    
    Change-Id: Ia875bb290acb12137f74defa5c5ab855c352a0ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182217
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sfx2/source/control/thumbnailviewacc.cxx 
b/sfx2/source/control/thumbnailviewacc.cxx
index 3315cb050354..b15ecca3b743 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -187,54 +187,6 @@ lang::Locale SAL_CALL ThumbnailViewAcc::getLocale()
     return aRet;
 }
 
-void SAL_CALL ThumbnailViewAcc::addAccessibleEventListener( const 
uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
-{
-    ThrowIfDisposed();
-    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 ThumbnailViewAcc::removeAccessibleEventListener( const 
uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
-{
-    ThrowIfDisposed();
-    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 ThumbnailViewAcc::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 
ThumbnailViewAcc::getAccessibleAtPoint( const awt::Point& aPoint )
 {
     ThrowIfDisposed();
@@ -256,10 +208,8 @@ uno::Reference< accessibility::XAccessible > SAL_CALL 
ThumbnailViewAcc::getAcces
     return xRet;
 }
 
-awt::Rectangle SAL_CALL ThumbnailViewAcc::getBounds()
+awt::Rectangle ThumbnailViewAcc::implGetBounds()
 {
-    ThrowIfDisposed();
-    const SolarMutexGuard aSolarGuard;
     const Point         aOutPos;
     const Size aOutSize(mpThumbnailView->GetOutputSizePixel());
     awt::Rectangle      aRet;
@@ -272,54 +222,6 @@ awt::Rectangle SAL_CALL ThumbnailViewAcc::getBounds()
     return aRet;
 }
 
-awt::Point SAL_CALL ThumbnailViewAcc::getLocation()
-{
-    ThrowIfDisposed();
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Point              aRet;
-
-    aRet.X = aRect.X;
-    aRet.Y = aRect.Y;
-
-    return aRet;
-}
-
-awt::Point SAL_CALL ThumbnailViewAcc::getLocationOnScreen()
-{
-    ThrowIfDisposed();
-    const SolarMutexGuard aSolarGuard;
-    awt::Point aScreenLoc(0, 0);
-
-    uno::Reference<accessibility::XAccessible> xParent(getAccessibleParent());
-    if (xParent)
-    {
-        uno::Reference<accessibility::XAccessibleContext> 
xParentContext(xParent->getAccessibleContext());
-        uno::Reference<accessibility::XAccessibleComponent> 
xParentComponent(xParentContext, css::uno::UNO_QUERY);
-        OSL_ENSURE( xParentComponent.is(), 
"ThumbnailViewAcc::getLocationOnScreen: no parent component!" );
-        if ( xParentComponent.is() )
-        {
-            awt::Point aParentScreenLoc( 
xParentComponent->getLocationOnScreen() );
-            awt::Point aOwnRelativeLoc( getLocation() );
-            aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X;
-            aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y;
-        }
-    }
-
-    return aScreenLoc;
-}
-
-awt::Size SAL_CALL ThumbnailViewAcc::getSize()
-{
-    ThrowIfDisposed();
-    const awt::Rectangle    aRect( getBounds() );
-    awt::Size               aRet;
-
-    aRet.Width = aRect.Width;
-    aRet.Height = aRect.Height;
-
-    return aRet;
-}
-
 void SAL_CALL ThumbnailViewAcc::grabFocus()
 {
     ThrowIfDisposed();
@@ -433,42 +335,6 @@ void SAL_CALL ThumbnailViewAcc::deselectAccessibleChild( 
sal_Int64 nChildIndex)
 //FIXME TODO        ;
 }
 
-void ThumbnailViewAcc::disposing(std::unique_lock<std::mutex>& rGuard)
-{
-    ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > 
aListenerListCopy;
-
-    // unlock because we need to take solar and the lock mutex in the correct 
order
-    rGuard.unlock();
-    {
-        const SolarMutexGuard aSolarGuard;
-        std::unique_lock aGuard (m_aMutex);
-
-        // Reset the pointer to the parent.  It has to be the one who has
-        // disposed us because he is dying.
-        mpThumbnailView = nullptr;
-
-        if (mxEventListeners.empty())
-            return;
-
-        // Make a copy of the list and clear the original.
-        aListenerListCopy = std::move(mxEventListeners);
-    }
-
-    // Inform all listeners that this objects is disposing.
-    lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
-    for (auto const& listener : aListenerListCopy)
-    {
-        try
-        {
-            listener->disposing (aEvent);
-        }
-        catch(const uno::Exception&)
-        {
-            // Ignore exceptions.
-        }
-    }
-}
-
 sal_uInt16 ThumbnailViewAcc::getItemCount() const
 {
     return mpThumbnailView->ImplGetVisibleItemCount();
@@ -481,45 +347,19 @@ ThumbnailViewItem* ThumbnailViewAcc::getItem (sal_uInt16 
nIndex) const
 
 void ThumbnailViewAcc::ThrowIfDisposed()
 {
-    if (m_bDisposed)
-    {
-        SAL_WARN("sfx", "Calling disposed object. Throwing exception:");
-        throw lang::DisposedException (
-            u"object has been already disposed"_ustr,
-            getXWeak());
-    }
-    else
-    {
-        DBG_ASSERT (mpThumbnailView!=nullptr, "ValueSetAcc not disposed but 
mpThumbnailView == NULL");
-    }
+    ensureAlive();
+
+    DBG_ASSERT (mpThumbnailView!=nullptr, "ValueSetAcc not disposed but 
mpThumbnailView == NULL");
 }
 
 void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& 
rOldValue, const uno::Any& rNewValue )
 {
-    if( !nEventId )
-        return;
-
-    std::unique_lock aGuard(m_aMutex);
-    ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > 
aTmpListeners( mxEventListeners );
-    aGuard.unlock();
-    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 ThumbnailViewAcc::HasAccessibleListeners() const
+{
+    return OAccessibleComponentHelper::hasAccessibleListeners();
 }
 
 void ThumbnailViewAcc::GetFocus()
diff --git a/sfx2/source/control/thumbnailviewacc.hxx 
b/sfx2/source/control/thumbnailviewacc.hxx
index 9184bfdb0149..944e05d9a27e 100644
--- a/sfx2/source/control/thumbnailviewacc.hxx
+++ b/sfx2/source/control/thumbnailviewacc.hxx
@@ -19,30 +19,20 @@
 
 #pragma once
 
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <cppuhelper/implbase.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 <vector>
 
 class ThumbnailView;
 class ThumbnailViewItem;
 
-typedef comphelper::WeakComponentImplHelper<
-    css::accessibility::XAccessible,
-    css::accessibility::XAccessibleEventBroadcaster,
-    css::accessibility::XAccessibleContext,
-    css::accessibility::XAccessibleComponent,
-    css::accessibility::XAccessibleSelection >
-    ValueSetAccComponentBase;
-
-class ThumbnailViewAcc :
-    public ValueSetAccComponentBase
+class ThumbnailViewAcc
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                         css::accessibility::XAccessible,
+                                         
css::accessibility::XAccessibleSelection>
 {
 public:
 
@@ -53,11 +43,7 @@ public:
                               const css::uno::Any& rOldValue,
                               const css::uno::Any& rNewValue );
 
-    bool HasAccessibleListeners() const
-    {
-        std::unique_lock aGuard (m_aMutex);
-        return( mxEventListeners.size() > 0 );
-    }
+    bool HasAccessibleListeners() const;
 
 public:
     /** Called by the corresponding ValueSet when it gets the focus.
@@ -73,10 +59,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;
@@ -89,13 +71,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;
@@ -110,15 +90,8 @@ public:
     virtual void SAL_CALL deselectAccessibleChild( sal_Int64 
nSelectedChildIndex ) override;
 
 private:
-    ::std::vector< css::uno::Reference<
-        css::accessibility::XAccessibleEventListener > >   mxEventListeners;
     ThumbnailView* mpThumbnailView;
 
-    /** 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;

Reply via email to