From 2fe3b64fb459414e6ef8a0eb98e254541b74134b Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 3 Feb 2009 13:18:02 -0600 Subject: [PATCH] msctf: Stub implementation of ITfCategoryMgr. --- dlls/msctf/Makefile.in | 1 + dlls/msctf/categorymgr.c | 248 ++++++++++++++++++++++++++++++++++++ dlls/msctf/msctf.c | 1 + dlls/msctf/msctf_internal.h | 1 + dlls/msctf/regsvr.c | 7 + dlls/uuid/uuid.c | 1 + include/msctf.idl | 61 +++++++++ 7 files changed, 320 insertions(+) create mode 100644 dlls/msctf/categorymgr.c diff --git a/dlls/msctf/Makefile.in b/dlls/msctf/Makefile.in index 6577ef0db0d..5502bd6f953 100644 --- a/dlls/msctf/Makefile.in +++ b/dlls/msctf/Makefile.in @@ -6,6 +6,7 @@ MODULE = msctf.dll IMPORTS = uuid ole32 user32 advapi32 kernel32 ntdll C_SRCS = \ + categorymgr.c \ context.c \ documentmgr.c \ inputprocessor.c \ diff --git a/dlls/msctf/categorymgr.c b/dlls/msctf/categorymgr.c new file mode 100644 index 00000000000..297007c0f42 --- /dev/null +++ b/dlls/msctf/categorymgr.c @@ -0,0 +1,248 @@ +/* + * ITfCategoryMgr 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 tagCategoryMgr { + const ITfCategoryMgrVtbl *CategoryMgrVtbl; + LONG refCount; +} CategoryMgr; + +static void CategoryMgr_Destructor(CategoryMgr *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI CategoryMgr_QueryInterface(ITfCategoryMgr *iface, REFIID iid, LPVOID *ppvOut) +{ + CategoryMgr *This = (CategoryMgr *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCategoryMgr)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI CategoryMgr_AddRef(ITfCategoryMgr *iface) +{ + CategoryMgr *This = (CategoryMgr *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI CategoryMgr_Release(ITfCategoryMgr *iface) +{ + CategoryMgr *This = (CategoryMgr *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + CategoryMgr_Destructor(This); + return ret; +} + +/***************************************************** + * ITfCategoryMgr functions + *****************************************************/ + +static HRESULT WINAPI CategoryMgr_RegisterCategory ( ITfCategoryMgr *iface, + REFCLSID rclsid, REFGUID rcatid, REFGUID rguid) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_UnregisterCategory ( ITfCategoryMgr *iface, + REFCLSID rclsid, REFGUID rcatid, REFGUID rguid) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_EnumCategoriesInItem ( ITfCategoryMgr *iface, + REFGUID rguid, IEnumGUID **ppEnum) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_EnumItemsInCategory ( ITfCategoryMgr *iface, + REFGUID rcatid, IEnumGUID **ppEnum) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_FindClosestCategory ( ITfCategoryMgr *iface, + REFGUID rguid, GUID *pcatid, const GUID **ppcatidList, ULONG ulCount) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_RegisterGUIDDescription ( + ITfCategoryMgr *iface, REFCLSID rclsid, REFGUID rguid, + const WCHAR *pchDesc, ULONG cch) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_UnregisterGUIDDescription ( + ITfCategoryMgr *iface, REFCLSID rclsid, REFGUID rguid) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_GetGUIDDescription ( ITfCategoryMgr *iface, + REFGUID rguid, BSTR *pbstrDesc) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_RegisterGUIDDWORD ( ITfCategoryMgr *iface, + REFCLSID rclsid, REFGUID rguid, DWORD dw) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_UnregisterGUIDDWORD ( ITfCategoryMgr *iface, + REFCLSID rclsid, REFGUID rguid) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_GetGUIDDWORD ( ITfCategoryMgr *iface, + REFGUID rguid, DWORD *pdw) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_RegisterGUID ( ITfCategoryMgr *iface, + REFGUID rguid, TfGuidAtom *pguidatom +) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_GetGUID ( ITfCategoryMgr *iface, + TfGuidAtom guidatom, GUID *pguid) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI CategoryMgr_IsEqualTfGuidAtom ( ITfCategoryMgr *iface, + TfGuidAtom guidatom, REFGUID rguid, BOOL *pfEqual) +{ + CategoryMgr *This = (CategoryMgr*)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + + +static const ITfCategoryMgrVtbl CategoryMgr_CategoryMgrVtbl = +{ + CategoryMgr_QueryInterface, + CategoryMgr_AddRef, + CategoryMgr_Release, + + CategoryMgr_RegisterCategory, + CategoryMgr_UnregisterCategory, + CategoryMgr_EnumCategoriesInItem, + CategoryMgr_EnumItemsInCategory, + CategoryMgr_FindClosestCategory, + CategoryMgr_RegisterGUIDDescription, + CategoryMgr_UnregisterGUIDDescription, + CategoryMgr_GetGUIDDescription, + CategoryMgr_RegisterGUIDDWORD, + CategoryMgr_UnregisterGUIDDWORD, + CategoryMgr_GetGUIDDWORD, + CategoryMgr_RegisterGUID, + CategoryMgr_GetGUID, + CategoryMgr_IsEqualTfGuidAtom +}; + +HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + CategoryMgr *This; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CategoryMgr)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->CategoryMgrVtbl= &CategoryMgr_CategoryMgrVtbl; + 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 e34a9c8f696..956ac89c8d9 100644 --- a/dlls/msctf/msctf.c +++ b/dlls/msctf/msctf.c @@ -55,6 +55,7 @@ static const struct { } ClassesTable[] = { {&CLSID_TF_ThreadMgr, ThreadMgr_Constructor}, {&CLSID_TF_InputProcessorProfiles, InputProcessorProfiles_Constructor}, + {&CLSID_TF_CategoryMgr, CategoryMgr_Constructor}, {NULL, NULL} }; diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h index cea172334ab..4d83aa392bd 100644 --- a/dlls/msctf/msctf_internal.h +++ b/dlls/msctf/msctf_internal.h @@ -26,6 +26,7 @@ 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); +extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); extern const WCHAR szwSystemTIPKey[]; #endif /* __WINE_MSCTF_I_H */ diff --git a/dlls/msctf/regsvr.c b/dlls/msctf/regsvr.c index 76be058488c..a47d984296f 100644 --- a/dlls/msctf/regsvr.c +++ b/dlls/msctf/regsvr.c @@ -455,6 +455,13 @@ static struct regsvr_coclass const coclass_list[] = { "msctf.dll", "Apartment" }, + { + &CLSID_TF_CategoryMgr, + "TF_CategoryMgr", + NULL, + "msctf.dll", + "Apartment" + }, { NULL } /* list terminator */ }; diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c index ea4c8563ab5..f3af92e7949 100644 --- a/dlls/uuid/uuid.c +++ b/dlls/uuid/uuid.c @@ -111,3 +111,4 @@ DEFINE_GUID(CLSID_SynchronizeContainer, 0x0000032d,0x0000,0x0000,0xc0,0x00,0x0 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); +DEFINE_GUID(CLSID_TF_CategoryMgr, 0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7); diff --git a/include/msctf.idl b/include/msctf.idl index a87147d578f..2b5d2dd6316 100644 --- a/include/msctf.idl +++ b/include/msctf.idl @@ -26,9 +26,11 @@ 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;") +cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;") typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)] DWORD TfEditCookie; typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId; +typedef [uuid(88a9c478-f3ec-4763-8345-cd9250443f8d)] DWORD TfGuidAtom; interface ITfDocumentMgr; interface ITfContext; @@ -340,3 +342,62 @@ interface ITfInputProcessorProfiles : IUnknown [in] REFGUID guidProfile, [in] HKL hKL); }; + +[ + object, + local, + uuid(c3acefb5-f69d-4905-938f-fcadcf4be830), + pointer_default(unique) +] +interface ITfCategoryMgr : IUnknown +{ + HRESULT RegisterCategory([in] REFCLSID rclsid, + [in] REFGUID rcatid, + [in] REFGUID rguid); + + HRESULT UnregisterCategory([in] REFCLSID rclsid, + [in] REFGUID rcatid, + [in] REFGUID rguid); + + HRESULT EnumCategoriesInItem([in] REFGUID rguid, + [out] IEnumGUID **ppEnum); + + HRESULT EnumItemsInCategory([in] REFGUID rcatid, + [out] IEnumGUID **ppEnum); + + HRESULT FindClosestCategory([in] REFGUID rguid, + [out] GUID *pcatid, + [in, size_is(ulCount)] const GUID **ppcatidList, + [in] ULONG ulCount); + + HRESULT RegisterGUIDDescription([in] REFCLSID rclsid, + [in] REFGUID rguid, + [in, size_is(cch)] const WCHAR *pchDesc, + [in] ULONG cch); + + HRESULT UnregisterGUIDDescription([in] REFCLSID rclsid, + [in] REFGUID rguid); + + HRESULT GetGUIDDescription([in] REFGUID rguid, + [out] BSTR *pbstrDesc); + + HRESULT RegisterGUIDDWORD([in] REFCLSID rclsid, + [in] REFGUID rguid, + [in] DWORD dw); + + HRESULT UnregisterGUIDDWORD([in] REFCLSID rclsid, + [in] REFGUID rguid); + + HRESULT GetGUIDDWORD([in] REFGUID rguid, + [out] DWORD *pdw); + + HRESULT RegisterGUID([in] REFGUID rguid, + [out] TfGuidAtom *pguidatom); + + HRESULT GetGUID([in] TfGuidAtom guidatom, + [out] GUID *pguid); + + HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom, + [in] REFGUID rguid, + [out] BOOL *pfEqual); +};