msctf: Add stub implementation of ITfInputProcessorProfiles.
[wine] / dlls / msctf / inputprocessor.c
1 /*
2  *  ITfInputProcessorProfiles implementation
3  *
4  *  Copyright 2009 Aric Stewart, CodeWeavers
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #define COBJMACROS
26
27 #include "wine/debug.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "shlwapi.h"
33 #include "winerror.h"
34 #include "objbase.h"
35
36 #include "wine/unicode.h"
37
38 #include "msctf.h"
39 #include "msctf_internal.h"
40
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
42
43 typedef struct tagInputProcessorProfiles {
44     const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl;
45     LONG refCount;
46 } InputProcessorProfiles;
47
48 static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
49 {
50     TRACE("destroying %p\n", This);
51     HeapFree(GetProcessHeap(),0,This);
52 }
53
54 static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut)
55 {
56     InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
57     *ppvOut = NULL;
58
59     if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles))
60     {
61         *ppvOut = This;
62     }
63
64     if (*ppvOut)
65     {
66         IUnknown_AddRef(iface);
67         return S_OK;
68     }
69
70     WARN("unsupported interface: %s\n", debugstr_guid(iid));
71     return E_NOINTERFACE;
72 }
73
74 static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface)
75 {
76     InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
77     return InterlockedIncrement(&This->refCount);
78 }
79
80 static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface)
81 {
82     InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
83     ULONG ret;
84
85     ret = InterlockedDecrement(&This->refCount);
86     if (ret == 0)
87         InputProcessorProfiles_Destructor(This);
88     return ret;
89 }
90
91 /*****************************************************
92  * ITfInputProcessorProfiles functions
93  *****************************************************/
94 static HRESULT WINAPI InputProcessorProfiles_Register(
95         ITfInputProcessorProfiles *iface, REFCLSID rclsid)
96 {
97     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
98     FIXME("STUB:(%p)\n",This);
99     return E_NOTIMPL;
100 }
101
102 static HRESULT WINAPI InputProcessorProfiles_Unregister(
103         ITfInputProcessorProfiles *iface, REFCLSID rclsid)
104 {
105     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
106     FIXME("STUB:(%p)\n",This);
107     return E_NOTIMPL;
108 }
109
110 static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile(
111         ITfInputProcessorProfiles *iface, REFCLSID rclsid,
112         LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc,
113         ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile,
114         ULONG uIconIndex)
115 {
116     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
117     FIXME("STUB:(%p)\n",This);
118     return E_NOTIMPL;
119 }
120
121 static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile(
122         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
123         REFGUID guidProfile)
124 {
125     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
126     FIXME("STUB:(%p)\n",This);
127     return E_NOTIMPL;
128 }
129
130 static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo(
131         ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum)
132 {
133     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
134     FIXME("STUB:(%p)\n",This);
135     return E_NOTIMPL;
136 }
137
138 static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile(
139         ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid,
140         CLSID *pclsid, GUID *pguidProfile)
141 {
142     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
143     FIXME("STUB:(%p)\n",This);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile(
148         ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid,
149         REFGUID guidProfiles)
150 {
151     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
152     FIXME("STUB:(%p)\n",This);
153     return E_NOTIMPL;
154 }
155
156 static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile(
157         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
158         REFGUID guidProfiles)
159 {
160     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
161     FIXME("STUB:(%p)\n",This);
162     return E_NOTIMPL;
163 }
164
165 static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
166         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
167         GUID *pguidProfile)
168 {
169     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
170     FIXME("STUB:(%p)\n",This);
171     return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
175         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
176         REFGUID guidProfile, BSTR *pbstrProfile)
177 {
178     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
179     FIXME("STUB:(%p)\n",This);
180     return E_NOTIMPL;
181 }
182
183 static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
184         ITfInputProcessorProfiles *iface, LANGID *plangid)
185 {
186     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
187     FIXME("STUB:(%p)\n",This);
188     return E_NOTIMPL;
189 }
190
191 static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
192         ITfInputProcessorProfiles *iface, LANGID langid)
193 {
194     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
195     FIXME("STUB:(%p)\n",This);
196     return E_NOTIMPL;
197 }
198
199 static HRESULT WINAPI InputProcessorProfiles_GetLanguageList(
200         ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount)
201 {
202     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
203     FIXME("STUB:(%p)\n",This);
204     return E_NOTIMPL;
205 }
206
207 static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles(
208         ITfInputProcessorProfiles *iface, LANGID langid,
209         IEnumTfLanguageProfiles **ppEnum)
210 {
211     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
212     FIXME("STUB:(%p)\n",This);
213     return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
217         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
218         REFGUID guidProfile, BOOL fEnable)
219 {
220     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
221     FIXME("STUB:(%p)\n",This);
222     return E_NOTIMPL;
223 }
224
225 static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile(
226         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
227         REFGUID guidProfile, BOOL *pfEnable)
228 {
229     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
230     FIXME("STUB:(%p)\n",This);
231     return E_NOTIMPL;
232 }
233
234 static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault(
235         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
236         REFGUID guidProfile, BOOL fEnable)
237 {
238     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
239     FIXME("STUB:(%p)\n",This);
240     return E_NOTIMPL;
241 }
242
243 static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout(
244         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
245         REFGUID guidProfile, HKL hKL)
246 {
247     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
248     FIXME("STUB:(%p)\n",This);
249     return E_NOTIMPL;
250 }
251
252
253 static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl =
254 {
255     InputProcessorProfiles_QueryInterface,
256     InputProcessorProfiles_AddRef,
257     InputProcessorProfiles_Release,
258
259     InputProcessorProfiles_Register,
260     InputProcessorProfiles_Unregister,
261     InputProcessorProfiles_AddLanguageProfile,
262     InputProcessorProfiles_RemoveLanguageProfile,
263     InputProcessorProfiles_EnumInputProcessorInfo,
264     InputProcessorProfiles_GetDefaultLanguageProfile,
265     InputProcessorProfiles_SetDefaultLanguageProfile,
266     InputProcessorProfiles_ActivateLanguageProfile,
267     InputProcessorProfiles_GetActiveLanguageProfile,
268     InputProcessorProfiles_GetLanguageProfileDescription,
269     InputProcessorProfiles_GetCurrentLanguage,
270     InputProcessorProfiles_ChangeCurrentLanguage,
271     InputProcessorProfiles_GetLanguageList,
272     InputProcessorProfiles_EnumLanguageProfiles,
273     InputProcessorProfiles_EnableLanguageProfile,
274     InputProcessorProfiles_IsEnabledLanguageProfile,
275     InputProcessorProfiles_EnableLanguageProfileByDefault,
276     InputProcessorProfiles_SubstituteKeyboardLayout
277 };
278
279 HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
280 {
281     InputProcessorProfiles *This;
282     if (pUnkOuter)
283         return CLASS_E_NOAGGREGATION;
284
285     This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputProcessorProfiles));
286     if (This == NULL)
287         return E_OUTOFMEMORY;
288
289     This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl;
290     This->refCount = 1;
291
292     TRACE("returning %p\n", This);
293     *ppOut = (IUnknown *)This;
294     return S_OK;
295 }