sc/source/ui/Accessibility/AccessibleEditObject.cxx |   24 ++++++++------------
 svtools/source/control/accessibletabbarpagelist.cxx |   10 ++------
 vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx     |   24 +++++---------------
 3 files changed, 20 insertions(+), 38 deletions(-)

New commits:
commit 95bff494c35045aba7abd730de8cf57992793170
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 30 17:58:28 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 1 11:32:35 2025 +0200

    a11y: Simplify AccessibleTabBarPageList::getAccessibleAtPoint
    
    AccessibleTabBarPage (and its OAccessible base class)
    implements XAccessibleComponent directly, so no need
    to go via the XAccessibleContext and query for the
    desired interface.
    
    Change-Id: I8a696bac1268de9c00465fed4253a6e4fe7687a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188639
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/control/accessibletabbarpagelist.cxx 
b/svtools/source/control/accessibletabbarpagelist.cxx
index 83b70c3754c1..94b8e08a9680 100644
--- a/svtools/source/control/accessibletabbarpagelist.cxx
+++ b/svtools/source/control/accessibletabbarpagelist.cxx
@@ -471,13 +471,9 @@ Reference< XAccessible > 
AccessibleTabBarPageList::getAccessibleAtPoint( const a
         rtl::Reference< AccessibleTabBarPage > xAcc = getAccessibleChildImpl( 
i );
         if ( xAcc.is() )
         {
-            Reference< XAccessibleComponent > xComp( 
xAcc->getAccessibleContext(), UNO_QUERY );
-            if ( xComp.is() )
-            {
-                tools::Rectangle aRect = 
vcl::unohelper::ConvertToVCLRect(xComp->getBounds());
-                if ( aRect.Contains( aPos ) )
-                    return xAcc;
-            }
+            tools::Rectangle aRect = 
vcl::unohelper::ConvertToVCLRect(xAcc->getBounds());
+            if (aRect.Contains(aPos))
+                return xAcc;
         }
     }
 
commit 10b25b243e7314ebebeb100821d882531dc12950
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 30 17:29:29 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 1 11:32:29 2025 +0200

    sc a11y: Drop one getAccessibleContext call
    
    Use on OAccessible instead of XAccessible var.
    Since OAccessible implements XAccessibleContext
    itself, there's no more need to call
    XAccessible::getAccessibleContext to get a
    reference to that interface.
    
    Change-Id: Ie1b4095ff564795419fb234b121e2a0fe124e700
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188638
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx 
b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index f0b377e82b8a..8f241c3cfefb 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -191,23 +191,19 @@ tools::Rectangle ScAccessibleEditObject::GetBoundingBox()
 
     if ( mpWindow )
     {
-        uno::Reference< XAccessible > xThis( mpWindow->GetAccessible() );
-        if ( xThis.is() )
+        rtl::Reference<comphelper::OAccessible> pThis = 
mpWindow->GetAccessible();
+        if (pThis.is())
         {
-            uno::Reference< XAccessibleContext > xContext( 
xThis->getAccessibleContext() );
-            if ( xContext.is() )
+            uno::Reference<XAccessible> xParent = pThis->getAccessibleParent();
+            if ( xParent.is() )
             {
-                uno::Reference< XAccessible > xParent( 
xContext->getAccessibleParent() );
-                if ( xParent.is() )
+                uno::Reference< XAccessibleComponent > xParentComponent( 
xParent->getAccessibleContext(), uno::UNO_QUERY );
+                if ( xParentComponent.is() )
                 {
-                    uno::Reference< XAccessibleComponent > xParentComponent( 
xParent->getAccessibleContext(), uno::UNO_QUERY );
-                    if ( xParentComponent.is() )
-                    {
-                        Point aScreenLoc = aBounds.TopLeft();
-                        awt::Point aParentScreenLoc = 
xParentComponent->getLocationOnScreen();
-                        Point aPos( aScreenLoc.getX() - aParentScreenLoc.X, 
aScreenLoc.getY() - aParentScreenLoc.Y );
-                        aBounds.SetPos( aPos );
-                    }
+                    Point aScreenLoc = aBounds.TopLeft();
+                    awt::Point aParentScreenLoc = 
xParentComponent->getLocationOnScreen();
+                    Point aPos( aScreenLoc.getX() - aParentScreenLoc.X, 
aScreenLoc.getY() - aParentScreenLoc.Y );
+                    aBounds.SetPos( aPos );
                 }
             }
         }
commit c82f061be9aa3d3991b9ee256b4fef6e8b4139c0
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 30 17:23:53 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 1 11:32:22 2025 +0200

    a11y tests: Use OAccessible in AccessibleDropDownListBox test
    
    This gets rid of the need of querying some of the
    UNO interfaces as OAccessible implements them
    itself.
    
    Change-Id: I6c7af462370cc23fdba9b29efaa3e9d4c1f283a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188637
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx 
b/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx
index f9b6d6030b06..e7cf2ae4e011 100644
--- a/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx
+++ b/vcl/qa/cppunit/a11y/widgetaccessibilitytest.cxx
@@ -48,39 +48,29 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, 
AccessibleDropDownListBox)
     pDialog->Show();
 
     // perform various a11y checks on the dropdown listbox
-    css::uno::Reference<css::accessibility::XAccessible> xListBoxAcc = 
pListBox->GetAccessible();
-    CPPUNIT_ASSERT(xListBoxAcc.is());
-    css::uno::Reference<css::accessibility::XAccessibleContext> xContext
-        = xListBoxAcc->getAccessibleContext();
-    CPPUNIT_ASSERT(xContext.is());
+    rtl::Reference<comphelper::OAccessible> pListBoxAcc = 
pListBox->GetAccessible();
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Drop down listbox has incorrect role",
                                  css::accessibility::AccessibleRole::COMBO_BOX,
-                                 xContext->getAccessibleRole());
+                                 pListBoxAcc->getAccessibleRole());
 
-    XAccessibleContextTester aContextTester(xContext);
+    XAccessibleContextTester aContextTester(pListBoxAcc);
     aContextTester.testAll();
 
-    css::uno::Reference<css::accessibility::XAccessibleComponent> 
xAccessibleComponent(
-        xContext, css::uno::UNO_QUERY_THROW);
-    XAccessibleComponentTester aComponentTester(xAccessibleComponent);
+    XAccessibleComponentTester aComponentTester(pListBoxAcc);
     aComponentTester.testAll();
 
-    css::uno::Reference<css::accessibility::XAccessibleExtendedComponent>
-        xAccessibleExtendedComponent(xContext, css::uno::UNO_QUERY_THROW);
-    XAccessibleExtendedComponentTester 
aExtendedComponentTester(xAccessibleExtendedComponent);
+    XAccessibleExtendedComponentTester aExtendedComponentTester(pListBoxAcc);
     aExtendedComponentTester.testAll();
 
     css::uno::Reference<css::accessibility::XAccessibleAction> 
xAccessibleAction(
-        xContext, css::uno::UNO_QUERY_THROW);
+        pListBoxAcc->getXWeak(), css::uno::UNO_QUERY_THROW);
     CPPUNIT_ASSERT_MESSAGE("No accessible action provided",
                            xAccessibleAction->getAccessibleActionCount() > 0);
     XAccessibleActionTester aActionTester(xAccessibleAction);
     aActionTester.testAll();
 
-    css::uno::Reference<css::accessibility::XAccessibleEventBroadcaster> 
xEventBroadcaster(
-        xContext, css::uno::UNO_QUERY_THROW);
-    WindowXAccessibleEventBroadcasterTester 
aEventBroadcasterTester(xEventBroadcaster, pListBox);
+    WindowXAccessibleEventBroadcasterTester 
aEventBroadcasterTester(pListBoxAcc, pListBox);
     aEventBroadcasterTester.testAll();
 }
 

Reply via email to