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/. */
6 
7 #ifndef mozilla_a11y_ia2Accessible_h_
8 #define mozilla_a11y_ia2Accessible_h_
9 
10 #include "nsISupports.h"
11 
12 #include "Accessible2_3.h"
13 
14 namespace mozilla {
15 namespace a11y {
16 class Attribute;
17 
18 class ia2Accessible : public IAccessible2_3
19 {
20 public:
21 
22   // IUnknown
23   STDMETHODIMP QueryInterface(REFIID, void**);
24 
25   // IAccessible2
26   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nRelations(
27     /* [retval][out] */ long* nRelations);
28 
29   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relation(
30     /* [in] */ long relationIndex,
31     /* [retval][out] */ IAccessibleRelation** relation);
32 
33   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relations(
34     /* [in] */ long maxRelations,
35     /* [length_is][size_is][out] */ IAccessibleRelation** relation,
36     /* [retval][out] */ long* nRelations);
37 
38   virtual HRESULT STDMETHODCALLTYPE role(
39     /* [retval][out] */ long* role);
40 
41   virtual HRESULT STDMETHODCALLTYPE scrollTo(
42     /* [in] */ enum IA2ScrollType scrollType);
43 
44   virtual HRESULT STDMETHODCALLTYPE scrollToPoint(
45     /* [in] */ enum IA2CoordinateType coordinateType,
46     /* [in] */ long x,
47     /* [in] */ long y);
48 
49   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_groupPosition(
50     /* [out] */ long* groupLevel,
51     /* [out] */ long* similarItemsInGroup,
52     /* [retval][out] */ long* positionInGroup);
53 
54   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_states(
55     /* [retval][out] */ AccessibleStates* states);
56 
57   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_extendedRole(
58     /* [retval][out] */ BSTR* extendedRole);
59 
60   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedExtendedRole(
61     /* [retval][out] */ BSTR* localizedExtendedRole);
62 
63   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nExtendedStates(
64     /* [retval][out] */ long* nExtendedStates);
65 
66   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_extendedStates(
67     /* [in] */ long maxExtendedStates,
68     /* [length_is][length_is][size_is][size_is][out] */ BSTR** extendedStates,
69     /* [retval][out] */ long* nExtendedStates);
70 
71   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_localizedExtendedStates(
72     /* [in] */ long maxLocalizedExtendedStates,
73     /* [length_is][length_is][size_is][size_is][out] */ BSTR** localizedExtendedStates,
74     /* [retval][out] */ long* nLocalizedExtendedStates);
75 
76   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_uniqueID(
77     /* [retval][out] */ long* uniqueID);
78 
79   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_windowHandle(
80     /* [retval][out] */ HWND* windowHandle);
81 
82   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_indexInParent(
83     /* [retval][out] */ long* indexInParent);
84 
85   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_locale(
86     /* [retval][out] */ IA2Locale* locale);
87 
88   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
89     /* [retval][out] */ BSTR* attributes);
90 
91   // IAccessible2_2
92   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_attribute(
93     /* [in] */ BSTR name,
94     /* [out, retval] */ VARIANT* attribute);
95 
96   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_accessibleWithCaret(
97     /* [out] */ IUnknown** accessible,
98     /* [out, retval] */ long* caretOffset);
99 
100   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationTargetsOfType(
101     /* [in] */ BSTR type,
102     /* [in] */ long maxTargets,
103     /* [out, size_is(,*nTargets)] */ IUnknown*** targets,
104     /* [out, retval] */ long* nTargets
105   );
106 
107   // IAccessible2_3
108   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectionRanges(
109     /* [out, size_is(,*nRanges)] */ IA2Range** ranges,
110     /* [out, retval] */ long *nRanges);
111 
112   // Helper method
113   static HRESULT ConvertToIA2Attributes(nsIPersistentProperties* aAttributes,
114                                         BSTR* aIA2Attributes);
115   static HRESULT ConvertToIA2Attributes(nsTArray<Attribute>* aAttributes,
116                                         BSTR* aIA2Attributes);
117 };
118 
119 } // namespace a11y
120 } // namespace mozilla
121 
122 #endif
123