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.

395 lines
10 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1996-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #ifndef __AFXDOCOB_H__
  11. #define __AFXDOCOB_H__
  12. //WINBUG: these error codes are needed by MFC's IPrint implementation
  13. // but aren't available in the SDK headers. Someday, these #define's
  14. // can be removed.
  15. #ifndef PRINT_E_CANCELLED
  16. #define PRINT_E_CANCELLED 0x80040160L
  17. #endif
  18. #ifndef PRINT_E_NOSUCHPAGE
  19. #define PRINT_E_NOSUCHPAGE 0x80040161L
  20. #endif
  21. #ifdef _AFX_NO_OLE_SUPPORT
  22. #error OLE classes not supported in this library variant.
  23. #endif
  24. #ifndef __AFXOLE_H__
  25. #include <afxole.h>
  26. #endif
  27. #ifndef __docobj_h__
  28. #include <docobj.h> // defines Document Object interfaces
  29. #endif
  30. #ifdef _AFX_MINREBUILD
  31. #pragma component(minrebuild, off)
  32. #endif
  33. #ifndef _AFX_FULLTYPEINFO
  34. #pragma component(mintypeinfo, on)
  35. #endif
  36. #ifdef _AFX_PACKING
  37. #pragma pack(push, _AFX_PACKING)
  38. #endif
  39. // AFXDLL support
  40. #undef AFX_DATA
  41. #define AFX_DATA AFX_OLE_DATA
  42. /////////////////////////////////////////////////////////////////////////////
  43. // AFXDOCOB.H - MFC OLE Document Object support
  44. //CCmdUI
  45. class COleCmdUI;
  46. //CCmdTarg
  47. class CDocObjectServer;
  48. //COleIPFrameWnd
  49. class COleDocIPFrameWnd;
  50. /////////////////////////////////////////////////////////////////////////////
  51. // COleCmdUI
  52. class COleCmdUI : public CCmdUI
  53. {
  54. public:
  55. COleCmdUI(OLECMD* rgCmds, ULONG cCmds, const GUID* m_pGroup);
  56. virtual void Enable(BOOL bOn);
  57. virtual void SetCheck(int nCheck);
  58. virtual void SetText(LPCTSTR lpszText);
  59. virtual BOOL DoUpdate(CCmdTarget* pTarget, BOOL bDisableIfNoHandler);
  60. DWORD m_nCmdTextFlag;
  61. protected:
  62. OLECMD* m_rgCmds;
  63. const GUID* m_pguidCmdGroup;
  64. public:
  65. CString m_strText;
  66. friend class CCmdTarget;
  67. };
  68. #define ON_OLECMD(pguid, olecmdid, id) \
  69. { pguid, (ULONG)olecmdid, (UINT)id },
  70. #define ON_OLECMD_OPEN() \
  71. ON_OLECMD(NULL, OLECMDID_OPEN, ID_FILE_OPEN)
  72. #define ON_OLECMD_NEW() \
  73. ON_OLECMD(NULL, OLECMDID_NEW, ID_FILE_NEW)
  74. #define ON_OLECMD_SAVE() \
  75. ON_OLECMD(NULL, OLECMDID_SAVE, ID_FILE_SAVE)
  76. #define ON_OLECMD_SAVE_AS() \
  77. ON_OLECMD(NULL, OLECMDID_SAVEAS, ID_FILE_SAVE_AS)
  78. #define ON_OLECMD_SAVE_COPY_AS() \
  79. ON_OLECMD(NULL, OLECMDID_SAVECOPYAS, ID_FILE_SAVE_COPY_AS)
  80. #define ON_OLECMD_PRINT() \
  81. ON_OLECMD(NULL, OLECMDID_PRINT, ID_FILE_PRINT)
  82. #define ON_OLECMD_PRINTPREVIEW() \
  83. ON_OLECMD(NULL, OLECMDID_PRINTPREVIEW, ID_FILE_PRINT_PREVIEW)
  84. #define ON_OLECMD_PAGESETUP() \
  85. ON_OLECMD(NULL, OLECMDID_PAGESETUP, ID_FILE_PAGE_SETUP)
  86. #define ON_OLECMD_CUT() \
  87. ON_OLECMD(NULL, OLECMDID_CUT, ID_EDIT_CUT)
  88. #define ON_OLECMD_COPY() \
  89. ON_OLECMD(NULL, OLECMDID_COPY, ID_EDIT_COPY)
  90. #define ON_OLECMD_PASTE() \
  91. ON_OLECMD(NULL, OLECMDID_PASTE, ID_EDIT_PASTE)
  92. #define ON_OLECMD_PASTESPECIAL() \
  93. ON_OLECMD(NULL, OLECMDID_PASTESPECIAL, ID_EDIT_PASTE_SPECIAL)
  94. #define ON_OLECMD_UNDO() \
  95. ON_OLECMD(NULL, OLECMDID_UNDO, ID_EDIT_UNDO)
  96. #define ON_OLECMD_REDO() \
  97. ON_OLECMD(NULL, OLECMDID_REDO, ID_EDIT_REDO)
  98. #define ON_OLECMD_SELECTALL() \
  99. ON_OLECMD(NULL, OLECMDID_SELECTALL, ID_EDIT_SELECT_ALL)
  100. #define ON_OLECMD_CLEARSELECTION() \
  101. ON_OLECMD(NULL, OLECMDID_CLEARSELECTION, ID_EDIT_CLEAR)
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CDocObjectServer class
  104. class CDocObjectServer : public CCmdTarget
  105. {
  106. DECLARE_DYNAMIC(CDocObjectServer)
  107. // Constructors
  108. public:
  109. CDocObjectServer(COleServerDoc* pOwner,
  110. LPOLEDOCUMENTSITE pDocSite = NULL);
  111. // Attributes
  112. public:
  113. // Operations
  114. public:
  115. void ActivateDocObject();
  116. // Overridables
  117. protected:
  118. // Document Overridables
  119. // View Overridables
  120. virtual void OnApplyViewState(CArchive& ar);
  121. virtual void OnSaveViewState(CArchive& ar);
  122. virtual HRESULT OnActivateView();
  123. // Implementation
  124. public:
  125. virtual ~CDocObjectServer();
  126. void ReleaseDocSite();
  127. void SetDocSite(LPOLEDOCUMENTSITE pNewSite);
  128. COleDocIPFrameWnd* GetControllingFrame() const;
  129. protected:
  130. STDMETHODIMP OnExecOleCmd(const GUID* pguidCmdGroup,
  131. DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG* pvarargIn,
  132. VARIANTARG* pvarargOut);
  133. BOOL DoPreparePrinting(CView* pView, CPrintInfo* printInfo);
  134. void DoPrepareDC(CView* pView, CDC* pdcPrint, CPrintInfo* pprintInfo);
  135. void DoPrint(CView* pView, CDC* pdcPrint, CPrintInfo* pprintInfo);
  136. void DoBeginPrinting(CView* pView, CDC* pDC, CPrintInfo* pprintInfo);
  137. void DoEndPrinting(CView* pView, CDC* pDC, CPrintInfo* pprintInfo);
  138. #ifdef _DEBUG
  139. virtual void AssertValid() const;
  140. virtual void Dump(CDumpContext& dc) const;
  141. #endif
  142. // Overrides
  143. protected:
  144. // ClassWizard generated virtual function overrides
  145. //{{AFX_VIRTUAL(CDocObjectServer)
  146. public:
  147. virtual void OnCloseDocument();
  148. //}}AFX_VIRTUAL
  149. // Implementation Data
  150. protected:
  151. // Document Data
  152. LPOLEDOCUMENTSITE m_pDocSite;
  153. COleServerDoc* m_pOwner;
  154. // Print Data
  155. LONG m_nFirstPage;
  156. LPCONTINUECALLBACK m_pContinueCallback;
  157. // View Data
  158. LPOLEINPLACESITE m_pViewSite;
  159. // Implementation Helpers
  160. protected:
  161. void OnSetItemRects(LPRECT lprcPosRect, LPRECT lprcClipRect);
  162. // LPUNKNOWN GetInterfaceHook(const void* iid);
  163. // Generated message map functions
  164. protected:
  165. //{{AFX_MSG(CDocObjectServer)
  166. // NOTE - the ClassWizard will add and remove member functions here.
  167. //}}AFX_MSG
  168. DECLARE_MESSAGE_MAP()
  169. // Interface Maps
  170. public:
  171. BEGIN_INTERFACE_PART(OleObject, IOleObject)
  172. INIT_INTERFACE_PART(CDocObjServerDoc, DocOleObject)
  173. STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  174. STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  175. STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  176. STDMETHOD(Close)(DWORD);
  177. STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  178. STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  179. STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  180. STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  181. STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  182. STDMETHOD(EnumVerbs)(IEnumOLEVERB**);
  183. STDMETHOD(Update)();
  184. STDMETHOD(IsUpToDate)();
  185. STDMETHOD(GetUserClassID)(CLSID*);
  186. STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  187. STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  188. STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  189. STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  190. STDMETHOD(Unadvise)(DWORD);
  191. STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  192. STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  193. STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  194. END_INTERFACE_PART(OleObject)
  195. BEGIN_INTERFACE_PART(OleDocument, IOleDocument)
  196. INIT_INTERFACE_PART(CDocObjectServer, OleDocument)
  197. STDMETHOD(CreateView)(LPOLEINPLACESITE, LPSTREAM, DWORD, LPOLEDOCUMENTVIEW*);
  198. STDMETHOD(GetDocMiscStatus)(LPDWORD);
  199. STDMETHOD(EnumViews)(LPENUMOLEDOCUMENTVIEWS*, LPOLEDOCUMENTVIEW*);
  200. END_INTERFACE_PART(OleDocument)
  201. BEGIN_INTERFACE_PART(OleDocumentView, IOleDocumentView)
  202. INIT_INTERFACE_PART(CDocObjectServer, OleDocumentView)
  203. STDMETHOD(SetInPlaceSite)(LPOLEINPLACESITE);
  204. STDMETHOD(GetInPlaceSite)(LPOLEINPLACESITE*);
  205. STDMETHOD(GetDocument)(LPUNKNOWN*);
  206. STDMETHOD(SetRect)(LPRECT);
  207. STDMETHOD(GetRect)(LPRECT);
  208. STDMETHOD(SetRectComplex)(LPRECT, LPRECT, LPRECT, LPRECT);
  209. STDMETHOD(Show)(BOOL);
  210. STDMETHOD(UIActivate)(BOOL);
  211. STDMETHOD(Open)();
  212. STDMETHOD(CloseView)(DWORD);
  213. STDMETHOD(SaveViewState)(LPSTREAM);
  214. STDMETHOD(ApplyViewState)(LPSTREAM);
  215. STDMETHOD(Clone)(LPOLEINPLACESITE, LPOLEDOCUMENTVIEW*);
  216. END_INTERFACE_PART(OleDocumentView)
  217. BEGIN_INTERFACE_PART(OleCommandTarget, IOleCommandTarget)
  218. INIT_INTERFACE_PART(CDocObjectServer, OleCommandTarget)
  219. STDMETHOD(QueryStatus)(const GUID*, ULONG, OLECMD foo[], OLECMDTEXT *);
  220. STDMETHOD(Exec)(const GUID*, DWORD, DWORD, VARIANTARG *, VARIANTARG *);
  221. END_INTERFACE_PART(OleCommandTarget)
  222. BEGIN_INTERFACE_PART(Print, IPrint)
  223. INIT_INTERFACE_PART(CDocObjectServer, Print)
  224. STDMETHOD(SetInitialPageNum)(LONG);
  225. STDMETHOD(GetPageInfo)(LPLONG, LPLONG);
  226. STDMETHOD(Print)(DWORD, DVTARGETDEVICE**, PAGESET**, LPSTGMEDIUM,
  227. LPCONTINUECALLBACK, LONG, LPLONG, LPLONG);
  228. END_INTERFACE_PART(Print)
  229. DECLARE_INTERFACE_MAP()
  230. };
  231. /////////////////////////////////////////////////////////////////////////////
  232. // COleDocIPFrameWnd class
  233. class COleDocIPFrameWnd : public COleIPFrameWnd
  234. {
  235. DECLARE_DYNCREATE(COleDocIPFrameWnd)
  236. // Constructors
  237. public:
  238. COleDocIPFrameWnd();
  239. // Attributes
  240. public:
  241. // Operations
  242. public:
  243. // Overridables
  244. protected:
  245. // Implementation
  246. public:
  247. virtual ~COleDocIPFrameWnd();
  248. #ifdef _DEBUG
  249. virtual void AssertValid() const;
  250. virtual void Dump(CDumpContext& dc) const;
  251. #endif
  252. // Overrides
  253. // ClassWizard generated virtual function overrides
  254. //{{AFX_VIRTUAL(COleDocIPFrameWnd)
  255. //}}AFX_VIRTUAL
  256. protected:
  257. virtual void OnRequestPositionChange(LPCRECT lpRect);
  258. virtual void RecalcLayout(BOOL bNotify = TRUE);
  259. // Menu Merging support
  260. HMENU m_hMenuHelpPopup;
  261. virtual BOOL BuildSharedMenu();
  262. virtual void DestroySharedMenu();
  263. // Generated message map functions
  264. //{{AFX_MSG(COleDocIPFrameWnd)
  265. // NOTE - the ClassWizard will add and remove member functions here.
  266. //}}AFX_MSG
  267. DECLARE_MESSAGE_MAP()
  268. };
  269. class CDocObjectServerItem : public COleServerItem
  270. {
  271. DECLARE_DYNAMIC(CDocObjectServerItem)
  272. // Constructors
  273. protected:
  274. CDocObjectServerItem(COleServerDoc* pServerDoc, BOOL bAutoDelete);
  275. // Attributes
  276. public:
  277. COleServerDoc* GetDocument() const
  278. { return (COleServerDoc*) COleServerItem::GetDocument(); }
  279. // Overridables
  280. public:
  281. // Implementation
  282. public:
  283. virtual ~CDocObjectServerItem();
  284. #ifdef _DEBUG
  285. virtual void AssertValid() const;
  286. virtual void Dump(CDumpContext& dc) const;
  287. #endif
  288. // Overrides
  289. protected:
  290. virtual void OnDoVerb(LONG iVerb);
  291. virtual void OnHide();
  292. virtual void OnOpen();
  293. virtual void OnShow();
  294. // ClassWizard generated virtual function overrides
  295. //{{AFX_VIRTUAL(CDocObjectServerItem)
  296. //}}AFX_VIRTUAL
  297. };
  298. /////////////////////////////////////////////////////////////////////////////
  299. #ifdef _AFX_PACKING
  300. #pragma pack(pop)
  301. #endif
  302. #undef AFX_DATA
  303. #define AFX_DATA
  304. #ifdef _AFX_MINREBUILD
  305. #pragma component(minrebuild, on)
  306. #endif
  307. #ifndef _AFX_FULLTYPEINFO
  308. #pragma component(mintypeinfo, off)
  309. #endif
  310. #endif //__AFXDOCOB_H__
  311. /////////////////////////////////////////////////////////////////////////////