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.

177 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 2001, Microsoft Corporation
  3. Module Name:
  4. txtevcb.h
  5. Abstract:
  6. This file defines the CTextEventSinkCallBack Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #ifndef _TXTEVCB_H_
  12. #define _TXTEVCB_H_
  13. #include "template.h"
  14. #include "imc.h"
  15. #include "context.h"
  16. class CTextEventSinkCallBack : public CTextEventSink
  17. {
  18. public:
  19. CTextEventSinkCallBack(HIMC hIMC,
  20. TfClientId tid,
  21. Interface_Attach<ITfContext> pic,
  22. LIBTHREAD* pLibTLS)
  23. : m_hIMC(hIMC), m_tid(tid), m_ic(pic), m_pLibTLS(pLibTLS),
  24. CTextEventSink(TextEventSinkCallback, NULL)
  25. {
  26. }
  27. virtual ~CTextEventSinkCallBack() { }
  28. void SetCallbackDataPointer(void* pv)
  29. {
  30. SetCallbackPV(pv);
  31. };
  32. BOOL _IsSapiFeedbackUIPresent(Interface_Attach<ITfContext>& ic, TESENDEDIT *ee);
  33. BOOL _IsComposingPresent(Interface_Attach<ITfContext>& ic, TESENDEDIT *ee);
  34. BOOL _IsInterim(Interface_Attach<ITfContext>& ic, TESENDEDIT *ee);
  35. BOOL _IsCompositionChanged(Interface_Attach<ITfContext>& ic, TESENDEDIT *ee);
  36. //
  37. // Callbacks
  38. //
  39. private:
  40. static HRESULT TextEventSinkCallback(UINT uCode, void *pv, void *pvData);
  41. //
  42. // Enumrate property
  43. //
  44. typedef struct _EnumPropertyArgs
  45. {
  46. Interface<ITfProperty> Property;
  47. TfEditCookie ec;
  48. GUID comp_guid;
  49. LIBTHREAD *pLibTLS;
  50. } EnumPropertyArgs;
  51. static ENUM_RET EnumPropertyCallback(ITfRange* pRange, EnumPropertyArgs *pargs);
  52. //
  53. // Enumrate track property
  54. //
  55. typedef struct _EnumTrackPropertyArgs
  56. {
  57. Interface<ITfReadOnlyProperty> Property;
  58. TfEditCookie ec;
  59. GUID **guids;
  60. int num_guids;
  61. LIBTHREAD *pLibTLS;
  62. } EnumTrackPropertyArgs;
  63. static ENUM_RET EnumTrackPropertyCallback(ITfRange* pRange, EnumTrackPropertyArgs *pargs);
  64. //
  65. // Enumrate property update
  66. //
  67. typedef struct _EnumPropertyUpdateArgs
  68. {
  69. _EnumPropertyUpdateArgs(ITfContext* pv, TfClientId p1, IMCLock& p2, LIBTHREAD* p3) : ic(pv), tid(p1), imc(p2), pLibTLS(p3) { }
  70. Interface<ITfProperty> Property;
  71. TfEditCookie ec;
  72. Interface_Attach<ITfContext> ic;
  73. IMCLock& imc;
  74. DWORD dwDeltaStart;
  75. TfClientId tid;
  76. LIBTHREAD* pLibTLS;
  77. } EnumPropertyUpdateArgs;
  78. static ENUM_RET EnumPropertyUpdateCallback(ITfRange* update_range, EnumPropertyUpdateArgs *pargs);
  79. //
  80. // Enumrate property change
  81. //
  82. typedef struct _EnumPropertyChangedCallbackArgs
  83. {
  84. TfEditCookie ec;
  85. } EnumPropertyChangedCallbackArgs;
  86. static ENUM_RET EnumPropertyChangedCallback(ITfRange* update_range, EnumPropertyChangedCallbackArgs *pargs);
  87. //
  88. // Enumrate find first track comp range
  89. //
  90. typedef struct _EnumFindFirstTrackCompRangeArgs
  91. {
  92. TfEditCookie ec;
  93. Interface<ITfProperty> Property;
  94. Interface<ITfRange> Range;
  95. } EnumFindFirstTrackCompRangeArgs;
  96. static ENUM_RET EnumFindFirstTrackCompRangeCallback(ITfRange* update_range, EnumFindFirstTrackCompRangeArgs *pargs);
  97. //
  98. // Edit session helper
  99. //
  100. protected:
  101. HRESULT EscbUpdateCompositionString(IMCLock& imc)
  102. {
  103. return ::EscbUpdateCompositionString(imc, m_tid, m_ic, m_pLibTLS, 0, 0);
  104. }
  105. HRESULT EscbUpdateCompositionString(IMCLock& imc, DWORD dwDeltaStart)
  106. {
  107. return ::EscbUpdateCompositionString(imc, m_tid, m_ic, m_pLibTLS, dwDeltaStart, 0);
  108. }
  109. HRESULT EscbCompComplete(IMCLock& imc, BOOL fSync)
  110. {
  111. return ::EscbCompComplete(imc, m_tid, m_ic, m_pLibTLS, fSync);
  112. }
  113. HRESULT EscbClearDocFeedBuffer(IMCLock& imc, CicInputContext& CicContext, BOOL fSync)
  114. {
  115. return ::EscbClearDocFeedBuffer(imc, CicContext, m_tid, m_ic, m_pLibTLS, fSync);
  116. }
  117. HRESULT EscbRemoveProperty(IMCLock& imc, const GUID* guid)
  118. {
  119. return ::EscbRemoveProperty(imc, m_tid, m_ic, m_pLibTLS, guid);
  120. }
  121. //
  122. // Edit session friend
  123. //
  124. private:
  125. friend HRESULT EscbUpdateCompositionString(IMCLock& imc, TfClientId tid, Interface_Attach<ITfContext> pic, LIBTHREAD* pLibTLS,
  126. DWORD dwDeltaStart,
  127. DWORD dwFlags);
  128. friend HRESULT EscbCompComplete(IMCLock& imc, TfClientId tid, Interface_Attach<ITfContext> pic, LIBTHREAD* pLibTLS,
  129. BOOL fSync);
  130. friend HRESULT EscbClearDocFeedBuffer(IMCLock& imc, CicInputContext& CicContext, TfClientId tid, Interface_Attach<ITfContext> pic, LIBTHREAD* pLibTLS,
  131. BOOL fSync);
  132. friend HRESULT EscbRemoveProperty(IMCLock& imc, TfClientId tid, Interface_Attach<ITfContext> pic, LIBTHREAD* pLibTLS,
  133. const GUID* guid);
  134. private:
  135. Interface_Attach<ITfContext> m_ic;
  136. TfClientId m_tid;
  137. LIBTHREAD* m_pLibTLS;
  138. HIMC m_hIMC;
  139. };
  140. #endif // _TXTEVCB_H_