sw/source/core/access/acccontext.cxx | 10 +++++----- sw/source/core/access/accfrmobj.cxx | 24 +++++++++--------------- vcl/unx/gtk4/a11y.cxx | 22 +++++++--------------- 3 files changed, 21 insertions(+), 35 deletions(-)
New commits: commit 09e14a275338cf31520f72c13adf2826824f38ef Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 16:27:01 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:31:15 2025 +0200 gtk4 a11y: Use OAccessible directly to simplify a bit Now that vcl::Window::GetAccessible returns a reference to an OAccessible, use that directly instead of the abstract XAccessible UNO interface and indirections to get the XAccessibleContext and XAccessibleComponent interface all implemented by the same object. Change-Id: If8f9042a6061658ec98f17d61c8d59c703ad6280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188627 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 79dbb9ec1f27..e68337caa6d7 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -232,7 +232,7 @@ map_accessible_role(const css::uno::Reference<css::accessibility::XAccessible>& return eRole; } -static css::uno::Reference<css::accessibility::XAccessible> get_uno_accessible(GtkWidget* pWidget) +static rtl::Reference<comphelper::OAccessible> get_uno_accessible(GtkWidget* pWidget) { GtkWidget* pTopLevel = widget_get_toplevel(pWidget); if (!pTopLevel) @@ -870,14 +870,9 @@ gboolean get_platform_state(GtkAccessible* self, GtkAccessiblePlatformState stat static gboolean get_bounds(GtkAccessible* accessible, int* x, int* y, int* width, int* height) { OOoFixed* pFixed = OOO_FIXED(accessible); - css::uno::Reference<css::accessibility::XAccessible> xAccessible( - get_uno_accessible(GTK_WIDGET(pFixed))); - css::uno::Reference<css::accessibility::XAccessibleContext> xContext( - xAccessible->getAccessibleContext()); - css::uno::Reference<css::accessibility::XAccessibleComponent> xAccessibleComponent( - xContext, css::uno::UNO_QUERY); + rtl::Reference<comphelper::OAccessible> pAccessible = get_uno_accessible(GTK_WIDGET(pFixed)); - css::awt::Rectangle aBounds = xAccessibleComponent->getBounds(); + css::awt::Rectangle aBounds = pAccessible->getBounds(); *x = aBounds.X; *y = aBounds.Y; *width = aBounds.Width; @@ -888,16 +883,13 @@ static gboolean get_bounds(GtkAccessible* accessible, int* x, int* y, int* width static GtkAccessible* get_first_accessible_child(GtkAccessible* accessible) { OOoFixed* pFixed = OOO_FIXED(accessible); - css::uno::Reference<css::accessibility::XAccessible> xAccessible( - get_uno_accessible(GTK_WIDGET(pFixed))); - if (!xAccessible) + rtl::Reference<comphelper::OAccessible> pAccessible = get_uno_accessible(GTK_WIDGET(pFixed)); + if (!pAccessible.is()) return nullptr; - css::uno::Reference<css::accessibility::XAccessibleContext> xContext( - xAccessible->getAccessibleContext()); - if (!xContext->getAccessibleChildCount()) + if (!pAccessible->getAccessibleChildCount()) return nullptr; css::uno::Reference<css::accessibility::XAccessible> xFirstChild( - xContext->getAccessibleChild(0)); + pAccessible->getAccessibleChild(0)); LoAccessible* child_accessible = GtkAccessibleRegistry::getLOAccessible( xFirstChild, gtk_widget_get_display(GTK_WIDGET(pFixed)), accessible); return GTK_ACCESSIBLE(g_object_ref(child_accessible)); commit ee2b1ac8c8f2b1e6757312247dc1b02bc215c9ba Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 16:15:01 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:31:09 2025 +0200 sw a11y: Use OAccessible in SwAccessibleChild::GetParent This also makes one call to XAccessible::getAccessibleContext unnecessary, because OAccessible implements that interface itself. Change-Id: I15ba396007d2de726f6b8001ec21dc9f2c11831c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188626 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sw/source/core/access/accfrmobj.cxx b/sw/source/core/access/accfrmobj.cxx index ea75836bb747..4eff43150329 100644 --- a/sw/source/core/access/accfrmobj.cxx +++ b/sw/source/core/access/accfrmobj.cxx @@ -371,24 +371,18 @@ const SwFrame* SwAccessibleChild::GetParent( const bool bInPagePreview ) const } else if ( mpWindow ) { - css::uno::Reference < css::accessibility::XAccessible > xAcc = - mpWindow->GetAccessible(); - if ( xAcc.is() ) + rtl::Reference<comphelper::OAccessible> pAcc = mpWindow->GetAccessible(); + if (pAcc.is()) { - css::uno::Reference < css::accessibility::XAccessibleContext > xAccContext = - xAcc->getAccessibleContext(); - if ( xAccContext.is() ) + css::uno::Reference<css::accessibility::XAccessible> xAccParent + = pAcc->getAccessibleParent(); + if (xAccParent.is()) { - css::uno::Reference < css::accessibility::XAccessible > xAccParent = - xAccContext->getAccessibleParent(); - if ( xAccParent.is() ) + SwAccessibleContext* pAccParentImpl + = dynamic_cast<SwAccessibleContext*>(xAccParent.get()); + if (pAccParentImpl) { - SwAccessibleContext* pAccParentImpl = - dynamic_cast< SwAccessibleContext *>( xAccParent.get() ); - if ( pAccParentImpl ) - { - pParent = pAccParentImpl->GetFrame(); - } + pParent = pAccParentImpl->GetFrame(); } } } commit 5c1902a41f43fcd6053b225cd62eedf6ecbd58e6 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 16:11:56 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:31:02 2025 +0200 sw a11y: Use OAccessible in SwAccessibleContext::getAccessibleChild Change-Id: Icd06d11e3382d402254bbb7bd53f23787477a855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188625 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 9282915901d6..2e45f843c5c9 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -550,7 +550,7 @@ uno::Reference< XAccessible> SAL_CALL throw aExcept; } - uno::Reference< XAccessible > xChild; + rtl::Reference<comphelper::OAccessible> pChild; if( aChild.GetSwFrame() ) { ::rtl::Reference < SwAccessibleContext > xChildImpl( @@ -558,7 +558,7 @@ uno::Reference< XAccessible> SAL_CALL if( xChildImpl.is() ) { xChildImpl->SetParent( this ); - xChild = xChildImpl.get(); + pChild = xChildImpl; } } else if ( aChild.GetDrawObject() ) @@ -567,14 +567,14 @@ uno::Reference< XAccessible> SAL_CALL GetMap()->GetContextImpl( aChild.GetDrawObject(), this, !m_isDisposing) ); if( xChildImpl.is() ) - xChild = xChildImpl.get(); + pChild = xChildImpl; } else if ( aChild.GetWindow() ) { - xChild = aChild.GetWindow()->GetAccessible(); + pChild = aChild.GetWindow()->GetAccessible(); } - return xChild; + return pChild; } css::uno::Sequence<uno::Reference<XAccessible>> SAL_CALL