1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QACCESSIBLE2_H
|
---|
43 | #define QACCESSIBLE2_H
|
---|
44 |
|
---|
45 | #include <QtGui/qaccessible.h>
|
---|
46 |
|
---|
47 | QT_BEGIN_HEADER
|
---|
48 |
|
---|
49 | QT_BEGIN_NAMESPACE
|
---|
50 |
|
---|
51 | QT_MODULE(Gui)
|
---|
52 |
|
---|
53 | #ifndef QT_NO_ACCESSIBILITY
|
---|
54 |
|
---|
55 | namespace QAccessible2
|
---|
56 | {
|
---|
57 | enum CoordinateType
|
---|
58 | {
|
---|
59 | RelativeToScreen = 0,
|
---|
60 | RelativeToParent = 1
|
---|
61 | };
|
---|
62 |
|
---|
63 | enum BoundaryType {
|
---|
64 | CharBoundary,
|
---|
65 | WordBoundary,
|
---|
66 | SentenceBoundary,
|
---|
67 | ParagraphBoundary,
|
---|
68 | LineBoundary,
|
---|
69 | NoBoundary
|
---|
70 | };
|
---|
71 | }
|
---|
72 |
|
---|
73 | class Q_GUI_EXPORT QAccessible2Interface
|
---|
74 | {
|
---|
75 | public:
|
---|
76 | virtual ~QAccessible2Interface() {}
|
---|
77 | };
|
---|
78 |
|
---|
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 |
|
---|
85 | #define Q_ACCESSIBLE_OBJECT \
|
---|
86 | public: \
|
---|
87 | QAccessible2Interface *interface_cast(QAccessible2::InterfaceType t) \
|
---|
88 | { \
|
---|
89 | switch (t) { \
|
---|
90 | case QAccessible2::TextInterface: \
|
---|
91 | return qAccessibleTextCastHelper(); \
|
---|
92 | case QAccessible2::EditableTextInterface: \
|
---|
93 | return qAccessibleEditableTextCastHelper(); \
|
---|
94 | case QAccessible2::ValueInterface: \
|
---|
95 | return qAccessibleValueCastHelper(); \
|
---|
96 | case QAccessible2::TableInterface: \
|
---|
97 | return qAccessibleTableCastHelper(); \
|
---|
98 | } \
|
---|
99 | return 0; \
|
---|
100 | } \
|
---|
101 | private:
|
---|
102 |
|
---|
103 | class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface
|
---|
104 | {
|
---|
105 | public:
|
---|
106 | inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; }
|
---|
107 |
|
---|
108 | virtual ~QAccessibleTextInterface() {}
|
---|
109 |
|
---|
110 | virtual void addSelection(int startOffset, int endOffset) = 0;
|
---|
111 | virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
|
---|
112 | virtual int cursorPosition() = 0;
|
---|
113 | virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
|
---|
114 | virtual int selectionCount() = 0;
|
---|
115 | virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
|
---|
116 | virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
|
---|
117 | virtual QString text(int startOffset, int endOffset) = 0;
|
---|
118 | virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
|
---|
119 | int *startOffset, int *endOffset) = 0;
|
---|
120 | virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
|
---|
121 | int *startOffset, int *endOffset) = 0;
|
---|
122 | virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
|
---|
123 | int *startOffset, int *endOffset) = 0;
|
---|
124 | virtual void removeSelection(int selectionIndex) = 0;
|
---|
125 | virtual void setCursorPosition(int position) = 0;
|
---|
126 | virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
|
---|
127 | virtual int characterCount() = 0;
|
---|
128 | virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
|
---|
129 | };
|
---|
130 |
|
---|
131 | class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface
|
---|
132 | {
|
---|
133 | public:
|
---|
134 | inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; }
|
---|
135 |
|
---|
136 | virtual ~QAccessibleEditableTextInterface() {}
|
---|
137 |
|
---|
138 | virtual void copyText(int startOffset, int endOffset) = 0;
|
---|
139 | virtual void deleteText(int startOffset, int endOffset) = 0;
|
---|
140 | virtual void insertText(int offset, const QString &text) = 0;
|
---|
141 | virtual void cutText(int startOffset, int endOffset) = 0;
|
---|
142 | virtual void pasteText(int offset) = 0;
|
---|
143 | virtual void replaceText(int startOffset, int endOffset, const QString &text) = 0;
|
---|
144 | virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0;
|
---|
145 | };
|
---|
146 |
|
---|
147 | class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
|
---|
148 | {
|
---|
149 | public:
|
---|
150 | QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface);
|
---|
151 |
|
---|
152 | void copyText(int startOffset, int endOffset);
|
---|
153 | void deleteText(int startOffset, int endOffset);
|
---|
154 | void insertText(int offset, const QString &text);
|
---|
|
---|