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.

100 lines
2.4 KiB

  1. // undo.h
  2. // Undo manager functions
  3. // Copyright (c)1997-1999 Microsoft Corporation, All Rights Reserved
  4. #ifndef __UNDO_H__
  5. #define __UNDO_H__
  6. // {6501DC80-12A6-11d1-9A15-006097C9B344}
  7. DEFINE_GUID(UID_TRIEDIT_UNDO,
  8. 0x6501dc80, 0x12a6, 0x11d1, 0x9a, 0x15, 0x0, 0x60, 0x97, 0xc9, 0xb3, 0x44);
  9. #define cUndoPackMax 1024
  10. //Add a constant when creating new undoable objects
  11. #define TRIEDIT_UNDO_DRAG 0
  12. #define TRIEDIT_UNDO_PACK 1
  13. //Use this method to add undoable objects to Trident's stack
  14. HRESULT AddUndoUnit(IUnknown* punkTrident, IOleUndoUnit* pioleUndoUnit);
  15. class CUndo : public IOleUndoUnit
  16. {
  17. protected:
  18. ULONG m_cRef;
  19. BOOL m_fUndo;
  20. public:
  21. CUndo();
  22. virtual ~CUndo();
  23. //IUnknown
  24. STDMETHOD (QueryInterface)(REFIID riid, LPVOID* ppvObject);
  25. STDMETHOD_(ULONG, AddRef)(void);
  26. STDMETHOD_(ULONG, Release)(void);
  27. //IOleUndoUnit
  28. STDMETHOD (Do)(IOleUndoManager *pUndoManager) PURE;
  29. STDMETHOD (GetDescription)(BSTR *pBstr) PURE;
  30. STDMETHOD (GetUnitType)(CLSID *pClsid, LONG *plID) PURE;
  31. STDMETHOD (OnNextAdd)(void) PURE;
  32. };
  33. class CUndoDrag : public CUndo
  34. {
  35. protected:
  36. IHTMLStyle* m_pihtmlStyle;
  37. POINT m_ptOrig;
  38. POINT m_ptMove;
  39. public:
  40. CUndoDrag(IHTMLStyle* pihtmlStyle, POINT m_ptOrig, POINT m_ptMove);
  41. virtual ~CUndoDrag();
  42. //IOleUndoUnit
  43. STDMETHOD (Do)(IOleUndoManager *pUndoManager);
  44. STDMETHOD (GetDescription)(BSTR *pBstr);
  45. STDMETHOD (GetUnitType)(CLSID *pClsid, LONG *plID);
  46. STDMETHOD (OnNextAdd)(void);
  47. };
  48. class CUndoPackUnit : public CUndo
  49. {
  50. protected:
  51. ULONG m_cRef;
  52. CComPtr<IOleUndoUnit> m_rgUndo[cUndoPackMax];
  53. public:
  54. CUndoPackUnit() {};
  55. virtual ~CUndoPackUnit(){};
  56. //IOleUndoUnit
  57. STDMETHOD (Do)(IOleUndoManager *pUndoManager);
  58. STDMETHOD (GetDescription)(BSTR *pBstr);
  59. STDMETHOD (GetUnitType)(CLSID *pClsid, LONG *plID);
  60. STDMETHOD (OnNextAdd)(void);
  61. HRESULT PackUndo(ULONG indexStartPacking, IUnknown *pUnkTrident);
  62. };
  63. class CUndoPackManager
  64. {
  65. protected:
  66. CComPtr<IUnknown> m_srpUnkTrident;
  67. ULONG m_indexStartPacking;
  68. BOOL m_fPacking;
  69. public:
  70. CUndoPackManager(IUnknown* pUnkTrident)
  71. { m_srpUnkTrident=pUnkTrident;
  72. m_indexStartPacking=0;
  73. m_fPacking=FALSE;
  74. };
  75. virtual ~CUndoPackManager();
  76. HRESULT Start(void);
  77. HRESULT End(void);
  78. };
  79. #endif //__UNDO_H__