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.

94 lines
2.6 KiB

  1. //
  2. // compose.h
  3. //
  4. #ifndef COMPOSE_H
  5. #define COMPOSE_H
  6. class CRange;
  7. class CInputContext;
  8. // return type for _IsRangeCovered method
  9. typedef enum { IRC_COVERED, IRC_OUTSIDE, IRC_NO_OWNEDCOMPOSITIONS } IRC;
  10. extern const IID IID_PRIV_CCOMPOSITION;
  11. class CComposition : public ITfCompositionView,
  12. public ITfComposition,
  13. public CComObjectRootImmx
  14. {
  15. public:
  16. CComposition() { Dbg_MemSetThisNameID(TEXT("CComposition")); }
  17. ~CComposition() { _Uninit(); }
  18. BOOL _Init(TfClientId tid, CInputContext *pic, IAnchor *paStart, IAnchor *paEnd, ITfCompositionSink *pSink);
  19. BEGIN_COM_MAP_IMMX(CComposition)
  20. COM_INTERFACE_ENTRY_IID(IID_PRIV_CCOMPOSITION, CComposition)
  21. COM_INTERFACE_ENTRY(ITfCompositionView)
  22. COM_INTERFACE_ENTRY(ITfComposition)
  23. END_COM_MAP_IMMX()
  24. IMMX_OBJECT_IUNKNOWN_FOR_ATL()
  25. // ITfCompositionView
  26. STDMETHODIMP GetOwnerClsid(CLSID *pclsid);
  27. STDMETHODIMP GetRange(ITfRange **ppRange);
  28. // ITfComposition
  29. //STDMETHODIMP GetRange(ITfRange **ppRange);
  30. STDMETHODIMP ShiftStart(TfEditCookie ecWrite, ITfRange *pNewStart);
  31. STDMETHODIMP ShiftEnd(TfEditCookie ecWrite, ITfRange *pNewEnd);
  32. STDMETHODIMP EndComposition(TfEditCookie ecWrite);
  33. void _AddToCompositionList(CComposition **ppCompositionList);
  34. BOOL _RemoveFromCompositionList(CComposition **ppCompositionList);
  35. BOOL _IsTerminated() { return _pic == NULL; }
  36. void _Terminate(TfEditCookie ec);
  37. void _SendOnTerminated(TfEditCookie ec, TfClientId tidForEditSession);
  38. TfClientId _GetOwner() { return _tid; }
  39. TfClientId _SetOwner(TfClientId tid)
  40. {
  41. TfClientId tidTmp = _tid;
  42. _tid = tid;
  43. return tidTmp;
  44. }
  45. void _SetSink(ITfCompositionSink *pSink)
  46. {
  47. SafeRelease(_pSink);
  48. _pSink = pSink;
  49. _pSink->AddRef();
  50. }
  51. static IRC _IsRangeCovered(CInputContext *pic, TfClientId tid, IAnchor *paStart, IAnchor *paEnd, CComposition **ppComposition);
  52. IAnchor *_GetStart() { return _paStart; }
  53. IAnchor *_GetEnd() { return _paEnd; }
  54. CComposition *_GetNext() { return _next; }
  55. void _Die() { _Uninit(); }
  56. private:
  57. void _ClearComposing(TfEditCookie ec, IAnchor *paStart, IAnchor *paEnd);
  58. void _SetComposing(TfEditCookie ec, IAnchor *paStart, IAnchor *paEnd);
  59. void _Uninit();
  60. TfClientId _tid;
  61. CInputContext *_pic;
  62. IAnchor *_paStart;
  63. IAnchor *_paEnd;
  64. ITfCompositionSink *_pSink;
  65. CComposition *_next;
  66. DBG_ID_DECLARE;
  67. };
  68. #endif // COMPOSE_H