Bug 453883, ensure true/false marcos are available, r=joshmoz, sr=jst
[wine-gecko.git] / accessible / src / msaa / nsAccessNodeWrap.h
blobb8bb7838406147d1bb6fd73ebce057686792e959
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2003
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Original Author: Aaron Leventhal (aaronl@netscape.com)
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 /* For documentation of the accessibility architecture,
40 * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
43 #ifndef _nsAccessNodeWrap_H_
44 #define _nsAccessNodeWrap_H_
46 // Avoid warning C4509:
47 // nonstandard extension used: 'nsAccessibleWrap::[methodname]'
48 // uses SEH and 'xpAccessible' has destructor
49 // At this point we're catching a crash which is of much greater
50 // importance than the missing dereference for the nsCOMPtr<>
51 #pragma warning( disable : 4509 )
53 #include "nsCOMPtr.h"
54 #include "nsIAccessible.h"
55 #include "nsIAccessibleEvent.h"
56 #include "nsIWinAccessNode.h"
57 #include "ISimpleDOMNode.h"
58 #include "nsIDOMElement.h"
59 #include "nsIContent.h"
60 #include "nsAccessNode.h"
61 #include "OLEIDL.H"
62 #include "OLEACC.H"
63 #include <winuser.h>
64 #ifndef WINABLEAPI
65 #include <winable.h>
66 #endif
67 #ifdef MOZ_CRASHREPORTER
68 #include "nsICrashReporter.h"
69 #endif
71 typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
72 typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
74 class nsAccessNodeWrap : public nsAccessNode,
75 public nsIWinAccessNode,
76 public ISimpleDOMNode,
77 public IServiceProvider
79 public:
80 NS_DECL_ISUPPORTS_INHERITED
81 NS_DECL_NSIWINACCESSNODE
83 public: // IServiceProvider
84 STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
86 public: // construction, destruction
87 nsAccessNodeWrap(nsIDOMNode *, nsIWeakReference* aShell);
88 virtual ~nsAccessNodeWrap();
90 // IUnknown
91 STDMETHODIMP QueryInterface(REFIID, void**);
93 public:
95 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nodeInfo(
96 /* [out] */ BSTR __RPC_FAR *tagName,
97 /* [out] */ short __RPC_FAR *nameSpaceID,
98 /* [out] */ BSTR __RPC_FAR *nodeValue,
99 /* [out] */ unsigned int __RPC_FAR *numChildren,
100 /* [out] */ unsigned int __RPC_FAR *aUniqueID,
101 /* [out][retval] */ unsigned short __RPC_FAR *nodeType);
103 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_attributes(
104 /* [in] */ unsigned short maxAttribs,
105 /* [length_is][size_is][out] */ BSTR __RPC_FAR *attribNames,
106 /* [length_is][size_is][out] */ short __RPC_FAR *nameSpaceID,
107 /* [length_is][size_is][out] */ BSTR __RPC_FAR *attribValues,
108 /* [out][retval] */ unsigned short __RPC_FAR *numAttribs);
110 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_attributesForNames(
111 /* [in] */ unsigned short maxAttribs,
112 /* [length_is][size_is][in] */ BSTR __RPC_FAR *attribNames,
113 /* [length_is][size_is][in] */ short __RPC_FAR *nameSpaceID,
114 /* [length_is][size_is][retval] */ BSTR __RPC_FAR *attribValues);
116 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_computedStyle(
117 /* [in] */ unsigned short maxStyleProperties,
118 /* [in] */ boolean useAlternateView,
119 /* [length_is][size_is][out] */ BSTR __RPC_FAR *styleProperties,
120 /* [length_is][size_is][out] */ BSTR __RPC_FAR *styleValues,
121 /* [out][retval] */ unsigned short __RPC_FAR *numStyleProperties);
123 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_computedStyleForProperties(
124 /* [in] */ unsigned short numStyleProperties,
125 /* [in] */ boolean useAlternateView,
126 /* [length_is][size_is][in] */ BSTR __RPC_FAR *styleProperties,
127 /* [length_is][size_is][out][retval] */ BSTR __RPC_FAR *styleValues);
129 virtual HRESULT STDMETHODCALLTYPE scrollTo(/* [in] */ boolean scrollTopLeft);
131 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_parentNode(ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
132 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_firstChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
133 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_lastChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
134 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_previousSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
135 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nextSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
136 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_childAt(unsigned childIndex,
137 ISimpleDOMNode __RPC_FAR *__RPC_FAR *node);
139 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_innerHTML(
140 /* [out][retval] */ BSTR __RPC_FAR *innerHTML);
142 virtual /* [local][propget] */ HRESULT STDMETHODCALLTYPE get_localInterface(
143 /* [retval][out] */ void __RPC_FAR *__RPC_FAR *localInterface);
145 virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_language(
146 /* [out][retval] */ BSTR __RPC_FAR *language);
148 static void InitAccessibility();
149 static void ShutdownAccessibility();
151 /// the accessible library and cached methods
152 static HINSTANCE gmAccLib;
153 static HINSTANCE gmUserLib;
154 static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
155 static LPFNNOTIFYWINEVENT gmNotifyWinEvent;
156 static LPFNGETGUITHREADINFO gmGetGUIThreadInfo;
158 static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
160 static PRBool IsOnlyMsaaCompatibleJawsPresent();
162 static void TurnOffNewTabSwitchingForJawsAndWE();
164 static void DoATSpecificProcessing();
165 protected:
166 void GetAccessibleFor(nsIDOMNode *node, nsIAccessible **newAcc);
167 ISimpleDOMNode* MakeAccessNode(nsIDOMNode *node);
169 static PRBool gIsEnumVariantSupportDisabled;
172 * Used to determine whether an IAccessible2 compatible screen reader is
173 * loaded. Currently used for JAWS versions older than 8.0.2173.
175 static PRBool gIsIA2Disabled;
178 * It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
179 * implementation.
181 static nsIAccessibleTextChangeEvent *gTextEvent;
185 * Converts nsresult to HRESULT.
187 HRESULT GetHRESULT(nsresult aResult);
189 #endif