diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-03-09 13:53:09 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-03-09 17:47:24 +0100 |
commit | f56b932487509de1ecde46a42c40df76c6ecebcf (patch) | |
tree | 93f9621e216b89bf1fcbe70e1d811c569b5b4f22 /accessibility | |
parent | 4e641d9240a981216d6724141b9b7a9e4c63c82a (diff) |
a11y: Leave cell vector handling to AccessibleGridControlTable
Use `AccessibleGridControlTable::getAccessibleCellAt` and
cast to `AccessibleGridControlTableCell*` instead of
directly accessing the cell vector in
`AccessibleGridControl::commitCellEvent`.
`AccessibleGridControlTable::getAccessibleCellAt`
just needs row and column index as parameters,
and already takes care of everything else that's
needed.
This includes creating an accessible object for
the given indices on demand.
Therefore, limiting this to only already existing
a11y objects, which was done to avoid crashes in
commit 4fc7deb7b0528010ebf644654bf4a36594e03f8c
Date: Thu Oct 3 23:16:34 2013 +0200
fix STL assert in accessibility::AccessibleGridControl::commitTableEvent
is no longer needed.
With this change in place, details of how cells are
organized in the vector only need to be known inside
of the `AccessibleGridControlTable` class itself, so
drop the now unused method
`AccessibleGridControlTable::getCellVector`.
(This code path is e.g. used when using
the macro from tdf#147742.)
Change-Id: I21027f0edc2904475ad6cc5fb136316f387499dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131248
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/inc/extended/AccessibleGridControlTable.hxx | 3 | ||||
-rw-r--r-- | accessibility/source/extended/AccessibleGridControl.cxx | 13 |
2 files changed, 4 insertions, 12 deletions
diff --git a/accessibility/inc/extended/AccessibleGridControlTable.hxx b/accessibility/inc/extended/AccessibleGridControlTable.hxx index 602365468505..69e3d9229694 100644 --- a/accessibility/inc/extended/AccessibleGridControlTable.hxx +++ b/accessibility/inc/extended/AccessibleGridControlTable.hxx @@ -142,9 +142,6 @@ public: // XComponent virtual void SAL_CALL dispose() override; - /**@return m_pCellVector*/ - std::vector< rtl::Reference<AccessibleGridControlTableCell> >& getCellVector() { return m_aCellVector;} - virtual void commitEvent(sal_Int16 nEventId, const css::uno::Any& rNewValue, const css::uno::Any& rOldValue) override; diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index 81f3d121ab0f..474945817603 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -270,15 +270,10 @@ void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNew css::uno::Reference< css::accessibility::XAccessible > xAccessible = getAccessibleChild(i); if(css::uno::Reference< css::accessibility::XAccessible >(m_xTable) == xAccessible) { - std::vector< rtl::Reference<AccessibleGridControlTableCell> >& rCells = - m_xTable->getCellVector(); - size_t nIndex = m_aTable.GetCurrentRow() * m_aTable.GetColumnCount() - + m_aTable.GetCurrentColumn(); - if (nIndex < rCells.size() && rCells[nIndex]) - { - rtl::Reference<AccessibleGridControlTableCell> xCell = rCells[nIndex]; - xCell->commitEvent( _nEventId, _rNewValue, _rOldValue ); - } + Reference<XAccessible> xCell = m_xTable->getAccessibleCellAt( + m_aTable.GetCurrentRow(), m_aTable.GetCurrentColumn()); + AccessibleGridControlTableCell* pCell = static_cast<AccessibleGridControlTableCell*>(xCell.get()); + pCell->commitEvent(_nEventId, _rNewValue, _rOldValue); } } } |