Back to index

lightning-sunbird  0.9+nobinonly
nsAccessibleWrap.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2003
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Original Author: Aaron Leventhal (aaronl@netscape.com)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 /* For documentation of the accessibility architecture, 
00040  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
00041  */
00042 
00043 #ifndef _nsAccessibleWrap_H_
00044 #define _nsAccessibleWrap_H_
00045 
00046 #include "nsCOMPtr.h"
00047 #include "nsAccessible.h"
00048 
00049 class nsAccessibleWrap : public nsAccessible, 
00050                          public IAccessible,
00051                          public IEnumVARIANT,
00052                          public IServiceProvider
00053 {
00054   public: // construction, destruction
00055     nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
00056     virtual ~nsAccessibleWrap();
00057 
00058   public: // IUnknown methods - see iunknown.h for documentation
00059     STDMETHODIMP_(ULONG) AddRef();
00060     STDMETHODIMP_(ULONG) Release();
00061     STDMETHODIMP QueryInterface(REFIID, void**);
00062 
00063   public: // IServiceProvider
00064     STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv);
00065 
00066   // Return the registered OLE class ID of this object's CfDataObj.
00067     CLSID GetClassID() const;
00068 
00069   public: // COM interface IAccessible
00070     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent( 
00071         /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent);
00072 
00073     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChildCount( 
00074         /* [retval][out] */ long __RPC_FAR *pcountChildren);
00075 
00076     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild( 
00077         /* [in] */ VARIANT varChild,
00078         /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
00079 
00080     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accName( 
00081         /* [optional][in] */ VARIANT varChild,
00082         /* [retval][out] */ BSTR __RPC_FAR *pszName);
00083 
00084     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue( 
00085         /* [optional][in] */ VARIANT varChild,
00086         /* [retval][out] */ BSTR __RPC_FAR *pszValue);
00087 
00088     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDescription( 
00089         /* [optional][in] */ VARIANT varChild,
00090         /* [retval][out] */ BSTR __RPC_FAR *pszDescription);
00091 
00092     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accRole( 
00093         /* [optional][in] */ VARIANT varChild,
00094         /* [retval][out] */ VARIANT __RPC_FAR *pvarRole);
00095 
00096     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accState( 
00097         /* [optional][in] */ VARIANT varChild,
00098         /* [retval][out] */ VARIANT __RPC_FAR *pvarState);
00099 
00100     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelp( 
00101         /* [optional][in] */ VARIANT varChild,
00102         /* [retval][out] */ BSTR __RPC_FAR *pszHelp);
00103 
00104     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelpTopic( 
00105         /* [out] */ BSTR __RPC_FAR *pszHelpFile,
00106         /* [optional][in] */ VARIANT varChild,
00107         /* [retval][out] */ long __RPC_FAR *pidTopic);
00108 
00109     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut( 
00110         /* [optional][in] */ VARIANT varChild,
00111         /* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut);
00112 
00113     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus( 
00114         /* [retval][out] */ VARIANT __RPC_FAR *pvarChild);
00115 
00116     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accSelection( 
00117         /* [retval][out] */ VARIANT __RPC_FAR *pvarChildren);
00118 
00119     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDefaultAction( 
00120         /* [optional][in] */ VARIANT varChild,
00121         /* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction);
00122 
00123     virtual /* [id] */ HRESULT STDMETHODCALLTYPE accSelect( 
00124         /* [in] */ long flagsSelect,
00125         /* [optional][in] */ VARIANT varChild);
00126 
00127     virtual /* [id] */ HRESULT STDMETHODCALLTYPE accLocation( 
00128         /* [out] */ long __RPC_FAR *pxLeft,
00129         /* [out] */ long __RPC_FAR *pyTop,
00130         /* [out] */ long __RPC_FAR *pcxWidth,
00131         /* [out] */ long __RPC_FAR *pcyHeight,
00132         /* [optional][in] */ VARIANT varChild);
00133 
00134     virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate( 
00135         /* [in] */ long navDir,
00136         /* [optional][in] */ VARIANT varStart,
00137         /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt);
00138 
00139     virtual /* [id] */ HRESULT STDMETHODCALLTYPE accHitTest( 
00140         /* [in] */ long xLeft,
00141         /* [in] */ long yTop,
00142         /* [retval][out] */ VARIANT __RPC_FAR *pvarChild);
00143 
00144     virtual /* [id] */ HRESULT STDMETHODCALLTYPE accDoDefaultAction( 
00145         /* [optional][in] */ VARIANT varChild);
00146 
00147     virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accName( 
00148         /* [optional][in] */ VARIANT varChild,
00149         /* [in] */ BSTR szName);
00150 
00151     virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accValue( 
00152         /* [optional][in] */ VARIANT varChild,
00153         /* [in] */ BSTR szValue);
00154 
00155   public:   // IEnumVariantMethods
00156     virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next( 
00157         /* [in] */ ULONG celt,
00158         /* [length_is][size_is][out] */ VARIANT __RPC_FAR *rgVar,
00159         /* [out] */ ULONG __RPC_FAR *pCeltFetched);
00160   
00161     virtual HRESULT STDMETHODCALLTYPE Skip( 
00162         /* [in] */ ULONG celt);
00163   
00164     virtual HRESULT STDMETHODCALLTYPE Reset( void);
00165   
00166     virtual HRESULT STDMETHODCALLTYPE Clone( 
00167         /* [out] */ IEnumVARIANT __RPC_FAR *__RPC_FAR *ppEnum);
00168 
00169         
00170   //   ======  Methods for IDispatch - for VisualBasic bindings (not implemented) ======
00171 
00172   STDMETHODIMP GetTypeInfoCount(UINT *p);
00173   STDMETHODIMP GetTypeInfo(UINT i, LCID lcid, ITypeInfo **ppti);
00174   STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames,
00175                                UINT cNames, LCID lcid, DISPID *rgDispId);
00176   STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid,
00177         LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
00178         VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
00179 
00180   virtual void GetXPAccessibleFor(const VARIANT& aVarChild, nsIAccessible **aXPAccessible);
00181   NS_IMETHOD GetNativeInterface(void **aOutAccessible);
00182   NS_IMETHOD GetDescription(nsAString& aDescription);
00183 
00184   // NT4 does not have the oleacc that defines these methods. So we define copies here that automatically
00185   // load the library only if needed.
00186   static STDMETHODIMP AccessibleObjectFromWindow(HWND hwnd,DWORD dwObjectID,REFIID riid,void **ppvObject);
00187   static STDMETHODIMP NotifyWinEvent(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
00188 
00189 protected:
00190   // mEnumVARIANTPosition not the current accessible's position, but a "cursor" of 
00191   // where we are in the current list of children, with respect to
00192   // nsIEnumVariant::Reset(), Skip() and Next().
00193   PRUint16 mEnumVARIANTPosition;  
00194 
00195   IDispatch *NativeAccessible(nsIAccessible *aXPAccessible);
00196 };
00197 
00198 // Define unsupported wrap classes here
00199 typedef class nsHTMLTextFieldAccessible    nsHTMLTextFieldAccessibleWrap;
00200 typedef class nsHTMLLinkAccessible         nsHTMLLinkAccessibleWrap;
00201 typedef class nsHTMLTableCellAccessible    nsHTMLTableCellAccessibleWrap;
00202 typedef class nsHTMLTableAccessible        nsHTMLTableAccessibleWrap;
00203 typedef class nsXULProgressMeterAccessible nsXULProgressMeterAccessibleWrap;
00204 typedef class nsXULTextFieldAccessible     nsXULTextFieldAccessibleWrap;
00205 
00206 #endif