diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2025-01-24 17:51:05 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2025-01-24 22:01:56 +0100 |
commit | d1d2afa7dd9591664c72fffd6cd941220bb05999 (patch) | |
tree | 61395454ee21ad54d9c629f52a7a4ec6f5bb967b /toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx | |
parent | 16684da3f18b8747714a7ddd44810cb429eab5ae (diff) |
toolkit a11y: Return parent-relative coords if requested
As its documentation described, the (so far) purely virtual
AccessibleGridControlBase::implGetBoundingBox was implemented
by all subclasses to return the bounding box relative to the
TableControl's vcl::Window parent.
However, this method is used to implement methods like
XAccessibleComponent::containsPoint,
XAccessibleComponent::getBounds and
XAccessibleComponent::getLocation, all of which are supposed
to be using the position relative to the *immediate* accessible
parent.
This mismatch could e.g. be seen with the grid control
in attachment 198647 of tdf#164783 and the gtk3 VCL plugin
as follows:
1) allow macros
2) open sample file
3) click "Grid in dialog" to start the dialog containing a grid
4) start Accerciser
5) In Accerciser's treeview of the LO a11y hierarchy, select the
"Grid control" object with a11y table role.
6) Select its first child, which is a table cell.
What could be seen is that the top-left corner of the highlighted
area for the first cell (step 6) is shifted to the right and down
as compareed to the highlighted area for the table (step 5), even
though the first cell in reality has the exact same origin, (because
the table area is defined by the cells it contains).
The AccessibleGridControlBase::implGetBoundingBoxOnScreen overrides
correctly return the bounding box on screen and duplicated much
of the logic.
Fix the problem and deduplicate code by implementing
AccessibleGridControlBase::implGetBoundingBox directly in
AccessibleGridControlBase: Let it calculate the position
relative to the parent from the absolute position of the parent
and of the object itself.
With this in place, the scenario described above now results in
the area highlighted in steps 5) and 6) to have the same top-left
corner.
Change-Id: If28de14d440706bd6493626586f82859e5570e75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180720
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx')
-rw-r--r-- | toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx index f0b50675a00a..4bf68ec3a047 100644 --- a/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx +++ b/toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx @@ -126,20 +126,6 @@ OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName() return u"com.sun.star.accessibility.AccessibleGridControlHeaderCell"_ustr; } -tools::Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox() -{ - vcl::Window* pParent = m_aTable.GetAccessibleParentWindow(); - tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( *pParent ) ); - sal_Int32 nIndex = getAccessibleIndexInParent(); - tools::Rectangle aCellRect; - if (m_eObjType == AccessibleTableControlObjType::COLUMNHEADERCELL) - aCellRect = m_aTable.calcHeaderCellRect(true, nIndex); - else - aCellRect = m_aTable.calcHeaderCellRect(false, nIndex); - return tools::Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize()); -} - - AbsoluteScreenPixelRectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() { AbsoluteScreenPixelRectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() ); |