vcl/source/treelist/svtabbx.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 5f7ae99211594919408dd20cd1215393b3c4b76b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 21 09:55:34 2023 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 21 15:03:22 2023 +0200

    tdf#99609 a11y: Implement retrieving selected rows in tab list box
    
    With this in place, the index of the selected row
    in the Expert Configuration dialog can e.g. be seen
    in Accerciser using this in its Python console with
    the table object selected in the tree view of the a11y objects:
    
        In [1]: table = acc.queryTable()
        In [2]: table.getSelectedRows()
        Out[2]: [12]
    
    Change-Id: I2f07e73552ef12989acab461b33c3e41d9195490
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154713
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index c98be249152d..91740daf3fb0 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -729,8 +729,20 @@ bool SvHeaderTabListBox::IsColumnSelected( sal_Int32 ) 
const
     return false;
 }
 
-void SvHeaderTabListBox::GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& 
) const
+void SvHeaderTabListBox::GetAllSelectedRows(css::uno::Sequence<sal_Int32 >& 
rRowIndices) const
 {
+    const sal_Int32 nCount = GetSelectedRowCount();
+    rRowIndices.realloc(nCount);
+    auto pRows = rRowIndices.getArray();
+    SvTreeListEntry* pEntry = FirstSelected();
+    sal_Int32 nIndex = 0;
+    while (nIndex < nCount && pEntry)
+    {
+        pRows[nIndex] = GetEntryPos(pEntry);
+        pEntry = NextSelected( pEntry );
+        ++nIndex;
+    }
+    assert(nIndex == nCount && "Mismatch between GetSelectedRowCount() and 
count of selected rows when iterating.");
 }
 
 void SvHeaderTabListBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 
>& ) const
commit ab72f6a4a4ceee41842c8a87b23086bce692b1e3
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 21 09:10:26 2023 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 21 15:03:15 2023 +0200

    tdf#99609 a11y: Use GetEntryOnPos in more places in tab list box
    
    As described in more detail for the case in
    Change-Id I35f7280d2c386a9a8e04e636ebf34850a733c84a
    ("tdf#99609 a11y: Announce the correct entry in tab list box"),
    `GetEntryOnPos` is the method that returns the correct entry
    when passing the row index (when there are also non-visible
    dummy entries) and that commit also mentioned:
    
    > There are more uses of `GetEntry` that will be
    > looked at separately.
    
    These two uses in `SvHeaderTabListBox::GetCurrRow` and
    `SvHeaderTabListBox::IsCellCheckBox` are also using a row
    index, so it looks to me like they should also be using
    `GetEntryOnPos`.
    
    Change-Id: I1170063d760c020ad543fb458cac99a10e37c9a2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154710
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index d9b3e2eaecb9..c98be249152d 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -613,7 +613,7 @@ void SvHeaderTabListBox::RecalculateAccessibleChildren()
 bool SvHeaderTabListBox::IsCellCheckBox( sal_Int32 _nRow, sal_uInt16 _nColumn, 
TriState& _rState ) const
 {
     bool bRet = false;
-    SvTreeListEntry* pEntry = GetEntry( _nRow );
+    SvTreeListEntry* pEntry = GetEntryOnPos( _nRow );
     if ( pEntry )
     {
         sal_uInt16 nItemCount = pEntry->ItemCount();
@@ -653,7 +653,7 @@ sal_Int32 SvHeaderTabListBox::GetCurrRow() const
         sal_uInt32 nCount = GetEntryCount();
         for ( sal_uInt32 i = 0; i < nCount; ++i )
         {
-            if ( pEntry == GetEntry(i) )
+            if ( pEntry == GetEntryOnPos(i) )
             {
                 nRet = i;
                 break;

Reply via email to