vcl/qt5/QtAccessibleWidget.cxx | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
New commits: commit c03a262c477b73aa170c6a38703d0930486255e5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Aug 4 11:52:43 2022 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Aug 4 19:34:27 2022 +0200 qt a11y: Implement QtAccessibleWidget::selectedCell{s,Count} Change-Id: I728456d27211916010c0174fa71b0125c7530707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137793 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 789de70d1311..0e9c083043a2 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <com/sun/star/accessibility/XAccessibleTable.hpp> #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> @@ -1250,14 +1251,37 @@ bool QtAccessibleWidget::selectRow(int row) int QtAccessibleWidget::selectedCellCount() const { - SAL_INFO("vcl.qt", "Unsupported QAccessibleTableInterface::selectedCellCount"); - return 0; + Reference<XAccessibleContext> xAcc = getAccessibleContextImpl(); + if (!xAcc.is()) + return 0; + + Reference<XAccessibleSelection> xSelection(xAcc, UNO_QUERY); + if (!xSelection.is()) + return 0; + + return xSelection->getSelectedAccessibleChildCount(); } QList<QAccessibleInterface*> QtAccessibleWidget::selectedCells() const { - SAL_INFO("vcl.qt", "Unsupported QAccessibleTableInterface::selectedCells"); - return QList<QAccessibleInterface*>(); + Reference<XAccessibleContext> xAcc = getAccessibleContextImpl(); + if (!xAcc.is()) + return QList<QAccessibleInterface*>(); + + Reference<XAccessibleSelection> xSelection(xAcc, UNO_QUERY); + if (!xSelection.is()) + return QList<QAccessibleInterface*>(); + + QList<QAccessibleInterface*> aSelectedCells; + const sal_Int32 nSelected = xSelection->getSelectedAccessibleChildCount(); + for (int i = 0; i < nSelected; i++) + { + Reference<XAccessible> xChild = xSelection->getSelectedAccessibleChild(i); + QAccessibleInterface* pInterface + = QAccessible::queryAccessibleInterface(new QtXAccessible(xChild)); + aSelectedCells.push_back(pInterface); + } + return aSelectedCells; } int QtAccessibleWidget::selectedColumnCount() const