michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_a11y_AccessibleWrap_h_ michael@0: #define mozilla_a11y_AccessibleWrap_h_ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "Accessible.h" michael@0: #include "Accessible2.h" michael@0: #include "ia2Accessible.h" michael@0: #include "ia2AccessibleComponent.h" michael@0: #include "ia2AccessibleHyperlink.h" michael@0: #include "ia2AccessibleValue.h" michael@0: michael@0: #ifdef __GNUC__ michael@0: // Inheriting from both XPCOM and MSCOM interfaces causes a lot of warnings michael@0: // about virtual functions being hidden by each other. This is done by michael@0: // design, so silence the warning. michael@0: #pragma GCC diagnostic ignored "-Woverloaded-virtual" michael@0: #endif michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class AccessibleWrap : public Accessible, michael@0: public ia2Accessible, michael@0: public ia2AccessibleComponent, michael@0: public ia2AccessibleHyperlink, michael@0: public ia2AccessibleValue michael@0: { michael@0: public: // construction, destruction michael@0: AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : michael@0: Accessible(aContent, aDoc) { } michael@0: virtual ~AccessibleWrap() { } michael@0: michael@0: // nsISupports michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: public: // IUnknown methods - see iunknown.h for documentation michael@0: STDMETHODIMP QueryInterface(REFIID, void**); michael@0: michael@0: // Return the registered OLE class ID of this object's CfDataObj. michael@0: CLSID GetClassID() const; michael@0: michael@0: public: // COM interface IAccessible michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent( michael@0: /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChildCount( michael@0: /* [retval][out] */ long __RPC_FAR *pcountChildren); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild( michael@0: /* [in] */ VARIANT varChild, michael@0: /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accName( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszName); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszValue); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDescription( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszDescription); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accRole( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarRole); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accState( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarState); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelp( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszHelp); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelpTopic( michael@0: /* [out] */ BSTR __RPC_FAR *pszHelpFile, michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ long __RPC_FAR *pidTopic); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus( michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarChild); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accSelection( michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarChildren); michael@0: michael@0: virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDefaultAction( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction); michael@0: michael@0: virtual /* [id] */ HRESULT STDMETHODCALLTYPE accSelect( michael@0: /* [in] */ long flagsSelect, michael@0: /* [optional][in] */ VARIANT varChild); michael@0: michael@0: virtual /* [id] */ HRESULT STDMETHODCALLTYPE accLocation( michael@0: /* [out] */ long __RPC_FAR *pxLeft, michael@0: /* [out] */ long __RPC_FAR *pyTop, michael@0: /* [out] */ long __RPC_FAR *pcxWidth, michael@0: /* [out] */ long __RPC_FAR *pcyHeight, michael@0: /* [optional][in] */ VARIANT varChild); michael@0: michael@0: virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate( michael@0: /* [in] */ long navDir, michael@0: /* [optional][in] */ VARIANT varStart, michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt); michael@0: michael@0: virtual /* [id] */ HRESULT STDMETHODCALLTYPE accHitTest( michael@0: /* [in] */ long xLeft, michael@0: /* [in] */ long yTop, michael@0: /* [retval][out] */ VARIANT __RPC_FAR *pvarChild); michael@0: michael@0: virtual /* [id] */ HRESULT STDMETHODCALLTYPE accDoDefaultAction( michael@0: /* [optional][in] */ VARIANT varChild); michael@0: michael@0: virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accName( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [in] */ BSTR szName); michael@0: michael@0: virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accValue( michael@0: /* [optional][in] */ VARIANT varChild, michael@0: /* [in] */ BSTR szValue); michael@0: michael@0: // IDispatch (support of scripting languages like VB) michael@0: virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, michael@0: ITypeInfo **ppTInfo); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, michael@0: LPOLESTR *rgszNames, michael@0: UINT cNames, michael@0: LCID lcid, michael@0: DISPID *rgDispId); michael@0: michael@0: virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, michael@0: LCID lcid, WORD wFlags, michael@0: DISPPARAMS *pDispParams, michael@0: VARIANT *pVarResult, michael@0: EXCEPINFO *pExcepInfo, michael@0: UINT *puArgErr); michael@0: michael@0: // Accessible michael@0: virtual nsresult HandleAccEvent(AccEvent* aEvent); michael@0: michael@0: // Helper methods michael@0: static int32_t GetChildIDFor(Accessible* aAccessible); michael@0: static HWND GetHWNDFor(Accessible* aAccessible); michael@0: michael@0: /** michael@0: * System caret support: update the Windows caret position. michael@0: * The system caret works more universally than the MSAA caret michael@0: * For example, Window-Eyes, JAWS, ZoomText and Windows Tablet Edition use it michael@0: * We will use an invisible system caret. michael@0: * Gecko is still responsible for drawing its own caret michael@0: */ michael@0: void UpdateSystemCaretFor(Accessible* aAccessible); michael@0: michael@0: /** michael@0: * Find an accessible by the given child ID in cached documents. michael@0: */ michael@0: Accessible* GetXPAccessibleFor(const VARIANT& aVarChild); michael@0: michael@0: NS_IMETHOD GetNativeInterface(void **aOutAccessible); michael@0: michael@0: static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible); michael@0: michael@0: protected: michael@0: michael@0: /** michael@0: * Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it. michael@0: */ michael@0: static ITypeInfo* GetTI(LCID lcid); michael@0: michael@0: static ITypeInfo* gTypeInfo; michael@0: michael@0: michael@0: enum navRelations { michael@0: NAVRELATION_CONTROLLED_BY = 0x1000, michael@0: NAVRELATION_CONTROLLER_FOR = 0x1001, michael@0: NAVRELATION_LABEL_FOR = 0x1002, michael@0: NAVRELATION_LABELLED_BY = 0x1003, michael@0: NAVRELATION_MEMBER_OF = 0x1004, michael@0: NAVRELATION_NODE_CHILD_OF = 0x1005, michael@0: NAVRELATION_FLOWS_TO = 0x1006, michael@0: NAVRELATION_FLOWS_FROM = 0x1007, michael@0: NAVRELATION_SUBWINDOW_OF = 0x1008, michael@0: NAVRELATION_EMBEDS = 0x1009, michael@0: NAVRELATION_EMBEDDED_BY = 0x100a, michael@0: NAVRELATION_POPUP_FOR = 0x100b, michael@0: NAVRELATION_PARENT_WINDOW_OF = 0x100c, michael@0: NAVRELATION_DEFAULT_BUTTON = 0x100d, michael@0: NAVRELATION_DESCRIBED_BY = 0x100e, michael@0: NAVRELATION_DESCRIPTION_FOR = 0x100f, michael@0: NAVRELATION_NODE_PARENT_OF = 0x1010, michael@0: NAVRELATION_CONTAINING_DOCUMENT = 0x1011, michael@0: NAVRELATION_CONTAINING_TAB_PANE = 0x1012, michael@0: NAVRELATION_CONTAINING_APPLICATION = 0x1014 michael@0: }; michael@0: }; michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: #ifdef XP_WIN michael@0: // Undo the windows.h damage michael@0: #undef GetMessage michael@0: #undef CreateEvent michael@0: #undef GetClassName michael@0: #undef GetBinaryType michael@0: #endif michael@0: michael@0: #endif