Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

721 lines
16 KiB

  1. /****************************************************************************
  2. IMC.H
  3. Owner: cslim
  4. Copyright (c) 1997-1999 Microsoft Corporation
  5. IME Context abstraction class
  6. History:
  7. 20-JUL-1999 cslim Created
  8. *****************************************************************************/
  9. #if !defined(_IMC_H__INCLUDED_)
  10. #define _IMC_H__INCLUDED_
  11. #include "gdata.h"
  12. // No GCS_COMPCLAUSE
  13. #define GCS_COMP_KOR (GCS_COMPSTR|GCS_COMPATTR)
  14. class CIMECtx
  15. {
  16. // Ctor and Dtor
  17. public:
  18. CIMECtx(HIMC hIMC);
  19. ~CIMECtx();
  20. // CIMECtx Methods
  21. public:
  22. CIMEData* GetGData();
  23. LPIMEDATA GetGDataRaw();
  24. CHangulAutomata* GetAutomata();
  25. HIMC GetHIMC();
  26. HWND GetAppWnd();
  27. HWND GetUIWnd();
  28. VOID SetUIWnd(HWND hUIWnd);
  29. HIMCC GetHCandInfo();
  30. LPCANDIDATEINFO GetPCandInfo();
  31. HIMCC GetHCompStr();
  32. HIMCC GetHMsgBuf();
  33. BOOL IsOpen();
  34. VOID SetOpen(BOOL fOpen);
  35. VOID SetStatusWndPos(POINT &pt);
  36. VOID GetStatusWndPos(POINT* pPt);
  37. DWORD SetConversionMode(DWORD dwConvMode);
  38. DWORD GetConversionMode();
  39. DWORD SetSentenceMode(DWORD dwSentMode);
  40. DWORD GetSentenceMode();
  41. LOGFONT* GetLogFont();
  42. // Initial status
  43. VOID SetInitStatus(DWORD dwInitState);
  44. VOID GetInitStatus(LPDWORD pdwInitState);
  45. // Composition string
  46. VOID SetCompositionStr(WCHAR wch);
  47. WCHAR GetCompositionStr();
  48. WCHAR GetCompBufStr();
  49. VOID SetCompBufStr(WCHAR wch);
  50. VOID SetCompBufStr(CHAR chHigh, CHAR chLow);
  51. VOID ClearCompositionStrBuffer();
  52. VOID SetResultStr(WCHAR* pwSz);
  53. VOID SetResultStr(WCHAR wch1, WCHAR wch2=0);
  54. VOID AppendResultStr(WCHAR wch);
  55. VOID FinalizeCurCompositionChar();
  56. VOID ResetComposition();
  57. VOID StoreComposition();
  58. BOOL IsCompositionString();
  59. DWORD GetCompBufLen();
  60. VOID SetStartComposition(BOOL fStart);
  61. VOID SetEndComposition(BOOL fEnd);
  62. //LPCOMPOSITIONSTRING GetCompositionStrBuffer() { DbgAssert(m_pCompStr!=NULL); return m_pCompStr; }
  63. // Cand string
  64. VOID ResetCandidate();
  65. VOID AppendCandidateStr(WCHAR wcCand, LPWSTR wszMeaning);
  66. WCHAR GetCandidateStr(INT iIdx);
  67. LPWSTR GetCandidateMeaningStr(INT iIdx);
  68. INT GetCandidateCount();
  69. VOID StoreCandidate();
  70. enum MSG_CAND { MSG_NONE = 0, MSG_OPENCAND, MSG_CLOSECAND, MSG_CHANGECAND };
  71. VOID SetCandidateMsg(UINT uiMsg);
  72. VOID SetCandStrSelection(DWORD dwSel);
  73. // Composition form
  74. VOID GetCompositionForm(LPCOMPOSITIONFORM* ppCompForm);
  75. VOID SetCompositionFormStyle(DWORD dwStyle);
  76. DWORD GetCompositionFormStyle();
  77. VOID SetCompositionFormPos(POINT pt);
  78. VOID GetCompositionForm(POINT* pPt);
  79. VOID GetCompositionForm(RECT* pRc);
  80. // Cand Form
  81. DWORD GetCandidateFormIndex(INT iIdxCand);
  82. VOID SetCandidateFormIndex(INT iIdx, INT iIdxCand = 0);
  83. DWORD GetCandidateFormStyle(INT iIdxCand = 0);
  84. VOID SetCandidateFormStyle(DWORD dwStyle, INT iIdxCand = 0);
  85. VOID GetCandidateForm(RECT* pRc, INT iIdxCand = 0);
  86. VOID SetCandidateFormArea(RECT* pRc, INT iIdxCand = 0);
  87. VOID GetCandidateFormPos(POINT* pPt, INT iIdxCand = 0);
  88. VOID SetCandidateFormPos(POINT pt, INT iIdxCand = 0);
  89. /////////////////////////////////////////////////
  90. // MSG buffer structure support
  91. VOID SetTransMessage(LPTRANSMSGLIST pMessage);
  92. VOID ResetMessage();
  93. INT GetMessageCount();
  94. BOOL FinalizeMessage();
  95. VOID FlushCandMessage();
  96. BOOL GenerateMessage();
  97. INT AddMessage(UINT uiMessage, WPARAM wParam = 0, LPARAM lParam = 0);
  98. VOID AddKeyDownMessage(WPARAM wParam = 0, LPARAM lParam = 0);
  99. /////////////////////////////////////////////////
  100. // Unicode environment
  101. BOOL IsUnicodeEnv(VOID);
  102. VOID SetUnicode(BOOL fUnicode);
  103. VOID NonUnicodeConversion(WCHAR* pwStr, INT* pcchStr, CHAR* pwOStr, BYTE* pbAtr, INT* pcchAtr, BYTE* pbOAtr, DWORD* pdwCls, INT* pcchCls, DWORD* pdwOCls);
  104. VOID SetProcessKeyStatus(BOOL fSet);
  105. BOOL IsProcessKeyStatus(VOID);
  106. // new and delete operator overloading
  107. void* operator new(size_t size);
  108. void operator delete(void *lp);
  109. // Implementation
  110. private:
  111. VOID InitCompStrStruct();
  112. /////////////////////////////////////////////////
  113. // Private status
  114. VOID ResetGCS();
  115. DWORD GetGCS();
  116. VOID DelGCS(DWORD dwGCS);
  117. VOID AddGCS(DWORD dwGCS);
  118. DWORD ValidateGCS();
  119. void ClearCandMeaningArray();
  120. // Implementation
  121. protected:
  122. CIMEData* m_pCIMEData;
  123. // Internal data
  124. private:
  125. // IME Context handle and pointer
  126. HIMC m_hIMC;
  127. LPINPUTCONTEXT m_pIMC;
  128. // hangul Automata. Created once and will be shared between all apps.
  129. CHangulAutomata* m_rgpHangulAutomata[NUM_OF_IME_KL];
  130. // Unicode flag
  131. BOOL m_fUnicode; // TRUE=UNICODE env. FALSE=NON UNICODE env
  132. // Composition string support
  133. LPCOMPOSITIONSTRING m_pCompStr;
  134. // Candidate list support
  135. LPCANDIDATEINFO m_pCandInfo;
  136. INT m_iciCandidate;
  137. LPWSTR m_pCandStr;
  138. LPWSTR* m_rgpCandMeaningStr;
  139. // Msg generation support
  140. BOOL m_fEndComposition; // don't call AddMes( WM_IME_ENDCOMPOSITION) now
  141. BOOL m_fStartComposition; // don't call AddMes( WM_IME_STARTCOMPOSITION) now
  142. // BOOL m_fStartCompMsgSent;
  143. UINT m_uiSendCand;
  144. BOOL m_fKeyProcessing; // TRUE while ImeProcessKey()
  145. // REVIEW: see KKIME ui.cpp SetOpenStatusWindow( TRUE );
  146. BOOL m_fOpenStatusWindow; // open status window status
  147. // for WM_IME_COMPOSITION flag
  148. DWORD m_dwGCS;
  149. /////////////////////////////////////////////////
  150. // Composition string buffer
  151. WCHAR m_wcComp; // Comp string always 1 char long
  152. WCHAR m_wzResult[nMaxResultStrLen + 2]; // Result string maximum 2 chars + one null + one extra wchar
  153. // ANSI Composition string
  154. UCHAR m_szComp[nMaxCompStrLen*2 + 2]; // 2: one null + extra byte
  155. UCHAR m_szResult[nMaxResultStrLen*2 + 4]; // 2: one null + extra bytes
  156. /////////////////////////////////////////////////
  157. // MSG buffer structure support
  158. UINT m_uiMsgCount;
  159. LPTRANSMSG m_pMessage;
  160. LPTRANSMSGLIST m_pTransMessage; // for ToAsciiEx
  161. // WM_IME_KEYDOWN support
  162. BOOL m_fKeyDown;
  163. WPARAM m_wParamKeyDown;
  164. LPARAM m_lParamKeyDown;
  165. /////////////////////////////////////////////////
  166. // Private status
  167. DWORD m_dwCandInfoSize;
  168. DWORD m_dwMessageSize;
  169. };
  170. typedef CIMECtx* PCIMECtx;
  171. //////////////////////////////////////////////////////////////////////////////
  172. // Inline functions
  173. __inline
  174. CIMEData* CIMECtx::GetGData()
  175. {
  176. return m_pCIMEData;
  177. }
  178. __inline
  179. LPIMEDATA CIMECtx::GetGDataRaw()
  180. {
  181. if (m_pCIMEData)
  182. return m_pCIMEData->GetGDataRaw();
  183. else
  184. return NULL;
  185. }
  186. __inline
  187. CHangulAutomata* CIMECtx::GetAutomata()
  188. {
  189. AST_EX(m_pCIMEData != NULL);
  190. if (m_pCIMEData)
  191. return m_rgpHangulAutomata[m_pCIMEData->GetCurrentBeolsik()];
  192. else
  193. return m_rgpHangulAutomata[0];
  194. }
  195. __inline
  196. HIMC CIMECtx::GetHIMC()
  197. {
  198. return m_hIMC;
  199. }
  200. __inline
  201. HWND CIMECtx::GetAppWnd() // m_hIMC->hWnd
  202. {
  203. AST_EX(m_pIMC != NULL);
  204. if (m_pIMC == NULL)
  205. return (HWND)0;
  206. return m_pIMC->hWnd;
  207. }
  208. __inline
  209. HIMCC CIMECtx::GetHCandInfo()
  210. {
  211. AST_EX(m_pIMC != NULL);
  212. AST_EX(m_pIMC->hCandInfo != (HIMCC)0);
  213. if (m_pIMC == NULL)
  214. return NULL;
  215. return m_pIMC->hCandInfo;
  216. }
  217. __inline
  218. LPCANDIDATEINFO CIMECtx::GetPCandInfo()
  219. {
  220. return m_pCandInfo;
  221. }
  222. __inline
  223. HIMCC CIMECtx::GetHCompStr()
  224. {
  225. AST_EX(m_pIMC != NULL);
  226. AST_EX(m_pIMC->hCompStr != (HIMCC)0);
  227. if (m_pIMC == NULL)
  228. return NULL;
  229. return m_pIMC->hCompStr;
  230. }
  231. __inline
  232. HIMCC CIMECtx::GetHMsgBuf()
  233. {
  234. AST_EX(m_pIMC != NULL);
  235. AST_EX(m_pIMC->hMsgBuf != (HIMCC)0);
  236. if (m_pIMC == NULL)
  237. return NULL;
  238. return m_pIMC->hMsgBuf;
  239. }
  240. __inline
  241. VOID CIMECtx::SetOpen(BOOL fOpen)
  242. {
  243. m_pIMC->fOpen = fOpen;
  244. }
  245. __inline
  246. BOOL CIMECtx::IsOpen()
  247. {
  248. // sometime IMM sets 0xffffffff as TRUE
  249. if (m_pIMC == NULL)
  250. return fFalse;
  251. return (m_pIMC->fOpen ? fTrue : fFalse);
  252. }
  253. __inline
  254. VOID CIMECtx::SetStatusWndPos(POINT &pt)
  255. {
  256. m_pIMC->ptStatusWndPos = pt;
  257. }
  258. __inline
  259. VOID CIMECtx::GetStatusWndPos(POINT* pPt)
  260. {
  261. *pPt = m_pIMC->ptStatusWndPos;
  262. }
  263. __inline
  264. DWORD CIMECtx::SetConversionMode(DWORD dwConvMode)
  265. {
  266. DWORD dwPrevConv = m_pIMC->fdwConversion;
  267. m_pIMC->fdwConversion = dwConvMode;
  268. return dwPrevConv; // return previous conversion mode
  269. }
  270. __inline
  271. DWORD CIMECtx::GetConversionMode()
  272. {
  273. return m_pIMC->fdwConversion;
  274. }
  275. __inline
  276. DWORD CIMECtx::SetSentenceMode(DWORD dwSentMode)
  277. {
  278. DWORD dwPrevSent = m_pIMC->fdwSentence;
  279. m_pIMC->fdwSentence = dwSentMode;
  280. return dwPrevSent; // return previous sentence mode
  281. }
  282. __inline
  283. DWORD CIMECtx::GetSentenceMode()
  284. {
  285. return m_pIMC->fdwSentence;
  286. }
  287. __inline
  288. LOGFONT* CIMECtx::GetLogFont()
  289. {
  290. return (&(m_pIMC->lfFont.A));
  291. }
  292. // Composition form
  293. __inline
  294. VOID CIMECtx::GetCompositionForm(LPCOMPOSITIONFORM *ppCompForm)
  295. {
  296. *ppCompForm = &m_pIMC->cfCompForm;
  297. }
  298. __inline
  299. VOID CIMECtx::SetCompositionFormStyle(DWORD dwStyle)
  300. {
  301. m_pIMC->cfCompForm.dwStyle = dwStyle;
  302. }
  303. __inline
  304. DWORD CIMECtx::GetCompositionFormStyle()
  305. {
  306. return m_pIMC->cfCompForm.dwStyle;
  307. }
  308. __inline
  309. VOID CIMECtx::SetCompositionFormPos(POINT pt)
  310. {
  311. m_pIMC->cfCompForm.ptCurrentPos = pt;
  312. }
  313. __inline
  314. VOID CIMECtx::GetCompositionForm(POINT* pPt)
  315. {
  316. pPt->x = m_pIMC->cfCompForm.ptCurrentPos.x;
  317. pPt->y = m_pIMC->cfCompForm.ptCurrentPos.y;
  318. }
  319. __inline
  320. VOID CIMECtx::GetCompositionForm(RECT* pRc)
  321. {
  322. CopyRect(pRc, &m_pIMC->cfCompForm.rcArea);
  323. }
  324. __inline
  325. VOID CIMECtx::SetInitStatus(DWORD dwInitState)
  326. {
  327. m_pIMC->fdwInit = dwInitState;
  328. }
  329. __inline
  330. VOID CIMECtx::GetInitStatus(LPDWORD pdwInitState)
  331. {
  332. *pdwInitState = m_pIMC->fdwInit;
  333. }
  334. __inline
  335. VOID CIMECtx::SetCompositionStr(WCHAR wch)
  336. {
  337. DbgAssert(wch != 0);
  338. m_wcComp = wch;
  339. AddGCS(GCS_COMPSTR);
  340. }
  341. __inline
  342. WCHAR CIMECtx::GetCompositionStr()
  343. {
  344. return m_wcComp;
  345. }
  346. // WARNING: This function will set raw data to comp buffer directly.
  347. // Pls. very careful to use this function. It could break everything.
  348. __inline
  349. VOID CIMECtx::SetCompBufStr(WCHAR wch)
  350. {
  351. DbgAssert(IsUnicodeEnv() == fTrue);
  352. m_pCompStr->dwCompStrLen = m_pCompStr->dwCompAttrLen = 1;
  353. *((LPBYTE)m_pCompStr + m_pCompStr->dwCompAttrOffset) = ATTR_INPUT;
  354. *(LPWSTR)((LPBYTE)m_pCompStr + m_pCompStr->dwCompStrOffset) = wch;
  355. }
  356. // For ANSI conversion
  357. __inline
  358. VOID CIMECtx::SetCompBufStr(CHAR chHigh, CHAR chLow)
  359. {
  360. DbgAssert(IsUnicodeEnv() == fFalse);
  361. m_pCompStr->dwCompStrLen = 2;
  362. m_pCompStr->dwCompAttrLen = 1;
  363. *((LPBYTE)m_pCompStr + m_pCompStr->dwCompAttrOffset) = ATTR_INPUT;
  364. *(LPSTR)((LPBYTE)m_pCompStr + m_pCompStr->dwCompStrOffset) = chHigh;
  365. *(LPSTR)((LPBYTE)m_pCompStr + m_pCompStr->dwCompStrOffset + 1) = chLow;
  366. }
  367. // WARNING: This function will set raw data to comp buffer directly.
  368. // Pls. very careful to use this function. It could break everything.
  369. __inline
  370. VOID CIMECtx::ClearCompositionStrBuffer()
  371. {
  372. Dbg(DBGID_Key, TEXT("ClearCompositionStrBuffer():"));
  373. if (m_pCompStr)
  374. {
  375. m_pCompStr->dwCompStrLen = m_pCompStr->dwCompAttrLen = 0;
  376. *(LPWSTR)((LPBYTE)m_pCompStr + m_pCompStr->dwCompStrOffset) = L'\0';
  377. *((LPBYTE)m_pCompStr + m_pCompStr->dwCompAttrOffset) = 0;
  378. }
  379. }
  380. __inline
  381. VOID CIMECtx::SetResultStr(LPWSTR pwSz)
  382. {
  383. DbgAssert(pwSz != NULL);
  384. m_wzResult[0] = *pwSz++;
  385. m_wzResult[1] = *pwSz;
  386. AddGCS(GCS_RESULTSTR);
  387. }
  388. __inline
  389. VOID CIMECtx::SetResultStr(WCHAR wch1, WCHAR wch2)
  390. {
  391. DbgAssert(wch1 != 0);
  392. Dbg(DBGID_Key, "CIMECtx::SetResultStr - wch1 = 0x%04X, wch2 = 0x%04X", wch1, wch2);
  393. m_wzResult[0] = wch1;
  394. m_wzResult[1] = wch2;
  395. AddGCS(GCS_RESULTSTR);
  396. }
  397. __inline
  398. VOID CIMECtx::AppendResultStr(WCHAR wch)
  399. {
  400. DbgAssert(wch != 0);
  401. if (m_wzResult[0] == L'\0')
  402. m_wzResult[0] = wch;
  403. else
  404. m_wzResult[1] = wch;
  405. AddGCS(GCS_RESULTSTR);
  406. }
  407. __inline
  408. VOID CIMECtx::FinalizeCurCompositionChar()
  409. {
  410. if (GetAutomata() != NULL)
  411. {
  412. GetAutomata()->MakeComplete();
  413. SetResultStr(GetAutomata()->GetCompleteChar());
  414. }
  415. SetEndComposition(fTrue);
  416. if (!IsProcessKeyStatus())
  417. StoreComposition();
  418. }
  419. __inline
  420. VOID CIMECtx::ResetComposition()
  421. {
  422. m_wcComp = L'\0';
  423. ZeroMemory(m_wzResult, sizeof(m_wzResult));
  424. }
  425. __inline
  426. BOOL CIMECtx::IsCompositionString()
  427. {
  428. return (m_wcComp ? fTrue : fFalse);
  429. }
  430. __inline
  431. DWORD CIMECtx::GetCompBufLen()
  432. {
  433. if (GetHCompStr() != NULL)
  434. return (m_pCompStr->dwCompStrLen);
  435. else
  436. return 0;
  437. }
  438. __inline
  439. VOID CIMECtx::SetStartComposition(BOOL fStart)
  440. {
  441. m_fStartComposition = fStart;
  442. }
  443. __inline
  444. VOID CIMECtx::SetEndComposition(BOOL fEnd)
  445. {
  446. m_fEndComposition = fEnd;
  447. }
  448. __inline
  449. VOID CIMECtx::ResetCandidate()
  450. {
  451. ClearCandMeaningArray();
  452. m_iciCandidate = 0;
  453. }
  454. __inline
  455. INT CIMECtx::GetCandidateCount()
  456. {
  457. return m_iciCandidate;
  458. }
  459. __inline
  460. VOID CIMECtx::SetCandidateMsg(UINT uiMsg)
  461. {
  462. m_uiSendCand = uiMsg;
  463. }
  464. __inline
  465. VOID CIMECtx::SetCandStrSelection(DWORD dwSel)
  466. {
  467. LPCANDIDATELIST lpCandList;
  468. if (m_pCandInfo == NULL || m_pCandInfo->dwCount == 0)
  469. {
  470. DbgAssert(0);
  471. return;
  472. }
  473. lpCandList = (LPCANDIDATELIST)((LPBYTE)m_pCandInfo + sizeof(CANDIDATEINFO));
  474. lpCandList->dwPageStart = (dwSel / lpCandList->dwPageSize) * lpCandList->dwPageSize;
  475. lpCandList->dwSelection = dwSel;
  476. }
  477. /////////////////////////////////////////////////
  478. // Candidate form
  479. __inline
  480. DWORD CIMECtx::GetCandidateFormIndex(INT iIdxCand)
  481. {
  482. return m_pIMC->cfCandForm[iIdxCand].dwIndex;
  483. }
  484. __inline
  485. VOID CIMECtx::SetCandidateFormIndex(INT iIdx, INT iIdxCand)
  486. {
  487. m_pIMC->cfCandForm[iIdxCand].dwIndex = (DWORD)iIdx;
  488. }
  489. __inline
  490. VOID CIMECtx::SetCandidateFormStyle(DWORD dwStyle, INT iIdxCand)
  491. {
  492. m_pIMC->cfCandForm[iIdxCand].dwStyle = dwStyle;
  493. }
  494. __inline
  495. DWORD CIMECtx::GetCandidateFormStyle(INT iIdxCand)
  496. {
  497. return m_pIMC->cfCandForm[iIdxCand].dwStyle;
  498. }
  499. __inline
  500. VOID CIMECtx::GetCandidateForm(RECT* pRc, INT iIdxCand)
  501. {
  502. CopyRect( pRc, &m_pIMC->cfCandForm[iIdxCand].rcArea );
  503. }
  504. __inline
  505. VOID CIMECtx::SetCandidateFormArea(RECT* pRc, INT iIdxCand)
  506. {
  507. CopyRect( &m_pIMC->cfCandForm[iIdxCand].rcArea, pRc );
  508. }
  509. __inline
  510. VOID CIMECtx::GetCandidateFormPos(POINT* pPt, INT iIdxCand)
  511. {
  512. pPt->x = m_pIMC->cfCandForm[iIdxCand].ptCurrentPos.x;
  513. pPt->y = m_pIMC->cfCandForm[iIdxCand].ptCurrentPos.y;
  514. }
  515. __inline
  516. VOID CIMECtx::SetCandidateFormPos(POINT pt, INT iIdxCand)
  517. {
  518. m_pIMC->cfCandForm[iIdxCand].ptCurrentPos = pt;
  519. }
  520. /////////////////////////////////////////////////
  521. // MSG buffer structure support
  522. __inline
  523. VOID CIMECtx::SetTransMessage(LPTRANSMSGLIST pMessage)
  524. {
  525. m_pTransMessage = pMessage;
  526. }
  527. __inline
  528. VOID CIMECtx::ResetMessage()
  529. {
  530. m_uiMsgCount = 0;
  531. m_pTransMessage = NULL; // trans message now NULL
  532. m_fEndComposition = fFalse;
  533. m_fStartComposition = fFalse;
  534. m_uiSendCand = 0;
  535. m_fKeyDown = fFalse;
  536. }
  537. __inline
  538. INT CIMECtx::GetMessageCount()
  539. {
  540. return m_uiMsgCount;
  541. }
  542. __inline
  543. VOID CIMECtx::AddKeyDownMessage(WPARAM wParam, LPARAM lParam)
  544. {
  545. m_fKeyDown = fTrue;
  546. m_wParamKeyDown = wParam;
  547. m_lParamKeyDown = lParam;
  548. }
  549. /////////////////////////////////////////////////
  550. // Unicode environment
  551. __inline
  552. BOOL CIMECtx::IsUnicodeEnv(VOID)
  553. {
  554. return m_fUnicode;
  555. }
  556. /////////////////////////////////////////////////
  557. // Private status
  558. __inline
  559. VOID CIMECtx::ResetGCS(VOID)
  560. {
  561. m_dwGCS = 0;
  562. }
  563. __inline
  564. DWORD CIMECtx::GetGCS(VOID)
  565. {
  566. return m_dwGCS;
  567. }
  568. __inline
  569. VOID CIMECtx::DelGCS(DWORD dwGCS)
  570. {
  571. m_dwGCS &= ~dwGCS;
  572. }
  573. __inline
  574. VOID CIMECtx::AddGCS(DWORD dwGCS)
  575. {
  576. m_dwGCS |= dwGCS;
  577. }
  578. __inline
  579. DWORD CIMECtx::ValidateGCS(VOID)
  580. {
  581. if (m_wcComp == 0)
  582. DelGCS(GCS_COMP_KOR);
  583. if (m_wzResult[0] == 0)
  584. DelGCS(GCS_RESULT);
  585. return m_dwGCS;
  586. }
  587. __inline
  588. VOID CIMECtx::SetUnicode(BOOL fUnicode)
  589. {
  590. m_fUnicode = fUnicode;
  591. }
  592. __inline
  593. VOID CIMECtx::SetProcessKeyStatus(BOOL fSet)
  594. {
  595. m_fKeyProcessing = fSet;
  596. }
  597. __inline
  598. BOOL CIMECtx::IsProcessKeyStatus(VOID)
  599. {
  600. return m_fKeyProcessing;
  601. }
  602. __inline
  603. void* CIMECtx::operator new(size_t size)
  604. {
  605. return (void*)GlobalAllocPtr(GHND, size);
  606. }
  607. __inline
  608. void CIMECtx::operator delete(void* pv)
  609. {
  610. if (pv)
  611. GlobalFreePtr(pv);
  612. }
  613. #endif // _IMC_H__INCLUDED_