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
qwindowsuiagriditemprovider.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 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// Qt-Security score:significant reason:default
4
5#include <QtGui/qtguiglobal.h>
6#if QT_CONFIG(accessibility)
7
8#include "qwindowsuiagriditemprovider.h"
9#include "qwindowsuiamainprovider.h"
10#include "qwindowsuiautils.h"
11#include "qwindowscontext.h"
12
13#include <QtGui/qaccessible.h>
14#include <QtCore/qloggingcategory.h>
15#include <QtCore/qstring.h>
16
17QT_BEGIN_NAMESPACE
18
19using namespace QWindowsUiAutomation;
20
21
22QWindowsUiaGridItemProvider::QWindowsUiaGridItemProvider(QAccessible::Id id) :
23 QWindowsUiaBaseProvider(id)
24{
25}
26
27QWindowsUiaGridItemProvider::~QWindowsUiaGridItemProvider()
28{
29}
30
31// Returns the row index of the item.
32HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_Row(int *pRetVal)
33{
34 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
35
36 if (!pRetVal)
37 return E_INVALIDARG;
38 *pRetVal = 0;
39
40 QAccessibleInterface *accessible = accessibleInterface();
41 if (!accessible)
42 return UIA_E_ELEMENTNOTAVAILABLE;
43
44 QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
45 if (!tableCellInterface)
46 return UIA_E_ELEMENTNOTAVAILABLE;
47
48 *pRetVal = tableCellInterface->rowIndex();
49 return S_OK;
50}
51
52// Returns the column index of the item.
53HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_Column(int *pRetVal)
54{
55 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
56
57 if (!pRetVal)
58 return E_INVALIDARG;
59 *pRetVal = 0;
60
61 QAccessibleInterface *accessible = accessibleInterface();
62 if (!accessible)
63 return UIA_E_ELEMENTNOTAVAILABLE;
64
65 QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
66 if (!tableCellInterface)
67 return UIA_E_ELEMENTNOTAVAILABLE;
68
69 *pRetVal = tableCellInterface->columnIndex();
70 return S_OK;
71}
72
73// Returns the number of rows occupied by the item.
74HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_RowSpan(int *pRetVal)
75{
76 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
77
78 if (!pRetVal)
79 return E_INVALIDARG;
80 *pRetVal = 0;
81
82 QAccessibleInterface *accessible = accessibleInterface();
83 if (!accessible)
84 return UIA_E_ELEMENTNOTAVAILABLE;
85
86 QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
87 if (!tableCellInterface)
88 return UIA_E_ELEMENTNOTAVAILABLE;
89
90 *pRetVal = tableCellInterface->rowExtent();
91 return S_OK;
92}
93
94// Returns the number of columns occupied by the item.
95HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_ColumnSpan(int *pRetVal)
96{
97 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
98
99 if (!pRetVal)
100 return E_INVALIDARG;
101 *pRetVal = 0;
102
103 QAccessibleInterface *accessible = accessibleInterface();
104 if (!accessible)
105 return UIA_E_ELEMENTNOTAVAILABLE;
106
107 QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
108 if (!tableCellInterface)
109 return UIA_E_ELEMENTNOTAVAILABLE;
110
111 *pRetVal = tableCellInterface->columnExtent();
112 return S_OK;
113}
114
115// Returns the provider for the containing table/tree.
116HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_ContainingGrid(IRawElementProviderSimple **pRetVal)
117{
118 qCDebug(lcQpaUiAutomation) << __FUNCTION__;
119
120 if (!pRetVal)
121 return E_INVALIDARG;
122 *pRetVal = nullptr;
123
124 QAccessibleInterface *accessible = accessibleInterface();
125 if (!accessible)
126 return UIA_E_ELEMENTNOTAVAILABLE;
127
128 QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
129 if (!tableCellInterface)
130 return UIA_E_ELEMENTNOTAVAILABLE;
131
132 if (QAccessibleInterface *table = tableCellInterface->table()) {
133 *pRetVal = QWindowsUiaMainProvider::providerForAccessible(table).Detach();
134 }
135 return S_OK;
136}
137
138QT_END_NAMESPACE
139
140#endif // QT_CONFIG(accessibility)