toolkit/source/controls/table/AccessibleGridControlTable.cxx |   11 ++++++-----
 toolkit/source/controls/table/tablecontrol.cxx               |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 1ddf5902591e8468401cba9d0b4a46c87603cca6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jan 27 17:23:34 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Jan 27 22:25:06 2025 +0100

    uno grid grid a11y: Return existing cell accessible
    
    ... instead of creating a new one every time
    AccessibleGridControlTable::getAccessibleAtPoint
    gets called.
    
    Change-Id: Icc6e2963bcbe56136717cc2499e10d8d45a2e15a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180804
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/toolkit/source/controls/table/AccessibleGridControlTable.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
index b06533fc95ca..51e8faf8d443 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTable.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
@@ -93,12 +93,11 @@ AccessibleGridControlTable::getAccessibleAtPoint( const 
awt::Point& rPoint )
     // convert position relative to this AccessibleGridControlTable to 
position relative to
     // the parent TableControl by adding own relative position within the 
TableControl parent
     Point aPosInTableControl = vcl::unohelper::ConvertToVCLPoint(rPoint) + 
implGetBoundingBox().TopLeft();
-    Reference< XAccessible > xChild;
     sal_Int32 nRow = 0;
     sal_Int32 nColumnPos = 0;
     if (m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, 
aPosInTableControl))
-        xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, 
nColumnPos);
-    return xChild;
+        return getAccessibleCellAt(nRow, nColumnPos);
+    return nullptr;
 }
 
 void SAL_CALL AccessibleGridControlTable::grabFocus()
commit 062681cecfbfd20990d53bc43ea3c601c8b3a1d8
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jan 27 17:06:14 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Jan 27 22:24:59 2025 +0100

    uno grid a11y: Pass pos relative to TableControl as expected
    
    TableControl::ConvertPointToCellAddress expects a position
    relative to the TableControl.
    However, AccessibleGridControlTable::getAccessibleAtPoint
    gets a position relative to itself, which is different
    at least when the table also has row/col headers.
    
    Add the own position relative to the parent (which is the
    TableControl) to convert the position as needed.
    
    With this in place, using Accerciser's "Select object under mouse"
    feature with the grid control from attachment 198647 from tdf#164783
    with the qt6 VCL plugin now results in the correct cell being
    highlighted when the mouse pointer is over a regular cell, while
    the cell one row above was highlighted previously.
    
    The cell is still not selected in Accerciser's treeview
    of LO a11y tree, but that's still another issue.
    
    Change-Id: If9456b6399ad7a871cb52d9ff4f38168e5907579
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180803
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/toolkit/source/controls/table/AccessibleGridControlTable.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
index ab6a5b5c5add..b06533fc95ca 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTable.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTable.cxx
@@ -90,11 +90,13 @@ AccessibleGridControlTable::getAccessibleAtPoint( const 
awt::Point& rPoint )
 
     ensureAlive();
 
+    // convert position relative to this AccessibleGridControlTable to 
position relative to
+    // the parent TableControl by adding own relative position within the 
TableControl parent
+    Point aPosInTableControl = vcl::unohelper::ConvertToVCLPoint(rPoint) + 
implGetBoundingBox().TopLeft();
     Reference< XAccessible > xChild;
     sal_Int32 nRow = 0;
     sal_Int32 nColumnPos = 0;
-    if (m_aTable.ConvertPointToCellAddress(nRow, nColumnPos,
-                                           
vcl::unohelper::ConvertToVCLPoint(rPoint)))
+    if (m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, 
aPosInTableControl))
         xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, 
nColumnPos);
     return xChild;
 }
commit ee9143100e4523c47702f54151b55c95e272389c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Jan 27 16:47:34 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Jan 27 22:24:53 2025 +0100

    uno grid a11y: Don't confuse row/col
    
    TableControl::calcHeaderRect's `_bIsColumnBar` param is
    passed as the `bColHeader` to TableControl_Impl::calcHeaderRect,
    both of which have the same meaning ("whether this is a column
    header (cell)"), so inverting it (for no apparent reason) is
    incorrect.
    
    As a consquence, selecting the grid control's column header bar
    in Accerciser's treeview of the LO a11y hierarchy with sample doc
    attachment 198647 from tdf#164783 with the qt6 VCL plugin
    would result in not only the header area getting highlighted, but
    the area of the rest of the table as well (as rectangle returned by
    AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen
    result was incorrect).
    
    With this commit in place, the header area is now highlighted
    as expected.
    
    Change-Id: I2c99c940faf469678ecee33dd029580e57170f2a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180802
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/toolkit/source/controls/table/tablecontrol.cxx 
b/toolkit/source/controls/table/tablecontrol.cxx
index edebb01ab5a8..555ad34a69b8 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -570,7 +570,7 @@ namespace svt::table
 
     tools::Rectangle TableControl::calcHeaderRect(bool _bIsColumnBar )
     {
-        return m_pImpl->calcHeaderRect( !_bIsColumnBar );
+        return m_pImpl->calcHeaderRect(_bIsColumnBar);
     }
 
 

Reply via email to