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.

109 lines
3.1 KiB

  1. //
  2. // tmgrsink.cpp
  3. //
  4. // ITfThreadMgrEventSink implementation.
  5. //
  6. #include "globals.h"
  7. #include "mark.h"
  8. //+---------------------------------------------------------------------------
  9. //
  10. // OnInitDocumentMgr
  11. //
  12. // Sink called by the framework just before the first context is pushed onto
  13. // a document.
  14. //----------------------------------------------------------------------------
  15. STDAPI CMarkTextService::OnInitDocumentMgr(ITfDocumentMgr *pDocMgr)
  16. {
  17. return S_OK;
  18. }
  19. //+---------------------------------------------------------------------------
  20. //
  21. // OnUninitDocumentMgr
  22. //
  23. // Sink called by the framework just after the last context is popped off a
  24. // document.
  25. //----------------------------------------------------------------------------
  26. STDAPI CMarkTextService::OnUninitDocumentMgr(ITfDocumentMgr *pDocMgr)
  27. {
  28. return S_OK;
  29. }
  30. //+---------------------------------------------------------------------------
  31. //
  32. // OnSetFocus
  33. //
  34. // Sink called by the framework when focus changes from one document to
  35. // another. Either document may be NULL, meaning previously there was no
  36. // focus document, or now no document holds the input focus.
  37. //----------------------------------------------------------------------------
  38. STDAPI CMarkTextService::OnSetFocus(ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus)
  39. {
  40. // we'll track edit changes in the focus document, the only place we start compositions
  41. _InitTextEditSink(pDocMgrFocus);
  42. return S_OK;
  43. }
  44. //+---------------------------------------------------------------------------
  45. //
  46. // OnPushContext
  47. //
  48. // Sink called by the framework when a context is pushed.
  49. //----------------------------------------------------------------------------
  50. STDAPI CMarkTextService::OnPushContext(ITfContext *pContext)
  51. {
  52. // ignore new contexts that appear while were uninitializing
  53. if (!_fCleaningUp)
  54. {
  55. _InitCleanupContextSink(pContext);
  56. _InitContextCompartment(pContext);
  57. }
  58. return S_OK;
  59. }
  60. //+---------------------------------------------------------------------------
  61. //
  62. // OnPopContext
  63. //
  64. // Sink called by the framework when a context is popped.
  65. //----------------------------------------------------------------------------
  66. STDAPI CMarkTextService::OnPopContext(ITfContext *pContext)
  67. {
  68. _UninitCleanupContextSink(pContext);
  69. _UninitCompartment(pContext);
  70. return S_OK;
  71. }
  72. //+---------------------------------------------------------------------------
  73. //
  74. // _InitThreadMgrSink
  75. //
  76. // Advise our sink.
  77. //----------------------------------------------------------------------------
  78. BOOL CMarkTextService::_InitThreadMgrSink()
  79. {
  80. return AdviseSink(_pThreadMgr, (ITfThreadMgrEventSink *)this,
  81. IID_ITfThreadMgrEventSink, &_dwThreadMgrEventSinkCookie);
  82. }
  83. //+---------------------------------------------------------------------------
  84. //
  85. // _UninitThreadMgrSink
  86. //
  87. // Unadvise our sink.
  88. //----------------------------------------------------------------------------
  89. void CMarkTextService::_UninitThreadMgrSink()
  90. {
  91. UnadviseSink(_pThreadMgr, &_dwThreadMgrEventSinkCookie);
  92. }