2 * Copyright 2014 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "oleacc_private.h"
23 #include "wine/unicode.h"
24 #include "wine/debug.h"
25 #include "wine/heap.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(oleacc
);
30 IAccessible IAccessible_iface
;
31 IOleWindow IOleWindow_iface
;
32 IEnumVARIANT IEnumVARIANT_iface
;
37 static inline Window
* impl_from_Window(IAccessible
*iface
)
39 return CONTAINING_RECORD(iface
, Window
, IAccessible_iface
);
42 static HRESULT WINAPI
Window_QueryInterface(IAccessible
*iface
, REFIID riid
, void **ppv
)
44 Window
*This
= impl_from_Window(iface
);
46 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
48 if(IsEqualIID(riid
, &IID_IAccessible
) ||
49 IsEqualIID(riid
, &IID_IDispatch
) ||
50 IsEqualIID(riid
, &IID_IUnknown
)) {
52 }else if(IsEqualIID(riid
, &IID_IOleWindow
)) {
53 *ppv
= &This
->IOleWindow_iface
;
54 }else if(IsEqualIID(riid
, &IID_IEnumVARIANT
)) {
55 *ppv
= &This
->IEnumVARIANT_iface
;
57 WARN("no interface: %s\n", debugstr_guid(riid
));
62 IAccessible_AddRef(iface
);
66 static ULONG WINAPI
Window_AddRef(IAccessible
*iface
)
68 Window
*This
= impl_from_Window(iface
);
69 ULONG ref
= InterlockedIncrement(&This
->ref
);
71 TRACE("(%p) ref = %u\n", This
, ref
);
75 static ULONG WINAPI
Window_Release(IAccessible
*iface
)
77 Window
*This
= impl_from_Window(iface
);
78 ULONG ref
= InterlockedDecrement(&This
->ref
);
80 TRACE("(%p) ref = %u\n", This
, ref
);
87 static HRESULT WINAPI
Window_GetTypeInfoCount(IAccessible
*iface
, UINT
*pctinfo
)
89 Window
*This
= impl_from_Window(iface
);
90 FIXME("(%p)->(%p)\n", This
, pctinfo
);
94 static HRESULT WINAPI
Window_GetTypeInfo(IAccessible
*iface
,
95 UINT iTInfo
, LCID lcid
, ITypeInfo
**ppTInfo
)
97 Window
*This
= impl_from_Window(iface
);
98 FIXME("(%p)->(%u %x %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
102 static HRESULT WINAPI
Window_GetIDsOfNames(IAccessible
*iface
, REFIID riid
,
103 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
105 Window
*This
= impl_from_Window(iface
);
106 FIXME("(%p)->(%s %p %u %x %p)\n", This
, debugstr_guid(riid
),
107 rgszNames
, cNames
, lcid
, rgDispId
);
111 static HRESULT WINAPI
Window_Invoke(IAccessible
*iface
, DISPID dispIdMember
,
112 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
113 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
115 Window
*This
= impl_from_Window(iface
);
116 FIXME("(%p)->(%x %s %x %x %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
117 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
121 static HRESULT WINAPI
Window_get_accParent(IAccessible
*iface
, IDispatch
**ppdispParent
)
123 Window
*This
= impl_from_Window(iface
);
124 FIXME("(%p)->(%p)\n", This
, ppdispParent
);
128 static HRESULT WINAPI
Window_get_accChildCount(IAccessible
*iface
, LONG
*pcountChildren
)
130 Window
*This
= impl_from_Window(iface
);
131 FIXME("(%p)->(%p)\n", This
, pcountChildren
);
135 static HRESULT WINAPI
Window_get_accChild(IAccessible
*iface
,
136 VARIANT varChildID
, IDispatch
**ppdispChild
)
138 Window
*This
= impl_from_Window(iface
);
139 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varChildID
), ppdispChild
);
143 static HRESULT WINAPI
Window_get_accName(IAccessible
*iface
, VARIANT varID
, BSTR
*pszName
)
145 Window
*This
= impl_from_Window(iface
);
146 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszName
);
150 static HRESULT WINAPI
Window_get_accValue(IAccessible
*iface
, VARIANT varID
, BSTR
*pszValue
)
152 Window
*This
= impl_from_Window(iface
);
153 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszValue
);
157 static HRESULT WINAPI
Window_get_accDescription(IAccessible
*iface
,
158 VARIANT varID
, BSTR
*pszDescription
)
160 Window
*This
= impl_from_Window(iface
);
161 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszDescription
);
165 static HRESULT WINAPI
Window_get_accRole(IAccessible
*iface
, VARIANT varID
, VARIANT
*pvarRole
)
167 Window
*This
= impl_from_Window(iface
);
168 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pvarRole
);
172 static HRESULT WINAPI
Window_get_accState(IAccessible
*iface
, VARIANT varID
, VARIANT
*pvarState
)
174 Window
*This
= impl_from_Window(iface
);
175 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pvarState
);
179 static HRESULT WINAPI
Window_get_accHelp(IAccessible
*iface
, VARIANT varID
, BSTR
*pszHelp
)
181 Window
*This
= impl_from_Window(iface
);
182 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszHelp
);
186 static HRESULT WINAPI
Window_get_accHelpTopic(IAccessible
*iface
,
187 BSTR
*pszHelpFile
, VARIANT varID
, LONG
*pidTopic
)
189 Window
*This
= impl_from_Window(iface
);
190 FIXME("(%p)->(%p %s %p)\n", This
, pszHelpFile
, debugstr_variant(&varID
), pidTopic
);
194 static HRESULT WINAPI
Window_get_accKeyboardShortcut(IAccessible
*iface
,
195 VARIANT varID
, BSTR
*pszKeyboardShortcut
)
197 Window
*This
= impl_from_Window(iface
);
198 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszKeyboardShortcut
);
202 static HRESULT WINAPI
Window_get_accFocus(IAccessible
*iface
, VARIANT
*pvarID
)
204 Window
*This
= impl_from_Window(iface
);
205 FIXME("(%p)->(%p)\n", This
, pvarID
);
209 static HRESULT WINAPI
Window_get_accSelection(IAccessible
*iface
, VARIANT
*pvarID
)
211 Window
*This
= impl_from_Window(iface
);
212 FIXME("(%p)->(%p)\n", This
, pvarID
);
216 static HRESULT WINAPI
Window_get_accDefaultAction(IAccessible
*iface
,
217 VARIANT varID
, BSTR
*pszDefaultAction
)
219 Window
*This
= impl_from_Window(iface
);
220 FIXME("(%p)->(%s %p)\n", This
, debugstr_variant(&varID
), pszDefaultAction
);
224 static HRESULT WINAPI
Window_accSelect(IAccessible
*iface
, LONG flagsSelect
, VARIANT varID
)
226 Window
*This
= impl_from_Window(iface
);
227 FIXME("(%p)->(%x %s)\n", This
, flagsSelect
, debugstr_variant(&varID
));
231 static HRESULT WINAPI
Window_accLocation(IAccessible
*iface
, LONG
*pxLeft
,
232 LONG
*pyTop
, LONG
*pcxWidth
, LONG
*pcyHeight
, VARIANT varID
)
234 Window
*This
= impl_from_Window(iface
);
235 FIXME("(%p)->(%p %p %p %p %s)\n", This
, pxLeft
, pyTop
,
236 pcxWidth
, pcyHeight
, debugstr_variant(&varID
));
240 static HRESULT WINAPI
Window_accNavigate(IAccessible
*iface
,
241 LONG navDir
, VARIANT varStart
, VARIANT
*pvarEnd
)
243 Window
*This
= impl_from_Window(iface
);
244 FIXME("(%p)->(%d %s %p)\n", This
, navDir
, debugstr_variant(&varStart
), pvarEnd
);
248 static HRESULT WINAPI
Window_accHitTest(IAccessible
*iface
,
249 LONG xLeft
, LONG yTop
, VARIANT
*pvarID
)
251 Window
*This
= impl_from_Window(iface
);
252 FIXME("(%p)->(%d %d %p)\n", This
, xLeft
, yTop
, pvarID
);
256 static HRESULT WINAPI
Window_accDoDefaultAction(IAccessible
*iface
, VARIANT varID
)
258 Window
*This
= impl_from_Window(iface
);
259 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&varID
));
263 static HRESULT WINAPI
Window_put_accName(IAccessible
*iface
, VARIANT varID
, BSTR pszName
)
265 Window
*This
= impl_from_Window(iface
);
266 FIXME("(%p)->(%s %s)\n", This
, debugstr_variant(&varID
), debugstr_w(pszName
));
270 static HRESULT WINAPI
Window_put_accValue(IAccessible
*iface
, VARIANT varID
, BSTR pszValue
)
272 Window
*This
= impl_from_Window(iface
);
273 FIXME("(%p)->(%s %s)\n", This
, debugstr_variant(&varID
), debugstr_w(pszValue
));
277 static const IAccessibleVtbl WindowVtbl
= {
278 Window_QueryInterface
,
281 Window_GetTypeInfoCount
,
283 Window_GetIDsOfNames
,
285 Window_get_accParent
,
286 Window_get_accChildCount
,
290 Window_get_accDescription
,
294 Window_get_accHelpTopic
,
295 Window_get_accKeyboardShortcut
,
297 Window_get_accSelection
,
298 Window_get_accDefaultAction
,
303 Window_accDoDefaultAction
,
308 static inline Window
* impl_from_Window_OleWindow(IOleWindow
*iface
)
310 return CONTAINING_RECORD(iface
, Window
, IOleWindow_iface
);
313 static HRESULT WINAPI
Window_OleWindow_QueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppv
)
315 Window
*This
= impl_from_Window_OleWindow(iface
);
316 return IAccessible_QueryInterface(&This
->IAccessible_iface
, riid
, ppv
);
319 static ULONG WINAPI
Window_OleWindow_AddRef(IOleWindow
*iface
)
321 Window
*This
= impl_from_Window_OleWindow(iface
);
322 return IAccessible_AddRef(&This
->IAccessible_iface
);
325 static ULONG WINAPI
Window_OleWindow_Release(IOleWindow
*iface
)
327 Window
*This
= impl_from_Window_OleWindow(iface
);
328 return IAccessible_Release(&This
->IAccessible_iface
);
331 static HRESULT WINAPI
Window_OleWindow_GetWindow(IOleWindow
*iface
, HWND
*phwnd
)
333 Window
*This
= impl_from_Window_OleWindow(iface
);
334 FIXME("(%p)->(%p)\n", This
, phwnd
);
338 static HRESULT WINAPI
Window_OleWindow_ContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
340 Window
*This
= impl_from_Window_OleWindow(iface
);
341 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
345 static const IOleWindowVtbl WindowOleWindowVtbl
= {
346 Window_OleWindow_QueryInterface
,
347 Window_OleWindow_AddRef
,
348 Window_OleWindow_Release
,
349 Window_OleWindow_GetWindow
,
350 Window_OleWindow_ContextSensitiveHelp
353 static inline Window
* impl_from_Window_EnumVARIANT(IEnumVARIANT
*iface
)
355 return CONTAINING_RECORD(iface
, Window
, IEnumVARIANT_iface
);
358 static HRESULT WINAPI
Window_EnumVARIANT_QueryInterface(IEnumVARIANT
*iface
, REFIID riid
, void **ppv
)
360 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
361 return IAccessible_QueryInterface(&This
->IAccessible_iface
, riid
, ppv
);
364 static ULONG WINAPI
Window_EnumVARIANT_AddRef(IEnumVARIANT
*iface
)
366 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
367 return IAccessible_AddRef(&This
->IAccessible_iface
);
370 static ULONG WINAPI
Window_EnumVARIANT_Release(IEnumVARIANT
*iface
)
372 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
373 return IAccessible_Release(&This
->IAccessible_iface
);
376 static HRESULT WINAPI
Window_EnumVARIANT_Next(IEnumVARIANT
*iface
,
377 ULONG celt
, VARIANT
*rgVar
, ULONG
*pCeltFetched
)
379 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
380 FIXME("(%p)->(%u %p %p)\n", This
, celt
, rgVar
, pCeltFetched
);
384 static HRESULT WINAPI
Window_EnumVARIANT_Skip(IEnumVARIANT
*iface
, ULONG celt
)
386 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
387 FIXME("(%p)->(%u)\n", This
, celt
);
391 static HRESULT WINAPI
Window_EnumVARIANT_Reset(IEnumVARIANT
*iface
)
393 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
394 FIXME("(%p)\n", This
);
398 static HRESULT WINAPI
Window_EnumVARIANT_Clone(IEnumVARIANT
*iface
, IEnumVARIANT
**ppEnum
)
400 Window
*This
= impl_from_Window_EnumVARIANT(iface
);
401 FIXME("(%p)->(%p)\n", This
, ppEnum
);
405 static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl
= {
406 Window_EnumVARIANT_QueryInterface
,
407 Window_EnumVARIANT_AddRef
,
408 Window_EnumVARIANT_Release
,
409 Window_EnumVARIANT_Next
,
410 Window_EnumVARIANT_Skip
,
411 Window_EnumVARIANT_Reset
,
412 Window_EnumVARIANT_Clone
415 HRESULT
create_window_object(HWND hwnd
, const IID
*iid
, void **obj
)
423 window
= heap_alloc_zero(sizeof(Window
));
425 return E_OUTOFMEMORY
;
427 window
->IAccessible_iface
.lpVtbl
= &WindowVtbl
;
428 window
->IOleWindow_iface
.lpVtbl
= &WindowOleWindowVtbl
;
429 window
->IEnumVARIANT_iface
.lpVtbl
= &WindowEnumVARIANTVtbl
;
432 hres
= IAccessible_QueryInterface(&window
->IAccessible_iface
, iid
, obj
);
433 IAccessible_Release(&window
->IAccessible_iface
);