• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef AccessibleBase_h
27 #define AccessibleBase_h
28 
29 #include <oleacc.h>
30 #include <WebCore/AccessibilityObject.h>
31 #include <WebCore/AccessibilityObjectWrapperWin.h>
32 
33 class AccessibleBase : public IAccessible, public WebCore::AccessibilityObjectWrapper {
34 public:
35     static AccessibleBase* createInstance(WebCore::AccessibilityObject*);
36 
37     // IUnknown
38     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
AddRef(void)39     virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++m_refCount; }
40     virtual ULONG STDMETHODCALLTYPE Release(void);
41 
42     // IAccessible
43     virtual HRESULT STDMETHODCALLTYPE get_accParent(IDispatch**);
44     virtual HRESULT STDMETHODCALLTYPE get_accChildCount(long*);
45     virtual HRESULT STDMETHODCALLTYPE get_accChild(VARIANT vChild, IDispatch** ppChild);
46     virtual HRESULT STDMETHODCALLTYPE get_accName(VARIANT vChild, BSTR*);
47     virtual HRESULT STDMETHODCALLTYPE get_accValue(VARIANT vChild, BSTR*);
48     virtual HRESULT STDMETHODCALLTYPE get_accDescription(VARIANT, BSTR*);
49     virtual HRESULT STDMETHODCALLTYPE get_accRole(VARIANT vChild, VARIANT* pvRole);
50     virtual HRESULT STDMETHODCALLTYPE get_accState(VARIANT vChild, VARIANT* pvState);
51     virtual HRESULT STDMETHODCALLTYPE get_accHelp(VARIANT vChild, BSTR* helpText);
52     virtual HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut(VARIANT vChild, BSTR*);
53     virtual HRESULT STDMETHODCALLTYPE get_accFocus(VARIANT* pvFocusedChild);
54     virtual HRESULT STDMETHODCALLTYPE get_accSelection(VARIANT* pvSelectedChild);
55     virtual HRESULT STDMETHODCALLTYPE get_accDefaultAction(VARIANT vChild, BSTR* actionDescription);
56     virtual HRESULT STDMETHODCALLTYPE accSelect(long selectionFlags, VARIANT vChild);
57     virtual HRESULT STDMETHODCALLTYPE accLocation(long* left, long* top, long* width, long* height, VARIANT vChild);
58     virtual HRESULT STDMETHODCALLTYPE accNavigate(long direction, VARIANT vFromChild, VARIANT* pvNavigatedTo);
59     virtual HRESULT STDMETHODCALLTYPE accHitTest(long x, long y, VARIANT* pvChildAtPoint);
60     virtual HRESULT STDMETHODCALLTYPE accDoDefaultAction(VARIANT vChild);
61 
62     // IAccessible - Not to be implemented.
put_accName(VARIANT,BSTR)63     virtual HRESULT STDMETHODCALLTYPE put_accName(VARIANT, BSTR) { return E_NOTIMPL; }
put_accValue(VARIANT,BSTR)64     virtual HRESULT STDMETHODCALLTYPE put_accValue(VARIANT, BSTR) { return E_NOTIMPL; }
get_accHelpTopic(BSTR * helpFile,VARIANT,long * topicID)65     virtual HRESULT STDMETHODCALLTYPE get_accHelpTopic(BSTR* helpFile, VARIANT, long* topicID)
66     {
67         *helpFile = 0;
68         *topicID = 0;
69         return E_NOTIMPL;
70     }
71 
72     // IDispatch - Not to be implemented.
GetTypeInfoCount(UINT * count)73     virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* count)
74     {
75         *count = 0;
76         return E_NOTIMPL;
77     }
GetTypeInfo(UINT,LCID,ITypeInfo ** ppTInfo)78     virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT, LCID, ITypeInfo** ppTInfo)
79     {
80         *ppTInfo = 0;
81         return E_NOTIMPL;
82     }
GetIDsOfNames(REFIID,LPOLESTR *,UINT,LCID,DISPID *)83     virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
Invoke(DISPID,REFIID,LCID,WORD,DISPPARAMS *,VARIANT *,EXCEPINFO *,UINT *)84     virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*) { return E_NOTIMPL; }
85 
86     // WebCore::AccessiblityObjectWrapper
detach()87     virtual void detach() {
88         ASSERT(m_object);
89         m_object = 0;
90     }
91 
92 protected:
93     AccessibleBase(WebCore::AccessibilityObject*);
94     virtual ~AccessibleBase();
95 
96     virtual WebCore::String name() const;
97     virtual WebCore::String value() const;
98     virtual WebCore::String description() const;
99     virtual long role() const;
100 
101     HRESULT getAccessibilityObjectForChild(VARIANT vChild, WebCore::AccessibilityObject*&) const;
102 
103     static AccessibleBase* wrapper(WebCore::AccessibilityObject*);
104 
105     int m_refCount;
106 
107 private:
AccessibleBase()108     AccessibleBase() { }
109 };
110 
111 #endif // AccessibleBase_h
112 
113