toolkit/source/controls/table/tablecontrol_impl.cxx |   51 +++++++-------------
 toolkit/source/controls/table/tablecontrol_impl.hxx |    3 -
 2 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit 2f574de08b5c4c009c1e3880f548e79d380bcc4f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 28 08:59:30 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 29 08:25:15 2025 +0100

    uno grid a11y: Merge TableControl_Impl::{impl_,isAccessibleAlive}
    
    Move logic from TableControl_Impl::isAccessibleAlive
    to TableControl_Impl::isAccessibleAlive, which was
    previously just calling the latter.
    
    Change-Id: I6161e8745568954fdaa53dbfa573d29daa547275
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180818
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/toolkit/source/controls/table/tablecontrol_impl.cxx 
b/toolkit/source/controls/table/tablecontrol_impl.cxx
index f4e47156a926..fd64b459fa1e 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.cxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.cxx
@@ -2268,14 +2268,14 @@ namespace svt::table
 
     void TableControl_Impl::commitCellEvent( sal_Int16 const i_eventID, const 
Any& i_newValue, const Any& i_oldValue )
     {
-        if ( impl_isAccessibleAlive() )
+        if (isAccessibleAlive())
              m_pAccessibleTable->commitCellEvent( i_eventID, i_newValue, 
i_oldValue );
     }
 
 
     void TableControl_Impl::commitTableEvent( sal_Int16 const i_eventID, const 
Any& i_newValue, const Any& i_oldValue )
     {
-        if ( impl_isAccessibleAlive() )
+        if (isAccessibleAlive())
              m_pAccessibleTable->commitTableEvent( i_eventID, i_newValue, 
i_oldValue );
     }
 
@@ -2366,7 +2366,7 @@ namespace svt::table
     }
 
 
-    bool TableControl_Impl::impl_isAccessibleAlive() const
+    bool TableControl_Impl::isAccessibleAlive() const
     {
         return m_pAccessibleTable && m_pAccessibleTable->isAlive();
     }
@@ -2374,7 +2374,7 @@ namespace svt::table
 
     void TableControl_Impl::impl_commitAccessibleEvent( sal_Int16 const 
i_eventID, Any const & i_newValue )
     {
-        if ( impl_isAccessibleAlive() )
+        if (isAccessibleAlive())
              m_pAccessibleTable->commitEvent( i_eventID, i_newValue );
     }
 
diff --git a/toolkit/source/controls/table/tablecontrol_impl.hxx 
b/toolkit/source/controls/table/tablecontrol_impl.hxx
index 96a7490c6204..cc53602671ac 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.hxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.hxx
@@ -293,7 +293,7 @@ namespace svt::table
         getAccessible(vcl::Window& i_parentWindow);
         void            disposeAccessible();
 
-        bool     isAccessibleAlive() const { return impl_isAccessibleAlive(); }
+        bool     isAccessibleAlive() const;
 
         // ITableModelListener
         virtual void    rowsInserted( RowPos first, RowPos last ) override;
@@ -306,7 +306,6 @@ namespace svt::table
         virtual void    tableMetricsChanged() override;
 
     private:
-        bool            impl_isAccessibleAlive() const;
         void            impl_commitAccessibleEvent(
                             sal_Int16 const i_eventID,
                             css::uno::Any const & i_newValue
commit b3a60c9d07a80f7e70fafaca7561b7fa5df36ecb
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 28 08:53:42 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 29 08:25:08 2025 +0100

    uno grid a11y: Drop duplicate check whether alive
    
    TableControl_Impl::commitTableEvent and
    TableControl_Impl::impl_commitAccessibleEvent
    check whether the accessible is alive before
    doing anything, so there's no need to do that
    manually before calling those methods in addition.
    
    Change-Id: Ie940653a994fe92eefd367d0816ba03c95d409a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180817
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/toolkit/source/controls/table/tablecontrol_impl.cxx 
b/toolkit/source/controls/table/tablecontrol_impl.cxx
index f6dc5c161f5f..f4e47156a926 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.cxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.cxx
@@ -321,12 +321,10 @@ namespace svt::table
         impl_ni_relayout();
 
         // notify A1YY events
-        if ( impl_isAccessibleAlive() )
-        {
-            impl_commitAccessibleEvent( AccessibleEventId::TABLE_MODEL_CHANGED,
-                Any( AccessibleTableModelChange( 
AccessibleTableModelChangeType::ROWS_INSERTED, i_first, i_last, -1, -1 ) )
-            );
-        }
+        impl_commitAccessibleEvent(
+            AccessibleEventId::TABLE_MODEL_CHANGED,
+            
Any(AccessibleTableModelChange(AccessibleTableModelChangeType::ROWS_INSERTED, 
i_first,
+                                           i_last, -1, -1)));
 
         // schedule repaint
         invalidateRowRange( i_first, ROW_INVALID );
@@ -389,20 +387,11 @@ namespace svt::table
         impl_ni_relayout();
 
         // notify A11Y events
-        if ( impl_isAccessibleAlive() )
-        {
-            commitTableEvent(
-                AccessibleEventId::TABLE_MODEL_CHANGED,
-                Any( AccessibleTableModelChange(
-                    AccessibleTableModelChangeType::ROWS_REMOVED,
-                    firstRemovedRow,
-                    lastRemovedRow,
-                    -1,
-                    -1
-                ) ),
-                Any()
-            );
-        }
+        commitTableEvent(
+            AccessibleEventId::TABLE_MODEL_CHANGED,
+            
Any(AccessibleTableModelChange(AccessibleTableModelChangeType::ROWS_REMOVED,
+                                           firstRemovedRow, lastRemovedRow, 
-1, -1)),
+            Any());
 
         // schedule a repaint
         invalidateRowRange( firstRemovedRow, ROW_INVALID );
commit 0267279ae8c2145cfedc1497634a869fb79e300e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jan 28 08:49:19 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jan 29 08:25:01 2025 +0100

    uno grid a11y: Drop superfluous check
    
    The non-null case already has an early return
    above, so there's no need to check again whether
    `m_pAccessibleTable` is actually nullptr.
    
    Change-Id: Id094c80787f425fe18e48cf0a6460c50d33056ef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180816
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/toolkit/source/controls/table/tablecontrol_impl.cxx 
b/toolkit/source/controls/table/tablecontrol_impl.cxx
index ac04b86a2255..f6dc5c161f5f 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.cxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.cxx
@@ -2356,15 +2356,13 @@ namespace svt::table
             return m_pAccessibleTable;
 
         DBG_TESTSOLARMUTEX();
-        if ( m_pAccessibleTable == nullptr )
+
+        Reference<XAccessible> const xAccParent = 
i_parentWindow.GetAccessible();
+        if (xAccParent.is())
         {
-            Reference< XAccessible > const xAccParent = 
i_parentWindow.GetAccessible();
-            if ( xAccParent.is() )
-            {
-                m_pAccessibleTable = new 
accessibility::AccessibleGridControlAccess(
-                    xAccParent, m_rAntiImpl
-                );
-            }
+            m_pAccessibleTable = new 
accessibility::AccessibleGridControlAccess(
+                xAccParent, m_rAntiImpl
+            );
         }
 
         return m_pAccessibleTable;

Reply via email to