Qt 4.8
qaccessible2.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QACCESSIBLE2_H
43 #define QACCESSIBLE2_H
44 
45 #include <QtGui/qaccessible.h>
46 
48 
50 
51 QT_MODULE(Gui)
52 
53 #ifndef QT_NO_ACCESSIBILITY
54 
55 class QModelIndex;
56 
57 namespace QAccessible2
58 {
60  {
63  };
64 
65  enum BoundaryType {
72  };
73 
78  };
79 
82  int firstRow;
84  int lastRow;
86 
88  : firstColumn(0), firstRow(0), lastColumn(0), lastRow(0), type(TableModelChangeUpdate)
89  {}
90  };
91 }
92 
94 {
95 public:
97 };
98 
99 // catch-all functions. If an accessible class doesn't implement interface T, return 0
107 
108 #define Q_ACCESSIBLE_OBJECT \
109  public: \
110  QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
111  { \
112  switch (t) { \
113  case QAccessible2::TextInterface: \
114  return qAccessibleTextCastHelper(); \
115  case QAccessible2::EditableTextInterface: \
116  return qAccessibleEditableTextCastHelper(); \
117  case QAccessible2::ValueInterface: \
118  return qAccessibleValueCastHelper(); \
119  case QAccessible2::TableInterface: \
120  return qAccessibleTableCastHelper(); \
121  case QAccessible2::ActionInterface: \
122  return qAccessibleActionCastHelper(); \
123  case QAccessible2::ImageInterface: \
124  return qAccessibleImageCastHelper(); \
125  case QAccessible2::Table2Interface: \
126  return qAccessibleTable2CastHelper(); \
127  } \
128  return 0; \
129  } \
130  private:
131 
133 {
134 public:
136 
138 
139  virtual void addSelection(int startOffset, int endOffset) = 0;
140  virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
141  virtual int cursorPosition() = 0;
142  virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
143  virtual int selectionCount() = 0;
144  virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
145  virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
146  virtual QString text(int startOffset, int endOffset) = 0;
147  virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
148  int *startOffset, int *endOffset) = 0;
149  virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
150  int *startOffset, int *endOffset) = 0;
151  virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
152  int *startOffset, int *endOffset) = 0;
153  virtual void removeSelection(int selectionIndex) = 0;
154  virtual void setCursorPosition(int position) = 0;
155  virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
156  virtual int characterCount() = 0;
157  virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
158 };
159 
161 {
162 public:
164 
166 
167  virtual void copyText(int startOffset, int endOffset) = 0;
168  virtual void deleteText(int startOffset, int endOffset) = 0;
169  virtual void insertText(int offset, const QString &text) = 0;
170  virtual void cutText(int startOffset, int endOffset) = 0;
171  virtual void pasteText(int offset) = 0;
172  virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
173  virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
174 };
175 
177 {
178 public:
180 
181  void copyText(int startOffset, int endOffset);
182  void deleteText(int startOffset, int endOffset);
183  void insertText(int offset, const QString &text);
184  void cutText(int startOffset, int endOffset);
185  void pasteText(int offset);
186  void replaceText(int startOffset, int endOffset, const QString &text);
187  inline void setAttributes(int, int, const QString &) {}
188 
189 private:
191 };
192 
194 {
195 public:
197 
199 
200  virtual QVariant currentValue() = 0;
201  virtual void setCurrentValue(const QVariant &value) = 0;
202  virtual QVariant maximumValue() = 0;
203  virtual QVariant minimumValue() = 0;
204 };
205 
207 {
208 public:
210 
211  virtual QAccessibleInterface *accessibleAt(int row, int column) = 0;
212  virtual QAccessibleInterface *caption() = 0;
213  virtual int childIndex(int rowIndex, int columnIndex) = 0;
214  virtual QString columnDescription(int column) = 0;
215  virtual int columnSpan(int row, int column) = 0;
216  virtual QAccessibleInterface *columnHeader() = 0;
217  virtual int columnIndex(int childIndex) = 0;
218  virtual int columnCount() = 0;
219  virtual int rowCount() = 0;
220  virtual int selectedColumnCount() = 0;
221  virtual int selectedRowCount() = 0;
222  virtual QString rowDescription(int row) = 0;
223  virtual int rowSpan(int row, int column) = 0;
224  virtual QAccessibleInterface *rowHeader() = 0;
225  virtual int rowIndex(int childIndex) = 0;
226  virtual int selectedRows(int maxRows, QList<int> *rows) = 0;
227  virtual int selectedColumns(int maxColumns, QList<int> *columns) = 0;
228  virtual QAccessibleInterface *summary() = 0;
229  virtual bool isColumnSelected(int column) = 0;
230  virtual bool isRowSelected(int row) = 0;
231  virtual bool isSelected(int row, int column) = 0;
232  virtual void selectRow(int row) = 0;
233  virtual void selectColumn(int column) = 0;
234  virtual void unselectRow(int row) = 0;
235  virtual void unselectColumn(int column) = 0;
236  virtual void cellAtIndex(int index, int *row, int *column, int *rowSpan,
237  int *columnSpan, bool *isSelected) = 0;
238 };
239 
241 {
242 public:
243  // Returns the number of columns occupied by this cell accessible.
244  virtual int columnExtent() const = 0;
245 
246  // Returns the column headers as an array of cell accessibles.
247  virtual QList<QAccessibleInterface*> columnHeaderCells() const = 0;
248 
249  // Translates this cell accessible into the corresponding column index.
250  virtual int columnIndex() const = 0;
251  // Returns the number of rows occupied by this cell accessible.
252  virtual int rowExtent() const = 0;
253  // Returns the row headers as an array of cell accessibles.
254  virtual QList<QAccessibleInterface*> rowHeaderCells() const = 0;
255  // Translates this cell accessible into the corresponding row index.
256  virtual int rowIndex() const = 0;
257  // Returns a boolean value indicating whether this cell is selected.
258  virtual bool isSelected() const = 0;
259 
260  // Gets the row and column indexes and extents of this cell accessible and whether or not it is selected.
261  virtual void rowColumnExtents(int *row, int *column, int *rowExtents, int *columnExtents, bool *selected) const = 0;
262  // Returns a reference to the accessbile of the containing table.
263  virtual QAccessibleTable2Interface* table() const = 0;
264 
265  // #### Qt5 this should not be here but part of the state
266  virtual bool isExpandable() const = 0;
267 };
268 
270 {
271 public:
273 
274  // Returns the cell at the specified row and column in the table.
275  virtual QAccessibleTable2CellInterface *cellAt (int row, int column) const = 0;
276  // Returns the caption for the table.
277  virtual QAccessibleInterface *caption() const = 0;
278  // Returns the description text of the specified column in the table.
279  virtual QString columnDescription(int column) const = 0;
280  // Returns the total number of columns in table.
281  virtual int columnCount() const = 0;
282  // Returns the total number of rows in table.
283  virtual int rowCount() const = 0;
284  // Returns the total number of selected cells.
285  virtual int selectedCellCount() const = 0;
286  // Returns the total number of selected columns.
287  virtual int selectedColumnCount() const = 0;
288  // Returns the total number of selected rows.
289  virtual int selectedRowCount() const = 0;
290  // Returns the description text of the specified row in the table.
291  virtual QString rowDescription(int row) const = 0;
292  // Returns a list of accessibles currently selected.
293  virtual QList<QAccessibleTable2CellInterface*> selectedCells() const = 0;
294  // Returns a list of column indexes currently selected (0 based).
295  virtual QList<int> selectedColumns() const = 0;
296  // Returns a list of row indexes currently selected (0 based).
297  virtual QList<int> selectedRows() const = 0;
298  // Returns the summary description of the table.
299  virtual QAccessibleInterface *summary() const = 0;
300  // Returns a boolean value indicating whether the specified column is completely selected.
301  virtual bool isColumnSelected(int column) const = 0;
302  // Returns a boolean value indicating whether the specified row is completely selected.
303  virtual bool isRowSelected(int row) const = 0;
304  // Selects a row and unselects all previously selected rows.
305  virtual bool selectRow(int row) = 0;
306  // Selects a column and unselects all previously selected columns.
307  virtual bool selectColumn(int column) = 0;
308  // Unselects one row, leaving other selected rows selected (if any).
309  virtual bool unselectRow(int row) = 0;
310  // Unselects one column, leaving other selected columns selected (if any).
311  virtual bool unselectColumn(int column) = 0;
312  // Returns the type and extents describing how a table changed.
313  virtual QAccessible2::TableModelChange modelChange() const = 0;
314 
315 protected:
316  // These functions are called when the model changes.
317  virtual void modelReset() = 0;
318  virtual void rowsInserted(const QModelIndex &parent, int first, int last) = 0;
319  virtual void rowsRemoved(const QModelIndex &parent, int first, int last) = 0;
320  virtual void columnsInserted(const QModelIndex &parent, int first, int last) = 0;
321  virtual void columnsRemoved(const QModelIndex &parent, int first, int last) = 0;
322  virtual void rowsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row) = 0;
323  virtual void columnsMoved( const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column) = 0;
324 
325 friend class QAbstractItemView;
327 };
328 
330 {
331 public:
333 
334  virtual int actionCount() = 0;
335  virtual void doAction(int actionIndex) = 0;
336  virtual QString description(int actionIndex) = 0;
337  virtual QString name(int actionIndex) = 0;
338  virtual QString localizedName(int actionIndex) = 0;
339  virtual QStringList keyBindings(int actionIndex) = 0;
340 };
341 
343 {
344 public:
346 
347  virtual QString imageDescription() = 0;
348  virtual QSize imageSize() = 0;
349  virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
350 };
351 
352 #endif // QT_NO_ACCESSIBILITY
353 
355 
357 
358 #endif
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QAccessible2Interface * qAccessibleActionCastHelper()
Definition: qaccessible2.h:104
The QAccessibleEditableTextInterface class implements support for the IAccessibleEditableText interfa...
Definition: qaccessible2.h:160
The QAccessible2 namespace defines constants relating to IAccessible2-based interfaces.
Definition: qaccessible.h:347
QAccessible2Interface * qAccessibleValueCastHelper()
Definition: qaccessible2.h:196
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
The QString class provides a Unicode character string.
Definition: qstring.h:83
TableModelChangeType type
Definition: qaccessible2.h:85
virtual ~QAccessible2Interface()
Definition: qaccessible2.h:96
QAccessible2Interface * qAccessibleTextCastHelper()
Definition: qaccessible2.h:101
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QAccessible2Interface * qAccessibleValueCastHelper()
Definition: qaccessible2.h:100
QAccessible2Interface * qAccessibleEditableTextCastHelper()
Definition: qaccessible2.h:102
QAccessible2Interface * qAccessibleTable2CastHelper()
Definition: qaccessible2.h:272
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QAccessible2Interface * qAccessibleImageCastHelper()
Definition: qaccessible2.h:345
The QAccessibleSimpleEditableTextInterface class is a convenience class for text-based widgets...
Definition: qaccessible2.h:176
The QAccessibleImageInterface class implements support for the IAccessibleImage interface.
Definition: qaccessible2.h:342
virtual ~QAccessibleValueInterface()
Definition: qaccessible2.h:198
QAccessible2Interface * qAccessibleTableCastHelper()
Definition: qaccessible2.h:103
The QAbstractItemView class provides the basic functionality for item view classes.
QAccessible2Interface * qAccessibleActionCastHelper()
Definition: qaccessible2.h:332
void setAttributes(int, int, const QString &)
Definition: qaccessible2.h:187
The QAccessibleTextInterface class implements support for the IAccessibleText interface.
Definition: qaccessible2.h:132
The QAccessibleInterface class defines an interface that exposes information about accessible objects...
Definition: qaccessible.h:370
QAccessible2Interface * qAccessibleEditableTextCastHelper()
Definition: qaccessible2.h:163
The QAccessibleActionInterface class implements support for the IAccessibleAction interface...
Definition: qaccessible2.h:329
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QModelIndex class is used to locate data in a data model.
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
quint16 index
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QAccessibleValueInterface class implements support for the IAccessibleValue interface.
Definition: qaccessible2.h:193
QAccessible2Interface * qAccessibleTextCastHelper()
Definition: qaccessible2.h:135
virtual ~QAccessibleTextInterface()
Definition: qaccessible2.h:137
static const KeyPair *const end
#define QT_END_HEADER
Definition: qglobal.h:137
QAccessible2Interface * qAccessibleTableCastHelper()
Definition: qaccessible2.h:209
static bool localizedName(const QString &name)
#define text
Definition: qobjectdefs.h:80
QAccessible2Interface * qAccessibleImageCastHelper()
Definition: qaccessible2.h:105
QAccessible2Interface * qAccessibleTable2CastHelper()
Definition: qaccessible2.h:106