summaryrefslogtreecommitdiff
path: root/toolkit/source
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2025-01-27 14:19:10 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2025-01-27 22:24:12 +0100
commit76677a804f23ebd1fac0a098883c861816103b91 (patch)
tree98c4a2ff66c0be6185c12298c272869a01771a84 /toolkit/source
parent2443e39e7b9623d3b69a38af5419a54ae0601e40 (diff)
a11y: Drop non-functional bits from AccessibleGridControl::getAccessibleAtPoint
XAccessibleComponent::getAccessibleAtPoint should return the direct child at the given point. AccessibleGridControl can have up to 3 children, see AccessibleGridControl::getAccessibleChild: * a row header (AccessibleGridControlHeader) * a column header (AccessibleGridControlHeader) * the table (AccessibleGridControlTable) TableControl::ConvertPointToControlIndex on the other hand returns the child index of a cell within the table, so could only be relevant when calling AccessibleGridControlTable::getAccessibleAtPoint on the AccessibleGridControlTable child (and AccessibleGridControlTable::getAccessibleAtPoint does similar, but uses a method called TableControl::ConvertPointToCellAddress instead). In addition, TableControl::CreateAccessibleControl that was called with the index retrieved that way was warning it should be overriden (Where?) and unconditionally returning nullptr. Drop that broken code path. The remaining logic to iterate over the children looks reasonable in principle. Without this commit in place, using the "Inspect object under mouse" feature in Accerciser when the mouse is over a cell of the grid control of the sample doc attachment 198647 from tdf#164783 with the qt6 VCL plugin would result in the top-level's TableControl's a11y object getting selected in Accerciser's treeview of the LO a11y and its full area getting highlighted. Now, it selects/highlights the column header cell - even if the mouse cursor is over one of the regular cells - which is still not fully correct, but that is a different issue. Change-Id: Ib4a0d05145c66a96dcb72a6a50805182c17fb2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180792 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'toolkit/source')
-rw-r--r--toolkit/source/controls/table/AccessibleGridControl.cxx26
-rw-r--r--toolkit/source/controls/table/tablecontrol.cxx8
2 files changed, 10 insertions, 24 deletions
diff --git a/toolkit/source/controls/table/AccessibleGridControl.cxx b/toolkit/source/controls/table/AccessibleGridControl.cxx
index 463821ae5b8c..740431ad73e3 100644
--- a/toolkit/source/controls/table/AccessibleGridControl.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControl.cxx
@@ -147,24 +147,18 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint )
SolarMutexGuard aSolarGuard;
ensureAlive();
- sal_Int32 nIndex = 0;
- if (m_aTable.ConvertPointToControlIndex(nIndex, vcl::unohelper::ConvertToVCLPoint(rPoint)))
- return m_aTable.CreateAccessibleControl(nIndex);
- else
+ // try whether point is in one of the fixed children
+ // (table, header bars, corner control)
+ Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint));
+ for (sal_Int32 nIndex = 0; nIndex < 3; ++nIndex)
{
- // try whether point is in one of the fixed children
- // (table, header bars, corner control)
- Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint));
- for (nIndex = 0; nIndex < 3; ++nIndex)
- {
- css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) );
- css::uno::Reference< css::accessibility::XAccessibleComponent >
- xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+ css::uno::Reference<css::accessibility::XAccessible> xCurrChild(implGetFixedChild(nIndex));
+ css::uno::Reference<css::accessibility::XAccessibleComponent> xCurrChildComp(
+ xCurrChild, uno::UNO_QUERY);
- if (xCurrChildComp.is()
- && vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint))
- return xCurrChild;
- }
+ if (xCurrChildComp.is()
+ && vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint))
+ return xCurrChild;
}
return nullptr;
}
diff --git a/toolkit/source/controls/table/tablecontrol.cxx b/toolkit/source/controls/table/tablecontrol.cxx
index 4caccefa4d09..860ed4892d1f 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -322,14 +322,6 @@ namespace svt::table
return m_pImpl->getAccessible( *pParent );
}
-
- Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 )
- {
- SAL_WARN( "svtools", "TableControl::CreateAccessibleControl: to be overwritten!" );
- return nullptr;
- }
-
-
OUString TableControl::GetAccessibleObjectName( vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
{
OUString aRetText;