svtools/source/brwbox/brwbox2.cxx                 |    5 +----
 vcl/source/accessibility/accessibletablistbox.cxx |   19 ++++---------------
 vcl/source/treelist/svtabbx.cxx                   |    9 ++++-----
 3 files changed, 9 insertions(+), 24 deletions(-)

New commits:
commit 098a706920d11cfe7a70d367e9e3e9eedc032773
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 4 18:02:12 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 5 08:37:40 2025 +0100

    browsebox a11y: Deduplicate 2 cases effectively doing the same
    
    There's no need to distinguish between the case where
    `pParent` is set (i.e. parent-relative coords were requested)
    and where it is not, as only the height, and not the position
    are used, and the size is the same for the two rectangles retrieved
    via Window::GetWindowExtentsRelative and
    Window::GetWindowExtentsAbsolute, so simply always use the latter.
    
    (The distinction further down is relevant, however,
    because it uses the top-left point of the rectangle,
    not its size.)
    
    Change-Id: I3362e1493112236e08600f66f7c772d339919e7e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181139
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/brwbox/brwbox2.cxx 
b/svtools/source/brwbox/brwbox2.cxx
index 0b6c622d4905..6762120b266c 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -1958,10 +1958,7 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool 
_bIsColumnBar, bool _bOnScreen)
     {
         aTopLeft.setY( GetDataRowHeight() );
         nWidth = GetColumnWidth(0);
-        if (pParent)
-            nHeight = GetWindowExtentsRelative( *pParent ).GetHeight() - 
aTopLeft.Y() - GetControlArea().GetSize().Height();
-        else
-            nHeight = GetWindowExtentsAbsolute().GetHeight() - aTopLeft.Y() - 
GetControlArea().GetSize().Height();
+        nHeight = GetWindowExtentsAbsolute().GetHeight() - aTopLeft.Y() - 
GetControlArea().GetSize().Height();
     }
     if (pParent)
         aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft();
commit 589ead3a6ae776fdbcb426f2817fbb94933a8bf7
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 4 17:16:27 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 5 08:37:34 2025 +0100

    treeview a11y: Fix parent-relative coordinates
    
    SvHeaderTabListBox::calcTableRect and
    SvHeaderTabListBox::GetFieldRectPixel get used when
    parent-relative coordinates are needed in
    AccessibleBrowseBoxTable.
    
    Parent-relative coordinates are meant to be
    relative to the immediate parent. The immediate
    parent of the AccessibleBrowseBoxTable is the
    AccessibleTabListBox, so there's no need to
    take the relative position of the
    AccessibleTabListBox parent within its parent
    (i.e. the AccessibleBrowseBoxTable's grand-parent)
    into account.
    
    Therefore, drop that extra offset.
    
    Without this commit, the highlighted area was too
    far down when clicking through the cells in the
    a11y tree of the treeview in the "Tools" -> "Options"
    -> "Advanced" -> "Open Expert Configuration" dialog
    in Accerciser when using the qt6 VCL plugin on Linux
    with an upcoming change to let
    AccessibleBrowseBoxBase derive from
    OAccessibleComponentHelper which makes use of the
    parent-relative coordinates instead of the
    screen coordinates currently reported by
    AccessibleBrowseBoxBase::getLocationOnScreen.
    
    Change-Id: Ie904701a0a715b22f210361eea3ced969b13c69f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181138
    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 165643f189ac..ecb9eab58128 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -835,10 +835,11 @@ tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool 
_bIsColumnBar, bool _b
 
 tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen )
 {
+    tools::Rectangle aScreenRect(GetWindowExtentsAbsolute());
     if ( _bOnScreen )
-        return tools::Rectangle(GetWindowExtentsAbsolute());
-    else
-        return GetWindowExtentsRelative( *GetAccessibleParentWindow() );
+        return aScreenRect;
+
+    return tools::Rectangle(Point(0, 0), aScreenRect.GetSize());
 }
 
 tools::Rectangle SvHeaderTabListBox::GetFieldRectPixel( sal_Int32 _nRow, 
sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen )
@@ -858,8 +859,6 @@ tools::Rectangle SvHeaderTabListBox::GetFieldRectPixel( 
sal_Int32 _nRow, sal_uIn
         aTopLeft = aRect.TopLeft();
         if (_bOnScreen)
             aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft());
-        else
-            aTopLeft += GetWindowExtentsRelative( *GetAccessibleParentWindow() 
).TopLeft();
         aRect = tools::Rectangle( aTopLeft, aRect.GetSize() );
     }
 
commit 1a40b93d11b940bfff020e330ee23801b10826a2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Feb 4 16:52:50 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Feb 5 08:37:28 2025 +0100

    treeview a11y: Don't report header twice
    
    AccessibleTabListBox is the a11y class for
    SvHeaderTabListBox. That widget only contains
    the table without the header, while the (column)
    header is implemented by HeaderBar which is a
    sibling of the SvHeaderTabListBox, see the
    "GtkTreeView" case in VclBuilder::makeObject.
    
    The header bar is already part of the a11y
    tree as a11y class for the HeaderBar.
    
    The fact that AccessibleTabListBox::getAccessibleChild
    was reporting that as a child as well resulted in the
    header bar (an a11y object with Table role) to appear
    in the a11y hierarchy seen in Accerciser twice when
    using the qt6 VCL plugin. (And clicking on it would
    result in an area to be highlighted that is not part
    of the area that the parent a11y object occupies.
    
    No longer report it as a child of the AccessibleTabListBox.
    
    The above can be observed with the "Tools" -> "Options"
    -> "Advanced" -> "Open Expert Configuration" dialog
    and the qt6 VCL plugin on Linux.
    
    Change-Id: If3099e12dd84cd4f3c420e94c377182c87c65106
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181137
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/accessibility/accessibletablistbox.cxx 
b/vcl/source/accessibility/accessibletablistbox.cxx
index c5e98159abf9..dcda21b84af7 100644
--- a/vcl/source/accessibility/accessibletablistbox.cxx
+++ b/vcl/source/accessibility/accessibletablistbox.cxx
@@ -63,7 +63,8 @@ rtl::Reference<AccessibleBrowseBoxTable> 
AccessibleTabListBox::createAccessibleT
 
 sal_Int64 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
 {
-    return 2; // header and table
+    // only the table; header is handled by HeaderBar (which is a sibling of 
the SvHeaderTabListBox)
+    return 1;
 }
 
 Reference< XAccessibleContext > SAL_CALL 
AccessibleTabListBox::getAccessibleContext()
@@ -77,22 +78,10 @@ AccessibleTabListBox::getAccessibleChild( sal_Int64 
nChildIndex )
     SolarMethodGuard aGuard(getMutex());
     ensureIsAlive();
 
-    if ( nChildIndex < 0 || nChildIndex > 1 )
+    if (nChildIndex != 0)
         throw IndexOutOfBoundsException();
 
-    Reference< XAccessible > xRet;
-    if (nChildIndex == 0)
-    {
-        //! so far the actual implementation object only supports column 
headers
-        xRet = implGetHeaderBar( AccessibleBrowseBoxObjType::ColumnHeaderBar );
-    }
-    else if (nChildIndex == 1)
-        xRet = implGetTable();
-
-    if ( !xRet.is() )
-        throw RuntimeException(u"getAccessibleChild called with NULL 
xRet"_ustr,getXWeak());
-
-    return xRet;
+    return implGetTable();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to