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.

155 lines
5.5 KiB

  1. /*
  2. * d o c h o s t . h
  3. *
  4. * Purpose:
  5. * basic implementation of a docobject host. Used by the body class to
  6. * host Trident and/or MSHTML
  7. *
  8. * History
  9. * August '96: brettm - created
  10. *
  11. * Copyright (C) Microsoft Corp. 1995, 1996.
  12. */
  13. #ifndef _DOCHOST_H
  14. #define _DOCHOST_H
  15. #include <docobj.h>
  16. // DocHost border sytles
  17. enum
  18. {
  19. dhbNone =0x0, // no border
  20. dhbHost =0x01, // dochost paints border
  21. dhbObject =0x02 // docobj paints border
  22. };
  23. class CDocHost:
  24. public IOleInPlaceUIWindow,
  25. public IOleInPlaceSite,
  26. public IOleClientSite,
  27. public IOleControlSite,
  28. public IAdviseSink,
  29. public IOleDocumentSite,
  30. public IOleCommandTarget,
  31. public IServiceProvider
  32. {
  33. public:
  34. // *** IUnknown methods ***
  35. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID FAR *);
  36. virtual ULONG STDMETHODCALLTYPE AddRef();
  37. virtual ULONG STDMETHODCALLTYPE Release();
  38. // *** IOleWindow methods ***
  39. virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *);
  40. virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL);
  41. // *** IOleInPlaceUIWindow methods ***
  42. virtual HRESULT STDMETHODCALLTYPE GetBorder(LPRECT);
  43. virtual HRESULT STDMETHODCALLTYPE RequestBorderSpace(LPCBORDERWIDTHS);
  44. virtual HRESULT STDMETHODCALLTYPE SetBorderSpace(LPCBORDERWIDTHS);
  45. virtual HRESULT STDMETHODCALLTYPE SetActiveObject(IOleInPlaceActiveObject *, LPCOLESTR);
  46. // IOleInPlaceSite methods.
  47. virtual HRESULT STDMETHODCALLTYPE CanInPlaceActivate();
  48. virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivate();
  49. virtual HRESULT STDMETHODCALLTYPE OnUIActivate();
  50. virtual HRESULT STDMETHODCALLTYPE GetWindowContext(LPOLEINPLACEFRAME *, LPOLEINPLACEUIWINDOW *, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
  51. virtual HRESULT STDMETHODCALLTYPE Scroll(SIZE);
  52. virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate(BOOL);
  53. virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate();
  54. virtual HRESULT STDMETHODCALLTYPE DiscardUndoState();
  55. virtual HRESULT STDMETHODCALLTYPE DeactivateAndUndo();
  56. virtual HRESULT STDMETHODCALLTYPE OnPosRectChange(LPCRECT);
  57. // IOleClientSite methods.
  58. virtual HRESULT STDMETHODCALLTYPE SaveObject();
  59. virtual HRESULT STDMETHODCALLTYPE GetMoniker(DWORD, DWORD, LPMONIKER *);
  60. virtual HRESULT STDMETHODCALLTYPE GetContainer(LPOLECONTAINER *);
  61. virtual HRESULT STDMETHODCALLTYPE ShowObject();
  62. virtual HRESULT STDMETHODCALLTYPE OnShowWindow(BOOL);
  63. virtual HRESULT STDMETHODCALLTYPE RequestNewObjectLayout();
  64. // IOleControlSite
  65. virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged();
  66. virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive(BOOL fLock);
  67. virtual HRESULT STDMETHODCALLTYPE GetExtendedControl(LPDISPATCH *ppDisp);
  68. virtual HRESULT STDMETHODCALLTYPE TransformCoords(POINTL *pPtlHimetric, POINTF *pPtfContainer,DWORD dwFlags);
  69. virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(MSG *lpMsg,DWORD grfModifiers);
  70. virtual HRESULT STDMETHODCALLTYPE OnFocus(BOOL fGotFocus);
  71. virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame(void);
  72. // IAdviseSink methods
  73. virtual void STDMETHODCALLTYPE OnDataChange(FORMATETC *, STGMEDIUM *);
  74. virtual void STDMETHODCALLTYPE OnViewChange(DWORD, LONG);
  75. virtual void STDMETHODCALLTYPE OnRename(LPMONIKER);
  76. virtual void STDMETHODCALLTYPE OnSave();
  77. virtual void STDMETHODCALLTYPE OnClose();
  78. // IOleDocumentSite
  79. virtual HRESULT STDMETHODCALLTYPE ActivateMe(LPOLEDOCUMENTVIEW);
  80. // IOleCommandTarget
  81. virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *, ULONG, OLECMD [], OLECMDTEXT *);
  82. virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *, DWORD, DWORD, VARIANTARG *, VARIANTARG *);
  83. // IServiceProvider
  84. virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, LPVOID *ppvObject);
  85. CDocHost();
  86. virtual ~CDocHost();
  87. // statics
  88. static LRESULT CALLBACK ExtWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  89. // overridble virtuals
  90. virtual LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  91. // derrived class notifications
  92. virtual HRESULT HrSubWMCreate();
  93. virtual void OnWMSize(LPRECT prc){};
  94. virtual void OnUpdateCommands(){};
  95. virtual HRESULT HrGetDocObjSize(LPRECT prc)
  96. {return E_NOTIMPL;};
  97. HRESULT HrCreateDocObj(LPCLSID pCLSID);
  98. HRESULT HrCloseDocObj();
  99. HRESULT HrInit(HWND hwndParent, int idDlgItem, DWORD dhbBorder);
  100. protected:
  101. HWND m_hwnd,
  102. m_hwndDocObj;
  103. LPOLEOBJECT m_lpOleObj;
  104. LPOLEDOCUMENTVIEW m_pDocView;
  105. LPOLECOMMANDTARGET m_pCmdTarget;
  106. BOOL m_fDownloading,
  107. m_fFocus,
  108. m_fUIActive,
  109. m_fCycleFocus;
  110. LPOLEINPLACEACTIVEOBJECT m_pInPlaceActiveObj;
  111. LPOLEINPLACEFRAME m_pInPlaceFrame;
  112. void WMSize(int x, int y);
  113. HRESULT HrShow();
  114. private:
  115. ULONG m_cRef,
  116. m_ulAdviseConnection;
  117. DWORD m_dwFrameWidth,
  118. m_dwFrameHeight,
  119. m_dhbBorder;
  120. HRESULT HrCreateDocView();
  121. BOOL WMCreate(HWND hwnd);
  122. void WMNCDestroy();
  123. };
  124. typedef CDocHost DOCHOST;
  125. typedef DOCHOST *LPDOCHOST;
  126. #endif //_DOCHOST_H