editeng/source/accessibility/AccessibleContextBase.cxx |   36 -----------------
 include/editeng/AccessibleContextBase.hxx              |    4 -
 svtools/source/control/accessibleruler.cxx             |   27 ------------
 svtools/source/control/accessibleruler.hxx             |    3 -
 svx/source/accessibility/AccessibleShape.cxx           |   12 ++---
 5 files changed, 5 insertions(+), 77 deletions(-)

New commits:
commit 2594caeda1d63c77ee7e448c0d5c51e9a1ffb3b4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 09:00:50 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 10:40:35 2025 +0200

    svx a11y: Slightly rearrange AccessibleShape::getAccessibleIndexInParent
    
    Return early and drop local var `nIndex`.
    Drop comment about this being "simple but slow",
    as simply returning the index if set is fast,
    and the rest of the comment would thus not refer
    to the implementation here, but in the base class.
    
    Change-Id: Id855a8abd9f6de98d4fda59dc10d65228cb610eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184002
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svx/source/accessibility/AccessibleShape.cxx 
b/svx/source/accessibility/AccessibleShape.cxx
index 33f4c1111b56..4b8a33c481ad 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -972,16 +972,14 @@ void AccessibleShape::disposing()
     AccessibleContextBase::disposing();
 }
 
-sal_Int64 SAL_CALL
-       AccessibleShape::getAccessibleIndexInParent()
+sal_Int64 SAL_CALL AccessibleShape::getAccessibleIndexInParent()
 {
     ensureAlive();
-    //  Use a simple but slow solution for now.  Optimize later.
 
-    sal_Int64 nIndex = m_nIndexInParent;
-    if ( -1 == nIndex )
-        nIndex = AccessibleContextBase::getAccessibleIndexInParent();
-    return nIndex;
+    if (m_nIndexInParent != -1)
+        return m_nIndexInParent;
+
+    return AccessibleContextBase::getAccessibleIndexInParent();
 }
 
 
commit 1a37558fb2f68f92a464b3c7c0e6fa8e21c6282e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 08:57:04 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 10:40:29 2025 +0200

    svtools a11y: Drop SvtRulerAccessible::getAccessibleIndexInParent
    
    The base class implementation in
    OAccessibleComponentHelper::getAccessibleIndexInParent
    implements the same logic.
    
    Change-Id: I92958cc3186cabd2e302cf03a297c07bbd65f1b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184001
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/control/accessibleruler.cxx 
b/svtools/source/control/accessibleruler.cxx
index 0dc6c2301164..a4674b328073 100644
--- a/svtools/source/control/accessibleruler.cxx
+++ b/svtools/source/control/accessibleruler.cxx
@@ -88,33 +88,6 @@ uno::Reference< XAccessible > SAL_CALL 
SvtRulerAccessible::getAccessibleParent()
     return mxParent;
 }
 
-sal_Int64 SAL_CALL SvtRulerAccessible::getAccessibleIndexInParent()
-{
-    SolarMutexGuard aSolarGuard;
-
-    //  Use a simple but slow solution for now.  Optimize later.
-
-    //  Iterate over all the parent's children and search for this object.
-    if( mxParent.is() )
-    {
-        uno::Reference< XAccessibleContext >        xParentContext( 
mxParent->getAccessibleContext() );
-        if( xParentContext.is() )
-        {
-            sal_Int64 nChildCount = xParentContext->getAccessibleChildCount();
-            for( sal_Int64 i = 0 ; i < nChildCount ; ++i )
-            {
-                uno::Reference< XAccessible >   xChild( 
xParentContext->getAccessibleChild( i ) );
-                if( xChild.get() == static_cast<XAccessible*>(this) )
-                    return i;
-            }
-        }
-    }
-
-    //   Return -1 to indicate that this object's parent does not know about 
the
-    //   object.
-    return -1;
-}
-
 sal_Int16 SAL_CALL SvtRulerAccessible::getAccessibleRole()
 {
     SolarMutexGuard aSolarGuard;
diff --git a/svtools/source/control/accessibleruler.hxx 
b/svtools/source/control/accessibleruler.hxx
index 76b806ea041e..530dceca34bc 100644
--- a/svtools/source/control/accessibleruler.hxx
+++ b/svtools/source/control/accessibleruler.hxx
@@ -71,9 +71,6 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
         getAccessibleParent() override;
 
-    virtual sal_Int64 SAL_CALL
-        getAccessibleIndexInParent() override;
-
     virtual sal_Int16 SAL_CALL
         getAccessibleRole() override;
 
commit 332fb61097f56d797027b9546629c13b8d7214be
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 08:54:58 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 10:40:23 2025 +0200

    editeng a11y: Drop AccessibleContextBase::getAccessibleIndexInParent
    
    The base class implementation in
    OAccessibleComponentHelper::getAccessibleIndexInParent
    already implements the same logic.
    
    Change-Id: I4bd338632c4e440a54470f1294a9e67a0ccb866d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184000
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx 
b/editeng/source/accessibility/AccessibleContextBase.cxx
index ff425091d9c0..93c6a2fb3bad 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -190,42 +190,6 @@ uno::Reference<XAccessible> SAL_CALL
     return mxParent;
 }
 
-
-sal_Int64 SAL_CALL
-       AccessibleContextBase::getAccessibleIndexInParent()
-{
-    ensureAlive();
-    //  Use a simple but slow solution for now.  Optimize later.
-
-    //  Iterate over all the parent's children and search for this object.
-    if (!mxParent.is())
-        //   Return -1 to indicate that this object's parent does not know 
about the
-        //   object.
-        return -1;
-
-    uno::Reference<XAccessibleContext> xParentContext (
-        mxParent->getAccessibleContext());
-    if (xParentContext.is())
-    {
-        sal_Int64 nChildCount = xParentContext->getAccessibleChildCount();
-        for (sal_Int64 i=0; i<nChildCount; i++)
-        {
-            uno::Reference<XAccessible> xChild 
(xParentContext->getAccessibleChild (i));
-            if (xChild.is())
-            {
-                uno::Reference<XAccessibleContext> xChildContext = 
xChild->getAccessibleContext();
-                if (xChildContext == static_cast<XAccessibleContext*>(this))
-                    return i;
-            }
-        }
-    }
-
-    //   Return -1 to indicate that this object's parent does not know about 
the
-    //   object.
-    return -1;
-}
-
-
 sal_Int16 SAL_CALL
     AccessibleContextBase::getAccessibleRole()
 {
diff --git a/include/editeng/AccessibleContextBase.hxx 
b/include/editeng/AccessibleContextBase.hxx
index 6a19371019c7..4e08267b2be7 100644
--- a/include/editeng/AccessibleContextBase.hxx
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -168,10 +168,6 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
         getAccessibleParent() override;
 
-    /// Return this objects index among the parents children.
-    virtual sal_Int64 SAL_CALL
-        getAccessibleIndexInParent() override;
-
     /// Return this object's role.
     virtual sal_Int16 SAL_CALL
         getAccessibleRole() override;

Reply via email to