[d148f3]: accessible / src / windows / msaa / AccessibleWrap.h Maximize Restore History

Download this file

AccessibleWrap.h    273 lines (209 with data), 10.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_AccessibleWrap_h_
#define mozilla_a11y_AccessibleWrap_h_
#include "nsCOMPtr.h"
#include "Accessible.h"
#include "Accessible2.h"
#include "ia2AccessibleComponent.h"
#include "ia2AccessibleHyperlink.h"
#include "ia2AccessibleValue.h"
namespace mozilla {
namespace a11y {
class AccessibleWrap : public Accessible,
public ia2AccessibleComponent,
public ia2AccessibleHyperlink,
public ia2AccessibleValue,
public IAccessible2
{
public: // construction, destruction
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
Accessible(aContent, aDoc) { }
virtual ~AccessibleWrap() { }
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
public: // IUnknown methods - see iunknown.h for documentation
STDMETHODIMP QueryInterface(REFIID, void**);
// Return the registered OLE class ID of this object's CfDataObj.
CLSID GetClassID() const;
public: // COM interface IAccessible
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChildCount(
/* [retval][out] */ long __RPC_FAR *pcountChildren);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild(
/* [in] */ VARIANT varChild,
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accName(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszName);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDescription(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszDescription);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accRole(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ VARIANT __RPC_FAR *pvarRole);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accState(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ VARIANT __RPC_FAR *pvarState);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelp(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszHelp);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelpTopic(
/* [out] */ BSTR __RPC_FAR *pszHelpFile,
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ long __RPC_FAR *pidTopic);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus(
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accSelection(
/* [retval][out] */ VARIANT __RPC_FAR *pvarChildren);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDefaultAction(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accSelect(
/* [in] */ long flagsSelect,
/* [optional][in] */ VARIANT varChild);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accLocation(
/* [out] */ long __RPC_FAR *pxLeft,
/* [out] */ long __RPC_FAR *pyTop,
/* [out] */ long __RPC_FAR *pcxWidth,
/* [out] */ long __RPC_FAR *pcyHeight,
/* [optional][in] */ VARIANT varChild);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate(
/* [in] */ long navDir,
/* [optional][in] */ VARIANT varStart,
/* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accHitTest(
/* [in] */ long xLeft,
/* [in] */ long yTop,
/* [retval][out] */ VARIANT __RPC_FAR *pvarChild);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE accDoDefaultAction(
/* [optional][in] */ VARIANT varChild);
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accName(
/* [optional][in] */ VARIANT varChild,
/* [in] */ BSTR szName);
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accValue(
/* [optional][in] */ VARIANT varChild,
/* [in] */ BSTR szValue);
public: // IAccessible2
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nRelations(
/* [retval][out] */ long *nRelations);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relation(
/* [in] */ long relationIndex,
/* [retval][out] */ IAccessibleRelation **relation);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relations(
/* [in] */ long maxRelations,
/* [length_is][size_is][out] */ IAccessibleRelation **relation,
/* [retval][out] */ long *nRelations);
virtual HRESULT STDMETHODCALLTYPE role(
/* [retval][out] */ long *role);
virtual HRESULT STDMETHODCALLTYPE scrollTo(
/* [in] */ enum IA2ScrollType scrollType);
virtual HRESULT STDMETHODCALLTYPE scrollToPoint(
/* [in] */ enum IA2CoordinateType coordinateType,
/* [in] */ long x,
/* [in] */ long y);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_groupPosition(
/* [out] */ long *groupLevel,
/* [out] */ long *similarItemsInGroup,
/* [retval][out] */ long *positionInGroup);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_states(
/* [retval][out] */ AccessibleStates *states);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_extendedRole(
/* [retval][out] */ BSTR *extendedRole);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedExtendedRole(
/* [retval][out] */ BSTR *localizedExtendedRole);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nExtendedStates(
/* [retval][out] */ long *nExtendedStates);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_extendedStates(
/* [in] */ long maxExtendedStates,
/* [length_is][length_is][size_is][size_is][out] */ BSTR **extendedStates,
/* [retval][out] */ long *nExtendedStates);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedExtendedStates(
/* [in] */ long maxLocalizedExtendedStates,
/* [length_is][length_is][size_is][size_is][out] */ BSTR **localizedExtendedStates,
/* [retval][out] */ long *nLocalizedExtendedStates);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_uniqueID(
/* [retval][out] */ long *uniqueID);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_windowHandle(
/* [retval][out] */ HWND *windowHandle);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_indexInParent(
/* [retval][out] */ long *indexInParent);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_locale(
/* [retval][out] */ IA2Locale *locale);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
/* [retval][out] */ BSTR *attributes);
// IDispatch (support of scripting languages like VB)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid,
ITypeInfo **ppTInfo);
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId);
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid,
LCID lcid, WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr);
// Accessible
virtual nsresult HandleAccEvent(AccEvent* aEvent);
// Helper methods
static int32_t GetChildIDFor(Accessible* aAccessible);
static HWND GetHWNDFor(Accessible* aAccessible);
static HRESULT ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
BSTR *aIA2Attributes);
/**
* System caret support: update the Windows caret position.
* The system caret works more universally than the MSAA caret
* For example, Window-Eyes, JAWS, ZoomText and Windows Tablet Edition use it
* We will use an invisible system caret.
* Gecko is still responsible for drawing its own caret
*/
void UpdateSystemCaret();
/**
* Find an accessible by the given child ID in cached documents.
*/
Accessible* GetXPAccessibleFor(const VARIANT& aVarChild);
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible);
protected:
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
/**
* Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
*/
static ITypeInfo* GetTI(LCID lcid);
static ITypeInfo* gTypeInfo;
enum navRelations {
NAVRELATION_CONTROLLED_BY = 0x1000,
NAVRELATION_CONTROLLER_FOR = 0x1001,
NAVRELATION_LABEL_FOR = 0x1002,
NAVRELATION_LABELLED_BY = 0x1003,
NAVRELATION_MEMBER_OF = 0x1004,
NAVRELATION_NODE_CHILD_OF = 0x1005,
NAVRELATION_FLOWS_TO = 0x1006,
NAVRELATION_FLOWS_FROM = 0x1007,
NAVRELATION_SUBWINDOW_OF = 0x1008,
NAVRELATION_EMBEDS = 0x1009,
NAVRELATION_EMBEDDED_BY = 0x100a,
NAVRELATION_POPUP_FOR = 0x100b,
NAVRELATION_PARENT_WINDOW_OF = 0x100c,
NAVRELATION_DEFAULT_BUTTON = 0x100d,
NAVRELATION_DESCRIBED_BY = 0x100e,
NAVRELATION_DESCRIPTION_FOR = 0x100f
};
};
} // namespace a11y
} // namespace mozilla
#endif