dbaccess/source/ui/control/TableGrantCtrl.cxx         |    3 -
 dbaccess/source/ui/inc/TableGrantCtrl.hxx             |    7 +--
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |    3 -
 dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx |    5 +-
 include/svtools/brwbox.hxx                            |    7 +--
 include/svtools/editbrowsebox.hxx                     |    4 +
 include/svx/gridctrl.hxx                              |    7 +--
 include/vcl/accessibletableprovider.hxx               |    4 +
 include/vcl/toolkit/svtabbx.hxx                       |    3 -
 svtools/source/brwbox/brwbox1.cxx                     |   40 +++++++-----------
 svtools/source/brwbox/brwbox3.cxx                     |    3 -
 svtools/source/brwbox/editbrowsebox.cxx               |    9 +---
 svtools/source/brwbox/editbrowsebox2.cxx              |   19 +++-----
 svx/source/fmcomp/gridctrl.cxx                        |    3 -
 vcl/source/treelist/svtabbx.cxx                       |    3 -
 15 files changed, 59 insertions(+), 61 deletions(-)

New commits:
commit 0f251379bc914747c1d8c76826887930648d0f62
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 15 14:27:16 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 15 17:42:15 2025 +0200

    svtools a11y: Use lambda instead of THeaderCellMapFunctorDispose
    
    Change-Id: I24451ab657380a3650907594d07d1a7f373c8fe6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189689
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/brwbox/brwbox1.cxx 
b/svtools/source/brwbox/brwbox1.cxx
index be799664d043..bec632584951 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -50,33 +50,28 @@ using namespace svt;
 
 namespace
 {
-    struct THeaderCellMapFunctorDispose
-    {
-        void operator()(const BrowseBox::THeaderCellMap::value_type& _aType)
+
+void disposeAndClearHeaderCell(BrowseBox::THeaderCellMap& _rHeaderCell)
+{
+    ::std::for_each(
+        _rHeaderCell.begin(), _rHeaderCell.end(),
+        [](const BrowseBox::THeaderCellMap::value_type& rType)
         {
-            css::uno::Reference<css::lang::XComponent> xComp(_aType.second, 
css::uno::UNO_QUERY);
-            OSL_ENSURE(xComp.is() || !_aType.second.is(), 
"THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!");
+            css::uno::Reference<css::lang::XComponent> xComp(rType.second, 
css::uno::UNO_QUERY);
+            OSL_ENSURE(xComp.is() || !rType.second.is(),
+                       "THeaderCellMapFunctorDispose: invalid accessible cell 
(no XComponent)!");
             if (xComp.is())
                 try
                 {
                     xComp->dispose();
                 }
-                catch(const css::uno::Exception&)
+                catch (const css::uno::Exception&)
                 {
                     TOOLS_WARN_EXCEPTION("svtools", 
"THeaderCellMapFunctorDispose");
                 }
-        }
-    };
-
-    void disposeAndClearHeaderCell(BrowseBox::THeaderCellMap& _rHeaderCell)
-    {
-        ::std::for_each(
-                        _rHeaderCell.begin(),
-                        _rHeaderCell.end(),
-                        THeaderCellMapFunctorDispose()
-                            );
-        _rHeaderCell.clear();
-    }
+        });
+    _rHeaderCell.clear();
+}
 }
 
 // we're just measuring the "real" NavigationBar
commit 6e99fa7b761725bdedd65031768dbd7e07b200af
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 15 14:17:54 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 15 17:42:08 2025 +0200

    a11y: Return OAccessible in IAccessibleTableProvider::CreateAccessibleCell
    
    Change-Id: I1c825afafd07eb119ab61521eb7926dba7d348ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189688
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx 
b/dbaccess/source/ui/control/TableGrantCtrl.cxx
index 607c0199729a..c19b945854aa 100644
--- a/dbaccess/source/ui/control/TableGrantCtrl.cxx
+++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx
@@ -454,7 +454,8 @@ OTableGrantControl::TTablePrivilegeMap::const_iterator 
OTableGrantControl::findP
     return aFind;
 }
 
-Reference< XAccessible > OTableGrantControl::CreateAccessibleCell( sal_Int32 
_nRow, sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible>
+OTableGrantControl::CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 
_nColumnPos)
 {
     sal_uInt16 nColumnId = GetColumnId( _nColumnPos );
     if(nColumnId != COL_TABLE_NAME)
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx 
b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
index d27766913ffe..62330965de98 100644
--- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -71,10 +71,9 @@ public:
     /** Creates the accessible object of a data table cell.
         @param nRow  The row index of the cell.
         @param nColumnId  The column ID of the cell.
-        @return  The XAccessible interface of the specified cell. */
-    virtual css::uno::Reference<
-        css::accessibility::XAccessible >
-    CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+        @return  The accessible object of the specified cell. */
+    virtual rtl::Reference<comphelper::OAccessible>
+    CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
 
 protected:
     virtual bool PreNotify(NotifyEvent& rNEvt ) override;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx 
b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b1b4ae673efa..5ffe2cf16718 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -2692,7 +2692,8 @@ void 
OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry)
     }
 }
 
-Reference< XAccessible > OSelectionBrowseBox::CreateAccessibleCell( sal_Int32 
_nRow, sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible>
+OSelectionBrowseBox::CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 
_nColumnPos)
 {
     OTableFieldDescRef pEntry;
     if ( _nColumnPos != 0 && _nColumnPos != BROWSER_INVALIDID && _nColumnPos 
<= getFields().size() )
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx 
b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
index d5e11c03e332..a799ca65e171 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx
@@ -178,8 +178,9 @@ namespace dbaui
         /** Creates the accessible object of a data table cell.
         @param nRow  The row index of the cell.
         @param nColumnId  The column ID of the cell.
-        @return  The XAccessible interface of the specified cell. */
-        virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+        @return  The accessible object of the specified cell. */
+        virtual rtl::Reference<comphelper::OAccessible>
+        CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
 
     private:
         virtual bool                SeekRow( sal_Int32 nRow ) override;
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index d7497bbc8aab..63c502d270bf 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -711,10 +711,9 @@ public:
     /** Creates the accessible object of a data table cell.
         @param nRow  The row index of the cell.
         @param nColumnId  The column pos of the cell.
-        @return  The XAccessible interface of the specified cell. */
-    virtual css::uno::Reference<
-        css::accessibility::XAccessible >
-    CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) override;
+        @return  The accessible object of the specified cell. */
+    virtual rtl::Reference<comphelper::OAccessible>
+    CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnPos) override;
 
     /** Creates the accessible object of a row header.
         @param nRow  The row index of the header.
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index 413a02b62cf9..4c9e79471755 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -552,10 +552,9 @@ public:
     /** Creates the accessible object of a data table cell.
         @param nRow  The row index of the cell.
         @param nColumnId  The column ID of the cell.
-        @return  The XAccessible interface of the specified cell. */
-    virtual css::uno::Reference<
-        css::accessibility::XAccessible >
-    CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnId ) override;
+        @return  The accessible object of the specified cell. */
+    virtual rtl::Reference<comphelper::OAccessible>
+    CreateAccessibleCell(sal_Int32 nRow, sal_uInt16 nColumnId) override;
 
     void RearrangeAtIdle();
 
diff --git a/include/vcl/accessibletableprovider.hxx 
b/include/vcl/accessibletableprovider.hxx
index 01421fabc0c4..2d1270faf888 100644
--- a/include/vcl/accessibletableprovider.hxx
+++ b/include/vcl/accessibletableprovider.hxx
@@ -86,7 +86,9 @@ public:
     virtual tools::Rectangle calcTableRect() = 0;
     virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRow, sal_uInt16 
_nColumnPos, bool _bIsHeader) = 0;
 
-    virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
+    virtual rtl::Reference<comphelper::OAccessible> 
CreateAccessibleCell(sal_Int32 _nRow,
+                                                                         
sal_uInt16 _nColumnPos)
+        = 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) = 0;
 
diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index e32b663cd360..dcea878ea85e 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -164,7 +164,8 @@ public:
     virtual tools::Rectangle calcTableRect() override;
     virtual tools::Rectangle calcFieldRectPixel(sal_Int32 _nRow, sal_uInt16 
_nColumn, bool _bIsHeader) override;
 
-    virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) override;
+    rtl::Reference<comphelper::OAccessible> CreateAccessibleCell(sal_Int32 
_nRow,
+                                                                 sal_uInt16 
_nColumn) override;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleRowHeader( sal_Int32 _nRow ) override;
     virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) override;
 
diff --git a/svtools/source/brwbox/brwbox1.cxx 
b/svtools/source/brwbox/brwbox1.cxx
index b727e863e7a3..be799664d043 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2352,11 +2352,10 @@ void BrowseBox::CursorMoved()
     // before implementing more here, please adjust the EditBrowseBox
 
     if ( isAccessibleAlive() && HasFocus() )
-        commitTableEvent(
-            AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
-            Any( CreateAccessibleCell( GetCurRow(),GetColumnPos( 
GetCurColumnId() ) ) ),
-            Any()
-        );
+        commitTableEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+                         
Any(css::uno::Reference<css::accessibility::XAccessible>(
+                             CreateAccessibleCell(GetCurRow(), 
GetColumnPos(GetCurColumnId())))),
+                         Any());
 }
 
 void BrowseBox::LoseFocus()
diff --git a/svtools/source/brwbox/brwbox3.cxx 
b/svtools/source/brwbox/brwbox3.cxx
index abdeb88a3264..b7f209ac8180 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -82,7 +82,8 @@ rtl::Reference<comphelper::OAccessible> 
BrowseBox::CreateAccessible()
 
 // Children -------------------------------------------------------------------
 
-Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, 
sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible> 
BrowseBox::CreateAccessibleCell(sal_Int32 _nRow,
+                                                                        
sal_uInt16 _nColumnPos)
 {
     // BBINDEX_TABLE must be the table
     OSL_ENSURE(m_xAccessible, "Invalid call: Accessible is null");
diff --git a/svtools/source/brwbox/editbrowsebox.cxx 
b/svtools/source/brwbox/editbrowsebox.cxx
index 2db62fb04db1..c15a287ace2b 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -993,11 +993,10 @@ void EditBrowseBox::ActivateCell(sal_Int32 nRow, 
sal_uInt16 nCol, bool bCellFocu
         // no controller -> we have a new "active descendant"
         if ( isAccessibleAlive() && HasFocus() )
         {
-            commitTableEvent(
-                AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
-                Any( CreateAccessibleCell( nRow, GetColumnPos( nCol -1) ) ),
-                Any()
-            );
+            commitTableEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+                             Any(css::uno::Reference<XAccessible>(
+                                 CreateAccessibleCell(nRow, GetColumnPos(nCol 
- 1)))),
+                             Any());
         }
     }
 }
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 280518c56ebc..bddea1bd54dc 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -3394,7 +3394,8 @@ rtl::Reference<comphelper::OAccessible> 
DbGridControl::CreateAccessibleControl(s
     return EditBrowseBox::CreateAccessibleControl(_nIndex);
 }
 
-Reference< XAccessible > DbGridControl::CreateAccessibleCell( sal_Int32 _nRow, 
sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible> 
DbGridControl::CreateAccessibleCell(sal_Int32 _nRow,
+                                                                            
sal_uInt16 _nColumnPos)
 {
     sal_uInt16 nColumnId = GetColumnId( _nColumnPos );
     size_t Location = GetModelColumnPos(nColumnId);
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 12c5c203141c..649042f78db9 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -830,7 +830,8 @@ tools::Rectangle 
SvHeaderTabListBox::calcFieldRectPixel(sal_Int32 _nRow, sal_uIn
     return aRect;
 }
 
-Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleCell( sal_Int32 
_nRow, sal_uInt16 _nColumnPos )
+rtl::Reference<comphelper::OAccessible>
+SvHeaderTabListBox::CreateAccessibleCell(sal_Int32 _nRow, sal_uInt16 
_nColumnPos)
 {
     OSL_ENSURE(m_xAccessible.is(), "Invalid call: Accessible is null");
 
commit 03a8ca08e24b37b2bf1ccec3ac34aaaf3f232e3e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 15 14:00:40 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 15 17:42:03 2025 +0200

    a11y: Return OAccessible in EditBrowseBox::CreateAccessibleCheckBoxCell
    
    ... and drop the redundant call to OAccessible::getAccessibleContext,
    which returns a reference to self.
    
    Change-Id: I2cc072171e8fcc9a1fb948011a59fb1083dbef46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189686
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/svtools/editbrowsebox.hxx 
b/include/svtools/editbrowsebox.hxx
index 71df50a9b045..98e52196439d 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -1094,7 +1094,9 @@ namespace svt
         virtual void ChildFocusIn() override;
         virtual void ChildFocusOut() override;
 
-        css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,const 
TriState& eState);
+        rtl::Reference<comphelper::OAccessible>
+        CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 _nColumnPos,
+                                     const TriState& eState);
         bool ControlHasFocus() const;
     protected:
         // creates the accessible which wraps the active cell
diff --git a/svtools/source/brwbox/editbrowsebox2.cxx 
b/svtools/source/brwbox/editbrowsebox2.cxx
index 4f4bcc251d83..836d95220c24 100644
--- a/svtools/source/brwbox/editbrowsebox2.cxx
+++ b/svtools/source/brwbox/editbrowsebox2.cxx
@@ -35,19 +35,16 @@ namespace svt
     using namespace com::sun::star::uno;
     using namespace ::com::sun::star::accessibility::AccessibleEventId;
 
-
-Reference< XAccessible > EditBrowseBox::CreateAccessibleCheckBoxCell(sal_Int32 
_nRow, sal_uInt16 _nColumnPos,const TriState& eState)
+rtl::Reference<comphelper::OAccessible>
+EditBrowseBox::CreateAccessibleCheckBoxCell(sal_Int32 _nRow, sal_uInt16 
_nColumnPos,
+                                            const TriState& eState)
 {
-    Reference< XAccessible > xAccessible( GetAccessible() );
-    if ( !xAccessible.is() )
-        return nullptr;
-
-    Reference< XAccessibleContext > xAccContext = 
xAccessible->getAccessibleContext();
-    if ( !xAccContext.is() )
-        return nullptr;
+    rtl::Reference<comphelper::OAccessible> pAccessible = GetAccessible();
+    if (!pAccessible.is())
+        return {};
 
-    return new 
AccessibleCheckBoxCell(xAccContext->getAccessibleChild(::vcl::BBINDEX_TABLE),
-                                         *this, _nRow, _nColumnPos, eState, 
true);
+    return new 
AccessibleCheckBoxCell(pAccessible->getAccessibleChild(::vcl::BBINDEX_TABLE),
+                                      *this, _nRow, _nColumnPos, eState, true);
 }
 
 sal_Int32 EditBrowseBox::GetAccessibleControlCount() const

Reply via email to