1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_MsaaAccessible_h_
8 #define mozilla_a11y_MsaaAccessible_h_
10 #include "ia2Accessible.h"
11 #include "ia2AccessibleComponent.h"
12 #include "ia2AccessibleHyperlink.h"
13 #include "ia2AccessibleValue.h"
14 #include "IUnknownImpl.h"
15 #include "MsaaIdGenerator.h"
16 #include "nsXULAppAPI.h"
17 #include "uiaRawElmProvider.h"
23 class LocalAccessible
;
26 class MsaaAccessible
: public ia2Accessible
,
27 public ia2AccessibleComponent
,
28 public ia2AccessibleHyperlink
,
29 public ia2AccessibleValue
,
30 public uiaRawElmProvider
{
32 static MsaaAccessible
* Create(Accessible
* aAcc
);
34 Accessible
* Acc() const { return mAcc
; }
35 AccessibleWrap
* LocalAcc();
37 uint32_t GetExistingID() const { return mID
; }
38 static const uint32_t kNoID
= 0;
40 static int32_t GetChildIDFor(Accessible
* aAccessible
);
41 static void AssignChildIDTo(NotNull
<sdnAccessible
*> aSdnAcc
);
42 static void ReleaseChildID(NotNull
<sdnAccessible
*> aSdnAcc
);
43 static HWND
GetHWNDFor(Accessible
* aAccessible
);
44 static void FireWinEvent(Accessible
* aTarget
, uint32_t aEventType
);
47 * Find an accessible by the given child ID in cached documents.
49 [[nodiscard
]] already_AddRefed
<IAccessible
> GetIAccessibleFor(
50 const VARIANT
& aVarChild
, bool* aIsDefunct
);
54 static IDispatch
* NativeAccessible(Accessible
* aAccessible
);
56 static MsaaAccessible
* GetFrom(Accessible
* aAcc
);
59 * Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it.
61 static ITypeInfo
* GetTI(LCID lcid
);
63 static Accessible
* GetAccessibleFrom(IUnknown
* aUnknown
);
68 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accParent(
69 /* [retval][out] */ IDispatch __RPC_FAR
* __RPC_FAR
* ppdispParent
)
71 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accChildCount(
72 /* [retval][out] */ long __RPC_FAR
* pcountChildren
) override
;
73 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accChild(
74 /* [in] */ VARIANT varChild
,
75 /* [retval][out] */ IDispatch __RPC_FAR
* __RPC_FAR
* ppdispChild
) override
;
76 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accName(
77 /* [optional][in] */ VARIANT varChild
,
78 /* [retval][out] */ BSTR __RPC_FAR
* pszName
) override
;
79 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accValue(
80 /* [optional][in] */ VARIANT varChild
,
81 /* [retval][out] */ BSTR __RPC_FAR
* pszValue
) override
;
82 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accDescription(
83 /* [optional][in] */ VARIANT varChild
,
84 /* [retval][out] */ BSTR __RPC_FAR
* pszDescription
) override
;
85 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accRole(
86 /* [optional][in] */ VARIANT varChild
,
87 /* [retval][out] */ VARIANT __RPC_FAR
* pvarRole
) override
;
88 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accState(
89 /* [optional][in] */ VARIANT varChild
,
90 /* [retval][out] */ VARIANT __RPC_FAR
* pvarState
) override
;
91 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accHelp(
92 /* [optional][in] */ VARIANT varChild
,
93 /* [retval][out] */ BSTR __RPC_FAR
* pszHelp
) override
;
94 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accHelpTopic(
95 /* [out] */ BSTR __RPC_FAR
* pszHelpFile
,
96 /* [optional][in] */ VARIANT varChild
,
97 /* [retval][out] */ long __RPC_FAR
* pidTopic
) override
;
98 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accKeyboardShortcut(
99 /* [optional][in] */ VARIANT varChild
,
100 /* [retval][out] */ BSTR __RPC_FAR
* pszKeyboardShortcut
) override
;
101 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accFocus(
102 /* [retval][out] */ VARIANT __RPC_FAR
* pvarChild
) override
;
103 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accSelection(
104 /* [retval][out] */ VARIANT __RPC_FAR
* pvarChildren
) override
;
105 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE
get_accDefaultAction(
106 /* [optional][in] */ VARIANT varChild
,
107 /* [retval][out] */ BSTR __RPC_FAR
* pszDefaultAction
) override
;
108 virtual /* [id] */ HRESULT STDMETHODCALLTYPE
accSelect(
109 /* [in] */ long flagsSelect
,
110 /* [optional][in] */ VARIANT varChild
) override
;
111 virtual /* [id] */ HRESULT STDMETHODCALLTYPE
accLocation(
112 /* [out] */ long __RPC_FAR
* pxLeft
,
113 /* [out] */ long __RPC_FAR
* pyTop
,
114 /* [out] */ long __RPC_FAR
* pcxWidth
,
115 /* [out] */ long __RPC_FAR
* pcyHeight
,
116 /* [optional][in] */ VARIANT varChild
) override
;
117 virtual /* [id] */ HRESULT STDMETHODCALLTYPE
accNavigate(
118 /* [in] */ long navDir
,
119 /* [optional][in] */ VARIANT varStart
,
120 /* [retval][out] */ VARIANT __RPC_FAR
* pvarEndUpAt
) override
;
121 virtual /* [id] */ HRESULT STDMETHODCALLTYPE
accHitTest(
122 /* [in] */ long xLeft
,
123 /* [in] */ long yTop
,
124 /* [retval][out] */ VARIANT __RPC_FAR
* pvarChild
) override
;
125 virtual /* [id] */ HRESULT STDMETHODCALLTYPE
accDoDefaultAction(
126 /* [optional][in] */ VARIANT varChild
) override
;
127 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE
put_accName(
128 /* [optional][in] */ VARIANT varChild
,
129 /* [in] */ BSTR szName
) override
;
130 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE
put_accValue(
131 /* [optional][in] */ VARIANT varChild
,
132 /* [in] */ BSTR szValue
) override
;
134 // IDispatch (support of scripting languages like VB)
135 virtual HRESULT STDMETHODCALLTYPE
GetTypeInfoCount(UINT
* pctinfo
) override
;
136 virtual HRESULT STDMETHODCALLTYPE
GetTypeInfo(UINT iTInfo
, LCID lcid
,
137 ITypeInfo
** ppTInfo
) override
;
138 virtual HRESULT STDMETHODCALLTYPE
GetIDsOfNames(REFIID riid
,
140 UINT cNames
, LCID lcid
,
141 DISPID
* rgDispId
) override
;
142 virtual HRESULT STDMETHODCALLTYPE
Invoke(DISPID dispIdMember
, REFIID riid
,
143 LCID lcid
, WORD wFlags
,
144 DISPPARAMS
* pDispParams
,
146 EXCEPINFO
* pExcepInfo
,
147 UINT
* puArgErr
) override
;
149 // UIA's IInvokeProvider has a method called Invoke too, but it's fine because
150 // it accepts very different parameters.
151 using uiaRawElmProvider::Invoke
;
154 explicit MsaaAccessible(Accessible
* aAcc
);
155 virtual ~MsaaAccessible();
160 static MsaaIdGenerator sIDGen
;
163 ResolveChild(const VARIANT
& aVarChild
, IAccessible
** aOutInterface
);
166 NAVRELATION_CONTROLLED_BY
= 0x1000,
167 NAVRELATION_CONTROLLER_FOR
= 0x1001,
168 NAVRELATION_LABEL_FOR
= 0x1002,
169 NAVRELATION_LABELLED_BY
= 0x1003,
170 NAVRELATION_MEMBER_OF
= 0x1004,
171 NAVRELATION_NODE_CHILD_OF
= 0x1005,
172 NAVRELATION_FLOWS_TO
= 0x1006,
173 NAVRELATION_FLOWS_FROM
= 0x1007,
174 NAVRELATION_SUBWINDOW_OF
= 0x1008,
175 NAVRELATION_EMBEDS
= 0x1009,
176 NAVRELATION_EMBEDDED_BY
= 0x100a,
177 NAVRELATION_POPUP_FOR
= 0x100b,
178 NAVRELATION_PARENT_WINDOW_OF
= 0x100c,
179 NAVRELATION_DEFAULT_BUTTON
= 0x100d,
180 NAVRELATION_DESCRIBED_BY
= 0x100e,
181 NAVRELATION_DESCRIPTION_FOR
= 0x100f,
182 NAVRELATION_NODE_PARENT_OF
= 0x1010,
183 NAVRELATION_CONTAINING_DOCUMENT
= 0x1011,
184 NAVRELATION_CONTAINING_TAB_PANE
= 0x1012,
185 NAVRELATION_CONTAINING_WINDOW
= 0x1013,
186 NAVRELATION_CONTAINING_APPLICATION
= 0x1014,
187 NAVRELATION_DETAILS
= 0x1015,
188 NAVRELATION_DETAILS_FOR
= 0x1016,
189 NAVRELATION_ERROR
= 0x1017,
190 NAVRELATION_ERROR_FOR
= 0x1018,
191 NAVRELATION_LINKS_TO
= 0x1019
195 static ITypeInfo
* gTypeInfo
;
199 } // namespace mozilla
202 // Undo the windows.h damage
206 # undef GetBinaryType
207 # undef RemoveDirectory