summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/qt5/Qt5AccessibleWidget.hxx18
-rw-r--r--vcl/qt5/Qt5AccessibleWidget.cxx111
2 files changed, 129 insertions, 0 deletions
diff --git a/vcl/inc/qt5/Qt5AccessibleWidget.hxx b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
index 54c967bf0ab1..54dab2e672f5 100644
--- a/vcl/inc/qt5/Qt5AccessibleWidget.hxx
+++ b/vcl/inc/qt5/Qt5AccessibleWidget.hxx
@@ -19,6 +19,7 @@
#include <QtGui/QAccessible>
#include <QtGui/QAccessibleActionInterface>
#include <QtGui/QAccessibleInterface>
+#include <QtGui/QAccessibleTableCellInterface>
#include <QtGui/QAccessibleTableInterface>
#include <QtGui/QAccessibleTextInterface>
#include <QtGui/QAccessibleValueInterface>
@@ -27,6 +28,11 @@
#include <com/sun/star/accessibility/XAccessible.hpp>
+namespace com::sun::star::accessibility
+{
+class XAccessibleTable;
+}
+
class Qt5Frame;
class Qt5Widget;
@@ -35,6 +41,7 @@ class Qt5AccessibleWidget final : public QObject,
public QAccessibleActionInterface,
public QAccessibleTextInterface,
public QAccessibleEditableTextInterface,
+ public QAccessibleTableCellInterface,
public QAccessibleTableInterface,
public QAccessibleValueInterface
{
@@ -129,12 +136,23 @@ public:
virtual bool unselectColumn(int column) override;
virtual bool unselectRow(int row) override;
+ // QAccessibleTableCellInterface
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const override;
+ virtual int columnIndex() const override;
+ virtual bool isSelected() const override;
+ virtual int columnExtent() const override;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const override;
+ virtual int rowExtent() const override;
+ virtual int rowIndex() const override;
+ virtual QAccessibleInterface* table() const override;
+
// Factory
static QAccessibleInterface* customFactory(const QString& classname, QObject* object);
private:
css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const;
+ css::uno::Reference<css::accessibility::XAccessibleTable> getAccessibleTableForParent() const;
QObject* m_pObject;
};
diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx
index f49bb59ce0b4..f7d833407a75 100644
--- a/vcl/qt5/Qt5AccessibleWidget.cxx
+++ b/vcl/qt5/Qt5AccessibleWidget.cxx
@@ -100,6 +100,24 @@ Reference<XAccessibleContext> Qt5AccessibleWidget::getAccessibleContextImpl() co
return xAc;
}
+css::uno::Reference<css::accessibility::XAccessibleTable>
+Qt5AccessibleWidget::getAccessibleTableForParent() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return nullptr;
+
+ Reference<XAccessible> xParent = xAcc->getAccessibleParent();
+ if (!xParent.is())
+ return nullptr;
+
+ Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext();
+ if (!xParentContext.is())
+ return nullptr;
+
+ return Reference<XAccessibleTable>(xParentContext, UNO_QUERY);
+}
+
QWindow* Qt5AccessibleWidget::window() const { return nullptr; }
int Qt5AccessibleWidget::childCount() const
@@ -725,6 +743,8 @@ void* Qt5AccessibleWidget::interface_cast(QAccessible::InterfaceType t)
return static_cast<QAccessibleEditableTextInterface*>(this);
if (t == QAccessible::ValueInterface)
return static_cast<QAccessibleValueInterface*>(this);
+ if (t == QAccessible::TableCellInterface)
+ return static_cast<QAccessibleTableCellInterface*>(this);
if (t == QAccessible::TableInterface)
return static_cast<QAccessibleTableInterface*>(this);
return nullptr;
@@ -1343,4 +1363,95 @@ bool Qt5AccessibleWidget::unselectRow(int row)
return xTableSelection->unselectRow(row);
}
+QList<QAccessibleInterface*> Qt5AccessibleWidget::columnHeaderCells() const
+{
+ SAL_WARN("vcl.qt5", "Unsupported QAccessibleTableCellInterface::columnHeaderCells");
+ return QList<QAccessibleInterface*>();
+}
+
+int Qt5AccessibleWidget::columnIndex() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return -1;
+
+ Reference<XAccessibleTable> xTable = getAccessibleTableForParent();
+ if (!xTable.is())
+ return -1;
+
+ const sal_Int32 nIndexInParent = xAcc->getAccessibleIndexInParent();
+ return xTable->getAccessibleColumn(nIndexInParent);
+}
+
+bool Qt5AccessibleWidget::isSelected() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return false;
+
+ Reference<XAccessibleTable> xTable = getAccessibleTableForParent();
+ if (!xTable.is())
+ return false;
+
+ const sal_Int32 nColumn = columnIndex();
+ const sal_Int32 nRow = rowIndex();
+ return xTable->isAccessibleSelected(nRow, nColumn);
+}
+
+int Qt5AccessibleWidget::columnExtent() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return -1;
+
+ Reference<XAccessibleTable> xTable = getAccessibleTableForParent();
+ if (!xTable.is())
+ return -1;
+
+ const sal_Int32 nColumn = columnIndex();
+ const sal_Int32 nRow = rowIndex();
+ return xTable->getAccessibleColumnExtentAt(nRow, nColumn);
+}
+
+QList<QAccessibleInterface*> Qt5AccessibleWidget::rowHeaderCells() const
+{
+ SAL_WARN("vcl.qt5", "Unsupported QAccessibleTableCellInterface::rowHeaderCells");
+ return QList<QAccessibleInterface*>();
+}
+
+int Qt5AccessibleWidget::rowExtent() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return -1;
+
+ Reference<XAccessibleTable> xTable = getAccessibleTableForParent();
+ if (!xTable.is())
+ return -1;
+
+ const sal_Int32 nColumn = columnIndex();
+ const sal_Int32 nRow = rowIndex();
+ return xTable->getAccessibleRowExtentAt(nRow, nColumn);
+}
+
+int Qt5AccessibleWidget::rowIndex() const
+{
+ Reference<XAccessibleContext> xAcc = getAccessibleContextImpl();
+ if (!xAcc.is())
+ return -1;
+
+ Reference<XAccessibleTable> xTable = getAccessibleTableForParent();
+ if (!xTable.is())
+ return -1;
+
+ const sal_Int32 nIndexInParent = xAcc->getAccessibleIndexInParent();
+ return xTable->getAccessibleRow(nIndexInParent);
+}
+
+QAccessibleInterface* Qt5AccessibleWidget::table() const
+{
+ SAL_WARN("vcl.qt5", "Unsupported QAccessibleTableCellInterface::table");
+ return nullptr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */