| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | // |
| 41 | // W A R N I N G |
| 42 | // ------------- |
| 43 | // |
| 44 | // This file is not part of the Qt API. It exists purely as an |
| 45 | // implementation detail. This header file may change from version to |
| 46 | // version without notice, or even be removed. |
| 47 | // |
| 48 | // We mean it. |
| 49 | // |
| 50 | |
| 51 | /* |
| 52 | * This file contains AT-SPI constants and mappings between QAccessible |
| 53 | * and AT-SPI constants such as 'role' and 'state' enumerations. |
| 54 | */ |
| 55 | |
| 56 | #ifndef Q_SPI_CONSTANT_MAPPINGS_H |
| 57 | #define Q_SPI_CONSTANT_MAPPINGS_H |
| 58 | |
| 59 | #include "struct_marshallers_p.h" |
| 60 | |
| 61 | #include <QtGui/private/qtguiglobal_p.h> |
| 62 | #include <QtGui/QAccessible> |
| 63 | #include <atspi/atspi-constants.h> |
| 64 | |
| 65 | QT_REQUIRE_CONFIG(accessibility); |
| 66 | |
| 67 | // interface names from at-spi2-core/atspi/atspi-misc-private.h |
| 68 | #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" |
| 69 | #define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry" |
| 70 | #define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry" |
| 71 | |
| 72 | #define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root" |
| 73 | |
| 74 | #define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller" |
| 75 | #define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController" |
| 76 | #define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener" |
| 77 | |
| 78 | #define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache" |
| 79 | #define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible" |
| 80 | #define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action" |
| 81 | #define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application" |
| 82 | #define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection" |
| 83 | #define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component" |
| 84 | #define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document" |
| 85 | #define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText" |
| 86 | #define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard" |
| 87 | #define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse" |
| 88 | #define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object" |
| 89 | #define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink" |
| 90 | #define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext" |
| 91 | #define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image" |
| 92 | #define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection" |
| 93 | #define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table" |
| 94 | #define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text" |
| 95 | #define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value" |
| 96 | #define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket" |
| 97 | |
| 98 | // missing from at-spi2-core: |
| 99 | #define ATSPI_DBUS_INTERFACE_EVENT_WINDOW "org.a11y.atspi.Event.Window" |
| 100 | #define ATSPI_DBUS_INTERFACE_EVENT_FOCUS "org.a11y.atspi.Event.Focus" |
| 101 | |
| 102 | #define QSPI_OBJECT_PATH_ACCESSIBLE "/org/a11y/atspi/accessible" |
| 103 | #define QSPI_OBJECT_PATH_PREFIX "/org/a11y/atspi/accessible/" |
| 104 | #define QSPI_OBJECT_PATH_ROOT QSPI_OBJECT_PATH_PREFIX "root" |
| 105 | |
| 106 | #define QSPI_REGISTRY_NAME "org.a11y.atspi.Registry" |
| 107 | |
| 108 | QT_BEGIN_NAMESPACE |
| 109 | |
| 110 | struct RoleNames { |
| 111 | RoleNames() {} |
| 112 | RoleNames(AtspiRole r, const QString& n, const QString& ln) |
| 113 | :m_spiRole(r), m_name(n), m_localizedName(ln) |
| 114 | {} |
| 115 | |
| 116 | AtspiRole spiRole() const {return m_spiRole;} |
| 117 | QString name() const {return m_name;} |
| 118 | QString localizedName() const {return m_localizedName;} |
| 119 | |
| 120 | private: |
| 121 | AtspiRole m_spiRole; |
| 122 | QString m_name; |
| 123 | QString m_localizedName; |
| 124 | }; |
| 125 | |
| 126 | extern QHash <QAccessible::Role, RoleNames> qSpiRoleMapping; |
| 127 | extern QHash <int, AtspiStateType> qSpiStateMapping; |
| 128 | |
| 129 | inline void setSpiStateBit(quint64* state, AtspiStateType spiState) |
| 130 | { |
| 131 | *state |= quint64(1) << spiState; |
| 132 | } |
| 133 | |
| 134 | inline void unsetSpiStateBit(quint64* state, AtspiStateType spiState) |
| 135 | { |
| 136 | *state &= ~(quint64(1) << spiState); |
| 137 | } |
| 138 | |
| 139 | quint64 spiStatesFromQState(QAccessible::State state); |
| 140 | QSpiUIntList spiStateSetFromSpiStates(quint64 states); |
| 141 | |
| 142 | AtspiRelationType qAccessibleRelationToAtSpiRelation(QAccessible::Relation relation); |
| 143 | |
| 144 | QT_END_NAMESPACE |
| 145 | |
| 146 | #endif /* Q_SPI_CONSTANT_MAPPINGS_H */ |
| 147 | |