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.

180 lines
6.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: srvhndlr.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 11-17-95 JohannP (Johann Posch) Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef _SRVHNDLR_H_DEFINED_
  18. #define _SRVHNDLR_H_DEFINED_
  19. class CStdIdentity;
  20. class CEmbServerClientSite;
  21. //+---------------------------------------------------------------------------
  22. //
  23. // Class: CServerHandler ()
  24. //
  25. // Purpose:
  26. //
  27. //
  28. // History: 11-17-95 JohannP (Johann Posch) Created
  29. //
  30. // Notes:
  31. //
  32. //----------------------------------------------------------------------------
  33. class CServerHandler : public IServerHandler
  34. {
  35. public:
  36. CServerHandler(CStdIdentity *pStdId);
  37. ~CServerHandler();
  38. // IUnknown methods
  39. STDMETHOD(QueryInterface) ( REFIID riid, LPVOID FAR* ppvObj);
  40. STDMETHOD_(ULONG,AddRef) (void);
  41. STDMETHOD_(ULONG,Release) (void);
  42. // IServerHandler
  43. STDMETHOD(Run) (DWORD dwDHFlags, REFIID riidClientInterface, MInterfacePointer* pIRDClientInterface, BOOL fHasIPSite, LPOLESTR szContainerApp,
  44. LPOLESTR szContainerObj,IStorage * pStg,IAdviseSink* pAdvSink,DWORD *pdwConnection,
  45. HRESULT *hresultClsidUser, CLSID *pContClassID, HRESULT *hresultContentMiscStatus,
  46. DWORD *pdwMiscStatus
  47. );
  48. STDMETHOD(DoVerb) (LONG iVerb, LPMSG lpmsg,BOOL fUseRunClientSite,
  49. IOleClientSite* pIRDClientSite,LONG lindex,HWND hwndParent,
  50. LPCRECT lprcPosRect);
  51. STDMETHOD(SetClientSite) (IOleClientSite* pClientSite);
  52. // Delegating IDataObject facing container
  53. STDMETHOD(GetData) ( LPFORMATETC pformatetcIn,
  54. LPSTGMEDIUM pmedium );
  55. STDMETHOD(GetDataHere) ( LPFORMATETC pformatetc,
  56. LPSTGMEDIUM pmedium );
  57. STDMETHOD(QueryGetData) ( LPFORMATETC pformatetc );
  58. STDMETHOD(GetCanonicalFormatEtc) ( LPFORMATETC pformatetc,
  59. LPFORMATETC pformatetcOut);
  60. STDMETHOD(SetData) ( LPFORMATETC pformatetc,
  61. LPSTGMEDIUM pmedium, BOOL fRelease);
  62. STDMETHOD(EnumFormatEtc) ( DWORD dwDirection,
  63. LPENUMFORMATETC FAR* ppenumFormatEtc);
  64. STDMETHOD(DAdvise) ( FORMATETC FAR* pFormatetc, DWORD advf,
  65. IAdviseSink FAR* pAdvSink,
  66. DWORD FAR* pdwConnection);
  67. STDMETHOD(DUnadvise) ( DWORD dwConnection);
  68. STDMETHOD(EnumDAdvise) ( LPENUMSTATDATA FAR* ppenumAdvise);
  69. private:
  70. STDMETHOD_(void, ReleaseObject)();
  71. INTERNAL(QueryServerInterface) (REFIID riid,void ** ppInterface);
  72. INTERNAL(ReleaseServerInterface) (void * ppInterface);
  73. INTERNAL(GetClientSiteFromMInterfacePtr) (REFIID riidClientInterface, MInterfacePointer* pIRDClientSite,BOOL fHasIPSite, LPOLECLIENTSITE* ppOleClientSite);
  74. ULONG _cRefs; // refcount on IServerHandler
  75. CStdIdentity *m_pStdId; // Pointer to StdIdentity for Embedding Handler.
  76. LPOLECLIENTSITE m_pOleEmbServerClientSite; // Review, shouldn't need Pointer to client site if have one.
  77. CEmbServerClientSite *m_pCEmbServerClientSite; // member pointing to ClientSiteObject.
  78. };
  79. // Wrapper object for Serverhandler Interfaces on the ClientSite.
  80. class CEmbServerWrapper : public IServerHandler, public IDataObject
  81. {
  82. public:
  83. CEmbServerWrapper(IUnknown *pUnkOuter,IServerHandler *ServerHandler);
  84. ~CEmbServerWrapper();
  85. // Controlling Unknown.
  86. class CPrivUnknown : public IUnknown
  87. {
  88. public:
  89. STDMETHOD(QueryInterface) ( REFIID riid, LPVOID FAR* ppvObj);
  90. STDMETHOD_(ULONG,AddRef) (void);
  91. STDMETHOD_(ULONG,Release) (void);
  92. CEmbServerWrapper *m_EmbServerWrapper;
  93. };
  94. friend class CPrivUnknown;
  95. CPrivUnknown m_Unknown;
  96. // IUnknown Methods
  97. STDMETHOD(QueryInterface) ( REFIID iid, LPVOID FAR* ppvObj);
  98. STDMETHOD_(ULONG,AddRef) (void);
  99. STDMETHOD_(ULONG,Release) (void);
  100. // IServerHandler
  101. STDMETHOD(Run) (DWORD dwDHFlags, REFIID riidClientInterface, MInterfacePointer* pIRDClientInterface,
  102. BOOL fHasIPSite,LPOLESTR szContainerApp,
  103. LPOLESTR szContainerObj,IStorage * pStg,IAdviseSink* pAdvSink,DWORD *pdwConnection,
  104. HRESULT *hresultClsidUser, CLSID *pContClassID, HRESULT *hresultContentMiscStatus,
  105. DWORD *pdwMiscStatus
  106. );
  107. STDMETHOD(DoVerb) (LONG iVerb, LPMSG lpmsg,BOOL fUseRunClientSite,
  108. IOleClientSite* pIRDClientSite,LONG lindex,HWND hwndParent,
  109. LPCRECT lprcPosRect);
  110. STDMETHOD(SetClientSite) (IOleClientSite* pClientSite);
  111. // Delegating IDataObject facing container
  112. STDMETHOD(GetData) ( LPFORMATETC pformatetcIn,
  113. LPSTGMEDIUM pmedium );
  114. STDMETHOD(GetDataHere) ( LPFORMATETC pformatetc,
  115. LPSTGMEDIUM pmedium );
  116. STDMETHOD(QueryGetData) ( LPFORMATETC pformatetc );
  117. STDMETHOD(GetCanonicalFormatEtc) ( LPFORMATETC pformatetc,
  118. LPFORMATETC pformatetcOut);
  119. STDMETHOD(SetData) ( LPFORMATETC pformatetc,
  120. LPSTGMEDIUM pmedium, BOOL fRelease);
  121. STDMETHOD(EnumFormatEtc) ( DWORD dwDirection,
  122. LPENUMFORMATETC FAR* ppenumFormatEtc);
  123. STDMETHOD(DAdvise) ( FORMATETC FAR* pFormatetc, DWORD advf,
  124. IAdviseSink FAR* pAdvSink,
  125. DWORD FAR* pdwConnection);
  126. STDMETHOD(DUnadvise) ( DWORD dwConnection);
  127. STDMETHOD(EnumDAdvise) ( LPENUMSTATDATA FAR* ppenumAdvise);
  128. public:
  129. IUnknown *m_pUnkOuter; // Controlling Unknown
  130. ULONG m_cRefs;
  131. IServerHandler *m_ServerHandler; // pointer to real server Handler.
  132. };
  133. HRESULT CreateServerHandler(const CLSID *pClsID, IUnknown *punk,
  134. IClientSiteHandler *pClntHndlr,
  135. IServerHandler **ppSrvHdlr);
  136. CEmbServerWrapper* CreateEmbServerWrapper(IUnknown *pUnkOuter,IServerHandler *ServerHandler);
  137. #endif // _SRVHNDLR_H_DEFINED