sw/source/core/access/acctable.cxx |   25 ++++++++-----------------
 sw/source/core/access/acctable.hxx |    4 ++--
 2 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit c21ed0c9136c0a26b6e7258492c635e988bb87a5
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Aug 30 15:37:51 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 31 10:41:43 2023 +0200

    use concrete type for SwAccessibleTable::Cells_t
    
    avoid some unnecessary casting
    
    Change-Id: If9998f5ffd3c4b71f81f10e8f274671bb72da017
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156317
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index 0e3101c71cef..3c8beaf9a0a4 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -1501,31 +1501,23 @@ void SwAccessibleTable::FireSelectionEvent( )
 
     aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
 
-    for (const auto& rCell : m_vecCellRemove)
+    for (const unotools::WeakReference<SwAccessibleContext>& rxCell : 
m_vecCellRemove)
     {
         // fdo#57197: check if the object is still alive
-        uno::Reference<XAccessible> const xAcc(rCell.second);
-        if (xAcc.is())
-        {
-            SwAccessibleContext *const pAccCell(rCell.first);
-            assert(pAccCell);
+        rtl::Reference<SwAccessibleContext> const pAccCell(rxCell);
+        if (pAccCell)
             pAccCell->FireAccessibleEvent(aEvent);
-        }
     }
 
     if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
     {
         aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
-        for (const auto& rCell : m_vecCellAdd)
+        for (const unotools::WeakReference<SwAccessibleContext>& rxCell : 
m_vecCellAdd)
         {
             // fdo#57197: check if the object is still alive
-            uno::Reference<XAccessible> const xAcc(rCell.second);
-            if (xAcc.is())
-            {
-                SwAccessibleContext *const pAccCell(rCell.first);
-                assert(pAccCell);
+            rtl::Reference<SwAccessibleContext> const pAccCell(rxCell);
+            if (pAccCell)
                 pAccCell->FireAccessibleEvent(aEvent);
-            }
         }
         return ;
     }
@@ -1539,14 +1531,13 @@ void SwAccessibleTable::FireSelectionEvent( )
 void SwAccessibleTable::AddSelectionCell(
         SwAccessibleContext *const pAccCell, bool const bAddOrRemove)
 {
-    uno::Reference<XAccessible> const xTmp(pAccCell);
     if (bAddOrRemove)
     {
-        m_vecCellAdd.emplace_back(pAccCell, xTmp);
+        m_vecCellAdd.emplace_back(pAccCell);
     }
     else
     {
-        m_vecCellRemove.emplace_back(pAccCell, xTmp);
+        m_vecCellRemove.emplace_back(pAccCell);
     }
 }
 
diff --git a/sw/source/core/access/acctable.hxx 
b/sw/source/core/access/acctable.hxx
index 5187caed411e..9996ffa33b0d 100644
--- a/sw/source/core/access/acctable.hxx
+++ b/sw/source/core/access/acctable.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
 
 #include <svl/listener.hxx>
+#include <unotools/weakref.hxx>
 
 #include "acccontext.hxx"
 
@@ -46,8 +47,7 @@ class SwAccessibleTable :
 {
     std::unique_ptr<SwAccessibleTableData_Impl> mpTableData;    // the table's 
data, protected by SolarMutex
     OUString m_sDesc;
-    typedef std::vector< std::pair<SwAccessibleContext*,
-        css::uno::WeakReference<css::accessibility::XAccessible> > > Cells_t;
+    typedef std::vector< unotools::WeakReference<SwAccessibleContext> > 
Cells_t;
     Cells_t m_vecCellAdd;
     Cells_t m_vecCellRemove;
 

Reply via email to