From 6c842a86bb630ec83f30802925312b6d98dab208 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 3 Feb 2009 13:17:04 -0600 Subject: [PATCH] msctf: Add stub implementation of ITfInputProcessorProfiles. --- dlls/msctf/Makefile.in | 1 + dlls/msctf/inputprocessor.c | 295 ++++++++++++++++++++++++++++++++++++ dlls/msctf/msctf.c | 1 + dlls/msctf/msctf_internal.h | 1 + dlls/msctf/regsvr.c | 7 + dlls/uuid/uuid.c | 1 + include/msctf.idl | 100 ++++++++++++ 7 files changed, 406 insertions(+) create mode 100644 dlls/msctf/inputprocessor.c diff --git a/dlls/msctf/Makefile.in b/dlls/msctf/Makefile.in index cdb51d8804e..6577ef0db0d 100644 --- a/dlls/msctf/Makefile.in +++ b/dlls/msctf/Makefile.in @@ -8,6 +8,7 @@ IMPORTS = uuid ole32 user32 advapi32 kernel32 ntdll C_SRCS = \ context.c \ documentmgr.c \ + inputprocessor.c \ msctf.c \ regsvr.c \ threadmgr.c diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c new file mode 100644 index 00000000000..ca77964b2a7 --- /dev/null +++ b/dlls/msctf/inputprocessor.c @@ -0,0 +1,295 @@ +/* + * ITfInputProcessorProfiles implementation + * + * Copyright 2009 Aric Stewart, CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#define COBJMACROS + +#include "wine/debug.h" +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winuser.h" +#include "shlwapi.h" +#include "winerror.h" +#include "objbase.h" + +#include "wine/unicode.h" + +#include "msctf.h" +#include "msctf_internal.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msctf); + +typedef struct tagInputProcessorProfiles { + const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl; + LONG refCount; +} InputProcessorProfiles; + +static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut) +{ + InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface) +{ + InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface) +{ + InputProcessorProfiles *This = (InputProcessorProfiles *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + InputProcessorProfiles_Destructor(This); + return ret; +} + +/***************************************************** + * ITfInputProcessorProfiles functions + *****************************************************/ +static HRESULT WINAPI InputProcessorProfiles_Register( + ITfInputProcessorProfiles *iface, REFCLSID rclsid) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_Unregister( + ITfInputProcessorProfiles *iface, REFCLSID rclsid) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, + LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc, + ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile, + ULONG uIconIndex) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo( + ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile( + ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid, + CLSID *pclsid, GUID *pguidProfile) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile( + ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid, + REFGUID guidProfiles) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfiles) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid, + GUID *pguidProfile) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile, BSTR *pbstrProfile) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage( + ITfInputProcessorProfiles *iface, LANGID *plangid) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage( + ITfInputProcessorProfiles *iface, LANGID langid) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_GetLanguageList( + ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles( + ITfInputProcessorProfiles *iface, LANGID langid, + IEnumTfLanguageProfiles **ppEnum) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile, BOOL fEnable) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile, BOOL *pfEnable) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile, BOOL fEnable) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout( + ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid, + REFGUID guidProfile, HKL hKL) +{ + InputProcessorProfiles *This = (InputProcessorProfiles*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + + +static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl = +{ + InputProcessorProfiles_QueryInterface, + InputProcessorProfiles_AddRef, + InputProcessorProfiles_Release, + + InputProcessorProfiles_Register, + InputProcessorProfiles_Unregister, + InputProcessorProfiles_AddLanguageProfile, + InputProcessorProfiles_RemoveLanguageProfile, + InputProcessorProfiles_EnumInputProcessorInfo, + InputProcessorProfiles_GetDefaultLanguageProfile, + InputProcessorProfiles_SetDefaultLanguageProfile, + InputProcessorProfiles_ActivateLanguageProfile, + InputProcessorProfiles_GetActiveLanguageProfile, + InputProcessorProfiles_GetLanguageProfileDescription, + InputProcessorProfiles_GetCurrentLanguage, + InputProcessorProfiles_ChangeCurrentLanguage, + InputProcessorProfiles_GetLanguageList, + InputProcessorProfiles_EnumLanguageProfiles, + InputProcessorProfiles_EnableLanguageProfile, + InputProcessorProfiles_IsEnabledLanguageProfile, + InputProcessorProfiles_EnableLanguageProfileByDefault, + InputProcessorProfiles_SubstituteKeyboardLayout +}; + +HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + InputProcessorProfiles *This; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputProcessorProfiles)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl; + This->refCount = 1; + + TRACE("returning %p\n", This); + *ppOut = (IUnknown *)This; + return S_OK; +} diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c index 7dc1bcd6000..224ce99e4a6 100644 --- a/dlls/msctf/msctf.c +++ b/dlls/msctf/msctf.c @@ -52,6 +52,7 @@ static const struct { LPFNCONSTRUCTOR ctor; } ClassesTable[] = { {&CLSID_TF_ThreadMgr, ThreadMgr_Constructor}, + {&CLSID_TF_InputProcessorProfiles, InputProcessorProfiles_Constructor}, {NULL, NULL} }; diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index 347c475bbe0..1cb4924971f 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -25,5 +25,6 @@ extern DWORD tlsIndex; extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); extern HRESULT DocumentMgr_Constructor(ITfDocumentMgr **ppOut); extern HRESULT Context_Constructor(TfClientId tidOwner, IUnknown *punk, ITfContext **ppOut, TfEditCookie *pecTextStore); +extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); #endif /* __WINE_MSCTF_I_H */ diff --git a/dlls/msctf/regsvr.c b/dlls/msctf/regsvr.c index c461cd8b418..76be058488c 100644 --- a/dlls/msctf/regsvr.c +++ b/dlls/msctf/regsvr.c @@ -448,6 +448,13 @@ static struct regsvr_coclass const coclass_list[] = { "msctf.dll", "Apartment" }, + { + &CLSID_TF_InputProcessorProfiles, + "TF_InputProcessorProfiles", + NULL, + "msctf.dll", + "Apartment" + }, { NULL } /* list terminator */ }; diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c index 1196080d36a..ea4c8563ab5 100644 --- a/dlls/uuid/uuid.c +++ b/dlls/uuid/uuid.c @@ -110,3 +110,4 @@ DEFINE_GUID(CLSID_ManualResetEvent, 0x0000032c,0x0000,0x0000,0xc0,0x00,0x0 DEFINE_GUID(CLSID_SynchronizeContainer, 0x0000032d,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); DEFINE_GUID(CLSID_InProcFreeMarshaler, 0x0000033a,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); DEFINE_GUID(CLSID_TF_ThreadMgr, 0x529a9e6b,0x6587,0x4f23,0xab,0x9e,0x9c,0x7d,0x68,0x3e,0x3c,0x50); +DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed); diff --git a/include/msctf.idl b/include/msctf.idl index 93780f08564..a87147d578f 100644 --- a/include/msctf.idl +++ b/include/msctf.idl @@ -25,6 +25,7 @@ import "textstor.idl"; cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)") cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;") +cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;") typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)] DWORD TfEditCookie; typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId; @@ -44,6 +45,7 @@ interface ITfProperty; interface ITfReadOnlyProperty; interface IEnumTfProperties; interface ITfRangeBackup; +interface IEnumTfLanguageProfiles; [ object, @@ -240,3 +242,101 @@ interface ITfSource : IUnknown HRESULT UnadviseSink( [in] DWORD dwCookie); }; + +[ + object, + local, + uuid(1F02B6C5-7842-4EE6-8A0B-9A24183A95CA), + pointer_default(unique) +] +interface ITfInputProcessorProfiles : IUnknown +{ + HRESULT Register( + [in] REFCLSID rclsid); + + HRESULT Unregister( + [in] REFCLSID rclsid); + + HRESULT AddLanguageProfile( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [in, size_is(cchDesc)] const WCHAR *pchDesc, + [in] ULONG cchDesc, + [in, size_is(cchFile)] const WCHAR *pchIconFile, + [in] ULONG cchFile, + [in] ULONG uIconIndex); + + HRESULT RemoveLanguageProfile( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile); + + HRESULT EnumInputProcessorInfo( + [out] IEnumGUID **ppEnum); + + HRESULT GetDefaultLanguageProfile( + [in] LANGID langid, + [in] REFGUID catid, + [out] CLSID *pclsid, + [out] GUID *pguidProfile); + + HRESULT SetDefaultLanguageProfile( + [in] LANGID langid, + [in] REFCLSID rclsid, + [in] REFGUID guidProfiles); + + HRESULT ActivateLanguageProfile( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfiles); + + HRESULT GetActiveLanguageProfile( + [in] REFCLSID rclsid, + [out] LANGID *plangid, + [out] GUID *pguidProfile); + + HRESULT GetLanguageProfileDescription( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [out] BSTR *pbstrProfile); + + HRESULT GetCurrentLanguage( + [out] LANGID *plangid); + + HRESULT ChangeCurrentLanguage( + [in] LANGID langid); + + HRESULT GetLanguageList( + [out] LANGID **ppLangId, + [out] ULONG *pulCount); + + HRESULT EnumLanguageProfiles( + [in] LANGID langid, + [out] IEnumTfLanguageProfiles **ppEnum); + + HRESULT EnableLanguageProfile( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [in] BOOL fEnable); + + HRESULT IsEnabledLanguageProfile( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [out] BOOL *pfEnable); + + HRESULT EnableLanguageProfileByDefault( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [in] BOOL fEnable); + + HRESULT SubstituteKeyboardLayout( + [in] REFCLSID rclsid, + [in] LANGID langid, + [in] REFGUID guidProfile, + [in] HKL hKL); +};