Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
atspiadaptor_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef ATSPIADAPTOR_H
6#define ATSPIADAPTOR_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <atspi/atspi.h>
20
21#include <QtGui/private/qtguiglobal_p.h>
22#include <QtDBus/qdbusvirtualobject.h>
23#include <QtGui/qaccessible.h>
24
28
30
31QT_BEGIN_NAMESPACE
32
33class QAccessibleInterface;
34class QSpiApplicationAdaptor;
35
36
38{
40
41public:
44
46 QString introspect(const QString &path) const override;
47 bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override;
48 void notify(QAccessibleEvent *event);
49
50 static QSpiAttributeSet getAttributes(QAccessibleInterface *);
51 static QStringList accessibleInterfaces(QAccessibleInterface *interface);
52 static AtspiRole getRole(QAccessibleInterface *interface);
53
54public Q_SLOTS:
56 void eventListenerDeregistered(const QString &bus, const QString &path);
57 void windowActivated(QObject* window, bool active);
58
59private:
60 void updateEventListeners();
61 void setBitFlag(const QString &flag);
62
63 // sending messages
64 static QVariantList packDBusSignalArguments(const QString &type, int data1, int data2, const QVariant &variantData);
65 bool sendDBusSignal(const QString &path, const QString &interface, const QString &name, const QVariantList &arguments) const;
66 QVariant variantForPath(const QString &path) const;
67
68 void sendFocusChanged(QAccessibleInterface *interface) const;
69 void notifyAboutCreation(QAccessibleInterface *interface) const;
70 void notifyAboutDestruction(QAccessibleInterface *interface) const;
71 void childrenChanged(QAccessibleInterface *interface) const;
72
73 // handlers for the different accessible interfaces
74 bool applicationInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
75 bool accessibleInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
76 bool collectionInterface(QAccessibleInterface *interface, const QString &function,
77 const QDBusMessage &message, const QDBusConnection &connection);
78 bool componentInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
79 bool actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
80 bool textInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
81 bool editableTextInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
82 bool valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
83 bool selectionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
84 bool tableInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
85 bool tableCellInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection);
86
87 void sendReply(const QDBusConnection &connection, const QDBusMessage &message, const QVariant &argument) const;
88
89 static QAccessibleInterface *interfaceFromPath(const QString &dbusPath);
90 static QString pathForInterface(QAccessibleInterface *interface);
91 static QString pathForObject(QObject *object);
92
93 void notifyStateChange(QAccessibleInterface *interface, const QString& state, int value);
94
95 void sendAnnouncement(QAccessibleAnnouncementEvent *event);
96
97 // accessible helper function
98 static QSpiRelationArray relationSet(QAccessibleInterface *interface,
99 const QDBusConnection &connection);
100
101 // component helper functions
102 static QRect getExtents(QAccessibleInterface *interface, uint coordType);
103 static bool isValidCoordType(uint coordType);
104 static QRect translateFromScreenCoordinates(QAccessibleInterface *interface, const QRect &rect, uint targetCoordType);
105 static QPoint translateToScreenCoordinates(QAccessibleInterface *interface, const QPoint &pos, uint fromCoordType);
106
107 // action helper functions
108 QSpiActionArray getActions(QAccessibleInterface *interface) const;
109
110 // text helper functions
111 static QVariantList getAttributes(QAccessibleInterface *, int offset, bool includeDefaults);
112 static QString getAttributeValue(QAccessibleInterface *, int offset,
113 const QString &attributeName);
114 static QList<QVariant> getCharacterExtents(QAccessibleInterface *, int offset, uint coordType);
115 static QList<QVariant> getRangeExtents(QAccessibleInterface *, int startOffset, int endOffset,
116 uint coordType);
117 static QAccessible::TextBoundaryType qAccessibleBoundaryTypeFromAtspiBoundaryType(int atspiTextBoundaryType);
118 static bool isValidAtspiTextGranularity(uint coordType);
119 static QAccessible::TextBoundaryType qAccessibleBoundaryTypeFromAtspiTextGranularity(uint atspiTextGranularity);
120 static bool inheritsQAction(QObject *object);
121
122 // collection helper function
123 static void addMatchingDescendants(QList<QAccessibleInterface *> &matches,
124 QAccessibleInterface *accessible,
125 const QSpiMatchRuleMatcher &matcher, bool invert, int count,
126 bool traverse);
127
128 // private vars
129 QSpiObjectReference m_accessibilityRegistry;
130 QAtSpiDBusConnection *m_dbus;
131 QSpiApplicationAdaptor *m_applicationAdaptor;
132
133 /// Assigned from the accessibility registry.
134 int m_applicationId;
135
136 // Bit fields - which updates to send
137
138 // AT-SPI has some events that we do not care about:
139 // document
140 // document-load-complete
141 // document-load-stopped
142 // document-reload
143 uint sendFocus : 1;
144 // mouse abs/rel/button
145
146 // all of object
147 uint sendObject : 1;
148 uint sendObject_active_descendant_changed : 1;
149 uint sendObject_announcement : 1;
150 uint sendObject_attributes_changed : 1;
151 uint sendObject_bounds_changed : 1;
152 uint sendObject_children_changed : 1;
153// uint sendObject_children_changed_add : 1;
154// uint sendObject_children_changed_remove : 1;
155 uint sendObject_column_deleted : 1;
156 uint sendObject_column_inserted : 1;
157 uint sendObject_column_reordered : 1;
158 uint sendObject_link_selected : 1;
159 uint sendObject_model_changed : 1;
160 uint sendObject_property_change : 1;
161 uint sendObject_property_change_accessible_description : 1;
162 uint sendObject_property_change_accessible_name : 1;
163 uint sendObject_property_change_accessible_parent : 1;
164 uint sendObject_property_change_accessible_role : 1;
165 uint sendObject_property_change_accessible_table_caption : 1;
166 uint sendObject_property_change_accessible_table_column_description : 1;
167 uint sendObject_property_change_accessible_table_column_header : 1;
168 uint sendObject_property_change_accessible_table_row_description : 1;
169 uint sendObject_property_change_accessible_table_row_header : 1;
170 uint sendObject_property_change_accessible_table_summary : 1;
171 uint sendObject_property_change_accessible_value : 1;
172 uint sendObject_row_deleted : 1;
173 uint sendObject_row_inserted : 1;
174 uint sendObject_row_reordered : 1;
175 uint sendObject_selection_changed : 1;
176 uint sendObject_state_changed : 1;
177 uint sendObject_text_attributes_changed : 1;
178 uint sendObject_text_bounds_changed : 1;
179 uint sendObject_text_caret_moved : 1;
180 uint sendObject_text_changed : 1;
181// uint sendObject_text_changed_delete : 1;
182// uint sendObject_text_changed_insert : 1;
183 uint sendObject_text_selection_changed : 1;
184 uint sendObject_value_changed : 1;
185 uint sendObject_visible_data_changed : 1;
186
187 // we don't implement terminal
188 // terminal-application_changed/charwidth_changed/columncount_changed/line_changed/linecount_changed
189 uint sendWindow : 1;
190 uint sendWindow_activate : 1;
191 uint sendWindow_close: 1;
192 uint sendWindow_create : 1;
193 uint sendWindow_deactivate : 1;
194// uint sendWindow_desktop_create : 1;
195// uint sendWindow_desktop_destroy : 1;
196 uint sendWindow_lower : 1;
197 uint sendWindow_maximize : 1;
198 uint sendWindow_minimize : 1;
199 uint sendWindow_move : 1;
200 uint sendWindow_raise : 1;
201 uint sendWindow_reparent : 1;
202 uint sendWindow_resize : 1;
203 uint sendWindow_restore : 1;
204 uint sendWindow_restyle : 1;
205 uint sendWindow_shade : 1;
206 uint sendWindow_unshade : 1;
207};
208
209QT_END_NAMESPACE
210
211#endif
QString introspect(const QString &path) const override
This function needs to handle the introspection of the virtual object on path.
static QStringList accessibleInterfaces(QAccessibleInterface *interface)
static QSpiAttributeSet getAttributes(QAccessibleInterface *)
void notify(QAccessibleEvent *event)
void windowActivated(QObject *window, bool active)
void registerApplication()
void eventListenerDeregistered(const QString &bus, const QString &path)
static AtspiRole getRole(QAccessibleInterface *interface)
bool handleMessage(const QDBusMessage &message, const QDBusConnection &connection) override
This function needs to handle all messages to the path of the virtual object, when the SubPath option...
Connects to the accessibility dbus.
QT_REQUIRE_CONFIG(thread)
QMap< QString, QString > QSpiAttributeSet
QList< QSpiRelationArrayEntry > QSpiRelationArray
QList< QSpiAction > QSpiActionArray