LibreOffice Module vcl (master)  1
Qt5AccessibleWidget.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #pragma once
11 
12 #include <vclpluginapi.h>
13 
14 #include <QtCore/QObject>
15 #include <QtCore/QPair>
16 #include <QtCore/QString>
17 #include <QtCore/QStringList>
18 #include <QtCore/QVector>
19 #include <QtGui/QAccessible>
20 #include <QtGui/QAccessibleActionInterface>
21 #include <QtGui/QAccessibleInterface>
22 #include <QtGui/QAccessibleTableInterface>
23 #include <QtGui/QAccessibleTextInterface>
24 #include <QtGui/QAccessibleValueInterface>
25 #include <QtGui/QColor>
26 #include <QtGui/QWindow>
27 
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 
30 class Qt5Frame;
31 class Qt5Widget;
32 
33 class Qt5AccessibleWidget final : public QObject,
34  public QAccessibleInterface,
35  public QAccessibleActionInterface,
36  public QAccessibleTextInterface,
37  public QAccessibleEditableTextInterface,
38  public QAccessibleTableInterface,
39  public QAccessibleValueInterface
40 {
41  Q_OBJECT
42 
43 public:
44  Qt5AccessibleWidget(const css::uno::Reference<css::accessibility::XAccessible> xAccessible);
45  QWindow* window() const override;
46  int childCount() const override;
47  int indexOfChild(const QAccessibleInterface* child) const override;
48  QVector<QPair<QAccessibleInterface*, QAccessible::Relation>>
49  relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
50  QAccessibleInterface* focusChild() const override;
51 
52  QRect rect() const override;
53 
54  QAccessibleInterface* parent() const override;
55  QAccessibleInterface* child(int index) const override;
56 
57  QString text(QAccessible::Text t) const override;
58  QAccessible::Role role() const override;
59  QAccessible::State state() const override;
60 
61  QColor foregroundColor() const override;
62  QColor backgroundColor() const override;
63 
64  bool isValid() const override;
65  QObject* object() const override;
66  void setText(QAccessible::Text t, const QString& text) override;
67  QAccessibleInterface* childAt(int x, int y) const override;
68 
69  void* interface_cast(QAccessible::InterfaceType t) override;
70 
71  // QAccessibleActionInterface
72  QStringList actionNames() const override;
73  void doAction(const QString& actionName) override;
74  QStringList keyBindingsForAction(const QString& actionName) const override;
75 
76  static QAccessibleValueInterface* valueInterface();
77  static QAccessibleTextInterface* textInterface();
78 
79  // QAccessibleTextInterface
80  void addSelection(int startOffset, int endOffset) override;
81  QString attributes(int offset, int* startOffset, int* endOffset) const override;
82  int characterCount() const override;
83  QRect characterRect(int offset) const override;
84  int cursorPosition() const override;
85  int offsetAtPoint(const QPoint& point) const override;
86  void removeSelection(int selectionIndex) override;
87  void scrollToSubstring(int startIndex, int endIndex) override;
88  void selection(int selectionIndex, int* startOffset, int* endOffset) const override;
89  int selectionCount() const override;
90  void setCursorPosition(int position) override;
91  void setSelection(int selectionIndex, int startOffset, int endOffset) override;
92  QString text(int startOffset, int endOffset) const override;
93  QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
94  int* startOffset, int* endOffset) const override;
95  QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int* startOffset,
96  int* endOffset) const override;
97  QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
98  int* startOffset, int* endOffset) const override;
99 
100  // QAccessibleEditableTextInterface
101  virtual void deleteText(int startOffset, int endOffset) override;
102  virtual void insertText(int offset, const QString& text) override;
103  virtual void replaceText(int startOffset, int endOffset, const QString& text) override;
104 
105  // QAccessibleValueInterface
106  QVariant currentValue() const override;
107  QVariant maximumValue() const override;
108  QVariant minimumStepSize() const override;
109  QVariant minimumValue() const override;
110  void setCurrentValue(const QVariant& value) override;
111 
112  // QAccessibleTableInterface
113  virtual QAccessibleInterface* caption() const override;
114  virtual QAccessibleInterface* cellAt(int row, int column) const override;
115  virtual int columnCount() const override;
116  virtual QString columnDescription(int column) const override;
117  virtual bool isColumnSelected(int column) const override;
118  virtual bool isRowSelected(int row) const override;
119  virtual void modelChange(QAccessibleTableModelChangeEvent* event) override;
120  virtual int rowCount() const override;
121  virtual QString rowDescription(int row) const override;
122  virtual bool selectColumn(int column) override;
123  virtual bool selectRow(int row) override;
124  virtual int selectedCellCount() const override;
125  virtual QList<QAccessibleInterface*> selectedCells() const override;
126  virtual int selectedColumnCount() const override;
127  virtual QList<int> selectedColumns() const override;
128  virtual int selectedRowCount() const override;
129  virtual QList<int> selectedRows() const override;
130  virtual QAccessibleInterface* summary() const override;
131  virtual bool unselectColumn(int column) override;
132  virtual bool unselectRow(int row) override;
133 
134  // Factory
135  static QAccessibleInterface* customFactory(const QString& classname, QObject* object);
136 
137 private:
138  css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
139  css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const;
140 };
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
QObject * object() const override
virtual int selectedRowCount() const override
void setSelection(int selectionIndex, int startOffset, int endOffset) override
virtual void deleteText(int startOffset, int endOffset) override
virtual bool isRowSelected(int row) const override
QAccessibleInterface * focusChild() const override
QAccessible::Role role() const override
virtual bool unselectRow(int row) override
css::uno::Reference< css::accessibility::XAccessible > m_xAccessible
QAccessibleInterface * parent() const override
QColor backgroundColor() const override
QStringList actionNames() const override
QStringList keyBindingsForAction(const QString &actionName) const override
def point()
QAccessible::State state() const override
virtual QString columnDescription(int column) const override
QRect rect() const override
virtual QList< int > selectedRows() const override
virtual int selectedCellCount() const override
QVector< QPair< QAccessibleInterface *, QAccessible::Relation > > relations(QAccessible::Relation match=QAccessible::AllRelations) const override
float x
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
virtual QAccessibleInterface * summary() const override
QVariant maximumValue() const override
virtual void insertText(int offset, const QString &text) override
int characterCount() const override
bool match(const sal_Unicode *pWild, const sal_Unicode *pStr, const sal_Unicode cEscape)
def position
void scrollToSubstring(int startIndex, int endIndex) override
virtual int rowCount() const override
int indexOfChild(const QAccessibleInterface *child) const override
int selectionCount() const override
QRect characterRect(int offset) const override
virtual bool selectColumn(int column) override
virtual bool isColumnSelected(int column) const override
css::uno::Reference< css::accessibility::XAccessibleContext > getAccessibleContextImpl() const
virtual QAccessibleInterface * caption() const override
virtual int columnCount() const override
virtual bool unselectColumn(int column) override
static QAccessibleInterface * customFactory(const QString &classname, QObject *object)
void setCursorPosition(int position) override
float y
int cursorPosition() const override
virtual int selectedColumnCount() const override
void * interface_cast(QAccessible::InterfaceType t) override
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
void removeSelection(int selectionIndex) override
virtual void replaceText(int startOffset, int endOffset, const QString &text) override
tuple index
virtual QList< QAccessibleInterface * > selectedCells() const override
virtual bool selectRow(int row) override
QAccessibleInterface * child(int index) const override
void selection(int selectionIndex, int *startOffset, int *endOffset) const override
XPropertyListType t
virtual void modelChange(QAccessibleTableModelChangeEvent *event) override
virtual QString rowDescription(int row) const override
Qt5AccessibleWidget(const css::uno::Reference< css::accessibility::XAccessible > xAccessible)
void setCurrentValue(const QVariant &value) override
QString attributes(int offset, int *startOffset, int *endOffset) const override
virtual QAccessibleInterface * cellAt(int row, int column) const override
void setText(QAccessible::Text t, const QString &text) override
QVariant minimumValue() const override
QVariant currentValue() const override
static QAccessibleValueInterface * valueInterface()
QVariant minimumStepSize() const override
int childCount() const override
QColor foregroundColor() const override
void addSelection(int startOffset, int endOffset) override
int offsetAtPoint(const QPoint &point) const override
Any value
virtual QList< int > selectedColumns() const override
bool isValid() const override
QAccessibleInterface * childAt(int x, int y) const override
QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType, int *startOffset, int *endOffset) const override
QWindow * window() const override
QString text(QAccessible::Text t) const override
void doAction(const QString &actionName) override
static QAccessibleTextInterface * textInterface()