* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "config.h"
+
+#include <stdarg.h>
+
+#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 "olectl.h"
+
+#include "wine/unicode.h"
+
+#include "msctf.h"
#include "msctf_internal.h"
+WINE_DEFAULT_DEBUG_CHANNEL(msctf);
+
static const WCHAR szwLngp[] = {'L','a','n','g','u','a','g','e','P','r','o','f','i','l','e',0};
static const WCHAR szwEnable[] = {'E','n','a','b','l','e',0};
static const WCHAR szwTipfmt[] = {'%','s','\\','%','s',0};
static const WCHAR szwProfile[] = {'P','r','o','f','i','l','e',0};
static const WCHAR szwDefaultFmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0};
-typedef struct tagInputProcessorProfilesSink {
- struct list entry;
- union {
- /* InputProcessorProfile Sinks */
- IUnknown *pIUnknown;
- ITfLanguageProfileNotifySink *pITfLanguageProfileNotifySink;
- } interfaces;
-} InputProcessorProfilesSink;
-
typedef struct tagInputProcessorProfiles {
- const ITfInputProcessorProfilesVtbl *InputProcessorProfilesVtbl;
- const ITfSourceVtbl *SourceVtbl;
- /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */
+ ITfInputProcessorProfiles ITfInputProcessorProfiles_iface;
+ ITfSource ITfSource_iface;
+ ITfInputProcessorProfileMgr ITfInputProcessorProfileMgr_iface;
/* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */
/* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */
LONG refCount;
} InputProcessorProfiles;
typedef struct tagProfilesEnumGuid {
- const IEnumGUIDVtbl *Vtbl;
+ IEnumGUID IEnumGUID_iface;
LONG refCount;
HKEY key;
} ProfilesEnumGuid;
typedef struct tagEnumTfLanguageProfiles {
- const IEnumTfLanguageProfilesVtbl *Vtbl;
+ IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface;
LONG refCount;
HKEY tipkey;
ITfCategoryMgr *catmgr;
} EnumTfLanguageProfiles;
+typedef struct {
+ IEnumTfInputProcessorProfiles IEnumTfInputProcessorProfiles_iface;
+ LONG ref;
+} EnumTfInputProcessorProfiles;
+
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
-static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut);
+static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out);
+
+static inline EnumTfInputProcessorProfiles *impl_from_IEnumTfInputProcessorProfiles(IEnumTfInputProcessorProfiles *iface)
+{
+ return CONTAINING_RECORD(iface, EnumTfInputProcessorProfiles, IEnumTfInputProcessorProfiles_iface);
+}
+
+static HRESULT WINAPI EnumTfInputProcessorProfiles_QueryInterface(IEnumTfInputProcessorProfiles *iface,
+ REFIID riid, void **ppv)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+
+ if(IsEqualGUID(riid, &IID_IUnknown)) {
+ TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
+ *ppv = &This->IEnumTfInputProcessorProfiles_iface;
+ }else if(IsEqualGUID(riid, &IID_IEnumTfInputProcessorProfiles)) {
+ TRACE("(%p)->(IID_IEnumTfInputProcessorProfiles %p)\n", This, ppv);
+ *ppv = &This->IEnumTfInputProcessorProfiles_iface;
+ }else {
+ *ppv = NULL;
+ WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
+ return E_NOINTERFACE;
+ }
+
+ IUnknown_AddRef((IUnknown*)*ppv);
+ return S_OK;
+}
+
+static ULONG WINAPI EnumTfInputProcessorProfiles_AddRef(IEnumTfInputProcessorProfiles *iface)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+ LONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI EnumTfInputProcessorProfiles_Release(IEnumTfInputProcessorProfiles *iface)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+ LONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%d\n", This, ref);
+
+ if(!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+static HRESULT WINAPI EnumTfInputProcessorProfiles_Clone(IEnumTfInputProcessorProfiles *iface,
+ IEnumTfInputProcessorProfiles **ret)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+ FIXME("(%p)->(%p)\n", This, ret);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI EnumTfInputProcessorProfiles_Next(IEnumTfInputProcessorProfiles *iface, ULONG count,
+ TF_INPUTPROCESSORPROFILE *profile, ULONG *fetch)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+
+ FIXME("(%p)->(%u %p %p)\n", This, count, profile, fetch);
+
+ if(fetch)
+ *fetch = 0;
+ return S_FALSE;
+}
+
+static HRESULT WINAPI EnumTfInputProcessorProfiles_Reset(IEnumTfInputProcessorProfiles *iface)
+{
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+ FIXME("(%p)\n", This);
+ return E_NOTIMPL;
+}
-static inline InputProcessorProfiles *impl_from_ITfSourceVtbl(ITfSource *iface)
+static HRESULT WINAPI EnumTfInputProcessorProfiles_Skip(IEnumTfInputProcessorProfiles *iface, ULONG count)
{
- return (InputProcessorProfiles *)((char *)iface - FIELD_OFFSET(InputProcessorProfiles,SourceVtbl));
+ EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
+ FIXME("(%p)->(%u)\n", This, count);
+ return E_NOTIMPL;
}
-static void free_sink(InputProcessorProfilesSink *sink)
+static const IEnumTfInputProcessorProfilesVtbl EnumTfInputProcessorProfilesVtbl = {
+ EnumTfInputProcessorProfiles_QueryInterface,
+ EnumTfInputProcessorProfiles_AddRef,
+ EnumTfInputProcessorProfiles_Release,
+ EnumTfInputProcessorProfiles_Clone,
+ EnumTfInputProcessorProfiles_Next,
+ EnumTfInputProcessorProfiles_Reset,
+ EnumTfInputProcessorProfiles_Skip
+};
+
+static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfiles(ITfInputProcessorProfiles *iface)
{
- IUnknown_Release(sink->interfaces.pIUnknown);
- HeapFree(GetProcessHeap(),0,sink);
+ return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfiles_iface);
+}
+
+static inline InputProcessorProfiles *impl_from_ITfSource(ITfSource *iface)
+{
+ return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfSource_iface);
+}
+
+static inline ProfilesEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface)
+{
+ return CONTAINING_RECORD(iface, ProfilesEnumGuid, IEnumGUID_iface);
+}
+
+static inline EnumTfLanguageProfiles *impl_from_IEnumTfLanguageProfiles(IEnumTfLanguageProfiles *iface)
+{
+ return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface);
}
static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
{
- struct list *cursor, *cursor2;
TRACE("destroying %p\n", This);
- /* free sinks */
- LIST_FOR_EACH_SAFE(cursor, cursor2, &This->LanguageProfileNotifySink)
- {
- InputProcessorProfilesSink* sink = LIST_ENTRY(cursor,InputProcessorProfilesSink,entry);
- list_remove(cursor);
- free_sink(sink);
- }
-
+ free_sinks(&This->LanguageProfileNotifySink);
HeapFree(GetProcessHeap(),0,This);
}
RegCloseKey(key);
}
-static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut)
+static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, void **ppv)
{
- InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
- *ppvOut = NULL;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles))
{
- *ppvOut = This;
+ *ppv = &This->ITfInputProcessorProfiles_iface;
+ }
+ else if (IsEqualIID(iid, &IID_ITfInputProcessorProfileMgr))
+ {
+ *ppv = &This->ITfInputProcessorProfileMgr_iface;
}
else if (IsEqualIID(iid, &IID_ITfSource))
{
- *ppvOut = &This->SourceVtbl;
+ *ppv = &This->ITfSource_iface;
}
-
- if (*ppvOut)
+ else
{
- ITfInputProcessorProfiles_AddRef(iface);
- return S_OK;
+ *ppv = NULL;
+ WARN("unsupported interface: %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
}
- WARN("unsupported interface: %s\n", debugstr_guid(iid));
- return E_NOINTERFACE;
+ ITfInputProcessorProfiles_AddRef(iface);
+ return S_OK;
}
static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface)
{
- InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface)
{
- InputProcessorProfiles *This = (InputProcessorProfiles *)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
ULONG ret;
ret = InterlockedDecrement(&This->refCount);
static HRESULT WINAPI InputProcessorProfiles_Register(
ITfInputProcessorProfiles *iface, REFCLSID rclsid)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY tipkey;
WCHAR buf[39];
WCHAR fullkey[68];
static HRESULT WINAPI InputProcessorProfiles_Unregister(
ITfInputProcessorProfiles *iface, REFCLSID rclsid)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR buf[39];
WCHAR fullkey[68];
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile,
ULONG uIconIndex)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY tipkey,fmtkey;
WCHAR buf[39];
WCHAR fullkey[100];
static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0};
static const WCHAR icni[] = {'I','c','o','n','I','n','d','e','x',0};
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
-
TRACE("(%p) %s %x %s %s %s %i\n",This,debugstr_guid(rclsid), langid,
debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc),
debugstr_wn(pchIconFile,cchFile),uIconIndex);
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo(
ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TRACE("(%p) %p\n",This,ppEnum);
return ProfilesEnumGuid_Constructor(ppEnum);
}
ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid,
CLSID *pclsid, GUID *pguidProfile)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR fullkey[168];
WCHAR buf[39];
HKEY hkey;
DWORD count;
ULONG res;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile);
ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid,
REFGUID guidProfiles)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
WCHAR fullkey[168];
WCHAR buf[39];
HKEY hkey;
GUID catid;
HRESULT hr;
ITfCategoryMgr *catmgr;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
&GUID_TFCAT_TIP_SPEECH,
&GUID_TFCAT_TIP_HANDWRITING };
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfiles)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HRESULT hr;
BOOL enabled;
TF_LANGUAGEPROFILE LanguageProfile;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles));
LanguageProfile.clsid = *rclsid;
LanguageProfile.langid = langid;
LanguageProfile.guidProfile = *guidProfiles;
+ LanguageProfile.fActive = TRUE;
- hr = add_active_textservice(&LanguageProfile);
-
- return hr;
+ return add_active_textservice(&LanguageProfile);
}
static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
GUID *pguidProfile)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TF_LANGUAGEPROFILE profile;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile);
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BSTR *pbstrProfile)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
ITfInputProcessorProfiles *iface, LANGID *plangid)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
TRACE("(%p) 0x%x\n",This,This->currentLanguage);
if (!plangid)
static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
ITfInputProcessorProfiles *iface, LANGID langid)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
+ ITfLanguageProfileNotifySink *sink;
struct list *cursor;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
BOOL accept;
FIXME("STUB:(%p)\n",This);
- LIST_FOR_EACH(cursor, &This->LanguageProfileNotifySink)
+ SINK_FOR_EACH(cursor, &This->LanguageProfileNotifySink, ITfLanguageProfileNotifySink, sink)
{
- InputProcessorProfilesSink* sink = LIST_ENTRY(cursor,InputProcessorProfilesSink,entry);
accept = TRUE;
- ITfLanguageProfileNotifySink_OnLanguageChange(sink->interfaces.pITfLanguageProfileNotifySink, langid, &accept);
+ ITfLanguageProfileNotifySink_OnLanguageChange(sink, langid, &accept);
if (!accept)
- return E_FAIL;
+ return E_FAIL;
}
/* TODO: On successful language change call OnLanguageChanged sink */
static HRESULT WINAPI InputProcessorProfiles_GetLanguageList(
ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("Semi-STUB:(%p)\n",This);
*ppLangId = CoTaskMemAlloc(sizeof(LANGID));
**ppLangId = This->currentLanguage;
ITfInputProcessorProfiles *iface, LANGID langid,
IEnumTfLanguageProfiles **ppEnum)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
+ EnumTfLanguageProfiles *profenum;
+ HRESULT hr;
+
TRACE("(%p) %x %p\n",This,langid,ppEnum);
- return EnumTfLanguageProfiles_Constructor(langid, ppEnum);
+
+ if (!ppEnum)
+ return E_INVALIDARG;
+ hr = EnumTfLanguageProfiles_Constructor(langid, &profenum);
+ *ppEnum = &profenum->IEnumTfLanguageProfiles_iface;
+
+ return hr;
}
static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL fEnable)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key;
WCHAR buf[39];
WCHAR buf2[39];
WCHAR fullkey[168];
ULONG res;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable);
StringFromGUID2(rclsid, buf, 39);
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL *pfEnable)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key;
WCHAR buf[39];
WCHAR buf2[39];
WCHAR fullkey[168];
ULONG res;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable);
if (!pfEnable)
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, BOOL fEnable)
{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
HKEY key;
WCHAR buf[39];
WCHAR buf2[39];
WCHAR fullkey[168];
ULONG res;
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable);
StringFromGUID2(rclsid, buf, 39);
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
REFGUID guidProfile, HKL hKL)
{
- InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
}
-
-static const ITfInputProcessorProfilesVtbl InputProcessorProfiles_InputProcessorProfilesVtbl =
+static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl =
{
InputProcessorProfiles_QueryInterface,
InputProcessorProfiles_AddRef,
InputProcessorProfiles_Release,
-
InputProcessorProfiles_Register,
InputProcessorProfiles_Unregister,
InputProcessorProfiles_AddLanguageProfile,
InputProcessorProfiles_SubstituteKeyboardLayout
};
+static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfileMgr(ITfInputProcessorProfileMgr *iface)
+{
+ return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfileMgr_iface);
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_QueryInterface(ITfInputProcessorProfileMgr *iface, REFIID riid, void **ppv)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, riid, ppv);
+}
+
+static ULONG WINAPI InputProcessorProfileMgr_AddRef(ITfInputProcessorProfileMgr *iface)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface);
+}
+
+static ULONG WINAPI InputProcessorProfileMgr_Release(ITfInputProcessorProfileMgr *iface)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface);
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_ActivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
+ LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%d %x %s %s %p %x)\n", This, dwProfileType, langid, debugstr_guid(clsid),
+ debugstr_guid(guidProfile), hkl, dwFlags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_DeactivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
+ LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%d %x %s %s %p %x)\n", This, dwProfileType, langid, debugstr_guid(clsid),
+ debugstr_guid(guidProfile), hkl, dwFlags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_GetProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
+ LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, TF_INPUTPROCESSORPROFILE *pProfile)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%d %x %s %s %p %p)\n", This, dwProfileType, langid, debugstr_guid(clsid),
+ debugstr_guid(guidProfile), hkl, pProfile);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_EnumProfiles(ITfInputProcessorProfileMgr *iface, LANGID langid,
+ IEnumTfInputProcessorProfiles **ppEnum)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ EnumTfInputProcessorProfiles *enum_profiles;
+
+ TRACE("(%p)->(%x %p)\n", This, langid, ppEnum);
+
+ enum_profiles = HeapAlloc(GetProcessHeap(), 0, sizeof(*enum_profiles));
+ if(!enum_profiles)
+ return E_OUTOFMEMORY;
+
+ enum_profiles->IEnumTfInputProcessorProfiles_iface.lpVtbl = &EnumTfInputProcessorProfilesVtbl;
+ enum_profiles->ref = 1;
+
+ *ppEnum = &enum_profiles->IEnumTfInputProcessorProfiles_iface;
+ return S_OK;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_ReleaseInputProcessor(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
+ DWORD dwFlags)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%s %x)\n", This, debugstr_guid(rclsid), dwFlags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_RegisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
+ LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc, ULONG cchDesc, const WCHAR *pchIconFile,
+ ULONG cchFile, ULONG uIconIndex, HKL hklsubstitute, DWORD dwPreferredLayout, BOOL bEnabledByDefault,
+ DWORD dwFlags)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%s %x %s %s %d %s %u %u %p %x %x %x)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile),
+ debugstr_w(pchDesc), cchDesc, debugstr_w(pchIconFile), cchFile, uIconIndex, hklsubstitute, dwPreferredLayout,
+ bEnabledByDefault, dwFlags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_UnregisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
+ LANGID langid, REFGUID guidProfile, DWORD dwFlags)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%s %x %s %x)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), dwFlags);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI InputProcessorProfileMgr_GetActiveProfile(ITfInputProcessorProfileMgr *iface, REFGUID catid,
+ TF_INPUTPROCESSORPROFILE *pProfile)
+{
+ InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
+ FIXME("(%p)->(%s %p)\n", This, debugstr_guid(catid), pProfile);
+ return E_NOTIMPL;
+}
+
+static const ITfInputProcessorProfileMgrVtbl InputProcessorProfileMgrVtbl = {
+ InputProcessorProfileMgr_QueryInterface,
+ InputProcessorProfileMgr_AddRef,
+ InputProcessorProfileMgr_Release,
+ InputProcessorProfileMgr_ActivateProfile,
+ InputProcessorProfileMgr_DeactivateProfile,
+ InputProcessorProfileMgr_GetProfile,
+ InputProcessorProfileMgr_EnumProfiles,
+ InputProcessorProfileMgr_ReleaseInputProcessor,
+ InputProcessorProfileMgr_RegisterProfile,
+ InputProcessorProfileMgr_UnregisterProfile,
+ InputProcessorProfileMgr_GetActiveProfile
+};
+
/*****************************************************
* ITfSource functions
*****************************************************/
static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
{
- InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
- return InputProcessorProfiles_QueryInterface((ITfInputProcessorProfiles *)This, iid, *ppvOut);
+ InputProcessorProfiles *This = impl_from_ITfSource(iface);
+ return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, iid, ppvOut);
}
static ULONG WINAPI IPPSource_AddRef(ITfSource *iface)
{
- InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
- return InputProcessorProfiles_AddRef((ITfInputProcessorProfiles*)This);
+ InputProcessorProfiles *This = impl_from_ITfSource(iface);
+ return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface);
}
static ULONG WINAPI IPPSource_Release(ITfSource *iface)
{
- InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
- return InputProcessorProfiles_Release((ITfInputProcessorProfiles *)This);
+ InputProcessorProfiles *This = impl_from_ITfSource(iface);
+ return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface);
}
static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
{
- InputProcessorProfilesSink *ipps;
- InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
+ InputProcessorProfiles *This = impl_from_ITfSource(iface);
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
return E_INVALIDARG;
if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink))
- {
- ipps = HeapAlloc(GetProcessHeap(),0,sizeof(InputProcessorProfilesSink));
- if (!ipps)
- return E_OUTOFMEMORY;
- if (FAILED(IUnknown_QueryInterface(punk, riid, (LPVOID *)&ipps->interfaces.pITfLanguageProfileNotifySink)))
- {
- HeapFree(GetProcessHeap(),0,ipps);
- return CONNECT_E_CANNOTCONNECT;
- }
- list_add_head(&This->LanguageProfileNotifySink,&ipps->entry);
- *pdwCookie = generate_Cookie(COOKIE_MAGIC_IPPSINK, ipps);
- }
- else
- {
- FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
- return E_NOTIMPL;
- }
-
- TRACE("cookie %x\n",*pdwCookie);
+ return advise_sink(&This->LanguageProfileNotifySink, &IID_ITfLanguageProfileNotifySink,
+ COOKIE_MAGIC_IPPSINK, punk, pdwCookie);
- return S_OK;
+ FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
+ return E_NOTIMPL;
}
static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{
- InputProcessorProfilesSink *sink;
- InputProcessorProfiles *This = impl_from_ITfSourceVtbl(iface);
+ InputProcessorProfiles *This = impl_from_ITfSource(iface);
TRACE("(%p) %x\n",This,pdwCookie);
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_IPPSINK)
return E_INVALIDARG;
- sink = remove_Cookie(pdwCookie);
- if (!sink)
- return CONNECT_E_NOCONNECTION;
-
- list_remove(&sink->entry);
- free_sink(sink);
-
- return S_OK;
+ return unadvise_sink(pdwCookie);
}
-static const ITfSourceVtbl InputProcessorProfiles_SourceVtbl =
+static const ITfSourceVtbl InputProcessorProfilesSourceVtbl =
{
IPPSource_QueryInterface,
IPPSource_AddRef,
IPPSource_Release,
-
IPPSource_AdviseSink,
IPPSource_UnadviseSink,
};
if (This == NULL)
return E_OUTOFMEMORY;
- This->InputProcessorProfilesVtbl= &InputProcessorProfiles_InputProcessorProfilesVtbl;
- This->SourceVtbl = &InputProcessorProfiles_SourceVtbl;
+ This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl;
+ This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl;
+ This->ITfInputProcessorProfileMgr_iface.lpVtbl = &InputProcessorProfileMgrVtbl;
This->refCount = 1;
This->currentLanguage = GetUserDefaultLCID();
list_init(&This->LanguageProfileNotifySink);
- TRACE("returning %p\n", This);
- *ppOut = (IUnknown *)This;
+ *ppOut = (IUnknown *)&This->ITfInputProcessorProfiles_iface;
+ TRACE("returning %p\n", *ppOut);
return S_OK;
}
static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
*ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID))
{
- *ppvOut = This;
+ *ppvOut = &This->IEnumGUID_iface;
}
if (*ppvOut)
static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid*)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG ret;
ret = InterlockedDecrement(&This->refCount);
static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface,
ULONG celt, GUID *rgelt, ULONG *pceltFetched)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
ULONG fetched = 0;
TRACE("(%p)\n",This);
static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
TRACE("(%p)\n",This);
This->next_index += celt;
static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
TRACE("(%p)\n",This);
This->next_index = 0;
return S_OK;
static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface,
IEnumGUID **ppenum)
{
- ProfilesEnumGuid *This = (ProfilesEnumGuid *)iface;
+ ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
HRESULT res;
TRACE("(%p)\n",This);
res = ProfilesEnumGuid_Constructor(ppenum);
if (SUCCEEDED(res))
{
- ProfilesEnumGuid *new_This = (ProfilesEnumGuid *)*ppenum;
+ ProfilesEnumGuid *new_This = impl_from_IEnumGUID(*ppenum);
new_This->next_index = This->next_index;
}
return res;
}
-static const IEnumGUIDVtbl IEnumGUID_Vtbl ={
+static const IEnumGUIDVtbl EnumGUIDVtbl =
+{
ProfilesEnumGuid_QueryInterface,
ProfilesEnumGuid_AddRef,
ProfilesEnumGuid_Release,
-
ProfilesEnumGuid_Next,
ProfilesEnumGuid_Skip,
ProfilesEnumGuid_Reset,
if (This == NULL)
return E_OUTOFMEMORY;
- This->Vtbl= &IEnumGUID_Vtbl;
+ This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl;
This->refCount = 1;
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
return E_FAIL;
}
- TRACE("returning %p\n", This);
- *ppOut = (IEnumGUID*)This;
+ *ppOut = &This->IEnumGUID_iface;
+ TRACE("returning %p\n", *ppOut);
return S_OK;
}
static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
+
*ppvOut = NULL;
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles))
{
- *ppvOut = This;
+ *ppvOut = &This->IEnumTfLanguageProfiles_iface;
}
if (*ppvOut)
static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles*)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
return InterlockedIncrement(&This->refCount);
}
static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
ULONG ret;
ret = InterlockedDecrement(&This->refCount);
static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface,
ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
ULONG fetched = 0;
TRACE("(%p)\n",This);
static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
FIXME("STUB (%p)\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
TRACE("(%p)\n",This);
This->tip_index = 0;
if (This->langkey)
static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface,
IEnumTfLanguageProfiles **ppenum)
{
- EnumTfLanguageProfiles *This = (EnumTfLanguageProfiles *)iface;
+ EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
+ EnumTfLanguageProfiles *new_This;
HRESULT res;
TRACE("(%p)\n",This);
if (ppenum == NULL) return E_POINTER;
- res = EnumTfLanguageProfiles_Constructor(This->langid, ppenum);
+ res = EnumTfLanguageProfiles_Constructor(This->langid, &new_This);
if (SUCCEEDED(res))
{
- EnumTfLanguageProfiles *new_This = (EnumTfLanguageProfiles *)*ppenum;
new_This->tip_index = This->tip_index;
lstrcpynW(new_This->szwCurrentClsid,This->szwCurrentClsid,39);
res = RegOpenKeyExW(new_This->tipkey, fullkey, 0, KEY_READ | KEY_WRITE, &This->langkey);
new_This->lang_index = This->lang_index;
}
+ *ppenum = &new_This->IEnumTfLanguageProfiles_iface;
}
return res;
}
-static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={
+static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl =
+{
EnumTfLanguageProfiles_QueryInterface,
EnumTfLanguageProfiles_AddRef,
EnumTfLanguageProfiles_Release,
-
EnumTfLanguageProfiles_Clone,
EnumTfLanguageProfiles_Next,
EnumTfLanguageProfiles_Reset,
EnumTfLanguageProfiles_Skip
};
-static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut)
+static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out)
{
HRESULT hr;
EnumTfLanguageProfiles *This;
if (This == NULL)
return E_OUTOFMEMORY;
- This->Vtbl= &IEnumTfLanguageProfiles_Vtbl;
+ This->IEnumTfLanguageProfiles_iface.lpVtbl= &EnumTfLanguageProfilesVtbl;
This->refCount = 1;
This->langid = langid;
return E_FAIL;
}
- TRACE("returning %p\n", This);
- *ppOut = (IEnumTfLanguageProfiles*)This;
+ *out = This;
+ TRACE("returning %p\n", *out);
return S_OK;
}