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.

75 lines
1.5 KiB

  1. //
  2. // perange.h
  3. //
  4. #ifndef PERANGE_H
  5. #define PERANGE_H
  6. #include "private.h"
  7. #include "ptrary.h"
  8. class CInputContext;
  9. class CRange;
  10. class CRangeBackup;
  11. class CProperty;
  12. typedef struct tag_PERSISTPROPERTYRANGE
  13. {
  14. ULONG achStart;
  15. ULONG achEnd;
  16. ITfPropertyStore *_pPropStore;
  17. } PERSISTPROPERTYRANGE;
  18. class CRangeBackupProperty
  19. {
  20. public:
  21. CRangeBackupProperty(CRangeBackup *ppr, CProperty *pProp);
  22. ~CRangeBackupProperty();
  23. BOOL Init(TfEditCookie ec);
  24. BOOL Restore(TfEditCookie ec);
  25. private:
  26. BOOL _StoreOneRange(TfEditCookie ec, CRange *pCRange);
  27. int _GetOffset(TfEditCookie ec, IAnchor *pa);
  28. CRangeBackup *_ppr;
  29. CProperty *_pProp;
  30. CStructArray<PERSISTPROPERTYRANGE> _rgPropRanges;
  31. };
  32. class CRangeBackup : public ITfRangeBackup,
  33. public CComObjectRootImmx
  34. {
  35. public:
  36. CRangeBackup(CInputContext *pic);
  37. ~CRangeBackup();
  38. BEGIN_COM_MAP_IMMX(CRangeBackup)
  39. COM_INTERFACE_ENTRY(ITfRangeBackup)
  40. END_COM_MAP_IMMX()
  41. IMMX_OBJECT_IUNKNOWN_FOR_ATL()
  42. STDMETHODIMP Restore(TfEditCookie ec, ITfRange *pRange);
  43. void Clear();
  44. HRESULT Init(TfEditCookie ec, CRange *pRange);
  45. private:
  46. friend CRangeBackupProperty;
  47. CPtrArray<CRangeBackupProperty> _rgProp;
  48. // temp text buffer.
  49. WCHAR *_psz;
  50. ULONG _cch;
  51. CInputContext *_pic;
  52. CRange *_pRange; // perf: we don't need this really
  53. DBG_ID_DECLARE;
  54. };
  55. #endif // PERANGE_H