diff --git a/dlls/msctf/Makefile.in b/dlls/msctf/Makefile.in index f8c22add883..687255109bf 100644 --- a/dlls/msctf/Makefile.in +++ b/dlls/msctf/Makefile.in @@ -7,7 +7,8 @@ IMPORTS = uuid ole32 user32 advapi32 kernel32 ntdll C_SRCS = \ msctf.c \ - regsvr.c + regsvr.c \ + threadmgr.c @MAKE_DLL_RULES@ diff --git a/dlls/msctf/msctf.c b/dlls/msctf/msctf.c index 564eb7385e1..76ed99df0f0 100644 --- a/dlls/msctf/msctf.c +++ b/dlls/msctf/msctf.c @@ -31,7 +31,11 @@ #include "winreg.h" #include "shlwapi.h" #include "shlguid.h" +#include "comcat.h" #include "initguid.h" +#include "msctf.h" + +#include "msctf_internal.h" WINE_DEFAULT_DEBUG_CHANNEL(msctf); @@ -45,6 +49,7 @@ static const struct { REFCLSID clsid; LPFNCONSTRUCTOR ctor; } ClassesTable[] = { + {&CLSID_TF_ThreadMgr, ThreadMgr_Constructor}, {NULL, NULL} }; diff --git a/dlls/msctf/msctf_internal.h b/dlls/msctf/msctf_internal.h new file mode 100644 index 00000000000..b8fd3ba7d21 --- /dev/null +++ b/dlls/msctf/msctf_internal.h @@ -0,0 +1,26 @@ +/* + * Internal header for msctf.dll + * + * Copyright 2008 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 + */ + +#ifndef __WINE_MSCTF_I_H +#define __WINE_MSCTF_I_H + +extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); + +#endif /* __WINE_MSCTF_I_H */ diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c new file mode 100644 index 00000000000..18675708cb8 --- /dev/null +++ b/dlls/msctf/threadmgr.c @@ -0,0 +1,214 @@ +/* + * ITfThreadMgr implementation + * + * Copyright 2008 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 tagACLMulti { + const ITfThreadMgrVtbl *ThreadMgrVtbl; + LONG refCount; +} ThreadMgr; + +static void ThreadMgr_Destructor(ThreadMgr *This) +{ + TRACE("destroying %p\n", This); + HeapFree(GetProcessHeap(),0,This); +} + +static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) +{ + ThreadMgr *This = (ThreadMgr *)iface; + *ppvOut = NULL; + + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) + { + *ppvOut = This; + } + + if (*ppvOut) + { + IUnknown_AddRef(iface); + return S_OK; + } + + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + return InterlockedIncrement(&This->refCount); +} + +static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + ULONG ret; + + ret = InterlockedDecrement(&This->refCount); + if (ret == 0) + ThreadMgr_Destructor(This); + return ret; +} + +/***************************************************** + * ITfThreadMgr functions + *****************************************************/ + +static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr +**ppdim) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs +**ppEnum) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr +**ppdimFocus) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, +ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid, +ITfFunctionProvider **ppFuncProv) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface, +IEnumTfFunctionProviders **ppEnum) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface, +ITfCompartmentMgr **ppCompMgr) +{ + ThreadMgr *This = (ThreadMgr *)iface; + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl = +{ + ThreadMgr_QueryInterface, + ThreadMgr_AddRef, + ThreadMgr_Release, + + ThreadMgr_fnActivate, + ThreadMgr_fnDeactivate, + ThreadMgr_CreateDocumentMgr, + ThreadMgr_EnumDocumentMgrs, + ThreadMgr_GetFocus, + ThreadMgr_SetFocus, + ThreadMgr_AssociateFocus, + ThreadMgr_IsThreadFocus, + ThreadMgr_GetFunctionProvider, + ThreadMgr_EnumFunctionProviders, + ThreadMgr_GetGlobalCompartment +}; + +HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + ThreadMgr *This; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ThreadMgr)); + if (This == NULL) + return E_OUTOFMEMORY; + + This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl; + This->refCount = 1; + + TRACE("returning %p\n", This); + *ppOut = (IUnknown *)This; + return S_OK; +} diff --git a/include/msctf.idl b/include/msctf.idl index 52683d38346..2ef8b074bfb 100644 --- a/include/msctf.idl +++ b/include/msctf.idl @@ -24,3 +24,54 @@ import "comcat.idl"; #endif cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;") + +typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId; + +interface ITfDocumentMgr; +interface IEnumTfDocumentMgrs; +interface ITfFunctionProvider; +interface IEnumTfFunctionProviders; +interface ITfCompartmentMgr; + +[ + object, + uuid(aa80e801-2021-11d2-93e0-0060b067b86e), + pointer_default(unique) +] +interface ITfThreadMgr: IUnknown +{ + HRESULT Activate( + [out] TfClientId *ptid); + + HRESULT Deactivate(); + + HRESULT CreateDocumentMgr( + [out] ITfDocumentMgr **ppdim); + + HRESULT EnumDocumentMgrs( + [out] IEnumTfDocumentMgrs **ppEnum); + + HRESULT GetFocus( + [out] ITfDocumentMgr **ppdimFocus); + + HRESULT SetFocus( + [in] ITfDocumentMgr *pdimFocus); + + HRESULT AssociateFocus( + [in] HWND hwnd, + [in, unique] ITfDocumentMgr *pdimNew, + [out] ITfDocumentMgr **ppdimPrev); + + HRESULT IsThreadFocus( + [out] BOOL *pfThreadFocus); + + HRESULT GetFunctionProvider( + [in] REFCLSID clsid, + [out] ITfFunctionProvider **ppFuncProv); + + HRESULT EnumFunctionProviders( + [out] IEnumTfFunctionProviders **ppEnum); + + HRESULT GetGlobalCompartment( + [out] ITfCompartmentMgr **ppCompMgr); +};