comphelper/source/misc/accessiblecomponenthelper.cxx      |   16 +-
 dbaccess/source/ui/inc/ConnectionLineAccess.hxx           |    7 -
 dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx   |   23 ---
 editeng/source/accessibility/AccessibleContextBase.cxx    |   97 --------------
 include/comphelper/accessiblecomponenthelper.hxx          |   10 -
 include/editeng/AccessibleContextBase.hxx                 |   51 -------
 include/svx/AccessibleShape.hxx                           |   11 -
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx |   41 -----
 sd/source/ui/accessibility/AccessiblePageShape.cxx        |    8 -
 sd/source/ui/inc/AccessibleDocumentViewBase.hxx           |   11 -
 sd/source/ui/inc/AccessiblePageShape.hxx                  |    5 
 svx/source/accessibility/AccessibleShape.cxx              |   57 --------
 svx/source/table/accessiblecell.cxx                       |   65 ---------
 svx/source/table/accessiblecell.hxx                       |    7 -
 14 files changed, 54 insertions(+), 355 deletions(-)

New commits:
commit 42e1ea290a01e6b1b8b2ba3f578d496a7913b388
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 31 13:43:05 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Apr 1 11:20:05 2025 +0200

    dbaccess a11y: Implement OConnectionLineAccess::implGetBounds
    
    Don't manually override OAccessibleExtendedComponentHelper
    methods related to bounds/position, but implement
    OConnectionLineAccess::implGetBounds (i.e. override
    the base class implementation) instead so that the
    logic in OAccessibleExtendedComponentHelper "just works".
    
    Mark the OAccessibleExtendedComponentHelper methods that
    shouldn't be manually overriden as final, just as is already
    the case in OAccessibleComponentHelper.
    
    Change-Id: Ia24d254384757796a8357928af05dca48e16ada9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183550
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx 
b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
index a73e7edaea02..dd7485b4652a 100644
--- a/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLineAccess.hxx
@@ -61,12 +61,11 @@ namespace dbaui
         virtual OUString SAL_CALL getAccessibleDescription(  ) override;
         virtual css::uno::Reference< 
css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( 
 ) override;
 
+        // OCommonAccessibleComponent
+        virtual css::awt::Rectangle implGetBounds() override;
+
         // XAccessibleComponent
         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;
 
         // XAccessibleRelationSet
         virtual sal_Int32 SAL_CALL getRelationCount(  ) override;
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx 
b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 2bff88cf3ecf..dc8ae20d50c0 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -98,30 +98,13 @@ namespace dbaui
     {
         return Reference< XAccessible >();
     }
-    awt::Rectangle SAL_CALL OConnectionLineAccess::getBounds(  )
+
+    awt::Rectangle OConnectionLineAccess::implGetBounds()
     {
-        ::osl::MutexGuard aGuard( m_aMutex  );
         tools::Rectangle aRect(m_pLine ? m_pLine->GetBoundingRect() : 
tools::Rectangle());
         return 
awt::Rectangle(aRect.Left(),aRect.Top(),aRect.getOpenWidth(),aRect.getOpenHeight());
     }
-    awt::Point SAL_CALL OConnectionLineAccess::getLocation(  )
-    {
-        ::osl::MutexGuard aGuard( m_aMutex  );
-        Point aPoint(m_pLine ? m_pLine->GetBoundingRect().TopLeft() : Point());
-        return awt::Point(aPoint.X(),aPoint.Y());
-    }
-    awt::Point SAL_CALL OConnectionLineAccess::getLocationOnScreen(  )
-    {
-        ::osl::MutexGuard aGuard( m_aMutex  );
-        Point aPoint(m_pLine ? 
m_pLine->GetParent()->ScreenToOutputPixel(m_pLine->GetBoundingRect().TopLeft()) 
: Point());
-        return awt::Point(aPoint.X(),aPoint.Y());
-    }
-    awt::Size SAL_CALL OConnectionLineAccess::getSize(  )
-    {
-        ::osl::MutexGuard aGuard( m_aMutex  );
-        Size aSize(m_pLine ? m_pLine->GetBoundingRect().GetSize() : Size());
-        return awt::Size(aSize.Width(),aSize.Height());
-    }
+
     // XAccessibleRelationSet
     sal_Int32 SAL_CALL OConnectionLineAccess::getRelationCount(  )
     {
diff --git a/include/comphelper/accessiblecomponenthelper.hxx 
b/include/comphelper/accessiblecomponenthelper.hxx
index ca5c4dc6af9d..6d58b421bada 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -210,10 +210,10 @@ namespace comphelper
     public:
         // XAccessibleComponent - default implementations
         virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint 
) override final;
-        virtual css::awt::Point SAL_CALL getLocation(  ) override;
+        virtual css::awt::Point SAL_CALL getLocation(  ) override final;
         virtual css::awt::Point SAL_CALL getLocationOnScreen(  ) override;
-        virtual css::awt::Size SAL_CALL getSize(  ) override;
-        virtual css::awt::Rectangle SAL_CALL getBounds(  ) override;
+        virtual css::awt::Size SAL_CALL getSize(  ) override final;
+        virtual css::awt::Rectangle SAL_CALL getBounds(  ) override final;
     };
 
 
commit 46f7fad86df883677e368f79bac4abada7281f9a
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 31 12:27:49 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Apr 1 11:19:58 2025 +0200

    editeng a11y: Use OAccessibleExtendedComponentHelper
    
    Let editeng's AccessibleContextBase derive from
    OAccessibleExtendedComponentHelper to make use of the
    logic already implemented there instead of having to
    implement all the XAccessible(Extended)Component
    and XAccessibleEventBroadcaster methods manually.
    
    Adjust the various subclasses accordingly as well.
    
    Make OCommonAccessibleComponent::addAccessibleEventListener
    and OCommonAccessibleComponent::removeAccessibleEventListener
    no longer final so that AccessibleShape can override them
    (to add/remove the listener for the AccessibleTextHelper
     object in addition to calling the base class implementation).
    
    The existing XAccessibleComponent::getBounds implementations
    provide the necessary logic to implement
    OAccessibleExtendedComponentHelper::implGetBounds,
    so rename those accordingly (and drop the extra guards,
    as the base class takes care of that).
    
    Drop all of the other overrides that are no longer
    needed as the implementation is now provided by
    the base class.
    
    No change in behavior intended or observed in a quick
    test with Impress and Accerciser and Orca when using
    the gtk3 and qt6 VCL plugins on Linux.
    
    Change-Id: I7c42a9cac1099991bc5763b87c55ace2b0fed8a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183549
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index c0a07af69ee0..2ec4fed420f0 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -46,11 +46,9 @@ namespace accessibility {
 AccessibleContextBase::AccessibleContextBase (
         uno::Reference<XAccessible> xParent,
         const sal_Int16 aRole)
-    :   WeakComponentImplHelper(m_aMutex),
-        mxParent(std::move(xParent)),
+    :   mxParent(std::move(xParent)),
         meDescriptionOrigin(NotSet),
         meNameOrigin(NotSet),
-        mnClientId(0),
         maRole(aRole)
 {
     // Create the state set.
@@ -319,62 +317,8 @@ lang::Locale SAL_CALL
     throw IllegalAccessibleComponentStateException ();
 }
 
-
-// XAccessibleEventListener
-
-void SAL_CALL AccessibleContextBase::addAccessibleEventListener (
-        const uno::Reference<XAccessibleEventListener >& rxListener)
-{
-    if (!rxListener.is())
-        return;
-
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        uno::Reference<uno::XInterface> x (static_cast<lang::XComponent 
*>(this), uno::UNO_QUERY);
-        rxListener->disposing (lang::EventObject (x));
-    }
-    else
-    {
-        if (!mnClientId)
-            mnClientId = comphelper::AccessibleEventNotifier::registerClient( 
);
-        comphelper::AccessibleEventNotifier::addEventListener( mnClientId, 
rxListener );
-    }
-}
-
-
-void SAL_CALL AccessibleContextBase::removeAccessibleEventListener (
-        const uno::Reference<XAccessibleEventListener >& rxListener )
-{
-    ThrowIfDisposed ();
-    if (!(rxListener.is() && mnClientId))
-        return;
-
-    sal_Int32 nListenerCount = 
comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, 
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
-        comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
-        mnClientId = 0;
-    }
-}
-
-
 // XAccessibleComponent
 
-sal_Bool SAL_CALL AccessibleContextBase::containsPoint (
-    const css::awt::Point& aPoint)
-{
-    awt::Size aSize (getSize());
-    return (aPoint.X >= 0)
-           && (aPoint.X < aSize.Width)
-           && (aPoint.Y >= 0)
-           && (aPoint.Y < aSize.Height);
-}
-
-
 uno::Reference<XAccessible > SAL_CALL
 AccessibleContextBase::getAccessibleAtPoint (
     const awt::Point& /*aPoint*/)
@@ -382,19 +326,6 @@ AccessibleContextBase::getAccessibleAtPoint (
     return uno::Reference<XAccessible>();
 }
 
-awt::Point SAL_CALL AccessibleContextBase::getLocation()
-{
-    awt::Rectangle aBBox (getBounds());
-    return awt::Point (aBBox.X, aBBox.Y);
-}
-
-css::awt::Size SAL_CALL AccessibleContextBase::getSize()
-{
-    awt::Rectangle aBBox (getBounds());
-    return awt::Size (aBBox.Width, aBBox.Height);
-}
-
-
 void SAL_CALL AccessibleContextBase::grabFocus()
 {
     uno::Reference<XAccessibleSelection> xSelection(getAccessibleParent(), 
uno::UNO_QUERY);
@@ -469,12 +400,8 @@ void SAL_CALL AccessibleContextBase::disposing()
 
     ::osl::MutexGuard aGuard (m_aMutex);
 
-    // Send a disposing to all listeners.
-    if ( mnClientId )
-    {
-        comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( 
mnClientId, *this );
-        mnClientId =  0;
-    }
+    comphelper::OAccessibleExtendedComponentHelper::disposing();
+
     mxParent.clear();
     mxRelationSet.clear();
 }
@@ -536,27 +463,13 @@ void AccessibleContextBase::CommitChange (
     const uno::Any& rOldValue,
     sal_Int32 nValueIndex)
 {
-    // Do not call FireEvent and do not even create the event object when no
-    // listener has been registered yet.  Creating the event object can
-    // otherwise lead to a crash.  See issue 93419 for details.
-    if (mnClientId != 0)
-    {
-        AccessibleEventObject aEvent (
-            static_cast<XAccessibleContext*>(this),
-            nEventId,
-            rNewValue,
-            rOldValue,
-            nValueIndex);
-
-        FireEvent (aEvent);
-    }
+    NotifyAccessibleEvent(nEventId, rOldValue, rNewValue, nValueIndex);
 }
 
 
 void AccessibleContextBase::FireEvent (const AccessibleEventObject& aEvent)
 {
-    if (mnClientId)
-        comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
+    NotifyAccessibleEvent(aEvent.EventId, aEvent.OldValue, aEvent.NewValue, 
aEvent.IndexHint);
 }
 
 
diff --git a/include/comphelper/accessiblecomponenthelper.hxx 
b/include/comphelper/accessiblecomponenthelper.hxx
index f40e78c6c0ab..ca5c4dc6af9d 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -59,8 +59,8 @@ namespace comphelper
 
     public:
         // XAccessibleEventBroadcaster
-        virtual void SAL_CALL addAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override final;
-        virtual void SAL_CALL removeAccessibleEventListener( const 
css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener 
) override final;
+        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 - still waiting to be overwritten
         virtual sal_Int64 SAL_CALL getAccessibleChildCount(  ) override = 0;
diff --git a/include/editeng/AccessibleContextBase.hxx 
b/include/editeng/AccessibleContextBase.hxx
index c59b353866c9..9f0d5cc0a30b 100644
--- a/include/editeng/AccessibleContextBase.hxx
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -20,11 +20,9 @@
 #pragma once
 
 #include <com/sun/star/accessibility/XAccessible.hpp>
-#include <com/sun/star/accessibility/XAccessibleContext.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
-#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
 #include <editeng/editengdllapi.h>
@@ -35,22 +33,9 @@ namespace utl { class AccessibleRelationSetHelper; }
 
 namespace accessibility {
 
-/** @descr
-        This base class provides an implementation of the
-        AccessibleContext service. Apart from the
-        <type>XAccessible<type>, XAccessibleContext, XAccessibleComponent
-        and XAccessibleExtendedComponent
-        interfaces it supports the XServiceInfo interface.
-*/
 class EDITENG_DLLPUBLIC AccessibleContextBase
-    :   public cppu::BaseMutex,
-        public cppu::WeakComponentImplHelper<
-        css::accessibility::XAccessible,
-        css::accessibility::XAccessibleContext,
-        css::accessibility::XAccessibleEventBroadcaster,
-        css::accessibility::XAccessibleExtendedComponent,
-        css::lang::XServiceInfo
-        >
+    : public 
cppu::ImplInheritanceHelper<comphelper::OAccessibleExtendedComponentHelper,
+                                         css::lang::XServiceInfo, 
css::accessibility::XAccessible>
 {
 public:
 
@@ -213,39 +198,13 @@ public:
     virtual css::lang::Locale SAL_CALL
         getLocale() 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;
-
     //=====  XAccessibleComponent  
================================================
 
-    /** The default implementation uses the result of
-        <member>getBounds</member> to determine whether the given point lies
-        inside this object.
-    */
-    virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point& aPoint) 
override;
-
     /** The default implementation returns an empty reference.
     */
     virtual css::uno::Reference<css::accessibility::XAccessible>
         SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override;
 
-    /** The default implementation uses the result of
-        <member>getBounds</member> to determine the location.
-    */
-    virtual css::awt::Point SAL_CALL getLocation() override;
-
-    /** The default implementation uses the result of
-        <member>getBounds</member> to determine the size.
-    */
-    virtual css::awt::Size SAL_CALL getSize() override;
-
     /** The default implementation does nothing.
     */
     virtual void SAL_CALL grabFocus() override;
@@ -363,10 +322,6 @@ private:
     */
     StringOrigin meNameOrigin;
 
-    /** client id in the AccessibleEventNotifier queue
-    */
-    sal_uInt32 mnClientId;
-
     /** This is the role of this object.
     */
     sal_Int16 maRole;
diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
index 91cc968e9692..641214ba600e 100644
--- a/include/svx/AccessibleShape.hxx
+++ b/include/svx/AccessibleShape.hxx
@@ -226,20 +226,15 @@ public:
     virtual sal_Int64 SAL_CALL
         getAccessibleIndexInParent() override;
 
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
+
     //=====  XAccessibleComponent  ============================================
 
     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 sal_Int32 SAL_CALL getForeground() override;
 
     virtual sal_Int32 SAL_CALL getBackground() override;
diff --git a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx 
b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index 8f1b489571da..21a1e32dd361 100644
--- a/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -292,11 +292,8 @@ uno::Reference<XAccessible > SAL_CALL
     return xChildAtPosition;
 }
 
-awt::Rectangle SAL_CALL
-    AccessibleDocumentViewBase::getBounds()
+awt::Rectangle AccessibleDocumentViewBase::implGetBounds()
 {
-    ThrowIfDisposed ();
-
     // Transform visible area into screen coordinates.
     ::tools::Rectangle aVisibleArea (
         maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
@@ -327,42 +324,6 @@ awt::Rectangle SAL_CALL
         aPixelSize.Y());
 }
 
-awt::Point SAL_CALL
-    AccessibleDocumentViewBase::getLocation()
-{
-    ThrowIfDisposed ();
-    awt::Rectangle aBoundingBox (getBounds());
-    return awt::Point (aBoundingBox.X, aBoundingBox.Y);
-}
-
-awt::Point SAL_CALL
-    AccessibleDocumentViewBase::getLocationOnScreen()
-{
-    ThrowIfDisposed ();
-    ::Point aLogicalPoint 
(maShapeTreeInfo.GetViewForwarder()->GetVisibleArea().TopLeft());
-    ::Point aPixelPoint (maShapeTreeInfo.GetViewForwarder()->LogicToPixel 
(aLogicalPoint));
-    return awt::Point (aPixelPoint.X(), aPixelPoint.Y());
-}
-
-awt::Size SAL_CALL
-    AccessibleDocumentViewBase::getSize()
-{
-    ThrowIfDisposed ();
-
-    // Transform visible area into screen coordinates.
-    ::tools::Rectangle aVisibleArea (
-        maShapeTreeInfo.GetViewForwarder()->GetVisibleArea());
-    ::Point aPixelTopLeft (
-        maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
-            aVisibleArea.TopLeft()));
-    ::Point aPixelSize (
-        maShapeTreeInfo.GetViewForwarder()->LogicToPixel (
-            aVisibleArea.BottomRight())
-        - aPixelTopLeft);
-
-    return awt::Size (aPixelSize.X(), aPixelSize.Y());
-}
-
 //=====  XInterface  ==========================================================
 
 uno::Any SAL_CALL
diff --git a/sd/source/ui/accessibility/AccessiblePageShape.cxx 
b/sd/source/ui/accessibility/AccessiblePageShape.cxx
index 22721bc3b3d5..9897e1d5eac2 100644
--- a/sd/source/ui/accessibility/AccessiblePageShape.cxx
+++ b/sd/source/ui/accessibility/AccessiblePageShape.cxx
@@ -71,12 +71,10 @@ uno::Reference<XAccessible> SAL_CALL
         static_cast<uno::XWeak*>(this));
 }
 
-//=====  XAccessibleComponent  ================================================
+// OCommonAccessibleComponent
 
-awt::Rectangle SAL_CALL AccessiblePageShape::getBounds()
+awt::Rectangle AccessiblePageShape::implGetBounds()
 {
-    ThrowIfDisposed ();
-
     awt::Rectangle aBoundingBox;
 
     if (maShapeTreeInfo.GetViewForwarder() != nullptr)
@@ -134,6 +132,8 @@ awt::Rectangle SAL_CALL AccessiblePageShape::getBounds()
     return aBoundingBox;
 }
 
+//=====  XAccessibleComponent  ================================================
+
 sal_Int32 SAL_CALL AccessiblePageShape::getForeground()
 {
     ThrowIfDisposed ();
diff --git a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx 
b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
index 798e94e2490b..7b741be2d221 100644
--- a/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
+++ b/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
@@ -146,19 +146,14 @@ public:
     virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL
         getAccessibleChild (sal_Int64 nIndex) override;
 
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
+
     //=====  XAccessibleComponent  ============================================
 
     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;
-
     //=====  XInterface  ======================================================
 
     virtual css::uno::Any SAL_CALL
diff --git a/sd/source/ui/inc/AccessiblePageShape.hxx 
b/sd/source/ui/inc/AccessiblePageShape.hxx
index 1e7568ab0038..49964167b8ff 100644
--- a/sd/source/ui/inc/AccessiblePageShape.hxx
+++ b/sd/source/ui/inc/AccessiblePageShape.hxx
@@ -73,9 +73,10 @@ public:
     virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL
         getAccessibleChild (sal_Int64 nIndex) override;
 
-    //=====  XAccessibleComponent  ============================================
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
 
-    virtual css::awt::Rectangle SAL_CALL getBounds() override;
+    //=====  XAccessibleComponent  ============================================
 
     virtual sal_Int32 SAL_CALL getForeground() override;
 
diff --git a/svx/source/accessibility/AccessibleShape.cxx 
b/svx/source/accessibility/AccessibleShape.cxx
index 93281d49faec..e5872bb1bc8e 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -463,12 +463,8 @@ uno::Reference<XAccessible > SAL_CALL
 }
 
 
-awt::Rectangle SAL_CALL AccessibleShape::getBounds()
+awt::Rectangle AccessibleShape::implGetBounds()
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard (m_aMutex);
-
-    ThrowIfDisposed ();
     awt::Rectangle aBoundingBox;
     if ( mxShape.is() )
     {
@@ -574,45 +570,6 @@ awt::Rectangle SAL_CALL AccessibleShape::getBounds()
     return aBoundingBox;
 }
 
-
-awt::Point SAL_CALL AccessibleShape::getLocation()
-{
-    ThrowIfDisposed ();
-    awt::Rectangle aBoundingBox (getBounds());
-    return awt::Point (aBoundingBox.X, aBoundingBox.Y);
-}
-
-
-awt::Point SAL_CALL AccessibleShape::getLocationOnScreen()
-{
-    ThrowIfDisposed ();
-
-    // Get relative position...
-    awt::Point aLocation (getLocation ());
-
-    // ... and add absolute position of the parent.
-    uno::Reference<XAccessibleComponent> xParentComponent (
-        getAccessibleParent(), uno::UNO_QUERY);
-    if (xParentComponent.is())
-    {
-        awt::Point aParentLocation (xParentComponent->getLocationOnScreen());
-        aLocation.X += aParentLocation.X;
-        aLocation.Y += aParentLocation.Y;
-    }
-    else
-        SAL_WARN("svx", "parent does not support XAccessibleComponent");
-    return aLocation;
-}
-
-
-awt::Size SAL_CALL AccessibleShape::getSize()
-{
-    ThrowIfDisposed ();
-    awt::Rectangle aBoundingBox (getBounds());
-    return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
-}
-
-
 sal_Int32 SAL_CALL AccessibleShape::getForeground()
 {
     ThrowIfDisposed ();
@@ -676,15 +633,11 @@ sal_Int32 SAL_CALL AccessibleShape::getBackground()
 void SAL_CALL AccessibleShape::addAccessibleEventListener (
     const Reference<XAccessibleEventListener >& rxListener)
 {
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        uno::Reference<uno::XInterface> xThis (
-            static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
-        rxListener->disposing (lang::EventObject (xThis));
-    }
-    else
+    AccessibleContextBase::addAccessibleEventListener(rxListener);
+
+    if (isAlive())
     {
-        AccessibleContextBase::addAccessibleEventListener (rxListener);
+
         if (mpText != nullptr)
             mpText->AddEventListener (rxListener);
     }
diff --git a/svx/source/table/accessiblecell.cxx 
b/svx/source/table/accessiblecell.cxx
index be3dba4956ad..b2ba84a5a8df 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -245,12 +245,8 @@ Reference<XAccessible > SAL_CALL  
AccessibleCell::getAccessibleAtPoint ( const c
 }
 
 
-css::awt::Rectangle SAL_CALL AccessibleCell::getBounds()
+css::awt::Rectangle AccessibleCell::implGetBounds()
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard (m_aMutex);
-
-    ThrowIfDisposed ();
     css::awt::Rectangle aBoundingBox;
     if( mxCell.is() )
     {
@@ -290,47 +286,6 @@ css::awt::Rectangle SAL_CALL AccessibleCell::getBounds()
     return aBoundingBox;
 }
 
-
-css::awt::Point SAL_CALL AccessibleCell::getLocation()
-{
-    ThrowIfDisposed ();
-    css::awt::Rectangle aBoundingBox(getBounds());
-    return css::awt::Point(aBoundingBox.X, aBoundingBox.Y);
-}
-
-
-css::awt::Point SAL_CALL AccessibleCell::getLocationOnScreen()
-{
-    ThrowIfDisposed ();
-
-    // Get relative position...
-    css::awt::Point aLocation(getLocation ());
-
-    // ... and add absolute position of the parent.
-    Reference<XAccessibleComponent> xParentComponent( getAccessibleParent(), 
uno::UNO_QUERY);
-    if(xParentComponent.is())
-    {
-        css::awt::Point 
aParentLocation(xParentComponent->getLocationOnScreen());
-        aLocation.X += aParentLocation.X;
-        aLocation.Y += aParentLocation.Y;
-    }
-    else
-    {
-        SAL_WARN("svx", "parent does not support XAccessibleComponent");
-    }
-
-    return aLocation;
-}
-
-
-awt::Size SAL_CALL AccessibleCell::getSize()
-{
-    ThrowIfDisposed ();
-    awt::Rectangle aBoundingBox (getBounds());
-    return awt::Size (aBoundingBox.Width, aBoundingBox.Height);
-}
-
-
 sal_Int32 SAL_CALL AccessibleCell::getForeground()
 {
     ThrowIfDisposed ();
@@ -353,20 +308,10 @@ sal_Int32 SAL_CALL AccessibleCell::getBackground()
 
 void SAL_CALL AccessibleCell::addAccessibleEventListener( const 
Reference<XAccessibleEventListener >& rxListener)
 {
-    SolarMutexGuard aSolarGuard;
-    ::osl::MutexGuard aGuard (m_aMutex);
-    if (rBHelper.bDisposed || rBHelper.bInDispose)
-    {
-        Reference<XInterface> xSource( static_cast<XComponent *>(this) );
-        lang::EventObject aEventObj(xSource);
-        rxListener->disposing(aEventObj);
-    }
-    else
-    {
-        AccessibleContextBase::addAccessibleEventListener (rxListener);
-        if (mpText != nullptr)
-            mpText->AddEventListener (rxListener);
-    }
+    AccessibleContextBase::addAccessibleEventListener(rxListener);
+
+    if (isAlive() && mpText)
+        mpText->AddEventListener (rxListener);
 }
 
 
diff --git a/svx/source/table/accessiblecell.hxx 
b/svx/source/table/accessiblecell.hxx
index e4af70d64caa..86276917def3 100644
--- a/svx/source/table/accessiblecell.hxx
+++ b/svx/source/table/accessiblecell.hxx
@@ -63,12 +63,11 @@ public:
     void UpdateChildren();
     static OUString getCellName( sal_Int32 nCol, sal_Int32 nRow );
 
+    // OCommonAccessibleComponent
+    virtual css::awt::Rectangle implGetBounds() override;
+
     // XAccessibleComponent
     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 sal_Int32 SAL_CALL getForeground() override;
     virtual sal_Int32 SAL_CALL getBackground() override;
 
commit 42ef76a37dc67007e0271db7501f35236e3c8d29
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Mar 31 11:51:30 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Apr 1 11:19:51 2025 +0200

    a11y: Return early for empty listener
    
    Check once early whether `_rxListener` is an empty reference
    and return in that case, instead of checking in different
    code paths.
    
    No change in behavior intended.
    
    Change-Id: Ib3548a7c9a71f8d24df4f91089dd46d376c031c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183545
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx 
b/comphelper/source/misc/accessiblecomponenthelper.cxx
index de7af60228da..659f9c39f9b6 100644
--- a/comphelper/source/misc/accessiblecomponenthelper.cxx
+++ b/comphelper/source/misc/accessiblecomponenthelper.cxx
@@ -70,20 +70,20 @@ namespace comphelper
             // don't use the OContextEntryGuard - it will throw an exception 
if we're not alive
             // anymore, while the most recent specification for XComponent 
states that we should
             // silently ignore the call in such a situation
+
+        if (!_rxListener.is())
+            return;
+
         if ( !isAlive() )
         {
-            if ( _rxListener.is() )
-                _rxListener->disposing( EventObject( *this ) );
+            _rxListener->disposing( EventObject( *this ) );
             return;
         }
 
-        if ( _rxListener.is() )
-        {
-            if ( !m_nClientId )
-                m_nClientId = AccessibleEventNotifier::registerClient( );
+        if (!m_nClientId)
+            m_nClientId = AccessibleEventNotifier::registerClient();
 
-            AccessibleEventNotifier::addEventListener( m_nClientId, 
_rxListener );
-        }
+        AccessibleEventNotifier::addEventListener(m_nClientId, _rxListener);
     }
 
 

Reply via email to