1
/****************************************************************************
3
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
7
** This file is part of the QtGui module of the Qt Toolkit.
9
** $QT_BEGIN_LICENSE:LGPL$
10
** GNU Lesser General Public License Usage
11
** This file may be used under the terms of the GNU Lesser General Public
12
** License version 2.1 as published by the Free Software Foundation and
13
** appearing in the file LICENSE.LGPL included in the packaging of this
14
** file. Please review the following information to ensure the GNU Lesser
15
** General Public License version 2.1 requirements will be met:
16
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
** In addition, as a special exception, Nokia gives you certain additional
19
** rights. These rights are described in the Nokia Qt LGPL Exception
20
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22
** GNU General Public License Usage
23
** Alternatively, this file may be used under the terms of the GNU General
24
** Public License version 3.0 as published by the Free Software Foundation
25
** and appearing in the file LICENSE.GPL included in the packaging of this
26
** file. Please review the following information to ensure the GNU General
27
** Public License version 3.0 requirements will be met:
28
** http://www.gnu.org/copyleft/gpl.html.
31
** Alternatively, this file may be used in accordance with the terms and
32
** conditions contained in a signed written agreement between you and Nokia.
40
****************************************************************************/
42
#ifndef QACCESSIBLE2_H
43
#define QACCESSIBLE2_H
45
#include <QtGui/qaccessible.h>
53
#ifndef QT_NO_ACCESSIBILITY
55
namespace QAccessible2
73
class Q_GUI_EXPORT QAccessible2Interface
76
virtual ~QAccessible2Interface() {}
79
// catch-all functions. If an accessible class doesn't implement interface T, return 0
80
inline QAccessible2Interface *qAccessibleValueCastHelper() { return 0; }
81
inline QAccessible2Interface *qAccessibleTextCastHelper() { return 0; }
82
inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return 0; }
83
inline QAccessible2Interface *qAccessibleTableCastHelper() { return 0; }
84
inline QAccessible2Interface *qAccessibleActionCastHelper() { return 0; }
85
inline QAccessible2Interface *qAccessibleImageCastHelper() { return 0; }
87
#define Q_ACCESSIBLE_OBJECT \
89
QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
92
case QAccessible2::TextInterface: \
93
return qAccessibleTextCastHelper(); \
94
case QAccessible2::EditableTextInterface: \
95
return qAccessibleEditableTextCastHelper(); \
96
case QAccessible2::ValueInterface: \
97
return qAccessibleValueCastHelper(); \
98
case QAccessible2::TableInterface: \
99
return qAccessibleTableCastHelper(); \
100
case QAccessible2::ActionInterface: \
101
return qAccessibleActionCastHelper(); \
102
case QAccessible2::ImageInterface: \
103
return qAccessibleImageCastHelper(); \
109
class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface
112
inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; }
114
virtual ~QAccessibleTextInterface() {}
116
virtual void addSelection(int startOffset, int endOffset) = 0;
117
virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
118
virtual int cursorPosition() = 0;
119
virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
120
virtual int selectionCount() = 0;
121
virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
122
virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
123
virtual QString text(int startOffset, int endOffset) = 0;
124
virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
125
int *startOffset, int *endOffset) = 0;
126
virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
127
int *startOffset, int *endOffset) = 0;
128
virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
129
int *startOffset, int *endOffset) = 0;
130
virtual void removeSelection(int selectionIndex) = 0;
131
virtual void setCursorPosition(int position) = 0;
132
virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
133
virtual int characterCount() = 0;
134
virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
137
class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface
140
inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; }
142
virtual ~QAccessibleEditableTextInterface() {}
144
virtual void copyText(int startOffset, int endOffset) = 0;
145
virtual void deleteText(int startOffset, int endOffset) = 0;
146
virtual void insertText(int offset, const QString &text) = 0;
147
virtual void cutText(int startOffset, int endOffset) = 0;
148
virtual void pasteText(int offset) = 0;
149
virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
150
virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
153
class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
156
QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface);
158
void copyText(int startOffset, int endOffset);
159
void deleteText(int startOffset, int endOffset);
160
void insertText(int offset, const QString &text);
161
void cutText(int startOffset, int endOffset);
162
void pasteText(int offset);
163
void replaceText(int startOffset, int endOffset, const QString &text);
164
inline void setAttributes(int, int, const QString &) {}
167
QAccessibleInterface *iface;
170
class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface
173
inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; }
175
virtual ~QAccessibleValueInterface() {}
177
virtual QVariant currentValue() = 0;
178
virtual void setCurrentValue(const QVariant &value) = 0;
179
virtual QVariant maximumValue() = 0;
180
virtual QVariant minimumValue() = 0;
183
class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface
186
inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; }
188
virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
189
virtual QAccessibleInterface *caption() = 0;
190
virtual int childIndex(int rowIndex, int columnIndex) = 0;
191
virtual QString columnDescription(int column) = 0;
192
virtual int columnSpan(int row, int column) = 0;
193
virtual QAccessibleInterface *columnHeader() = 0;
194
virtual int columnIndex(int childIndex) = 0;
195
virtual int columnCount() = 0;
196
virtual int rowCount() = 0;
197
virtual int selectedColumnCount() = 0;
198
virtual int selectedRowCount() = 0;
199
virtual QString rowDescription(int row) = 0;
200
virtual int rowSpan(int row, int column) = 0;
201
virtual QAccessibleInterface *rowHeader() = 0;
202
virtual int rowIndex(int childIndex) = 0;
203
virtual int selectedRows(int maxRows, QList<int> *rows) = 0;
204
virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0;
205
virtual QAccessibleInterface *summary() = 0;
206
virtual bool isColumnSelected(int column) = 0;
207
virtual bool isRowSelected(int row) = 0;
208
virtual bool isSelected(int row, int column) = 0;
209
virtual void selectRow(int row) = 0;
210
virtual void selectColumn(int column) = 0;
211
virtual void unselectRow(int row) = 0;
212
virtual void unselectColumn(int column) = 0;
213
virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan,
214
int *columnSpan, bool *isSelected) = 0;
217
class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface
220
inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; }
222
virtual int actionCount() = 0;
223
virtual void doAction(int actionIndex) = 0;
224
virtual QString description(int actionIndex) = 0;
225
virtual QString name(int actionIndex) = 0;
226
virtual QString localizedName(int actionIndex) = 0;
227
virtual QStringList keyBindings(int actionIndex) = 0;
230
class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface
233
inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; }
235
virtual QString imageDescription() = 0;
236
virtual QSize imageSize() = 0;
237
virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
240
#endif // QT_NO_ACCESSIBILITY