xref: /reactos/dll/win32/oleacc/propservice.c (revision 8a978a17)
1 /*
2  * Copyright 2014 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #define COBJMACROS
20 
21 #include <stdarg.h>
22 
23 #include "oleacc_private.h"
24 
25 #include "wine/debug.h"
26 
27 WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
28 
29 static HRESULT WINAPI AccPropServices_QueryInterface(IAccPropServices *iface, REFIID riid, void **ppv)
30 {
31     if(IsEqualGUID(&IID_IUnknown, riid)) {
32         TRACE("(IID_IUnknown %p)\n", ppv);
33         *ppv = iface;
34     }else if(IsEqualGUID(&IID_IAccPropServices, riid)) {
35         TRACE("(IID_IAccPropServices %p)\n", ppv);
36         *ppv = iface;
37     }else {
38         FIXME("Unknown iface %s\n", debugstr_guid(riid));
39         *ppv = NULL;
40         return E_NOINTERFACE;
41     }
42 
43     IUnknown_AddRef((IUnknown*)*ppv);
44     return S_OK;
45 }
46 
47 static ULONG WINAPI AccPropServices_AddRef(IAccPropServices *iface)
48 {
49     return 2;
50 }
51 
52 static ULONG WINAPI AccPropServices_Release(IAccPropServices *iface)
53 {
54     return 1;
55 }
56 
57 static HRESULT WINAPI AccPropServices_SetPropValue(IAccPropServices *iface, const BYTE *pIDString,
58         DWORD dwIDStringLen, MSAAPROPID idProp, VARIANT var)
59 {
60     FIXME("(%p %u %s %s)\n", pIDString, dwIDStringLen, debugstr_guid(&idProp), debugstr_variant(&var));
61     return E_NOTIMPL;
62 }
63 
64 static HRESULT WINAPI AccPropServices_SetPropServer(IAccPropServices *iface, const BYTE *pIDString,
65         DWORD dwIDStringLen, const MSAAPROPID *paProps, int cProps, IAccPropServer *pServer, AnnoScope AnnoScope)
66 {
67     FIXME("(%p %u %p %d %p %u)\n", pIDString, dwIDStringLen, paProps, cProps, pServer, AnnoScope);
68     return E_NOTIMPL;
69 }
70 
71 static HRESULT WINAPI AccPropServices_ClearProps(IAccPropServices *iface, const BYTE *pIDString,
72         DWORD dwIDStringLen, const MSAAPROPID *paProps, int cProps)
73 {
74     FIXME("(%p %u %p %d)\n", pIDString, dwIDStringLen, paProps, cProps);
75     return E_NOTIMPL;
76 }
77 
78 static HRESULT WINAPI AccPropServices_SetHwndProp(IAccPropServices *iface, HWND hwnd, DWORD idObject,
79         DWORD idChild, MSAAPROPID idProp, VARIANT var)
80 {
81     FIXME("(%p %u %u %s %s)\n", hwnd, idObject, idChild, debugstr_guid(&idProp), debugstr_variant(&var));
82     return E_NOTIMPL;
83 }
84 
85 static HRESULT WINAPI AccPropServices_SetHwndPropStr(IAccPropServices *iface, HWND hwnd, DWORD idObject,
86         DWORD idChild, MSAAPROPID idProp, LPWSTR str)
87 {
88     FIXME("(%p %u %u %s %s)\n", hwnd, idObject, idChild, debugstr_guid(&idProp), debugstr_w(str));
89     return E_NOTIMPL;
90 }
91 
92 static HRESULT WINAPI AccPropServices_SetHwndPropServer(IAccPropServices *iface, HWND hwnd, DWORD idObject,
93         DWORD idChild, const MSAAPROPID *paProps, int cProps, IAccPropServer *pServer, AnnoScope AnnoScope)
94 {
95     FIXME("(%p %u %u %p %d %p %u)\n", hwnd, idObject, idChild, paProps, cProps, pServer, AnnoScope);
96     return E_NOTIMPL;
97 }
98 
99 static HRESULT WINAPI AccPropServices_ClearHwndProps(IAccPropServices *iface, HWND hwnd, DWORD idObject,
100         DWORD idChild, const MSAAPROPID *paProps, int cProps)
101 {
102     FIXME("(%p %u %u %p %d)\n", hwnd, idObject, idChild, paProps, cProps);
103     return E_NOTIMPL;
104 }
105 
106 static HRESULT WINAPI AccPropServices_ComposeHwndIdentityString(IAccPropServices *iface, HWND hwnd,
107         DWORD idObject, DWORD idChild, BYTE **ppIDString, DWORD *pdwIDStringLen)
108 {
109     FIXME("(%p %u %u %p %p)\n", hwnd, idObject, idChild, ppIDString, pdwIDStringLen);
110     return E_NOTIMPL;
111 }
112 
113 static HRESULT WINAPI AccPropServices_DecomposeHwndIdentityString(IAccPropServices *iface, const BYTE *pIDString,
114         DWORD dwIDStringLen, HWND *phwnd, DWORD *pidObject, DWORD *pidChild)
115 {
116     FIXME("(%p %u %p %p %p)\n", pIDString, dwIDStringLen, phwnd, pidObject, pidChild);
117     return E_NOTIMPL;
118 }
119 
120 static HRESULT WINAPI AccPropServices_SetHmenuProp(IAccPropServices *iface, HMENU hmenu, DWORD idChild,
121         MSAAPROPID idProp, VARIANT var)
122 {
123     FIXME("(%p %u %s %s)\n", hmenu, idChild, debugstr_guid(&idProp), debugstr_variant(&var));
124     return E_NOTIMPL;
125 }
126 
127 static HRESULT WINAPI AccPropServices_SetHmenuPropStr(IAccPropServices *iface, HMENU hmenu, DWORD idChild,
128         MSAAPROPID idProp, LPWSTR str)
129 {
130     FIXME("(%p %u %s %s)\n", hmenu, idChild, debugstr_guid(&idProp), debugstr_w(str));
131     return E_NOTIMPL;
132 }
133 
134 static HRESULT WINAPI AccPropServices_SetHmenuPropServer(IAccPropServices *iface, HMENU hmenu, DWORD idChild,
135         const MSAAPROPID *paProps, int cProps, IAccPropServer *pServer, AnnoScope AnnoScope)
136 {
137     FIXME("(%p %u %p %d %p %u)\n", hmenu, idChild, paProps, cProps, pServer, AnnoScope);
138     return E_NOTIMPL;
139 }
140 
141 static HRESULT WINAPI AccPropServices_ClearHmenuProps(IAccPropServices *iface, HMENU hmenu, DWORD idChild,
142         const MSAAPROPID *paProps, int cProps)
143 {
144     FIXME("(%p %u %p %d)\n", hmenu, idChild, paProps, cProps);
145     return E_NOTIMPL;
146 }
147 
148 static HRESULT WINAPI AccPropServices_ComposeHmenuIdentityString(IAccPropServices *iface, HMENU hmenu, DWORD idChild,
149         BYTE **ppIDString, DWORD *pdwIDStringLen)
150 {
151     FIXME("(%p %u %p %p)\n", hmenu, idChild, ppIDString, pdwIDStringLen);
152     return E_NOTIMPL;
153 }
154 
155 static HRESULT WINAPI AccPropServices_DecomposeHmenuIdentityString(IAccPropServices *iface, const BYTE *pIDString,
156         DWORD dwIDStringLen, HMENU *phmenu, DWORD *pidChild)
157 {
158     FIXME("(%p %u %p %p\n", pIDString, dwIDStringLen, phmenu, pidChild);
159     return E_NOTIMPL;
160 }
161 
162 static const IAccPropServicesVtbl AccPropServicesVtbl = {
163     AccPropServices_QueryInterface,
164     AccPropServices_AddRef,
165     AccPropServices_Release,
166     AccPropServices_SetPropValue,
167     AccPropServices_SetPropServer,
168     AccPropServices_ClearProps,
169     AccPropServices_SetHwndProp,
170     AccPropServices_SetHwndPropStr,
171     AccPropServices_SetHwndPropServer,
172     AccPropServices_ClearHwndProps,
173     AccPropServices_ComposeHwndIdentityString,
174     AccPropServices_DecomposeHwndIdentityString,
175     AccPropServices_SetHmenuProp,
176     AccPropServices_SetHmenuPropStr,
177     AccPropServices_SetHmenuPropServer,
178     AccPropServices_ClearHmenuProps,
179     AccPropServices_ComposeHmenuIdentityString,
180     AccPropServices_DecomposeHmenuIdentityString
181 };
182 
183 static IAccPropServices AccPropServices = { &AccPropServicesVtbl };
184 
185 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
186 {
187     *ppv = NULL;
188 
189     if(IsEqualGUID(&IID_IUnknown, riid)) {
190         TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
191         *ppv = iface;
192     }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
193         TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
194         *ppv = iface;
195     }
196 
197     if(*ppv) {
198         IUnknown_AddRef((IUnknown*)*ppv);
199         return S_OK;
200     }
201 
202     FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
203     return E_NOINTERFACE;
204 }
205 
206 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
207 {
208     TRACE("(%p)\n", iface);
209     return 2;
210 }
211 
212 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
213 {
214     TRACE("(%p)\n", iface);
215     return 1;
216 }
217 
218 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
219 {
220     TRACE("(%p)->(%x)\n", iface, fLock);
221     return S_OK;
222 }
223 
224 static HRESULT WINAPI CAccPropServices_CreateInstance(IClassFactory *iface, IUnknown *outer,
225         REFIID riid, void **ppv)
226 {
227     TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
228 
229     if(outer) {
230         *ppv = NULL;
231         return CLASS_E_NOAGGREGATION;
232     }
233 
234     return IAccPropServices_QueryInterface(&AccPropServices, riid, ppv);
235 }
236 
237 static const IClassFactoryVtbl CAccPropServicesFactoryVtbl = {
238     ClassFactory_QueryInterface,
239     ClassFactory_AddRef,
240     ClassFactory_Release,
241     CAccPropServices_CreateInstance,
242     ClassFactory_LockServer
243 };
244 
245 static IClassFactory CAccPropServicesFactory = { &CAccPropServicesFactoryVtbl };
246 
247 HRESULT get_accpropservices_factory(REFIID riid, void **ppv)
248 {
249     return IClassFactory_QueryInterface(&CAccPropServicesFactory, riid, ppv);
250 }
251