toolkit/inc/controls/table/AccessibleGridControlBase.hxx          |   78 ---
 toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx    |   13 
 toolkit/inc/controls/table/AccessibleGridControlTable.hxx         |    1 
 toolkit/source/controls/table/AccessibleGridControl.cxx           |    8 
 toolkit/source/controls/table/AccessibleGridControlBase.cxx       |  200 
----------
 toolkit/source/controls/table/AccessibleGridControlHeader.cxx     |   18 
 toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx |   28 -
 toolkit/source/controls/table/AccessibleGridControlTable.cxx      |   39 +
 toolkit/source/controls/table/AccessibleGridControlTableBase.cxx  |   22 -
 toolkit/source/controls/table/AccessibleGridControlTableCell.cxx  |   14 
 10 files changed, 84 insertions(+), 337 deletions(-)

New commits:
commit b92e6bf5c5d1aa3fd6ea8c31afb286803e26ad83
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jan 24 19:54:49 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 24 22:02:22 2025 +0100

    toolkit a11y: Use cppu::ImplInheritanceHelper
    
    Change-Id: I69a1eeb53b1f3f2f4ba2b9050c70efb3d91e2150
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180725
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx 
b/toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx
index 57b348333fc1..f6387f0bde9f 100644
--- a/toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx
+++ b/toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx
@@ -23,7 +23,8 @@
 
 namespace accessibility
 {
-    class AccessibleGridControlHeaderCell final : public 
AccessibleGridControlCell, public css::accessibility::XAccessible
+    class AccessibleGridControlHeaderCell final
+        : public cppu::ImplInheritanceHelper<AccessibleGridControlCell, 
css::accessibility::XAccessible>
     {
         sal_Int32   m_nColumnRowId;
     public:
@@ -44,16 +45,6 @@ namespace accessibility
         /** Grabs the focus to the GridControl. */
         virtual void SAL_CALL grabFocus() override;
 
-        // XInterface
-
-        /** Queries for a new interface. */
-        css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) 
override;
-
-        /** Acquires the object (calls acquire() on base class). */
-        virtual void SAL_CALL acquire() noexcept override;
-
-        /** Releases the object (calls release() on base class). */
-        virtual void SAL_CALL release() noexcept override;
         // XAccessible
 
         /** @return  The XAccessibleContext interface of this object. */
diff --git a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx 
b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
index 178ea9e23b71..5551dbf79182 100644
--- a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
@@ -35,14 +35,15 @@ 
AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nCol
                                   const Reference< XAccessible >& rxParent,
                                   svt::table::TableControl& rTable,
                                   AccessibleTableControlObjType  eObjType)
-: AccessibleGridControlCell(rxParent, rTable,
+    : ImplInheritanceHelper(rxParent, rTable,
                             (eObjType == 
AccessibleTableControlObjType::ROWHEADERCELL) ? _nColumnRowId : 0,
                             (eObjType == 
AccessibleTableControlObjType::ROWHEADERCELL) ? 0 : _nColumnRowId,
                             eObjType)
-, m_nColumnRowId(_nColumnRowId)
+    , m_nColumnRowId(_nColumnRowId)
 {
     assert(eObjType == AccessibleTableControlObjType::ROWHEADERCELL || 
eObjType == AccessibleTableControlObjType::COLUMNHEADERCELL);
 }
+
 /** Return a bitset of states of the current object.
 */
 sal_Int64 AccessibleGridControlHeaderCell::implCreateStateSet()
@@ -85,26 +86,7 @@ Reference<XAccessible > SAL_CALL 
AccessibleGridControlHeaderCell::getAccessibleC
 {
     throw IndexOutOfBoundsException();
 }
-// XInterface -------------------------------------------------------------
 
-    /** Queries for a new interface. */
-    css::uno::Any SAL_CALL AccessibleGridControlHeaderCell::queryInterface( 
const css::uno::Type& rType )
-    {
-        Any aRet = AccessibleGridControlCell::queryInterface(rType);
-        return aRet;
-    }
-
-    /** Acquires the object (calls acquire() on base class). */
-    void SAL_CALL AccessibleGridControlHeaderCell::acquire() noexcept
-    {
-        AccessibleGridControlCell::acquire();
-    }
-
-    /** Releases the object (calls release() on base class). */
-    void SAL_CALL AccessibleGridControlHeaderCell::release() noexcept
-    {
-        AccessibleGridControlCell::release();
-    }
         /** @return  The XAccessibleContext interface of this object. */
     Reference< css::accessibility::XAccessibleContext > SAL_CALL 
AccessibleGridControlHeaderCell::getAccessibleContext()
     {
commit 23d2869e9b74673a11a9f8c3d45a2f5e6990dc5c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jan 24 19:10:54 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 24 22:02:15 2025 +0100

    toolkit a11y: Drop AccessibleGridControlBase::getAccessibleIndexInParent
    
    It effectively does the same as the base class implementation,
    OCommonAccessibleComponent::getAccessibleIndexInParent.
    
    Change-Id: I649841c4676009797612cbe0e6422dd088218a78
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180724
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx 
b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
index 960eca6b610a..22e6f4500006 100644
--- a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
+++ b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
@@ -70,9 +70,6 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
     getAccessibleParent() override;
 
-    /** @return  The index of this object among the parent's children. */
-    virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
-
     /** @return
             The description of this object.
     */
diff --git a/toolkit/source/controls/table/AccessibleGridControlBase.cxx 
b/toolkit/source/controls/table/AccessibleGridControlBase.cxx
index add068d6dc7f..5b169f94b7dd 100644
--- a/toolkit/source/controls/table/AccessibleGridControlBase.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlBase.cxx
@@ -76,41 +76,6 @@ css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL AccessibleGridCo
     return m_xParent;
 }
 
-sal_Int64 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent()
-{
-    SolarMutexGuard g;
-
-    ensureAlive();
-
-    // -1 for child not found/no parent (according to specification)
-    sal_Int64 nRet = -1;
-
-    css::uno::Reference< uno::XInterface > xMeMyselfAndI( static_cast< 
css::accessibility::XAccessibleContext* >( this ), uno::UNO_QUERY );
-
-    //  iterate over parent's children and search for this object
-    if( m_xParent.is() )
-    {
-        css::uno::Reference< css::accessibility::XAccessibleContext >
-            xParentContext( m_xParent->getAccessibleContext() );
-        if( xParentContext.is() )
-        {
-            css::uno::Reference< uno::XInterface > xChild;
-
-            sal_Int64 nChildCount = xParentContext->getAccessibleChildCount();
-            for( sal_Int64 nChild = 0; nChild < nChildCount; ++nChild )
-            {
-                xChild.set(xParentContext->getAccessibleChild( nChild ), 
css::uno::UNO_QUERY);
-                if ( xMeMyselfAndI.get() == xChild.get() )
-                {
-                    nRet = nChild;
-                    break;
-                }
-            }
-        }
-    }
-    return nRet;
-}
-
 OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription()
 {
     SolarMutexGuard g;
commit 7107db3fe773629cc511eb5922bc9c28c9c5c60a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jan 24 18:57:58 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jan 24 22:02:08 2025 +0100

    toolkit a11y: Use OAccessibleComponentHelper for grid control
    
    Simplify AccessibleGridControlBase by subclassing the
    comphelper::OAccessibleComponentHelper helper class
    that already provides much of the logic.
    
    Unless I'm missing anything, the corresponding custom
    implementations in AccessibleGridControlBase were
    equivalent (and partly looked copy-pasted).
    
    Notes:
    
    * XAccessibleEventBroadcaster logic is fully implemented
      in OAccessibleComponentHelper, so drop the custom logic.
    
    * In order to implement XAccessibleComponent methods,
      only OAccessibleComponentHelper::getBounds needs
      to be overriden. The logic is already implemented
      in AccessibleGridControlBase::implGetBoundingBox,
      just need to convert from tools::Rectangle to
      css::awt::Rectangle in addition.
      Drop all of the other methods related to location/bounds
      handling. The AccessibleGridControlBase logic takes
      care of that now.
    
    * Drop AccessibleGridControlBase::ensureIsAlive and
      use OAccessibleComponentHelper::ensureAlive instead,
      which has the same logic.
    
    In a quick test using sample document attachment 198647
    from tdf#164783 with the qt6 VCL plugin and Accerciser
    and the Orca screen reader, no differences in behavior
    were observed with this change in place.
    
    Change-Id: I90099dd5426db093260175b2c3d09db548e05c33
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180723
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx 
b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
index 92c78652f198..960eca6b610a 100644
--- a/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
+++ b/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 #include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <comphelper/uno3.hxx>
 
 
@@ -42,19 +43,11 @@ namespace vcl { class Window; }
 
 namespace accessibility {
 
-typedef ::cppu::WeakComponentImplHelper<
-            css::accessibility::XAccessibleContext,
-            css::accessibility::XAccessibleComponent,
-            css::accessibility::XAccessibleEventBroadcaster,
-            css::lang::XServiceInfo >
-        AccessibleGridControlImplHelper;
-
 /** The GridControl accessible objects inherit from this base class. It
-    implements basic functionality for various Accessibility interfaces and
-    the event broadcaster and contains the osl::Mutex. */
-class AccessibleGridControlBase :
-    public ::cppu::BaseMutex,
-    public AccessibleGridControlImplHelper
+    implements basic functionality. */
+class AccessibleGridControlBase
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper,
+                                         css::lang::XServiceInfo>
 {
 public:
     /** Constructor.
@@ -67,9 +60,7 @@ public:
         ::vcl::table::AccessibleTableControlObjType  eObjType );
 
 protected:
-    virtual ~AccessibleGridControlBase() override;
-
-    /** Commits DeFunc event to listeners and cleans up members. */
+    virtual ~AccessibleGridControlBase() = default;
     virtual void SAL_CALL disposing() override;
 
 public:
@@ -117,25 +108,6 @@ public:
         performance. */
 
     // XAccessibleComponent
-
-    /** @return
-        TRUE, if the point lies within the bounding box of this object. */
-    virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& rPoint ) 
override;
-
-    /** @return  The bounding box of this object. */
-    virtual css::awt::Rectangle SAL_CALL getBounds() override;
-
-    /** @return
-        The upper left corner of the bounding box relative to the parent. */
-    virtual css::awt::Point SAL_CALL getLocation() override;
-
-    /** @return
-        The upper left corner of the bounding box in screen coordinates. */
-    virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
-
-    /** @return  The size of the bounding box. */
-    virtual css::awt::Size SAL_CALL getSize() override;
-
     virtual sal_Int32 SAL_CALL getForeground(  ) override;
     virtual sal_Int32 SAL_CALL getBackground(  ) override;
 
@@ -150,16 +122,6 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
     getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
 
-    // XAccessibleEventBroadcaster
-
-    /** Adds a new event listener */
-    virtual void SAL_CALL addAccessibleEventListener(
-            const css::uno::Reference< 
css::accessibility::XAccessibleEventListener>& rxListener ) override;
-
-    /** Removes an event listener. */
-    virtual void SAL_CALL removeAccessibleEventListener(
-            const css::uno::Reference< 
css::accessibility::XAccessibleEventListener>& rxListener ) override;
-
     // XTypeProvider
 
     /** @return  a unique implementation ID. */
@@ -185,10 +147,10 @@ public:
     /** Commits an event to all listeners. */
     virtual void commitEvent(sal_Int16 nEventId, const css::uno::Any& 
rNewValue,
                              const css::uno::Any& rOldValue);
-    /** @return  TRUE, if the object is not disposed or disposing. */
-    bool isAlive() const;
 
 protected:
+    virtual css::awt::Rectangle implGetBounds() override;
+
     // internal virtual methods
 
     /** Determines whether the Grid control is really showing inside of
@@ -203,7 +165,6 @@ protected:
         @return  The bounding box (VCL rect.) relative to the parent. */
     tools::Rectangle implGetBoundingBox();
 
-
     ///** Derived classes return the bounding box in screen coordinates.
     //    @attention  This method requires locked mutex's and a living object.
     //    @return  The bounding box (VCL rect.) in screen coordinates. */
@@ -217,23 +178,6 @@ protected:
     */
     virtual sal_Int64 implCreateStateSet();
 
-    // internal helper methods
-
-    /** @throws <type>DisposedException</type>  If the object is not alive. */
-    void ensureIsAlive() const;
-
-    /** Locks all mutex's and calculates the bounding box relative to the
-        parent window.
-        @return  The bounding box (VCL rect.) relative to the parent object.
-        @throws css::lang::DisposedException
-    */
-    tools::Rectangle getBoundingBox();
-    ///** Locks all mutex's and calculates the bounding box in screen
-    //    coordinates.
-    //    @return  The bounding box (VCL rect.) in screen coordinates. */
-    /// @throws css::lang::DisposedException
-    AbsoluteScreenPixelRectangle getBoundingBoxOnScreen();
-
 protected:
     // members
 
@@ -243,9 +187,6 @@ protected:
     svt::table::TableControl& m_aTable;
     /** The type of this object (for names, descriptions, state sets, ...). */
     ::vcl::table::AccessibleTableControlObjType m_eObjType;
-
-private:
-    ::comphelper::AccessibleEventNotifier::TClientId    m_aClientId;
 };
 
 
diff --git a/toolkit/inc/controls/table/AccessibleGridControlTable.hxx 
b/toolkit/inc/controls/table/AccessibleGridControlTable.hxx
index 79031f56d74e..51a392149311 100644
--- a/toolkit/inc/controls/table/AccessibleGridControlTable.hxx
+++ b/toolkit/inc/controls/table/AccessibleGridControlTable.hxx
@@ -153,7 +153,6 @@ private:
     //    @return  The bounding box (VCL rect.) in screen coordinates. */
     virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override;
 
-
     //// internal helper methods
     ///** @attention  This method requires a locked mutex.
     //    @return  The XAccessibleTable interface of the specified header bar. 
*/
diff --git a/toolkit/source/controls/table/AccessibleGridControl.cxx 
b/toolkit/source/controls/table/AccessibleGridControl.cxx
index 277929ca56ac..463821ae5b8c 100644
--- a/toolkit/source/controls/table/AccessibleGridControl.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControl.cxx
@@ -83,7 +83,7 @@ sal_Int64 AccessibleGridControl::implGetAccessibleChildCount()
 sal_Int64 SAL_CALL AccessibleGridControl::getAccessibleChildCount()
 {
     SolarMutexGuard aSolarGuard;
-    ensureIsAlive();
+    ensureAlive();
     return implGetAccessibleChildCount();
 }
 
@@ -134,7 +134,7 @@ sal_Int16 SAL_CALL 
AccessibleGridControl::getAccessibleRole()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return AccessibleRole::PANEL;
 }
 
@@ -145,7 +145,7 @@ css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL
 AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint )
 {
     SolarMutexGuard aSolarGuard;
-    ensureIsAlive();
+    ensureAlive();
 
     sal_Int32 nIndex = 0;
     if (m_aTable.ConvertPointToControlIndex(nIndex, 
vcl::unohelper::ConvertToVCLPoint(rPoint)))
@@ -173,7 +173,7 @@ AccessibleGridControl::getAccessibleAtPoint( const 
awt::Point& rPoint )
 void SAL_CALL AccessibleGridControl::grabFocus()
 {
     SolarMutexGuard aSolarGuard;
-    ensureIsAlive();
+    ensureAlive();
     m_aTable.GrabFocus();
 }
 
diff --git a/toolkit/source/controls/table/AccessibleGridControlBase.cxx 
b/toolkit/source/controls/table/AccessibleGridControlBase.cxx
index e62a7b9ea907..add068d6dc7f 100644
--- a/toolkit/source/controls/table/AccessibleGridControlBase.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlBase.cxx
@@ -47,39 +47,20 @@ namespace accessibility {
 
 using namespace com::sun::star::accessibility::AccessibleStateType;
 
-
 AccessibleGridControlBase::AccessibleGridControlBase(
-        css::uno::Reference< css::accessibility::XAccessible > xParent,
-        svt::table::TableControl& rTable,
-        ::vcl::table::AccessibleTableControlObjType      eObjType ) :
-    AccessibleGridControlImplHelper( m_aMutex ),
-    m_xParent(std::move( xParent )),
-    m_aTable( rTable),
-    m_eObjType( eObjType ),
-    m_aClientId(0)
-{
-}
-
-AccessibleGridControlBase::~AccessibleGridControlBase()
+    css::uno::Reference<css::accessibility::XAccessible> xParent, 
svt::table::TableControl& rTable,
+    ::vcl::table::AccessibleTableControlObjType eObjType)
+    : m_xParent(std::move(xParent))
+    , m_aTable(rTable)
+    , m_eObjType(eObjType)
 {
-    if( isAlive() )
-    {
-        // increment ref count to prevent double call of Dtor
-        osl_atomic_increment( &m_refCount );
-        dispose();
-    }
 }
 
 void SAL_CALL AccessibleGridControlBase::disposing()
 {
     SolarMutexGuard g;
 
-    if (m_aClientId)
-    {
-        AccessibleEventNotifier::TClientId nId = m_aClientId;
-        m_aClientId = 0;
-        AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
-    }
+    OAccessibleComponentHelper::disposing();
 
     m_xParent = nullptr;
     //m_aTable = NULL;
@@ -91,7 +72,7 @@ css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL AccessibleGridCo
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return m_xParent;
 }
 
@@ -99,7 +80,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlBase::getAccessibleIndexInParent()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
 
     // -1 for child not found/no parent (according to specification)
     sal_Int64 nRet = -1;
@@ -134,7 +115,7 @@ OUString SAL_CALL 
AccessibleGridControlBase::getAccessibleDescription()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return m_aTable.GetAccessibleObjectDescription(m_eObjType);
 }
 
@@ -142,7 +123,7 @@ OUString SAL_CALL 
AccessibleGridControlBase::getAccessibleName()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return m_aTable.GetAccessibleObjectName(m_eObjType, 0, 0);
 }
 
@@ -151,7 +132,7 @@ AccessibleGridControlBase::getAccessibleRelationSet()
 {
    SolarMutexGuard g;
 
-   ensureIsAlive();
+   ensureAlive();
    // GridControl does not have relations.
    return new utl::AccessibleRelationSetHelper;
 }
@@ -169,7 +150,7 @@ lang::Locale SAL_CALL AccessibleGridControlBase::getLocale()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     if( m_xParent.is() )
     {
         css::uno::Reference< css::accessibility::XAccessibleContext >
@@ -180,71 +161,6 @@ lang::Locale SAL_CALL 
AccessibleGridControlBase::getLocale()
     throw IllegalAccessibleComponentStateException();
 }
 
-// css::accessibility::XAccessibleComponent
-
-sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& 
rPoint )
-{
-    return tools::Rectangle(Point(), getBoundingBox().GetSize())
-        .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint));
-}
-
-awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds()
-{
-    return vcl::unohelper::ConvertToAWTRect(getBoundingBox());
-}
-
-awt::Point SAL_CALL AccessibleGridControlBase::getLocation()
-{
-    return vcl::unohelper::ConvertToAWTPoint(getBoundingBox().TopLeft());
-}
-
-awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen()
-{
-    return 
vcl::unohelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft());
-}
-
-awt::Size SAL_CALL AccessibleGridControlBase::getSize()
-{
-    return vcl::unohelper::ConvertToAWTSize(getBoundingBox().GetSize());
-}
-
-// css::accessibility::XAccessibleEventBroadcaster
-
-void SAL_CALL AccessibleGridControlBase::addAccessibleEventListener(
-        const css::uno::Reference< 
css::accessibility::XAccessibleEventListener>& _rxListener )
-{
-    if ( _rxListener.is() )
-    {
-        SolarMutexGuard g;
-
-        if (!m_aClientId)
-            m_aClientId = AccessibleEventNotifier::registerClient();
-
-        AccessibleEventNotifier::addEventListener(m_aClientId, _rxListener );
-    }
-}
-
-void SAL_CALL AccessibleGridControlBase::removeAccessibleEventListener(
-        const css::uno::Reference< 
css::accessibility::XAccessibleEventListener>& _rxListener )
-{
-    if (!(_rxListener.is() && m_aClientId))
-        return;
-
-    SolarMutexGuard g;
-
-    sal_Int32 nListenerCount = 
AccessibleEventNotifier::removeEventListener(m_aClientId, _rxListener);
-    if ( !nListenerCount )
-    {
-        // no listeners anymore
-        // -> revoke ourself. This may lead to the notifier thread dying (if 
we were the last client),
-        // and at least to us not firing any events anymore, in case somebody 
calls
-        // NotifyAccessibleEvent, again
-        AccessibleEventNotifier::TClientId nId = m_aClientId;
-        m_aClientId = 0;
-        AccessibleEventNotifier::revokeClient( nId );
-    }
-}
-
 // XTypeProvider
 
 Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId()
@@ -313,65 +229,20 @@ sal_Int64 AccessibleGridControlBase::implCreateStateSet()
     return nStateSet;
 }
 
-// internal helper methods
-
-bool AccessibleGridControlBase::isAlive() const
-{
-    ::osl::MutexGuard g(m_aMutex); // guards rBHelper members
-    return !rBHelper.bDisposed && !rBHelper.bInDispose;
-}
-
-void AccessibleGridControlBase::ensureIsAlive() const
+css::awt::Rectangle AccessibleGridControlBase::implGetBounds()
 {
-    if( !isAlive() )
-        throw lang::DisposedException();
-}
-
-tools::Rectangle AccessibleGridControlBase::getBoundingBox()
-{
-    SolarMutexGuard aSolarGuard;
-    ensureIsAlive();
-    tools::Rectangle aRect = implGetBoundingBox();
-    if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && 
aRect.Bottom() == 0 )
-    {
-        SAL_WARN( "accessibility", "rectangle doesn't exist" );
-    }
-    return aRect;
-}
-
-AbsoluteScreenPixelRectangle 
AccessibleGridControlBase::getBoundingBoxOnScreen()
-{
-    SolarMutexGuard aSolarGuard;
-    ensureIsAlive();
-    AbsoluteScreenPixelRectangle aRect = implGetBoundingBoxOnScreen();
-    if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && 
aRect.Bottom() == 0 )
-    {
-        SAL_WARN( "accessibility", "rectangle doesn't exist" );
-    }
-    return aRect;
+    return vcl::unohelper::ConvertToAWTRect(implGetBoundingBox());
 }
 
 void AccessibleGridControlBase::commitEvent(
         sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
 {
-    SolarMutexGuard g;
-
-    if (!m_aClientId)
-            // 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
-            return;
-
-    // build an event object
-    AccessibleEventObject aEvent(*this, _nEventId, _rNewValue, _rOldValue, -1);
-
-    // let the notifier handle this event
-
-    AccessibleEventNotifier::addEvent(m_aClientId, aEvent);
+    NotifyAccessibleEvent(_nEventId, _rOldValue, _rNewValue);
 }
 
 sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
 {
-    ensureIsAlive();
+    ensureAlive();
     sal_Int16 nRole = AccessibleRole::UNKNOWN;
     switch ( m_eObjType )
     {
@@ -405,7 +276,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlBase::getForeground(  )
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 
     Color nColor;
     if (m_aTable.IsControlForeground())
@@ -426,7 +297,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlBase::getBackground(  )
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     Color nColor;
     if (m_aTable.IsControlBackground())
         nColor = m_aTable.GetControlBackground();
@@ -449,7 +320,7 @@ css::uno::Reference< css::accessibility::XAccessibleContext 
> SAL_CALL GridContr
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return this;
 }
 
diff --git a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx 
b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx
index ea1c71b138eb..b77d63355b80 100644
--- a/toolkit/source/controls/table/AccessibleGridControlHeader.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlHeader.cxx
@@ -58,7 +58,7 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int64 
nChildIndex )
 
     if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
         throw IndexOutOfBoundsException();
-    ensureIsAlive();
+    ensureAlive();
     Reference< XAccessible > xChild;
     if (m_eObjType == 
vcl::table::AccessibleTableControlObjType::COLUMNHEADERBAR)
     {
@@ -79,7 +79,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlHeader::getAccessibleIndexInParent()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     if (m_eObjType == vcl::table::AccessibleTableControlObjType::ROWHEADERBAR 
&& m_aTable.HasColHeader())
         return 1;
     else
@@ -93,7 +93,7 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const 
awt::Point& rPoint )
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 
     sal_Int32 nRow = 0;
     sal_Int32 nColumnPos = 0;
@@ -104,7 +104,7 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const 
awt::Point& rPoint )
 
 void SAL_CALL AccessibleGridControlHeader::grabFocus()
 {
-    ensureIsAlive();
+    ensureAlive();
     // focus on header not supported
 }
 
@@ -114,7 +114,7 @@ OUString SAL_CALL 
AccessibleGridControlHeader::getAccessibleRowDescription( sal_
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidRow( nRow );
     return OUString();  // no headers in headers
 }
@@ -123,7 +123,7 @@ OUString SAL_CALL 
AccessibleGridControlHeader::getAccessibleColumnDescription( s
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidColumn( nColumn );
     return OUString();  // no headers in headers
 }
@@ -132,7 +132,7 @@ Reference< XAccessibleTable > SAL_CALL 
AccessibleGridControlHeader::getAccessibl
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return nullptr;        // no headers in headers
 }
 
@@ -140,7 +140,7 @@ Reference< XAccessibleTable > SAL_CALL 
AccessibleGridControlHeader::getAccessibl
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return nullptr;        // no headers in headers
 }
 //not selectable
@@ -169,7 +169,7 @@ Reference< XAccessible > SAL_CALL 
AccessibleGridControlHeader::getAccessibleCell
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress(nRow, nColumn);
     return implGetChild(nRow, nColumn);
 }
diff --git a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx 
b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
index 4bf68ec3a047..178ea9e23b71 100644
--- a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
@@ -108,7 +108,7 @@ Reference<XAccessible > SAL_CALL 
AccessibleGridControlHeaderCell::getAccessibleC
         /** @return  The XAccessibleContext interface of this object. */
     Reference< css::accessibility::XAccessibleContext > SAL_CALL 
AccessibleGridControlHeaderCell::getAccessibleContext()
     {
-        ensureIsAlive();
+        ensureAlive();
         return this;
     }
 
@@ -142,7 +142,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlHeaderCell::getAccessibleIndexInParent()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return m_nColumnRowId;
 }
 
diff --git a/toolkit/source/controls/table/AccessibleGridControlTable.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
index d9c9e5fd2853..72e2e2a376db 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTable.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
@@ -55,7 +55,7 @@ AccessibleGridControlTable::getAccessibleChild( sal_Int64 
nChildIndex )
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidIndex( nChildIndex );
     sal_Int64 nCount = getAccessibleChildCount();
     if(m_aCellVector.empty() || m_aCellVector.size() != 
static_cast<unsigned>(nCount))
@@ -74,7 +74,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlTable::getAccessibleIndexInParent()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     if(m_aTable.HasRowHeader() && m_aTable.HasColHeader())
         return 0;
     else if(m_aTable.HasRowHeader() != m_aTable.HasColHeader())
@@ -90,7 +90,7 @@ AccessibleGridControlTable::getAccessibleAtPoint( const 
awt::Point& rPoint )
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 
     Reference< XAccessible > xChild;
     sal_Int32 nRow = 0;
@@ -105,7 +105,7 @@ void SAL_CALL AccessibleGridControlTable::grabFocus()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     m_aTable.GrabFocus();
 }
 
@@ -115,7 +115,7 @@ OUString SAL_CALL 
AccessibleGridControlTable::getAccessibleRowDescription( sal_I
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidRow( nRow );
     return u"row description"_ustr;
 }
@@ -124,7 +124,7 @@ OUString SAL_CALL 
AccessibleGridControlTable::getAccessibleColumnDescription( sa
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidColumn( nColumn );
     return u"col description"_ustr;
 }
@@ -133,7 +133,7 @@ Reference< XAccessibleTable > SAL_CALL 
AccessibleGridControlTable::getAccessible
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     if(m_aTable.HasColHeader())
         return implGetHeaderBar( 1 );
     else
@@ -144,7 +144,7 @@ Reference< XAccessibleTable > SAL_CALL 
AccessibleGridControlTable::getAccessible
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return implGetHeaderBar( 0 );
 }
 
@@ -152,7 +152,7 @@ Sequence< sal_Int32 > SAL_CALL 
AccessibleGridControlTable::getSelectedAccessible
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     Sequence< sal_Int32 > aSelSeq;
     implGetSelectedRows( aSelSeq );
     return aSelSeq;
@@ -168,7 +168,7 @@ sal_Bool SAL_CALL 
AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidRow( nRow );
     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
     return comphelper::findValue(selectedRows, nRow) != -1;
@@ -185,7 +185,7 @@ Reference< XAccessible > SAL_CALL 
AccessibleGridControlTable::getAccessibleCellA
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress( nRow, nColumn );
     sal_Int64 nChildIndex = static_cast<sal_Int64>(nRow) * 
static_cast<sal_Int64>(m_aTable.GetColumnCount()) + nColumn;
     return getAccessibleChild(nChildIndex);
@@ -196,7 +196,7 @@ sal_Bool SAL_CALL 
AccessibleGridControlTable::isAccessibleSelected(
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress( nRow, nColumn );
     //selection of single cells not possible, so if row is selected, the cell 
will be selected too
     return isAccessibleRowSelected(nRow);
@@ -205,7 +205,7 @@ void SAL_CALL 
AccessibleGridControlTable::selectAccessibleChild( sal_Int64 nChil
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidIndex( nChildIndex );
     sal_Int32 nColumns = m_aTable.GetColumnCount();
     sal_Int32 nRow = nChildIndex / nColumns;
@@ -215,7 +215,7 @@ sal_Bool SAL_CALL 
AccessibleGridControlTable::isAccessibleChildSelected( sal_Int
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidIndex( nChildIndex );
     sal_Int32 nColumns = m_aTable.GetColumnCount();
     sal_Int32 nRow = nChildIndex / nColumns;
@@ -225,14 +225,14 @@ void SAL_CALL 
AccessibleGridControlTable::clearAccessibleSelection()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     m_aTable.SelectAllRows( false );
 }
 void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
     auto selectedRowsRange = asNonConstRange(selectedRows);
     for(tools::Long i=0; i<m_aTable.GetRowCount(); i++)
@@ -242,7 +242,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlTable::getSelectedAccessibleChildCount()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
     sal_Int32 nColumns = m_aTable.GetColumnCount();
     return static_cast<sal_Int64>(selectedRows.getLength()) * 
static_cast<sal_Int64>(nColumns);
@@ -252,7 +252,7 @@ AccessibleGridControlTable::getSelectedAccessibleChild( 
sal_Int64 nSelectedChild
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     if (nSelectedChildIndex < 0 || nSelectedChildIndex >= 
getSelectedAccessibleChildCount())
         throw lang::IndexOutOfBoundsException(u"Invalid index into 
selection"_ustr, *this);
 
@@ -270,7 +270,7 @@ void SAL_CALL 
AccessibleGridControlTable::deselectAccessibleChild(
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 }
 // XInterface -----------------------------------------------------------------
 
@@ -353,6 +353,7 @@ AbsoluteScreenPixelRectangle 
AccessibleGridControlTable::implGetBoundingBoxOnScr
     AbsoluteScreenPixelRectangle aTable( AbsoluteScreenPixelPoint( nX, nY ), 
AbsoluteScreenPixelSize( nWidth, nHeight ));
     return aTable;
 }
+
 // internal helper methods ----------------------------------------------------
 Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
         sal_Int32 nChildIndex )
diff --git a/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx
index a11604a4ca00..9df91afb57cc 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTableBase.cxx
@@ -51,7 +51,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleChildCount()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     sal_Int64 nChildren = 0;
     if (m_eObjType == AccessibleTableControlObjType::ROWHEADERBAR)
         nChildren = m_aTable.GetRowCount();
@@ -66,7 +66,7 @@ sal_Int16 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleRole()
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return AccessibleRole::TABLE;
 }
 
@@ -76,7 +76,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleRowCount()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 
     if (m_eObjType == AccessibleTableControlObjType::COLUMNHEADERBAR)
         return 1;
@@ -87,7 +87,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleColumnCount()
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
 
     if (m_eObjType == AccessibleTableControlObjType::ROWHEADERBAR)
         return 1;
@@ -99,7 +99,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleRowExtentAt(
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress( nRow, nColumn );
     return 1;   // merged cells not supported
 }
@@ -109,7 +109,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleColumnExtentAt(
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress( nRow, nColumn );
     return 1;   // merged cells not supported
 }
@@ -118,7 +118,7 @@ Reference< XAccessible > SAL_CALL 
AccessibleGridControlTableBase::getAccessibleC
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return nullptr;    // not supported
 }
 
@@ -126,7 +126,7 @@ Reference< XAccessible > SAL_CALL 
AccessibleGridControlTableBase::getAccessibleS
 {
     SolarMutexGuard g;
 
-    ensureIsAlive();
+    ensureAlive();
     return nullptr;    // not supported
 }
 
@@ -135,7 +135,7 @@ sal_Int64 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleIndex(
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidAddress( nRow, nColumn );
     return static_cast<sal_Int64>(nRow) * 
static_cast<sal_Int64>(m_aTable.GetColumnCount()) + nColumn;
 }
@@ -144,7 +144,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleRow( sal_Int64 n
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidIndex( nChildIndex );
     return implGetRow( nChildIndex );
 }
@@ -153,7 +153,7 @@ sal_Int32 SAL_CALL 
AccessibleGridControlTableBase::getAccessibleColumn( sal_Int6
 {
     SolarMutexGuard aSolarGuard;
 
-    ensureIsAlive();
+    ensureAlive();
     ensureIsValidIndex( nChildIndex );
     return implGetColumn( nChildIndex );
 }
diff --git a/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
index 151972ab7535..6ebc48494a67 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
@@ -75,20 +75,20 @@ namespace accessibility
     {
         SolarMutexGuard g;
 
-        ensureIsAlive();
+        ensureAlive();
         return m_aTable.GetAccessibleObjectName(m_eObjType, m_nRowPos, 
m_nColPos);
     }
 
     // implementation of a table cell
     OUString AccessibleGridControlTableCell::implGetText()
     {
-        ensureIsAlive();
+        ensureAlive();
         return m_aTable.GetAccessibleCellText( getRowPos(),  getColumnPos() );
     }
 
     css::lang::Locale AccessibleGridControlTableCell::implGetLocale()
     {
-        ensureIsAlive();
+        ensureAlive();
         return m_aTable.GetAccessible()->getAccessibleContext()->getLocale();
     }
 
@@ -134,7 +134,7 @@ namespace accessibility
     {
         SolarMutexGuard aSolarGuard;
 
-        ensureIsAlive();
+        ensureAlive();
         if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
             throw IndexOutOfBoundsException();
 
@@ -146,7 +146,7 @@ namespace accessibility
     {
         SolarMutexGuard aSolarGuard;
 
-        ensureIsAlive();
+        ensureAlive();
 
         return 
m_aTable.GetIndexForPoint(vcl::unohelper::ConvertToVCLPoint(_aPoint));
     }
@@ -199,7 +199,7 @@ namespace accessibility
     {
         SolarMutexGuard g;
 
-        ensureIsAlive();
+        ensureAlive();
         return this;
     }
 
@@ -209,7 +209,7 @@ namespace accessibility
     {
         SolarMutexGuard aSolarGuard;
 
-        ensureIsAlive();
+        ensureAlive();
 
         return (static_cast<sal_Int64>(getRowPos()) * 
static_cast<sal_Int64>(m_aTable.GetColumnCount())) + getColumnPos();
     }

Reply via email to