ReactOS 0.4.16-dev-1668-g3f66390
CEnumTfLanguageProfiles Class Reference
Inheritance diagram for CEnumTfLanguageProfiles:
Collaboration diagram for CEnumTfLanguageProfiles:

Public Member Functions

 CEnumTfLanguageProfiles (LANGID langid)
 
virtual ~CEnumTfLanguageProfiles ()
 
STDMETHODIMP QueryInterface (REFIID iid, LPVOID *ppvObj) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP Clone (_Out_ IEnumTfLanguageProfiles **ppEnum) override
 
STDMETHODIMP Next (_In_ ULONG ulCount, _Out_ TF_LANGUAGEPROFILE *pProfile, _Out_ ULONG *pcFetch) override
 
STDMETHODIMP Reset () override
 
STDMETHODIMP Skip (_In_ ULONG ulCount) override
 
- Public Member Functions inherited from IEnumTfLanguageProfiles
HRESULT Clone ([out] IEnumTfLanguageProfiles **ppEnum)
 
HRESULT Next ([in] ULONG ulCount, [out, size_is(ulCount), length_is(*pcFetch)] TF_LANGUAGEPROFILE *pProfile, [out] ULONG *pcFetch)
 
HRESULT Reset ()
 
HRESULT Skip ([in] ULONG ulCount)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Static Public Member Functions

static HRESULT CreateInstance (LANGID langid, CEnumTfLanguageProfiles **out)
 

Protected Member Functions

INT next_LanguageProfile (CLSID clsid, TF_LANGUAGEPROFILE *tflp)
 

Protected Attributes

LONG m_cRefs
 
HKEY m_tipkey
 
DWORD m_tip_index
 
WCHAR m_szwCurrentClsid [39]
 
HKEY m_langkey
 
DWORD m_lang_index
 
LANGID m_langid
 
ITfCategoryMgrm_catmgr
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 198 of file inputprocessor.cpp.

Constructor & Destructor Documentation

◆ CEnumTfLanguageProfiles()

CEnumTfLanguageProfiles::CEnumTfLanguageProfiles ( LANGID  langid)

Definition at line 1038 of file inputprocessor.cpp.

1039 : m_cRefs(1)
1040 , m_langid(langid)
1041{
1042}
LANGID langid
Definition: msctf.idl:626

◆ ~CEnumTfLanguageProfiles()

CEnumTfLanguageProfiles::~CEnumTfLanguageProfiles ( )
virtual

Definition at line 1044 of file inputprocessor.cpp.

1045{
1046 TRACE("destroying %p\n", this);
1048 if (m_langkey)
1050 m_catmgr->Release();
1051}
#define RegCloseKey(hKey)
Definition: registry.h:49
ITfCategoryMgr * m_catmgr
ULONG Release()
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ Clone()

STDMETHODIMP CEnumTfLanguageProfiles::Clone ( _Out_ IEnumTfLanguageProfiles **  ppEnum)
override

Definition at line 1228 of file inputprocessor.cpp.

1229{
1230 TRACE("(%p)\n", this);
1231
1232 if (!ppEnum)
1233 return E_POINTER;
1234
1235 *ppEnum = NULL;
1236
1237 CEnumTfLanguageProfiles *new_This;
1239 if (FAILED(hr))
1240 return hr;
1241
1242 new_This->m_tip_index = m_tip_index;
1244
1245 if (m_langkey)
1246 {
1247 WCHAR fullkey[168];
1248 StringCchPrintfW(fullkey, _countof(fullkey), L"%s\\%s\\0x%08x", m_szwCurrentClsid, L"LanguageProfile", m_langid);
1249 RegOpenKeyExW(new_This->m_tipkey, fullkey, 0, KEY_READ | KEY_WRITE, &new_This->m_langkey);
1250 new_This->m_lang_index = m_lang_index;
1251 }
1252
1253 *ppEnum = static_cast<IEnumTfLanguageProfiles *>(new_This);
1254 return hr;
1255}
static HRESULT CreateInstance(LANGID langid, CEnumTfLanguageProfiles **out)
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define lstrcpynW
Definition: compat.h:738
#define L(x)
Definition: resources.c:13
#define FAILED(hr)
Definition: intsafe.h:51
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define E_POINTER
Definition: winerror.h:3480
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ CreateInstance()

HRESULT CEnumTfLanguageProfiles::CreateInstance ( LANGID  langid,
CEnumTfLanguageProfiles **  out 
)
static

Definition at line 1053 of file inputprocessor.cpp.

1054{
1055 HRESULT hr;
1057 if (!This)
1058 return E_OUTOFMEMORY;
1059
1060 hr = CategoryMgr_Constructor(NULL, (IUnknown**)&This->m_catmgr);
1061 if (FAILED(hr))
1062 {
1063 delete This;
1064 return hr;
1065 }
1066
1068 KEY_READ | KEY_WRITE, NULL, &This->m_tipkey, NULL) != ERROR_SUCCESS)
1069 {
1070 delete This;
1071 return E_FAIL;
1072 }
1073
1074 *out = This;
1075 TRACE("returning %p\n", *out);
1076 return S_OK;
1077}
#define szwSystemTIPKey
Definition: precomp.h:105
EXTERN_C HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
#define cicNoThrow
Definition: cicbase.h:46
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define S_OK
Definition: intsafe.h:52
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by Clone(), and CInputProcessorProfiles::EnumLanguageProfiles().

◆ Next()

STDMETHODIMP CEnumTfLanguageProfiles::Next ( _In_ ULONG  ulCount,
_Out_ TF_LANGUAGEPROFILE pProfile,
_Out_ ULONG pcFetch 
)
override

Definition at line 1158 of file inputprocessor.cpp.

1162{
1163 ULONG fetched = 0;
1164
1165 TRACE("(%p)\n", this);
1166
1167 if (!pProfile)
1168 return E_POINTER;
1169
1170 if (m_tipkey)
1171 {
1172 while (fetched < ulCount)
1173 {
1174 LSTATUS error;
1175 HRESULT hr;
1177 CLSID clsid;
1178
1180 NULL, NULL);
1182 break;
1183
1184 ++m_tip_index;
1185
1187 if (FAILED(hr))
1188 continue;
1189
1190 while (fetched < ulCount)
1191 {
1192 INT res = next_LanguageProfile(clsid, pProfile);
1193 if (res == 1)
1194 {
1195 ++fetched;
1196 ++pProfile;
1197 }
1198 else if (res == -1)
1199 {
1200 break;
1201 }
1202 }
1203 }
1204 }
1205
1206 if (pcFetch)
1207 *pcFetch = fetched;
1208 return (fetched == ulCount) ? S_OK : S_FALSE;
1209}
INT next_LanguageProfile(CLSID clsid, TF_LANGUAGEPROFILE *tflp)
#define ERROR_MORE_DATA
Definition: dderror.h:13
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
#define error(str)
Definition: mkdosfs.c:1605
const CLSID * clsid
Definition: msctf.cpp:50
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:3451

◆ next_LanguageProfile()

INT CEnumTfLanguageProfiles::next_LanguageProfile ( CLSID  clsid,
TF_LANGUAGEPROFILE tflp 
)
protected

Definition at line 1109 of file inputprocessor.cpp.

1110{
1111 WCHAR fullkey[168], profileid[39];
1112 LSTATUS error;
1113 DWORD cName = _countof(profileid);
1114 GUID profile;
1115
1116 if (!m_langkey)
1117 {
1118 StringCchPrintfW(fullkey, _countof(fullkey), L"%s\\%s\\0x%08x", m_szwCurrentClsid,
1119 L"LanguageProfile", m_langid);
1121 if (error != ERROR_SUCCESS)
1122 {
1123 m_langkey = NULL;
1124 return -1;
1125 }
1126 m_lang_index = 0;
1127 }
1128
1129 error = RegEnumKeyExW(m_langkey, m_lang_index, profileid, &cName, NULL, NULL, NULL, NULL);
1131 {
1133 m_langkey = NULL;
1134 return -1;
1135 }
1136 ++m_lang_index;
1137
1138 if (tflp)
1139 {
1140 static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
1143 HRESULT hr = CLSIDFromString(profileid, &profile);
1144 if (FAILED(hr))
1145 return 0;
1146
1147 tflp->clsid = clsid;
1148 tflp->langid = m_langid;
1150 tflp->guidProfile = profile;
1151 if (m_catmgr->FindClosestCategory(clsid, &tflp->catid, tipcats, 3) != S_OK)
1153 }
1154
1155 return 1;
1156}
HRESULT FindClosestCategory([in] REFGUID rguid, [out] GUID *pcatid, [in, size_is(ulCount)] const GUID **ppcatidList, [in] ULONG ulCount)
#define profile
Definition: kernel32.h:12
EXTERN_C BOOL get_active_textservice(REFCLSID rclsid, TF_LANGUAGEPROFILE *profile)
Definition: msctf.cpp:432
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:81
EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH
Definition: msctf.idl:82
EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING
Definition: msctf.idl:83

Referenced by Next().

◆ QueryInterface()

STDMETHODIMP CEnumTfLanguageProfiles::QueryInterface ( REFIID  iid,
LPVOID ppvObj 
)
override

Definition at line 1079 of file inputprocessor.cpp.

1080{
1081 *ppvObj = NULL;
1082
1083 if (iid == IID_IUnknown || iid == IID_IEnumTfLanguageProfiles)
1084 *ppvObj = static_cast<IEnumTfLanguageProfiles *>(this);
1085
1086 if (*ppvObj)
1087 {
1088 AddRef();
1089 return S_OK;
1090 }
1091
1092 WARN("unsupported interface: %s\n", debugstr_guid(&iid));
1093 return E_NOINTERFACE;
1094}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
ULONG AddRef()
#define debugstr_guid
Definition: kernel32.h:35
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ Reset()

STDMETHODIMP CEnumTfLanguageProfiles::Reset ( )
override

Implements IEnumTfLanguageProfiles.

Definition at line 1217 of file inputprocessor.cpp.

1218{
1219 TRACE("(%p)\n", this);
1220 m_tip_index = 0;
1221 if (m_langkey)
1223 m_langkey = NULL;
1224 m_lang_index = 0;
1225 return S_OK;
1226}

◆ Skip()

STDMETHODIMP CEnumTfLanguageProfiles::Skip ( _In_ ULONG  ulCount)
override

Definition at line 1211 of file inputprocessor.cpp.

1212{
1213 FIXME("STUB (%p)\n", this);
1214 return E_NOTIMPL;
1215}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ STDMETHODIMP_() [1/2]

CEnumTfLanguageProfiles::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

CEnumTfLanguageProfiles::STDMETHODIMP_ ( ULONG  )
override

Member Data Documentation

◆ m_catmgr

ITfCategoryMgr* CEnumTfLanguageProfiles::m_catmgr
protected

Definition at line 229 of file inputprocessor.cpp.

Referenced by next_LanguageProfile(), and ~CEnumTfLanguageProfiles().

◆ m_cRefs

LONG CEnumTfLanguageProfiles::m_cRefs
protected

Definition at line 222 of file inputprocessor.cpp.

◆ m_lang_index

DWORD CEnumTfLanguageProfiles::m_lang_index
protected

Definition at line 227 of file inputprocessor.cpp.

Referenced by Clone(), next_LanguageProfile(), and Reset().

◆ m_langid

LANGID CEnumTfLanguageProfiles::m_langid
protected

Definition at line 228 of file inputprocessor.cpp.

Referenced by Clone(), and next_LanguageProfile().

◆ m_langkey

HKEY CEnumTfLanguageProfiles::m_langkey
protected

Definition at line 226 of file inputprocessor.cpp.

Referenced by Clone(), next_LanguageProfile(), Reset(), and ~CEnumTfLanguageProfiles().

◆ m_szwCurrentClsid

WCHAR CEnumTfLanguageProfiles::m_szwCurrentClsid[39]
protected

Definition at line 225 of file inputprocessor.cpp.

Referenced by Clone(), Next(), and next_LanguageProfile().

◆ m_tip_index

DWORD CEnumTfLanguageProfiles::m_tip_index
protected

Definition at line 224 of file inputprocessor.cpp.

Referenced by Clone(), Next(), and Reset().

◆ m_tipkey

HKEY CEnumTfLanguageProfiles::m_tipkey
protected

Definition at line 223 of file inputprocessor.cpp.

Referenced by Clone(), Next(), next_LanguageProfile(), and ~CEnumTfLanguageProfiles().


The documentation for this class was generated from the following file: