2 * ITfInputProcessorProfiles implementation
4 * Copyright 2009 Aric Stewart, CodeWeavers
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.
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.
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
27 #include "wine/debug.h"
36 #include "wine/unicode.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
43 typedef struct tagInputProcessorProfiles {
44 const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl;
47 LANGID currentLanguage;
48 } InputProcessorProfiles;
50 static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
52 TRACE("destroying %p\n", This);
53 HeapFree(GetProcessHeap(),0,This);
56 static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut)
58 InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
61 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles))
68 IUnknown_AddRef(iface);
72 WARN("unsupported interface: %s\n", debugstr_guid(iid));
76 static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface)
78 InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
79 return InterlockedIncrement(&This->refCount);
82 static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface)
84 InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
87 ret = InterlockedDecrement(&This->refCount);
89 InputProcessorProfiles_Destructor(This);
93 /*****************************************************
94 * ITfInputProcessorProfiles functions
95 *****************************************************/
96 static HRESULT WINAPI InputProcessorProfiles_Register(
97 ITfInputProcessorProfiles *iface, REFCLSID rclsid)
99 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
102 static const WCHAR fmt[] = {'%','s','\\','%','s',0};
105 TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
107 StringFromGUID2(rclsid, buf, 39);
108 sprintfW(fullkey,fmt,szwSystemTIPKey,buf);
110 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,fullkey, 0, NULL, 0,
111 KEY_READ | KEY_WRITE, NULL, &tipkey, NULL) != ERROR_SUCCESS)
119 static HRESULT WINAPI InputProcessorProfiles_Unregister(
120 ITfInputProcessorProfiles *iface, REFCLSID rclsid)
122 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
123 FIXME("STUB:(%p)\n",This);
127 static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile(
128 ITfInputProcessorProfiles *iface, REFCLSID rclsid,
129 LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc,
130 ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile,
133 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
134 FIXME("STUB:(%p)\n",This);
138 static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile(
139 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
142 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
143 FIXME("STUB:(%p)\n",This);
147 static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo(
148 ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum)
150 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
151 FIXME("STUB:(%p)\n",This);
155 static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile(
156 ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid,
157 CLSID *pclsid, GUID *pguidProfile)
159 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
160 FIXME("STUB:(%p)\n",This);
164 static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile(
165 ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid,
166 REFGUID guidProfiles)
168 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
169 FIXME("STUB:(%p)\n",This);
173 static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile(
174 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
175 REFGUID guidProfiles)
177 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
178 FIXME("STUB:(%p)\n",This);
182 static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
183 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
186 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
187 FIXME("STUB:(%p)\n",This);
191 static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
192 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
193 REFGUID guidProfile, BSTR *pbstrProfile)
195 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
196 FIXME("STUB:(%p)\n",This);
200 static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
201 ITfInputProcessorProfiles *iface, LANGID *plangid)
203 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
204 TRACE("(%p) 0x%x\n",This,This->currentLanguage);
209 *plangid = This->currentLanguage;
214 static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
215 ITfInputProcessorProfiles *iface, LANGID langid)
217 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
218 FIXME("STUB:(%p)\n",This);
222 static HRESULT WINAPI InputProcessorProfiles_GetLanguageList(
223 ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount)
225 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
226 FIXME("STUB:(%p)\n",This);
230 static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles(
231 ITfInputProcessorProfiles *iface, LANGID langid,
232 IEnumTfLanguageProfiles **ppEnum)
234 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
235 FIXME("STUB:(%p)\n",This);
239 static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
240 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
241 REFGUID guidProfile, BOOL fEnable)
243 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
244 FIXME("STUB:(%p)\n",This);
248 static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile(
249 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
250 REFGUID guidProfile, BOOL *pfEnable)
252 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
253 FIXME("STUB:(%p)\n",This);
257 static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault(
258 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
259 REFGUID guidProfile, BOOL fEnable)
261 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
262 FIXME("STUB:(%p)\n",This);
266 static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout(
267 ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
268 REFGUID guidProfile, HKL hKL)
270 InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
271 FIXME("STUB:(%p)\n",This);
276 static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl =
278 InputProcessorProfiles_QueryInterface,
279 InputProcessorProfiles_AddRef,
280 InputProcessorProfiles_Release,
282 InputProcessorProfiles_Register,
283 InputProcessorProfiles_Unregister,
284 InputProcessorProfiles_AddLanguageProfile,
285 InputProcessorProfiles_RemoveLanguageProfile,
286 InputProcessorProfiles_EnumInputProcessorInfo,
287 InputProcessorProfiles_GetDefaultLanguageProfile,
288 InputProcessorProfiles_SetDefaultLanguageProfile,
289 InputProcessorProfiles_ActivateLanguageProfile,
290 InputProcessorProfiles_GetActiveLanguageProfile,
291 InputProcessorProfiles_GetLanguageProfileDescription,
292 InputProcessorProfiles_GetCurrentLanguage,
293 InputProcessorProfiles_ChangeCurrentLanguage,
294 InputProcessorProfiles_GetLanguageList,
295 InputProcessorProfiles_EnumLanguageProfiles,
296 InputProcessorProfiles_EnableLanguageProfile,
297 InputProcessorProfiles_IsEnabledLanguageProfile,
298 InputProcessorProfiles_EnableLanguageProfileByDefault,
299 InputProcessorProfiles_SubstituteKeyboardLayout
302 HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
304 InputProcessorProfiles *This;
306 return CLASS_E_NOAGGREGATION;
308 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputProcessorProfiles));
310 return E_OUTOFMEMORY;
312 This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl;
314 This->currentLanguage = GetUserDefaultLCID();
316 TRACE("returning %p\n", This);
317 *ppOut = (IUnknown *)This;