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.

200 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1985 - 1999, Microsoft Corporation
  3. Module Name:
  4. imclock.h
  5. Abstract:
  6. This file defines the _IMCLock/_IMCCLock Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #ifndef _IMCLOCK_H_
  12. #define _IMCLOCK_H_
  13. typedef struct tagINPUTCONTEXT_AIMM12 {
  14. HWND hWnd;
  15. BOOL fOpen;
  16. POINT ptStatusWndPos;
  17. POINT ptSoftKbdPos;
  18. DWORD fdwConversion;
  19. DWORD fdwSentence;
  20. union {
  21. LOGFONTA A;
  22. LOGFONTW W;
  23. } lfFont;
  24. COMPOSITIONFORM cfCompForm;
  25. CANDIDATEFORM cfCandForm[4];
  26. HIMCC hCompStr;
  27. HIMCC hCandInfo;
  28. HIMCC hGuideLine;
  29. HIMCC hPrivate;
  30. DWORD dwNumMsgBuf;
  31. HIMCC hMsgBuf;
  32. DWORD fdwInit;
  33. //
  34. // Use dwReserve[0] area for AIMM12
  35. //
  36. union {
  37. DWORD m_dwReserve0;
  38. #ifdef _ENABLE_AIME_CONTEXT_
  39. IAImeContext* m_pContext;
  40. #endif
  41. #ifdef _ENABLE_CAIME_CONTEXT_
  42. CAImeContext* m_pAImeContext;
  43. #endif
  44. };
  45. //
  46. // Use dwReserve[1] area for AIMM12(Hangul mode tracking)
  47. //
  48. DWORD fdwHangul;
  49. DWORD dwReserve[1];
  50. } INPUTCONTEXT_AIMM12, *PINPUTCONTEXT_AIMM12, NEAR *NPINPUTCONTEXT_AIMM12, FAR *LPINPUTCONTEXT_AIMM12;
  51. // bit field for extended conversion mode
  52. #define IME_CMODE_GUID_NULL 0x80000000
  53. #define IME_SMODE_GUID_NULL 0x00008000
  54. typedef struct tagCOMPOSITIONSTRING_AIMM12 {
  55. COMPOSITIONSTRING CompStr;
  56. //
  57. // IME share of GUID map attribute.
  58. //
  59. DWORD dwTfGuidAtomLen;
  60. DWORD dwTfGuidAtomOffset;
  61. //
  62. DWORD dwGuidMapAttrLen;
  63. DWORD dwGuidMapAttrOffset;
  64. } COMPOSITIONSTRING_AIMM12, *PCOMPOSITIONSTRING_AIMM12, NEAR *NPCOMPOSITIONSTRING_AIMM12, FAR *LPCOMPOSITIONSTRING_AIMM12;
  65. // bits of fdwInit of INPUTCONTEXT
  66. #define INIT_GUID_ATOM 0x00000040
  67. //
  68. // AIMM12 Compatibility flag
  69. //
  70. extern LPCTSTR REG_MSIMTF_KEY;
  71. #define AIMM12_COMP_WINWORD 0x00000001
  72. class _IMCLock
  73. {
  74. public:
  75. _IMCLock(HIMC hImc=NULL);
  76. virtual ~_IMCLock() {};
  77. bool Valid() { return m_inputcontext != NULL ? m_hr == S_OK : FALSE; }
  78. bool Invalid() { return !Valid(); }
  79. HRESULT GetResult() { return m_inputcontext ? m_hr : E_FAIL; }
  80. operator INPUTCONTEXT_AIMM12*() { return m_inputcontext; }
  81. INPUTCONTEXT_AIMM12* operator->() {
  82. ASSERT(m_inputcontext);
  83. return m_inputcontext;
  84. }
  85. operator HIMC() { return m_himc; }
  86. BOOL IsUnicode() { return m_fUnicode; }
  87. protected:
  88. INPUTCONTEXT_AIMM12* m_inputcontext;
  89. HIMC m_himc;
  90. HRESULT m_hr;
  91. BOOL m_fUnicode;
  92. virtual HRESULT _LockIMC(HIMC hIMC, INPUTCONTEXT_AIMM12 **ppIMC) = 0;
  93. virtual HRESULT _UnlockIMC(HIMC hIMC) = 0;
  94. private:
  95. // Do not allow to make a copy
  96. _IMCLock(_IMCLock&) { }
  97. };
  98. inline
  99. _IMCLock::_IMCLock(
  100. HIMC hImc
  101. )
  102. {
  103. m_inputcontext = NULL;
  104. m_himc = hImc;
  105. m_hr = S_OK;
  106. m_fUnicode = FALSE;
  107. }
  108. class _IMCCLock
  109. {
  110. public:
  111. _IMCCLock(HIMCC himcc = NULL);
  112. virtual ~_IMCCLock() {};
  113. bool Valid() { return m_pimcc != NULL; }
  114. bool Invalid() { return !Valid(); }
  115. HRESULT GetResult() { return m_pimcc ? m_hr : E_FAIL; }
  116. void ReleaseBuffer() { }
  117. void* GetOffsetPointer(DWORD dwOffset) {
  118. return (void*)( (LPBYTE)m_pimcc + dwOffset );
  119. }
  120. protected:
  121. union {
  122. void* m_pimcc;
  123. COMPOSITIONSTRING_AIMM12* m_pcomp;
  124. #ifdef _ENABLE_PRIVCONTEXT_
  125. PRIVCONTEXT* m_ppriv;
  126. #endif
  127. };
  128. HIMCC m_himcc;
  129. HRESULT m_hr;
  130. virtual HRESULT _LockIMCC(HIMCC hIMCC, void **ppv) = 0;
  131. virtual HRESULT _UnlockIMCC(HIMCC hIMCC) = 0;
  132. private:
  133. void init(HIMCC hImcc);
  134. // Do not allow to make a copy
  135. _IMCCLock(_IMCCLock&) { }
  136. };
  137. inline
  138. _IMCCLock::_IMCCLock(
  139. HIMCC hImcc
  140. )
  141. {
  142. init(hImcc);
  143. }
  144. inline
  145. void
  146. _IMCCLock::init(
  147. HIMCC hImcc
  148. )
  149. {
  150. m_pimcc = NULL;
  151. m_himcc = hImcc;
  152. m_hr = S_OK;
  153. }
  154. #endif // _IMCLOCK_H_