server: Use server_get_file_info for all info classes not implemented on client side.
[wine.git] / dlls / oleacc / window.c
blob32c19fd7c2c822e5cf51322587d90b78345bd905
1 /*
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
19 #define COBJMACROS
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);
29 typedef struct {
30 IAccessible IAccessible_iface;
31 IOleWindow IOleWindow_iface;
32 IEnumVARIANT IEnumVARIANT_iface;
34 LONG ref;
35 } Window;
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)) {
51 *ppv = iface;
52 }else if(IsEqualIID(riid, &IID_IOleWindow)) {
53 *ppv = &This->IOleWindow_iface;
54 }else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
55 *ppv = &This->IEnumVARIANT_iface;
56 }else {
57 WARN("no interface: %s\n", debugstr_guid(riid));
58 *ppv = NULL;
59 return E_NOINTERFACE;
62 IAccessible_AddRef(iface);
63 return S_OK;
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);
72 return 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);
82 if(!ref)
83 heap_free(This);
84 return 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);
91 return E_NOTIMPL;
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);
99 return E_NOTIMPL;
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);
108 return E_NOTIMPL;
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);
118 return E_NOTIMPL;
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);
125 return E_NOTIMPL;
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);
132 return E_NOTIMPL;
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);
140 return E_NOTIMPL;
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);
147 return E_NOTIMPL;
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);
154 return E_NOTIMPL;
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);
162 return E_NOTIMPL;
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);
169 return E_NOTIMPL;
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);
176 return E_NOTIMPL;
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);
183 return E_NOTIMPL;
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);
191 return E_NOTIMPL;
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);
199 return E_NOTIMPL;
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);
206 return E_NOTIMPL;
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);
213 return E_NOTIMPL;
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);
221 return E_NOTIMPL;
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));
228 return E_NOTIMPL;
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));
237 return E_NOTIMPL;
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);
245 return E_NOTIMPL;
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);
253 return E_NOTIMPL;
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));
260 return E_NOTIMPL;
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));
267 return E_NOTIMPL;
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));
274 return E_NOTIMPL;
277 static const IAccessibleVtbl WindowVtbl = {
278 Window_QueryInterface,
279 Window_AddRef,
280 Window_Release,
281 Window_GetTypeInfoCount,
282 Window_GetTypeInfo,
283 Window_GetIDsOfNames,
284 Window_Invoke,
285 Window_get_accParent,
286 Window_get_accChildCount,
287 Window_get_accChild,
288 Window_get_accName,
289 Window_get_accValue,
290 Window_get_accDescription,
291 Window_get_accRole,
292 Window_get_accState,
293 Window_get_accHelp,
294 Window_get_accHelpTopic,
295 Window_get_accKeyboardShortcut,
296 Window_get_accFocus,
297 Window_get_accSelection,
298 Window_get_accDefaultAction,
299 Window_accSelect,
300 Window_accLocation,
301 Window_accNavigate,
302 Window_accHitTest,
303 Window_accDoDefaultAction,
304 Window_put_accName,
305 Window_put_accValue
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);
335 return E_NOTIMPL;
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);
342 return E_NOTIMPL;
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);
381 return E_NOTIMPL;
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);
388 return E_NOTIMPL;
391 static HRESULT WINAPI Window_EnumVARIANT_Reset(IEnumVARIANT *iface)
393 Window *This = impl_from_Window_EnumVARIANT(iface);
394 FIXME("(%p)\n", This);
395 return E_NOTIMPL;
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);
402 return E_NOTIMPL;
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)
417 Window *window;
418 HRESULT hres;
420 if(!IsWindow(hwnd))
421 return E_FAIL;
423 window = heap_alloc_zero(sizeof(Window));
424 if(!window)
425 return E_OUTOFMEMORY;
427 window->IAccessible_iface.lpVtbl = &WindowVtbl;
428 window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
429 window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl;
430 window->ref = 1;
432 hres = IAccessible_QueryInterface(&window->IAccessible_iface, iid, obj);
433 IAccessible_Release(&window->IAccessible_iface);
434 return hres;