Source code of Windows XP (NT5)
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.

141 lines
5.4 KiB

  1. //**********************************************************************
  2. // File name: obj.h
  3. //
  4. // Definition of CSimpSvrObj
  5. //
  6. // Copyright (c) 1993 Microsoft Corporation. All rights reserved.
  7. //**********************************************************************
  8. #if !defined( _OBJ_H_)
  9. #define _OBJ_H_
  10. #include "ioipao.h"
  11. #include "ioipo.h"
  12. #include "ioo.h"
  13. #include "ips.h"
  14. #include "ido.h"
  15. #include "iec.h"
  16. class CSimpSvrDoc;
  17. interface COleObject;
  18. interface CPersistStorage;
  19. interface CDataObject;
  20. interface COleInPlaceActiveObject;
  21. interface COleInPlaceObject;
  22. interface CExternalConnection;
  23. class CSimpSvrObj : public IUnknown
  24. {
  25. private:
  26. CSimpSvrDoc FAR * m_lpDoc; // Back pointer
  27. int m_nCount; // reference count
  28. BOOL m_fInPlaceActive; // Used during InPlace Negotiation
  29. BOOL m_fInPlaceVisible; // " " " " " " " " "
  30. BOOL m_fUIActive; // " " " " " " " " "
  31. HMENU m_hmenuShared; // " " " " " " " " "
  32. HOLEMENU m_hOleMenu; // " " " " " " " " "
  33. RECT m_posRect; // " " " " " " " " "
  34. OLEINPLACEFRAMEINFO m_FrameInfo;
  35. BOOL m_fSaveWithSameAsLoad;
  36. BOOL m_fNoScribbleMode;
  37. DWORD m_dwRegister; // Registered in ROT
  38. int m_red, m_green, m_blue; // current color
  39. POINT m_size; // current size
  40. int m_xOffset;
  41. int m_yOffset;
  42. float m_scale;
  43. HWND m_hWndParent; // parent window handle
  44. // interfaces used
  45. LPSTORAGE m_lpStorage;
  46. LPSTREAM m_lpColorStm, m_lpSizeStm;
  47. LPOLECLIENTSITE m_lpOleClientSite; // IOleClientSite
  48. LPOLEADVISEHOLDER m_lpOleAdviseHolder; // IOleAdviseHolder
  49. LPDATAADVISEHOLDER m_lpDataAdviseHolder; // IDataAdviseHolder
  50. LPOLEINPLACEFRAME m_lpFrame; // IOleInPlaceFrame
  51. LPOLEINPLACEUIWINDOW m_lpCntrDoc; // IOleInPlaceUIWindow
  52. LPOLEINPLACESITE m_lpIPSite; // IOleInPlaceSite
  53. // interface implemented
  54. COleObject m_OleObject; // IOleObject
  55. CPersistStorage m_PersistStorage; // IPersistStorage
  56. CDataObject m_DataObject; // IDataObject
  57. COleInPlaceActiveObject m_OleInPlaceActiveObject; // IOleInPlaceActiveObject
  58. COleInPlaceObject m_OleInPlaceObject; // IOleInPlaceObject
  59. CExternalConnection m_ExternalConnection;
  60. public:
  61. STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj);
  62. STDMETHODIMP_(ULONG) AddRef ();
  63. STDMETHODIMP_(ULONG) Release ();
  64. // construction/destruction
  65. CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc);
  66. ~CSimpSvrObj();
  67. // utility functions
  68. void Draw(HDC hDC, BOOL fMetaDC = TRUE);
  69. void PaintObj(HDC hDC);
  70. void lButtonDown(WPARAM wParam,LPARAM lParam);
  71. HANDLE GetMetaFilePict();
  72. void SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad);
  73. void LoadFromStorage ();
  74. // visual editing helper functions
  75. BOOL DoInPlaceActivate (LONG lVerb);
  76. void AssembleMenus();
  77. void AddFrameLevelUI();
  78. void DoInPlaceHide();
  79. void DisassembleMenus();
  80. void SendOnDataChange();
  81. void DeactivateUI();
  82. // member variable access
  83. inline BOOL IsInPlaceActive() { return m_fInPlaceActive; };
  84. inline BOOL IsInPlaceVisible() { return m_fInPlaceVisible; };
  85. inline BOOL IsUIActive() { return m_fUIActive; };
  86. inline HWND GetParent() { return m_hWndParent; };
  87. inline LPSTORAGE GetStorage() { return m_lpStorage; };
  88. inline LPOLECLIENTSITE GetOleClientSite() { return m_lpOleClientSite; };
  89. inline LPDATAADVISEHOLDER GetDataAdviseHolder() { return m_lpDataAdviseHolder; };
  90. inline LPOLEADVISEHOLDER GetOleAdviseHolder() { return m_lpOleAdviseHolder; };
  91. inline LPOLEINPLACEFRAME GetInPlaceFrame() { return m_lpFrame; };
  92. inline LPOLEINPLACEUIWINDOW GetUIWindow() { return m_lpCntrDoc; };
  93. inline LPOLEINPLACESITE GetInPlaceSite() { return m_lpIPSite; };
  94. inline COleObject FAR * GetOleObject() { return &m_OleObject; };
  95. inline CPersistStorage FAR * GetPersistStorage() { return &m_PersistStorage; };
  96. inline CDataObject FAR * GetDataObject() { return &m_DataObject; };
  97. inline COleInPlaceActiveObject FAR * GetOleInPlaceActiveObject() { return &m_OleInPlaceActiveObject; };
  98. inline COleInPlaceObject FAR * GetOleInPlaceObject() { return &m_OleInPlaceObject; };
  99. inline void ClearOleClientSite() { m_lpOleClientSite = NULL; };
  100. inline void ClearDataAdviseHolder() { m_lpDataAdviseHolder = NULL; };
  101. inline void ClearOleAdviseHolder() { m_lpOleAdviseHolder = NULL; };
  102. inline LPRECT GetPosRect() { return &m_posRect; };
  103. inline LPPOINT GetSize() { return &m_size; };
  104. inline LPOLEINPLACEFRAMEINFO GetFrameInfo() {return &m_FrameInfo;};
  105. inline DWORD GetRotRegister() { return m_dwRegister; };
  106. inline void ClearDoc() { m_lpDoc = NULL; };
  107. // member manipulation
  108. inline void SetColor (int nRed, int nGreen, int nBlue)
  109. { m_red = nRed; m_green = nGreen; m_blue = nBlue; };
  110. inline void RotateColor()
  111. { m_red+=10; m_green+=10; m_blue+=10;};
  112. // all of the interface implementations should be friends of this
  113. // class
  114. friend interface COleObject;
  115. friend interface CPersistStorage;
  116. friend interface CDataObject;
  117. friend interface COleInPlaceActiveObject;
  118. friend interface COleInPlaceObject;
  119. friend interface CExternalConnection;
  120. };
  121. #endif
  122.