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.

362 lines
9.7 KiB

  1. // Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1993 Microsoft Corporation,
  3. // All rights reserved.
  4. // This source code is only intended as a supplement to the
  5. // Microsoft Foundation Classes Reference and Microsoft
  6. // QuickHelp and/or WinHelp documentation provided with the library.
  7. // See these sources for detailed information regarding the
  8. // Microsoft Foundation Classes product.
  9. #ifndef __AFXODLGS_H__
  10. #define __AFXODLGS_H__
  11. #ifdef _AFXCTL
  12. #error illegal file inclusion
  13. #endif
  14. #ifndef __AFXOLE_H__
  15. #include <afxole.h>
  16. #endif
  17. // include OLE 2.0 dialog/helper APIs
  18. #include <ole2ui.h>
  19. /////////////////////////////////////////////////////////////////////////////
  20. // AFXODLGS.H - MFC OLE dialogs
  21. // Classes declared in this file
  22. //CDialog
  23. class COleDialog; // base class for OLE dialog wrappers
  24. class COleInsertDialog; // insert object dialog
  25. class COleConvertDialog; // convert dialog
  26. class COleChangeIconDialog; // change icon dialog
  27. class COlePasteSpecialDialog; // paste special dialog
  28. class COleLinksDialog; // edit links dialog
  29. class COleUpdateDialog; // update links/embeddings dialog
  30. class COleBusyDialog; // used for
  31. /////////////////////////////////////////////////////////////////////////////
  32. // AFXDLL support
  33. #undef AFXAPP_DATA
  34. #define AFXAPP_DATA AFXAPIEX_DATA
  35. /////////////////////////////////////////////////////////////////////////////
  36. // Wrappers for OLE UI dialogs
  37. class COleDialog : public CDialog
  38. {
  39. DECLARE_DYNAMIC(COleDialog)
  40. // Attributes
  41. public:
  42. UINT GetLastError() const;
  43. // Implementation
  44. public:
  45. int MapResult(UINT nResult);
  46. COleDialog(CWnd* pParentWnd);
  47. #ifdef _DEBUG
  48. virtual void Dump(CDumpContext& dc) const;
  49. #endif
  50. protected:
  51. virtual void OnOK();
  52. virtual void OnCancel();
  53. UINT m_nLastError;
  54. protected:
  55. friend UINT CALLBACK AFX_EXPORT _AfxOleHookProc(HWND, UINT, WPARAM, LPARAM);
  56. };
  57. /////////////////////////////////////////////////////////////////////////////
  58. // COleInsertDialog
  59. class COleInsertDialog : public COleDialog
  60. {
  61. DECLARE_DYNAMIC(COleInsertDialog)
  62. // Attributes
  63. public:
  64. OLEUIINSERTOBJECT m_io; // structure for OleUIInsertObject
  65. // Constructors
  66. COleInsertDialog(DWORD dwFlags = IOF_SELECTCREATENEW,
  67. CWnd* pParentWnd = NULL);
  68. // Operations
  69. virtual int DoModal();
  70. BOOL CreateItem(COleClientItem* pItem);
  71. // call after DoModal to create item based on dialog data
  72. // Attributes (after DoModal returns IDOK)
  73. enum Selection { createNewItem, insertFromFile, linkToFile };
  74. UINT GetSelectionType() const;
  75. // return type of selection made
  76. CString GetPathName() const; // return full path name
  77. REFCLSID GetClassID() const; // get class ID of new item
  78. DVASPECT GetDrawAspect() const;
  79. // DVASPECT_CONTENT or DVASPECT_ICON
  80. HGLOBAL GetIconicMetafile() const;
  81. // returns HGLOBAL to METAFILEPICT struct with iconic data
  82. // Implementation
  83. public:
  84. virtual ~COleInsertDialog();
  85. #ifdef _DEBUG
  86. virtual void Dump(CDumpContext& dc) const;
  87. #endif
  88. protected:
  89. char m_szFileName[OLEUI_CCHPATHMAX];
  90. // contains full path name after return
  91. };
  92. /////////////////////////////////////////////////////////////////////////////
  93. // COleConvertDialog
  94. class COleConvertDialog : public COleDialog
  95. {
  96. DECLARE_DYNAMIC(COleConvertDialog)
  97. // Attributes
  98. public:
  99. OLEUICONVERT m_cv; // structure for OleUIConvert
  100. // Constructors
  101. COleConvertDialog(COleClientItem* pItem,
  102. DWORD dwFlags = CF_SELECTCONVERTTO, CLSID FAR* pClassID = NULL,
  103. CWnd* pParentWnd = NULL);
  104. // Operations
  105. virtual int DoModal();
  106. // just display the dialog and collect convert info
  107. BOOL DoConvert(COleClientItem* pItem);
  108. // do the conversion on pItem (after DoModal == IDOK)
  109. // Attributes (after DoModal returns IDOK)
  110. enum Selection { noConversion, convertItem, activateAs };
  111. UINT GetSelectionType() const;
  112. HGLOBAL GetIconicMetafile() const; // will return NULL if same as before
  113. REFCLSID GetClassID() const; // get class ID to convert or activate as
  114. DVASPECT GetDrawAspect() const; // get new draw aspect
  115. // Implementation
  116. public:
  117. virtual ~COleConvertDialog();
  118. #ifdef _DEBUG
  119. virtual void Dump(CDumpContext& dc) const;
  120. #endif
  121. };
  122. /////////////////////////////////////////////////////////////////////////////
  123. // COleChangeIconDialog
  124. class COleChangeIconDialog : public COleDialog
  125. {
  126. DECLARE_DYNAMIC(COleChangeIconDialog)
  127. // Attributes
  128. public:
  129. OLEUICHANGEICON m_ci; // structure for OleUIChangeIcon
  130. // Constructors
  131. COleChangeIconDialog(COleClientItem* pItem,
  132. DWORD dwFlags = CIF_SELECTCURRENT,
  133. CWnd* pParentWnd = NULL);
  134. // Operations
  135. virtual int DoModal();
  136. BOOL DoChangeIcon(COleClientItem* pItem);
  137. // Attributes
  138. HGLOBAL GetIconicMetafile() const;
  139. // Implementation
  140. public:
  141. virtual ~COleChangeIconDialog();
  142. #ifdef _DEBUG
  143. virtual void Dump(CDumpContext& dc) const;
  144. #endif
  145. };
  146. /////////////////////////////////////////////////////////////////////////////
  147. // COlePasteSpecialDialog
  148. class COlePasteSpecialDialog : public COleDialog
  149. {
  150. DECLARE_DYNAMIC(COlePasteSpecialDialog)
  151. // Attributes
  152. public:
  153. OLEUIPASTESPECIAL m_ps; // structure for OleUIPasteSpecial
  154. // Constructors
  155. COlePasteSpecialDialog(DWORD dwFlags = PSF_SELECTPASTE,
  156. COleDataObject* pDataObject = NULL, CWnd *pParentWnd = NULL);
  157. // Operations
  158. OLEUIPASTEFLAG AddLinkEntry(UINT cf);
  159. void AddFormat(const FORMATETC& formatEtc, LPSTR lpstrFormat,
  160. LPSTR lpstrResult, DWORD flags);
  161. void AddFormat(UINT cf, DWORD tymed, UINT nFormatID, BOOL bEnableIcon,
  162. BOOL bLink);
  163. void AddStandardFormats(BOOL bEnableLink = TRUE);
  164. virtual int DoModal();
  165. BOOL CreateItem(COleClientItem *pNewItem);
  166. // creates a standard OLE item from selection data
  167. // Attributes (after DoModal returns IDOK)
  168. int GetPasteIndex() const; // resulting index to use for paste
  169. enum Selection { pasteLink = 1, pasteNormal = 2, pasteStatic = 3, pasteOther = 4};
  170. UINT GetSelectionType() const;
  171. // get selection type (pasteLink, pasteNormal, pasteStatic)
  172. DVASPECT GetDrawAspect() const;
  173. // DVASPECT_CONTENT or DVASPECT_ICON
  174. HGLOBAL GetIconicMetafile() const;
  175. // returns HGLOBAL to METAFILEPICT struct with iconic data
  176. // Implementation
  177. public:
  178. virtual ~COlePasteSpecialDialog();
  179. #ifdef _DEBUG
  180. virtual void Dump(CDumpContext& dc) const;
  181. virtual void AssertValid() const;
  182. #endif
  183. unsigned int m_arrLinkTypes[8];
  184. // size limit imposed by MFCOLEUI library
  185. };
  186. /////////////////////////////////////////////////////////////////////////////
  187. // COleLinksDialog
  188. class COleLinksDialog : public COleDialog
  189. {
  190. DECLARE_DYNAMIC(COleLinksDialog)
  191. // Attributes
  192. public:
  193. OLEUIEDITLINKS m_el; // structure for OleUIEditLinks
  194. // Constructors
  195. COleLinksDialog(COleDocument* pDoc, CView* pView, DWORD dwFlags = 0,
  196. CWnd* pParentWnd = NULL);
  197. // Operations
  198. virtual int DoModal(); // display the dialog and edit links
  199. // Implementation
  200. public:
  201. virtual ~COleLinksDialog();
  202. #ifdef _DEBUG
  203. virtual void Dump(CDumpContext& dc) const;
  204. virtual void AssertValid() const;
  205. #endif
  206. protected:
  207. COleDocument* m_pDocument; // document being manipulated
  208. COleClientItem* m_pSelectedItem; // primary selected item in m_pDocument
  209. POSITION m_pos; // used during link enumeration
  210. BOOL m_bUpdateLinks; // update links?
  211. BOOL m_bUpdateEmbeddings; // update embeddings?
  212. // Interface Maps
  213. BEGIN_INTERFACE_PART(OleUILinkContainer, IOleUILinkContainer)
  214. STDMETHOD_(DWORD,GetNextLink)(DWORD);
  215. STDMETHOD(SetLinkUpdateOptions)(DWORD, DWORD);
  216. STDMETHOD(GetLinkUpdateOptions)(DWORD, LPDWORD);
  217. STDMETHOD(SetLinkSource)(DWORD, LPSTR, ULONG, ULONG FAR*, BOOL);
  218. STDMETHOD(GetLinkSource)(DWORD, LPSTR FAR*, ULONG FAR*,
  219. LPSTR FAR*, LPSTR FAR*, BOOL FAR*, BOOL FAR*);
  220. STDMETHOD(OpenLinkSource)(DWORD);
  221. STDMETHOD(UpdateLink)(DWORD, BOOL, BOOL);
  222. STDMETHOD(CancelLink)(DWORD);
  223. END_INTERFACE_PART(OleUILinkContainer)
  224. DECLARE_INTERFACE_MAP()
  225. };
  226. /////////////////////////////////////////////////////////////////////////////
  227. // COleUpdateDialog
  228. class COleUpdateDialog : public COleLinksDialog
  229. {
  230. DECLARE_DYNAMIC(COleUpdateDialog)
  231. // Constructors
  232. public:
  233. COleUpdateDialog(COleDocument* pDoc,
  234. BOOL bUpdateLinks = TRUE, BOOL bUpdateEmbeddings = FALSE,
  235. CWnd* pParentWnd = NULL);
  236. // Operations
  237. virtual int DoModal();
  238. // Implementation
  239. public:
  240. virtual ~COleUpdateDialog();
  241. #ifdef _DEBUG
  242. virtual void Dump(CDumpContext& dc) const;
  243. #endif
  244. protected:
  245. CString m_strCaption; // caption for the dialog
  246. };
  247. /////////////////////////////////////////////////////////////////////////////
  248. // COleBusyDialog - useful in managing concurrency
  249. class COleBusyDialog : public COleDialog
  250. {
  251. DECLARE_DYNAMIC(COleBusyDialog)
  252. // Attributes
  253. public:
  254. OLEUIBUSY m_bz;
  255. // Constructors
  256. COleBusyDialog(HTASK htaskBusy, BOOL bNotResponding = FALSE,
  257. DWORD dwFlags = 0, CWnd* pParentWnd = NULL);
  258. // Operations
  259. virtual int DoModal();
  260. enum Selection { switchTo = 1, retry = 2, callUnblocked = 3 };
  261. UINT GetSelectionType() const;
  262. // Implementation
  263. public:
  264. ~COleBusyDialog();
  265. #ifdef _DEBUG
  266. virtual void Dump(CDumpContext& dc) const;
  267. #endif
  268. protected:
  269. Selection m_selection; // selection after DoModal returns IDOK
  270. };
  271. /////////////////////////////////////////////////////////////////////////////
  272. // Inline function declarations
  273. #ifdef _AFX_ENABLE_INLINES
  274. #define _AFXODLGS_INLINE inline
  275. #include <afxole.inl>
  276. #undef _AFXODLGS_INLINE
  277. #endif
  278. #undef AFXAPP_DATA
  279. #define AFXAPP_DATA NEAR
  280. #endif //__AFXODLGS_H__
  281. /////////////////////////////////////////////////////////////////////////////