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.

115 lines
3.6 KiB

  1. //
  2. // case.h
  3. //
  4. // CCaseTextService declaration.
  5. //
  6. #ifndef CASE_H
  7. #define CASE_H
  8. class CLangBarItemButton;
  9. class CSnoopWnd;
  10. class CCaseTextService : public ITfTextInputProcessor,
  11. public ITfThreadMgrEventSink,
  12. public ITfTextEditSink,
  13. public ITfThreadFocusSink,
  14. public ITfKeyEventSink
  15. {
  16. public:
  17. CCaseTextService();
  18. ~CCaseTextService();
  19. // IUnknown
  20. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  21. STDMETHODIMP_(ULONG) AddRef(void);
  22. STDMETHODIMP_(ULONG) Release(void);
  23. // ITfTextInputProcessor
  24. STDMETHODIMP Activate(ITfThreadMgr *pThreadMgr, TfClientId tfClientId);
  25. STDMETHODIMP Deactivate();
  26. // ITfThreadMgrEventSink
  27. STDMETHODIMP OnInitDocumentMgr(ITfDocumentMgr *pDocMgr);
  28. STDMETHODIMP OnUninitDocumentMgr(ITfDocumentMgr *pDocMgr);
  29. STDMETHODIMP OnSetFocus(ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus);
  30. STDMETHODIMP OnPushContext(ITfContext *pContext);
  31. STDMETHODIMP OnPopContext(ITfContext *pContext);
  32. // ITfThreadFocusSink
  33. STDMETHODIMP OnSetThreadFocus();
  34. STDMETHODIMP OnKillThreadFocus();
  35. // ITfTextEditSink
  36. STDMETHODIMP OnEndEdit(ITfContext *pContext, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord);
  37. // ITfKeyEventSink
  38. STDMETHODIMP OnSetFocus(BOOL fForeground);
  39. STDMETHODIMP OnTestKeyDown(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  40. STDMETHODIMP OnKeyDown(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  41. STDMETHODIMP OnTestKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  42. STDMETHODIMP OnKeyUp(ITfContext *pContext, WPARAM wParam, LPARAM lParam, BOOL *pfEaten);
  43. STDMETHODIMP OnPreservedKey(ITfContext *pContext, REFGUID rguid, BOOL *pfEaten);
  44. // CClassFactory factory callback
  45. static HRESULT CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObj);
  46. // server registration
  47. static BOOL RegisterProfiles();
  48. static void UnregisterProfiles();
  49. static BOOL RegisterCategories(BOOL fRegister);
  50. static BOOL RegisterServer();
  51. static void UnregisterServer();
  52. // language bar menu handlers
  53. static void _Menu_HelloWord(CCaseTextService *_this);
  54. static void _Menu_FlipSel(CCaseTextService *_this);
  55. static void _Menu_FlipDoc(CCaseTextService *_this);
  56. static void _Menu_ShowSnoopWnd(CCaseTextService *_this);
  57. static void _Menu_FlipKeys(CCaseTextService *_this);
  58. ITfThreadMgr *_GetThreadMgr() { return _pThreadMgr; }
  59. TfClientId _GetClientId() { return _tfClientId; }
  60. BOOL _IsSnoopWndVisible() { return _fShowSnoop; }
  61. BOOL _IsKeyFlipping() { return _fFlipKeys; }
  62. private:
  63. // init methods
  64. BOOL _InitLanguageBar();
  65. BOOL _InitThreadMgrSink();
  66. BOOL _InitSnoopWnd();
  67. BOOL _InitTextEditSink(ITfDocumentMgr *pDocMgr);
  68. BOOL _InitKeystrokeSink();
  69. BOOL _InitPreservedKey();
  70. // uninit methods
  71. void _UninitLanguageBar();
  72. void _UninitThreadMgrSink();
  73. void _UninitSnoopWnd();
  74. void _UninitKeystrokeSink();
  75. void _UninitPreservedKey();
  76. //
  77. // state
  78. //
  79. ITfThreadMgr *_pThreadMgr;
  80. TfClientId _tfClientId;
  81. BOOL _fShowSnoop; // hide/show the snoop window popup
  82. CSnoopWnd *_pSnoopWnd;
  83. BOOL _fFlipKeys;
  84. CLangBarItemButton *_pLangBarItem;
  85. DWORD _dwThreadMgrEventSinkCookie;
  86. DWORD _dwThreadFocusSinkCookie;
  87. DWORD _dwTextEditSinkCookie;
  88. ITfContext *_pTextEditSinkContext;
  89. LONG _cRef; // COM ref count
  90. };
  91. #endif // CASE_H