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.

153 lines
4.2 KiB

  1. //
  2. // ICPRIV.H CICPriv class (TIP private data handling class)
  3. //
  4. // History:
  5. // 20-DEC-1999 CSLim Created
  6. #ifndef __ICPRIV_H__INCLUDED_
  7. #define __ICPRIV_H__INCLUDED_
  8. #include "korimx.h"
  9. #include "hauto.h"
  10. #include "tes.h"
  11. #include "gdata.h"
  12. class CMouseSink;
  13. class CICPriv : public IUnknown
  14. {
  15. public:
  16. CICPriv();
  17. ~CICPriv();
  18. //
  19. // IUnknown methods
  20. //
  21. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  22. STDMETHODIMP_(ULONG) AddRef(void);
  23. STDMETHODIMP_(ULONG) Release(void);
  24. // Operations
  25. public:
  26. // Initialize
  27. void Initialized(BOOL fInit) { m_fInitialized = fInit; }
  28. BOOL IsInitialized() { return m_fInitialized; }
  29. // CKorIMX
  30. void RegisterIMX(CKorIMX* pIMX) { m_pimx = pIMX; }
  31. CKorIMX* GetIMX() { return m_pimx; }
  32. // IC
  33. void RegisterIC(ITfContext* pic) { m_pic = pic; }
  34. ITfContext* GetIC(VOID) { return m_pic; }
  35. // Active composition
  36. void SetActiveComposition(ITfComposition *pComposition) { m_pActiveCompositon = pComposition; }
  37. ITfComposition* GetActiveComposition() { return m_pActiveCompositon; }
  38. //
  39. // Text edit sink cookie
  40. //
  41. VOID RegisterCookieForTextEditSink(DWORD dwCookie) { m_dwCookieForTextEditSink = dwCookie; }
  42. DWORD GetCookieForTextEditSink() { return m_dwCookieForTextEditSink; }
  43. //
  44. // transaction sink cookie
  45. //
  46. VOID RegisterCookieForTransactionSink(DWORD dwCookie) { m_dwCookieForTransactionSink = dwCookie; }
  47. DWORD GetCookieForTransactionSink() { return m_dwCookieForTransactionSink; }
  48. // Text event sink
  49. void RegisterCompartmentEventSink(CCompartmentEventSink* pCompartmentSink) { m_pCompartmentSink = pCompartmentSink; }
  50. CCompartmentEventSink* GetCompartmentEventSink() { return m_pCompartmentSink; }
  51. static HRESULT _TextEventCallback(UINT uCode, VOID *pv, VOID *pvData);
  52. // Set AIMM
  53. void SetAIMM(BOOL fAIMM) { m_fAIMM = fAIMM; }
  54. BOOL GetAIMM() { return m_fAIMM; }
  55. // Hangul Automata
  56. // void RegisterAutomata(CHangulAutomata *pHangulMachine) { m_pHangulMachine = pHangulMachine; }
  57. CHangulAutomata *GetAutomata();
  58. BOOL fGetK1HanjaOn();
  59. // Modebias
  60. TfGuidAtom GetModeBias() { return m_guidMBias; }
  61. void SetModeBias(TfGuidAtom guidMBias) { m_guidMBias = guidMBias; }
  62. BOOL GetfTransaction() { return m_fTransaction; }
  63. void SetfTransaction(BOOL ftran) { m_fTransaction = ftran; }
  64. // Mouse Sink
  65. void SetMouseSink(CMouseSink *pMouseSink) { m_pMouseSink = pMouseSink; }
  66. CMouseSink* GetMouseSink() { return m_pMouseSink; }
  67. static HRESULT _MouseCallback(ULONG uEdge, ULONG uQuadrant, DWORD dwBtnStatus, BOOL *pfEaten, void *pv);
  68. // IImePoint
  69. void RegisterIPoint(IImeIPoint1* pIP) { m_pIP = pIP; }
  70. IImeIPoint1* GetIPoint() { return m_pIP; }
  71. void InitializedIPoint(BOOL fInit) { m_fInitializedIPoint = fInit; }
  72. BOOL IsInitializedIPoint() { return m_fInitializedIPoint; }
  73. // Internal data
  74. protected:
  75. BOOL m_fInitialized;
  76. // CKorIMX
  77. CKorIMX* m_pimx;
  78. // Context
  79. ITfContext* m_pic;
  80. // Active composition
  81. ITfComposition* m_pActiveCompositon;
  82. // On/Off Compartment
  83. CCompartmentEventSink* m_pCompartmentSink;
  84. // AIMM
  85. BOOL m_fAIMM;
  86. // Hangul Automata object
  87. CHangulAutomata* m_rgpHangulAutomata[NUM_OF_IME_KL];
  88. // Shared memory for user setting.
  89. CIMEData* m_pCIMEData;
  90. // Modebias Atom
  91. TfGuidAtom m_guidMBias;
  92. DWORD m_dwCookieForTextEditSink;
  93. DWORD m_dwCookieForTransactionSink;
  94. // If in transaction
  95. BOOL m_fTransaction;
  96. // Mouse Sink
  97. CMouseSink *m_pMouseSink;
  98. // IImePoint for IME PAD
  99. IImeIPoint1 *m_pIP;
  100. BOOL m_fInitializedIPoint;
  101. // ref count
  102. LONG m_cRef;
  103. };
  104. //////////////////////////////////////////////////////////////////////////////
  105. // Inline functions
  106. inline
  107. CHangulAutomata *CICPriv::GetAutomata()
  108. {
  109. Assert(m_pCIMEData != NULL);
  110. if (m_pCIMEData && m_rgpHangulAutomata[m_pCIMEData->GetCurrentBeolsik()])
  111. return m_rgpHangulAutomata[m_pCIMEData->GetCurrentBeolsik()];
  112. else
  113. return NULL;
  114. }
  115. inline
  116. BOOL CICPriv::fGetK1HanjaOn()
  117. {
  118. if (m_pCIMEData && m_pCIMEData->GetKSC5657Hanja())
  119. return fTrue;
  120. else
  121. return fFalse;
  122. }
  123. #endif // __ICPRIV_H__INCLUDED_