include/vcl/weld.hxx                                |    7 ++++++-
 toolkit/qa/cppunit/a11y/AccessibleFixedTextTest.cxx |   10 +++++-----
 vcl/inc/jsdialog/jsdialogbuilder.hxx                |   14 +++++++-------
 vcl/inc/qt5/QtAccessibleWidget.hxx                  |   11 ++++++-----
 vcl/inc/qt5/QtInstanceBuilder.hxx                   |    7 +++----
 vcl/inc/salvtables.hxx                              |   12 ++++++------
 vcl/jsdialog/jsdialogbuilder.cxx                    |    6 ++++--
 vcl/qt5/QtAccessibleWidget.cxx                      |    8 ++++----
 vcl/qt5/QtInstanceBuilder.cxx                       |    7 ++++---
 vcl/source/app/salvtables.cxx                       |    6 ++++--
 vcl/unx/gtk3/gtkinst.cxx                            |   15 ++++++++-------
 11 files changed, 57 insertions(+), 46 deletions(-)

New commits:
commit f7db96b3e3e6c2c1f310cd9c4af7f4c471b268e4
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jun 26 14:34:31 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jun 27 09:09:04 2025 +0200

    toolkit a11y test: Pass param by const ref
    
    ... and consistently spell out the css:: prefix for both params.
    
    Change-Id: Idf92f00a04093ad23852b0008ffbb55a7bbd1c5b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187047
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/toolkit/qa/cppunit/a11y/AccessibleFixedTextTest.cxx 
b/toolkit/qa/cppunit/a11y/AccessibleFixedTextTest.cxx
index 59b4a8ef984a..2c2c791eec24 100644
--- a/toolkit/qa/cppunit/a11y/AccessibleFixedTextTest.cxx
+++ b/toolkit/qa/cppunit/a11y/AccessibleFixedTextTest.cxx
@@ -44,9 +44,9 @@ class AccessibleFixedTextTest : public 
test::AccessibleTestBase
 {
 private:
     void testFixedText();
-    void
-    runInterfaceTests(const uno::Reference<accessibility::XAccessibleContext>& 
rxFixedTextContext,
-                      css::uno::Reference<css::awt::XWindow>& 
rxFixedTextWindow);
+    void runInterfaceTests(
+        const css::uno::Reference<accessibility::XAccessibleContext>& 
rxFixedTextContext,
+        const css::uno::Reference<css::awt::XWindow>& rxFixedTextWindow);
 
 public:
     CPPUNIT_TEST_SUITE(AccessibleFixedTextTest);
@@ -111,8 +111,8 @@ void AccessibleFixedTextTest::testFixedText()
 }
 
 void AccessibleFixedTextTest::runInterfaceTests(
-    const uno::Reference<accessibility::XAccessibleContext>& rxContext,
-    css::uno::Reference<css::awt::XWindow>& rxFixedTextWindow)
+    const css::uno::Reference<accessibility::XAccessibleContext>& rxContext,
+    const css::uno::Reference<css::awt::XWindow>& rxFixedTextWindow)
 {
     XAccessibleContextTester aContextTester(rxContext);
     aContextTester.testAll();
commit a7eecff4295a5e1b0d09aaccedef6c2fe92d10c2
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jun 26 14:29:50 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jun 27 09:08:57 2025 +0200

    vcl: Use Switch SalInstanceDrawingArea param to OAccessible
    
    Following
    
        Change-Id: I552cace3cb2a3f1129e19d4e76631220af00be3b
        Author: Michael Weghorn <[email protected]>
        Date:   Wed Jun 25 18:04:59 2025 +0200
    
            weld: Use OAccessible for DrawingArea accessible
    
    , also use the more specific type for the param passed to
    the SalInstanceDrawingArea ctor and subclasses.
    
    Change-Id: I9c78d4faf0fa3e3ed5eeacf2d578628ded1718a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187046
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 70a0edece5c9..bc2817dd317c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -283,8 +283,8 @@ public:
     }
 
     JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* 
pBuilder,
-             const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, 
void* pUserData,
-             bool bTakeOwnership)
+             const rtl::Reference<comphelper::OAccessible>& rAlly,
+             FactoryFunction pUITestFactoryFunction, void* pUserData, bool 
bTakeOwnership)
         : BaseInstanceClass(pObject, pBuilder, rAlly, 
std::move(pUITestFactoryFunction), pUserData,
                             bTakeOwnership)
         , m_nFreezeCounter(0)
@@ -639,7 +639,8 @@ class JSDrawingArea final : public 
JSWidget<SalInstanceDrawingArea, VclDrawingAr
 {
 public:
     JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
-                  SalInstanceBuilder* pBuilder, const a11yref& rAlly,
+                  SalInstanceBuilder* pBuilder,
+                  const rtl::Reference<comphelper::OAccessible>& rAlly,
                   FactoryFunction pUITestFactoryFunction, void* pUserData);
 
     virtual void queue_draw() override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index be9cda2623b8..49ebd5bb0f23 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1300,8 +1300,9 @@ private:
 
 public:
     SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, SalInstanceBuilder* 
pBuilder,
-                           const a11yref& rAlly, FactoryFunction 
pUITestFactoryFunction,
-                           void* pUserData, bool bTakeOwnership);
+                           const rtl::Reference<comphelper::OAccessible>& 
rAlly,
+                           FactoryFunction pUITestFactoryFunction, void* 
pUserData,
+                           bool bTakeOwnership);
 
     virtual void queue_draw() override;
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 845a7bf641ce..7f9693a9d4cf 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1561,7 +1561,8 @@ void JSCheckButton::set_active(bool active)
 }
 
 JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* 
pDrawingArea,
-                             SalInstanceBuilder* pBuilder, const a11yref& 
rAlly,
+                             SalInstanceBuilder* pBuilder,
+                             const rtl::Reference<comphelper::OAccessible>& 
rAlly,
                              FactoryFunction pUITestFactoryFunction, void* 
pUserData)
     : JSWidget<SalInstanceDrawingArea, VclDrawingArea>(pSender, pDrawingArea, 
pBuilder, rAlly,
                                                        
std::move(pUITestFactoryFunction), pUserData,
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6eda922ba570..658258634ada 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6313,7 +6313,8 @@ void 
SalInstanceDrawingArea::HandleMouseEventListener(VclWindowEvent& rEvent)
 bool SalInstanceDrawingArea::HandleKeyEventListener(VclWindowEvent& 
/*rEvent*/) { return false; }
 
 SalInstanceDrawingArea::SalInstanceDrawingArea(VclDrawingArea* pDrawingArea,
-                                               SalInstanceBuilder* pBuilder, 
const a11yref& rAlly,
+                                               SalInstanceBuilder* pBuilder,
+                                               const 
rtl::Reference<comphelper::OAccessible>& rAlly,
                                                FactoryFunction 
pUITestFactoryFunction,
                                                void* pUserData, bool 
bTakeOwnership)
     : SalInstanceWidget(pDrawingArea, pBuilder, bTakeOwnership)
commit 2d3a835ae0046d734f15f9052829e4ea5876cf56
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Jun 25 18:04:59 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jun 27 09:08:50 2025 +0200

    weld: Use OAccessible for DrawingArea accessible
    
    Use the more concrete OAccessible instead of the
    abstract XAccessible for weld::DrawingArea:
    Switch param to weld::Builder::weld_drawing_area
    and do further adjustments that this allows in
    the underlying implementations.
    
    Change-Id: I552cace3cb2a3f1129e19d4e76631220af00be3b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186995
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ce231ca7977a..2fa451f32bc4 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -48,6 +48,10 @@ namespace com::sun::star::graphic
 {
 class XGraphic;
 }
+namespace comphelper
+{
+class OAccessible;
+}
 typedef css::uno::Reference<css::accessibility::XAccessible> a11yref;
 typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> 
a11yrelationset;
 enum class PointerStyle;
@@ -2855,7 +2859,8 @@ public:
     virtual std::unique_ptr<Image> weld_image(const OUString& id) = 0;
     virtual std::unique_ptr<Calendar> weld_calendar(const OUString& id) = 0;
     virtual std::unique_ptr<DrawingArea>
-    weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
+    weld_drawing_area(const OUString& id,
+                      const rtl::Reference<comphelper::OAccessible>& rA11yImpl 
= nullptr,
                       FactoryFunction pUITestFactoryFunction = nullptr, void* 
pUserData = nullptr)
         = 0;
     virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const 
OUString& containerid,
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 18df577e78b5..70a0edece5c9 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -184,10 +184,9 @@ public:
     virtual std::unique_ptr<weld::FormattedSpinButton>
     weld_formatted_spin_button(const OUString& id) override;
     virtual std::unique_ptr<weld::CheckButton> weld_check_button(const 
OUString& id) override;
-    virtual std::unique_ptr<weld::DrawingArea>
-    weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr,
-                      void* pUserData = nullptr) override;
+    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(
+        const OUString& id, const rtl::Reference<comphelper::OAccessible>& 
rA11yImpl = nullptr,
+        FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = 
nullptr) override;
     virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& id) 
override;
     virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString& id) 
override;
     virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OUString& id) 
override;
diff --git a/vcl/inc/qt5/QtAccessibleWidget.hxx 
b/vcl/inc/qt5/QtAccessibleWidget.hxx
index 2c53f02e9081..297508cbcbdf 100644
--- a/vcl/inc/qt5/QtAccessibleWidget.hxx
+++ b/vcl/inc/qt5/QtAccessibleWidget.hxx
@@ -11,6 +11,10 @@
 
 #include <vclpluginapi.h>
 
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <comphelper/OAccessible.hxx>
+#include <rtl/ref.hxx>
+
 #include <QtCore/QObject>
 #include <QtCore/QPair>
 #include <QtCore/QString>
@@ -26,8 +30,6 @@
 #include <QtGui/QColor>
 #include <QtGui/QWindow>
 
-#include <com/sun/star/accessibility/XAccessible.hpp>
-
 namespace com::sun::star::accessibility
 {
 class XAccessibleTable;
@@ -189,9 +191,8 @@ public:
 
     // Factory
     static QAccessibleInterface* customFactory(const QString& classname, 
QObject* object);
-    static void
-    setCustomAccessible(QObject& rObject,
-                        const 
css::uno::Reference<css::accessibility::XAccessible>& rxAccessible);
+    static void setCustomAccessible(QObject& rObject,
+                                    const 
rtl::Reference<comphelper::OAccessible>& rAccessible);
 
 private:
     css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index 7cfbee5db926..f5eb9d94e862 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -71,10 +71,9 @@ public:
     virtual std::unique_ptr<weld::Label> weld_label(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::TextView> weld_text_view(const OUString& 
rId) override;
     virtual std::unique_ptr<weld::Expander> weld_expander(const OUString& rId) 
override;
-    virtual std::unique_ptr<weld::DrawingArea>
-    weld_drawing_area(const OUString&, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr,
-                      void* pUserData = nullptr) override;
+    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(
+        const OUString&, const rtl::Reference<comphelper::OAccessible>& 
rA11yImpl = nullptr,
+        FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = 
nullptr) override;
     virtual std::unique_ptr<weld::Menu> weld_menu(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::Popover> weld_popover(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& rId) 
override;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 3f9d3238c7c1..be9cda2623b8 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -128,10 +128,9 @@ public:
 
     virtual std::unique_ptr<weld::Expander> weld_expander(const OUString& id) 
override;
 
-    virtual std::unique_ptr<weld::DrawingArea>
-    weld_drawing_area(const OUString& id, const a11yref& rA11yImpl = nullptr,
-                      FactoryFunction pUITestFactoryFunction = nullptr,
-                      void* pUserData = nullptr) override;
+    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(
+        const OUString& id, const rtl::Reference<comphelper::OAccessible>& 
rA11yImpl = nullptr,
+        FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = 
nullptr) override;
 
     virtual std::unique_ptr<weld::Menu> weld_menu(const OUString& id) override;
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 64b20771e1a6..845a7bf641ce 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -705,7 +705,8 @@ std::unique_ptr<weld::CheckButton> 
JSInstanceBuilder::weld_check_button(const OU
 }
 
 std::unique_ptr<weld::DrawingArea>
-JSInstanceBuilder::weld_drawing_area(const OUString& id, const a11yref& 
rA11yImpl,
+JSInstanceBuilder::weld_drawing_area(const OUString& id,
+                                     const 
rtl::Reference<comphelper::OAccessible>& rA11yImpl,
                                      FactoryFunction pUITestFactoryFunction, 
void* pUserData)
 {
     VclDrawingArea* pArea = m_xBuilder->get<VclDrawingArea>(id);
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 0ced72c74ee3..e23a2d7cca11 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -844,10 +844,10 @@ QAccessibleInterface* 
QtAccessibleWidget::customFactory(const QString& classname
     return nullptr;
 }
 
-void QtAccessibleWidget::setCustomAccessible(QObject& rObject,
-                                             const 
uno::Reference<XAccessible>& rxAccessible)
+void QtAccessibleWidget::setCustomAccessible(
+    QObject& rObject, const rtl::Reference<comphelper::OAccessible>& 
rAccessible)
 {
-    assert(rxAccessible.is());
+    assert(rAccessible.is());
 
     // unset/delete the current/default accessible of the object
     QAccessibleInterface* pOldAccessible = 
QAccessible::queryAccessibleInterface(&rObject);
@@ -856,7 +856,7 @@ void QtAccessibleWidget::setCustomAccessible(QObject& 
rObject,
 
     // let QtAccessibleWidget::customFactory set the custom accessible
     rObject.setProperty(PROPERTY_ACCESSIBLE,
-                        QVariant::fromValue(new 
QtAccessibleWidget(rxAccessible, rObject)));
+                        QVariant::fromValue(new 
QtAccessibleWidget(rAccessible, rObject)));
     QAccessible::queryAccessibleInterface(&rObject);
 }
 
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 648ce9ee0abd..e57b483b8976 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -604,9 +604,10 @@ std::unique_ptr<weld::Expander> 
QtInstanceBuilder::weld_expander(const OUString&
     return xRet;
 }
 
-std::unique_ptr<weld::DrawingArea> QtInstanceBuilder::weld_drawing_area(const 
OUString& rId,
-                                                                        const 
a11yref& rA11yImpl,
-                                                                        
FactoryFunction, void*)
+std::unique_ptr<weld::DrawingArea>
+QtInstanceBuilder::weld_drawing_area(const OUString& rId,
+                                     const 
rtl::Reference<comphelper::OAccessible>& rA11yImpl,
+                                     FactoryFunction, void*)
 {
     SolarMutexGuard g;
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9860a5224a8e..6eda922ba570 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -7416,7 +7416,8 @@ std::unique_ptr<weld::Expander> 
SalInstanceBuilder::weld_expander(const OUString
 }
 
 std::unique_ptr<weld::DrawingArea>
-SalInstanceBuilder::weld_drawing_area(const OUString& id, const a11yref& 
rA11yImpl,
+SalInstanceBuilder::weld_drawing_area(const OUString& id,
+                                      const 
rtl::Reference<comphelper::OAccessible>& rA11yImpl,
                                       FactoryFunction pUITestFactoryFunction, 
void* pUserData)
 {
     VclDrawingArea* pDrawingArea = m_xBuilder->get<VclDrawingArea>(id);
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 7b483cafc521..98ccff3c44dc 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -18731,7 +18731,7 @@ class GtkInstanceDrawingArea : public 
GtkInstanceWidget, public virtual weld::Dr
 {
 private:
     GtkDrawingArea* m_pDrawingArea;
-    a11yref m_xAccessible;
+    rtl::Reference<comphelper::OAccessible> m_xAccessible;
 #if !GTK_CHECK_VERSION(4, 0, 0)
     AtkObject *m_pAccessible;
 #endif
@@ -18912,7 +18912,8 @@ private:
 #endif
 
 public:
-    GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* 
pBuilder, a11yref xA11y, bool bTakeOwnership)
+    GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* 
pBuilder,
+                           rtl::Reference<comphelper::OAccessible> xA11y, bool 
bTakeOwnership)
         : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
         , m_pDrawingArea(pDrawingArea)
         , m_xAccessible(std::move(xA11y))
@@ -19182,9 +19183,8 @@ public:
         if (m_pAccessible)
             g_object_unref(m_pAccessible);
 #endif
-        css::uno::Reference<css::lang::XComponent> xComp(m_xAccessible, 
css::uno::UNO_QUERY);
-        if (xComp.is())
-            xComp->dispose();
+        if (m_xAccessible.is())
+            m_xAccessible->dispose();
 #if !GTK_CHECK_VERSION(4, 0, 0)
         g_signal_handler_disconnect(m_pDrawingArea, m_nScrollEvent);
 #endif
@@ -24982,8 +24982,9 @@ public:
         return std::make_unique<GtkInstanceExpander>(pExpander, this, false);
     }
 
-    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const 
OUString &id, const a11yref& rA11y,
-            FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/) 
override
+    virtual std::unique_ptr<weld::DrawingArea>
+    weld_drawing_area(const OUString& id, const 
rtl::Reference<comphelper::OAccessible>& rA11y,
+                      FactoryFunction /*pUITestFactoryFunction*/, void* 
/*pUserData*/) override
     {
         GtkDrawingArea* pDrawingArea = 
GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, OUStringToOString(id, 
RTL_TEXTENCODING_UTF8).getStr()));
         if (!pDrawingArea)

Reply via email to