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.

516 lines
13 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-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 __AFXODLGS_H__
  11. #define __AFXODLGS_H__
  12. #ifdef _AFX_NO_OLE_SUPPORT
  13. #error OLE classes not supported in this library variant.
  14. #endif
  15. #ifndef __AFXOLE_H__
  16. #include <afxole.h>
  17. #endif
  18. #ifndef __AFXDLGS_H__
  19. #include <afxdlgs.h>
  20. #endif
  21. // include OLE dialog/helper APIs
  22. #ifndef _OLEDLG_H_
  23. #include <oledlg.h>
  24. #endif
  25. #ifdef _AFX_MINREBUILD
  26. #pragma component(minrebuild, off)
  27. #endif
  28. #ifndef _AFX_FULLTYPEINFO
  29. #pragma component(mintypeinfo, on)
  30. #endif
  31. #ifdef _AFX_PACKING
  32. #pragma pack(push, _AFX_PACKING)
  33. #endif
  34. /////////////////////////////////////////////////////////////////////////////
  35. // AFXODLGS.H - MFC OLE dialogs
  36. // Classes declared in this file
  37. //CCommonDialog
  38. class COleDialog; // base class for OLE dialog wrappers
  39. class COleInsertDialog; // insert object dialog
  40. class COleConvertDialog; // convert dialog
  41. class COleChangeIconDialog; // change icon dialog
  42. class COlePasteSpecialDialog; // paste special dialog
  43. class COleLinksDialog; // edit links dialog
  44. class COleUpdateDialog; // update links/embeddings dialog
  45. class COleBusyDialog; // used for
  46. class COlePropertiesDialog;
  47. class COleChangeSourceDialog;
  48. /////////////////////////////////////////////////////////////////////////////
  49. // AFXDLL support
  50. #undef AFX_DATA
  51. #define AFX_DATA AFX_OLE_DATA
  52. /////////////////////////////////////////////////////////////////////////////
  53. // COleUILinkInfo -- used internally to implement
  54. // IOleUILinkInfo and IOleUILinkContainer
  55. // used by COleLinksDialog and COleChangeSourceDialog
  56. class COleUILinkInfo : public IOleUILinkInfo
  57. {
  58. public:
  59. COleUILinkInfo(COleDocument* pDocument);
  60. // Implementation
  61. COleDocument* m_pDocument; // document being manipulated
  62. COleClientItem* m_pSelectedItem; // primary selected item in m_pDocument
  63. POSITION m_pos; // used during link enumeration
  64. BOOL m_bUpdateLinks; // update links?
  65. BOOL m_bUpdateEmbeddings; // update embeddings?
  66. STDMETHOD_(ULONG, AddRef)();
  67. STDMETHOD_(ULONG, Release)();
  68. STDMETHOD(QueryInterface)(REFIID, LPVOID*);
  69. // IOleUILinkContainer
  70. STDMETHOD_(DWORD,GetNextLink)(DWORD);
  71. STDMETHOD(SetLinkUpdateOptions)(DWORD, DWORD);
  72. STDMETHOD(GetLinkUpdateOptions)(DWORD, LPDWORD);
  73. STDMETHOD(SetLinkSource)(DWORD, LPTSTR, ULONG, ULONG*, BOOL);
  74. STDMETHOD(GetLinkSource)(DWORD, LPTSTR*, ULONG*, LPTSTR*, LPTSTR*, BOOL*,
  75. BOOL*);
  76. STDMETHOD(OpenLinkSource)(DWORD);
  77. STDMETHOD(UpdateLink)(DWORD, BOOL, BOOL);
  78. STDMETHOD(CancelLink)(DWORD);
  79. // IOleUILinkInfo
  80. STDMETHOD(GetLastUpdate)(DWORD dwLink, FILETIME* lpLastUpdate);
  81. };
  82. /////////////////////////////////////////////////////////////////////////////
  83. // Wrappers for OLE UI dialogs
  84. #ifdef _AFXDLL
  85. class COleDialog : public CCommonDialog
  86. #else
  87. class AFX_NOVTABLE COleDialog : public CCommonDialog
  88. #endif
  89. {
  90. DECLARE_DYNAMIC(COleDialog)
  91. // Attributes
  92. public:
  93. UINT GetLastError() const;
  94. // Implementation
  95. public:
  96. int MapResult(UINT nResult);
  97. COleDialog(CWnd* pParentWnd);
  98. #ifdef _DEBUG
  99. virtual void Dump(CDumpContext& dc) const;
  100. #endif
  101. protected:
  102. UINT m_nLastError;
  103. protected:
  104. friend UINT CALLBACK _AfxOleHookProc(HWND, UINT, WPARAM, LPARAM);
  105. };
  106. /////////////////////////////////////////////////////////////////////////////
  107. // COleInsertDialog
  108. class COleInsertDialog : public COleDialog
  109. {
  110. DECLARE_DYNAMIC(COleInsertDialog)
  111. // Attributes
  112. public:
  113. OLEUIINSERTOBJECT m_io; // structure for OleUIInsertObject
  114. // Constructors
  115. COleInsertDialog(DWORD dwFlags = IOF_SELECTCREATENEW,
  116. CWnd* pParentWnd = NULL);
  117. // Operations
  118. virtual INT_PTR DoModal();
  119. #if _MFC_VER >= 0x0600
  120. INT_PTR DoModal(DWORD dwFlags);
  121. #endif
  122. BOOL CreateItem(COleClientItem* pItem);
  123. // call after DoModal to create item based on dialog data
  124. // Attributes (after DoModal returns IDOK)
  125. enum Selection { createNewItem, insertFromFile, linkToFile };
  126. UINT GetSelectionType() const;
  127. // return type of selection made
  128. CString GetPathName() const; // return full path name
  129. REFCLSID GetClassID() const; // get class ID of new item
  130. DVASPECT GetDrawAspect() const;
  131. // DVASPECT_CONTENT or DVASPECT_ICON
  132. HGLOBAL GetIconicMetafile() const;
  133. // returns HGLOBAL to METAFILEPICT struct with iconic data
  134. // Implementation
  135. public:
  136. virtual ~COleInsertDialog();
  137. #ifdef _DEBUG
  138. virtual void Dump(CDumpContext& dc) const;
  139. #endif
  140. #if _MFC_VER >= 0x0600
  141. enum FilterFlags {
  142. DocObjectsOnly = 1,
  143. ControlsOnly = 2,
  144. };
  145. #endif
  146. protected:
  147. TCHAR m_szFileName[_MAX_PATH];
  148. // contains full path name after return
  149. #if _MFC_VER >= 0x0600
  150. void AddClassIDToList(LPCLSID& lpList, int& nListCount,
  151. int& nBufferLen, LPCLSID pNewID);
  152. #endif
  153. };
  154. /////////////////////////////////////////////////////////////////////////////
  155. // COleConvertDialog
  156. class COleConvertDialog : public COleDialog
  157. {
  158. DECLARE_DYNAMIC(COleConvertDialog)
  159. // Attributes
  160. public:
  161. OLEUICONVERT m_cv; // structure for OleUIConvert
  162. // Constructors
  163. COleConvertDialog(COleClientItem* pItem,
  164. DWORD dwFlags = CF_SELECTCONVERTTO, CLSID* pClassID = NULL,
  165. CWnd* pParentWnd = NULL);
  166. // Operations
  167. virtual INT_PTR DoModal();
  168. // just display the dialog and collect convert info
  169. BOOL DoConvert(COleClientItem* pItem);
  170. // do the conversion on pItem (after DoModal == IDOK)
  171. // Attributes (after DoModal returns IDOK)
  172. enum Selection { noConversion, convertItem, activateAs };
  173. UINT GetSelectionType() const;
  174. HGLOBAL GetIconicMetafile() const; // will return NULL if same as before
  175. REFCLSID GetClassID() const; // get class ID to convert or activate as
  176. DVASPECT GetDrawAspect() const; // get new draw aspect
  177. // Implementation
  178. public:
  179. virtual ~COleConvertDialog();
  180. #ifdef _DEBUG
  181. virtual void Dump(CDumpContext& dc) const;
  182. #endif
  183. };
  184. /////////////////////////////////////////////////////////////////////////////
  185. // COleChangeIconDialog
  186. class COleChangeIconDialog : public COleDialog
  187. {
  188. DECLARE_DYNAMIC(COleChangeIconDialog)
  189. // Attributes
  190. public:
  191. OLEUICHANGEICON m_ci; // structure for OleUIChangeIcon
  192. // Constructors
  193. COleChangeIconDialog(COleClientItem* pItem,
  194. DWORD dwFlags = CIF_SELECTCURRENT,
  195. CWnd* pParentWnd = NULL);
  196. // Operations
  197. virtual INT_PTR DoModal();
  198. BOOL DoChangeIcon(COleClientItem* pItem);
  199. // Attributes
  200. HGLOBAL GetIconicMetafile() const;
  201. // Implementation
  202. public:
  203. virtual ~COleChangeIconDialog();
  204. #ifdef _DEBUG
  205. virtual void Dump(CDumpContext& dc) const;
  206. #endif
  207. };
  208. /////////////////////////////////////////////////////////////////////////////
  209. // COlePasteSpecialDialog
  210. class COlePasteSpecialDialog : public COleDialog
  211. {
  212. DECLARE_DYNAMIC(COlePasteSpecialDialog)
  213. // Attributes
  214. public:
  215. OLEUIPASTESPECIAL m_ps; // structure for OleUIPasteSpecial
  216. // Constructors
  217. COlePasteSpecialDialog(DWORD dwFlags = PSF_SELECTPASTE,
  218. COleDataObject* pDataObject = NULL, CWnd *pParentWnd = NULL);
  219. // Operations
  220. OLEUIPASTEFLAG AddLinkEntry(UINT cf);
  221. void AddFormat(const FORMATETC& formatEtc, LPTSTR lpszFormat,
  222. LPTSTR lpszResult, DWORD flags);
  223. void AddFormat(UINT cf, DWORD tymed, UINT nFormatID, BOOL bEnableIcon,
  224. BOOL bLink);
  225. void AddStandardFormats(BOOL bEnableLink = TRUE);
  226. virtual INT_PTR DoModal();
  227. BOOL CreateItem(COleClientItem *pNewItem);
  228. // creates a standard OLE item from selection data
  229. // Attributes (after DoModal returns IDOK)
  230. int GetPasteIndex() const; // resulting index to use for paste
  231. enum Selection { pasteLink = 1, pasteNormal = 2, pasteStatic = 3, pasteOther = 4};
  232. UINT GetSelectionType() const;
  233. // get selection type (pasteLink, pasteNormal, pasteStatic)
  234. DVASPECT GetDrawAspect() const;
  235. // DVASPECT_CONTENT or DVASPECT_ICON
  236. HGLOBAL GetIconicMetafile() const;
  237. // returns HGLOBAL to METAFILEPICT struct with iconic data
  238. // Implementation
  239. public:
  240. virtual ~COlePasteSpecialDialog();
  241. #ifdef _DEBUG
  242. virtual void Dump(CDumpContext& dc) const;
  243. virtual void AssertValid() const;
  244. #endif
  245. unsigned int m_arrLinkTypes[8];
  246. // size limit imposed by MFCUIx32.DLL library
  247. };
  248. /////////////////////////////////////////////////////////////////////////////
  249. // COleLinksDialog
  250. class COleLinksDialog : public COleDialog
  251. {
  252. DECLARE_DYNAMIC(COleLinksDialog)
  253. // Attributes
  254. public:
  255. OLEUIEDITLINKS m_el; // structure for OleUIEditLinks
  256. // Constructors
  257. COleLinksDialog(COleDocument* pDoc, CView* pView, DWORD dwFlags = 0,
  258. CWnd* pParentWnd = NULL);
  259. // Operations
  260. virtual INT_PTR DoModal(); // display the dialog and edit links
  261. // Implementation
  262. public:
  263. virtual ~COleLinksDialog();
  264. #ifdef _DEBUG
  265. virtual void Dump(CDumpContext& dc) const;
  266. virtual void AssertValid() const;
  267. #endif
  268. public:
  269. COleUILinkInfo m_xLinkInfo; // implements IOleUILinkContainer
  270. };
  271. /////////////////////////////////////////////////////////////////////////////
  272. // COleUpdateDialog
  273. class COleUpdateDialog : public COleLinksDialog
  274. {
  275. DECLARE_DYNAMIC(COleUpdateDialog)
  276. // Constructors
  277. public:
  278. COleUpdateDialog(COleDocument* pDoc,
  279. BOOL bUpdateLinks = TRUE, BOOL bUpdateEmbeddings = FALSE,
  280. CWnd* pParentWnd = NULL);
  281. // Operations
  282. virtual INT_PTR DoModal();
  283. // Implementation
  284. public:
  285. virtual ~COleUpdateDialog();
  286. #ifdef _DEBUG
  287. virtual void Dump(CDumpContext& dc) const;
  288. #endif
  289. protected:
  290. CString m_strCaption; // caption for the dialog
  291. };
  292. /////////////////////////////////////////////////////////////////////////////
  293. // COleBusyDialog - useful in managing concurrency
  294. class COleBusyDialog : public COleDialog
  295. {
  296. DECLARE_DYNAMIC(COleBusyDialog)
  297. // Attributes
  298. public:
  299. OLEUIBUSY m_bz;
  300. // Constructors
  301. COleBusyDialog(HTASK htaskBusy, BOOL bNotResponding = FALSE,
  302. DWORD dwFlags = 0, CWnd* pParentWnd = NULL);
  303. // Operations
  304. virtual INT_PTR DoModal();
  305. enum Selection { switchTo = 1, retry = 2, callUnblocked = 3 };
  306. UINT GetSelectionType() const;
  307. // Implementation
  308. public:
  309. ~COleBusyDialog();
  310. #ifdef _DEBUG
  311. virtual void Dump(CDumpContext& dc) const;
  312. #endif
  313. protected:
  314. Selection m_selection; // selection after DoModal returns IDOK
  315. };
  316. /////////////////////////////////////////////////////////////////////////////
  317. // COleEditProperties
  318. class COlePropertiesDialog : public COleDialog
  319. {
  320. DECLARE_DYNAMIC(COlePropertiesDialog)
  321. // Attributes
  322. public:
  323. OLEUIOBJECTPROPS m_op; // structure for OleUIObjectProperties
  324. OLEUIGNRLPROPS m_gp; // specific to "General" page
  325. OLEUIVIEWPROPS m_vp; // specific to "View" page
  326. OLEUILINKPROPS m_lp; // specific to "Link" page
  327. PROPSHEETHEADER m_psh; // PROPSHEETHEADER for customization
  328. // Constructors
  329. public:
  330. COlePropertiesDialog(COleClientItem* pItem,
  331. UINT nScaleMin = 10, UINT nScaleMax = 500, CWnd* pParentWnd = NULL);
  332. // Operations
  333. virtual INT_PTR DoModal();
  334. // Overridables
  335. virtual BOOL OnApplyScale(
  336. COleClientItem* pItem, int nCurrentScale, BOOL bRelativeToOrig);
  337. // Implementation
  338. public:
  339. #ifdef _DEBUG
  340. virtual void Dump(CDumpContext& dc) const;
  341. virtual void AssertValid() const;
  342. #endif
  343. virtual BOOL OnInitDialog();
  344. BEGIN_INTERFACE_PART(OleUIObjInfo, IOleUIObjInfo)
  345. INIT_INTERFACE_PART(COlePropertiesDialog, OleUIObjInfo)
  346. STDMETHOD(GetObjectInfo) (THIS_ DWORD dwObject,
  347. DWORD* lpdwObjSize, LPTSTR* lplpszLabel,
  348. LPTSTR* lplpszType, LPTSTR* lplpszShortType,
  349. LPTSTR* lplpszLocation);
  350. STDMETHOD(GetConvertInfo) (THIS_ DWORD dwObject,
  351. CLSID* lpClassID, WORD* lpwFormat,
  352. CLSID* lpConvertDefaultClassID,
  353. LPCLSID* lplpClsidExclude, UINT* lpcClsidExclude);
  354. STDMETHOD(ConvertObject) (THIS_ DWORD dwObject, REFCLSID clsidNew);
  355. STDMETHOD(GetViewInfo) (THIS_ DWORD dwObject,
  356. HGLOBAL* phMetaPict, DWORD* pdvAspect, int* pnCurrentScale);
  357. STDMETHOD(SetViewInfo) (THIS_ DWORD dwObject,
  358. HGLOBAL hMetaPict, DWORD dvAspect,
  359. int nCurrentScale, BOOL bRelativeToOrig);
  360. END_INTERFACE_PART(OleUIObjInfo)
  361. COleUILinkInfo m_xLinkInfo; // implements IOleUILinkContainer
  362. };
  363. /////////////////////////////////////////////////////////////////////////////
  364. // COleChangeSourceDialog
  365. class COleChangeSourceDialog : public COleDialog
  366. {
  367. DECLARE_DYNAMIC(COleChangeSourceDialog)
  368. // Attributes
  369. public:
  370. OLEUICHANGESOURCE m_cs; // structure for OleUIChangeSource
  371. // Constructors
  372. public:
  373. COleChangeSourceDialog(COleClientItem* pItem, CWnd* pParentWnd = NULL);
  374. // Operations
  375. virtual INT_PTR DoModal();
  376. // Attributes (after DoModal returns IDOK)
  377. BOOL IsValidSource();
  378. CString GetDisplayName();
  379. CString GetFileName();
  380. CString GetItemName();
  381. CString GetFromPrefix();
  382. CString GetToPrefix();
  383. // Implementation
  384. public:
  385. COleUILinkInfo m_xLinkInfo;
  386. virtual ~COleChangeSourceDialog();
  387. #ifdef _DEBUG
  388. virtual void Dump(CDumpContext& dc) const;
  389. virtual void AssertValid() const;
  390. #endif
  391. virtual void PreInitDialog();
  392. };
  393. /////////////////////////////////////////////////////////////////////////////
  394. // Inline function declarations
  395. #ifdef _AFX_PACKING
  396. #pragma pack(pop)
  397. #endif
  398. #ifdef _AFX_ENABLE_INLINES
  399. #define _AFXODLGS_INLINE AFX_INLINE
  400. #include <afxole.inl>
  401. #undef _AFXODLGS_INLINE
  402. #endif
  403. #undef AFX_DATA
  404. #define AFX_DATA
  405. #ifdef _AFX_MINREBUILD
  406. #pragma component(minrebuild, on)
  407. #endif
  408. #ifndef _AFX_FULLTYPEINFO
  409. #pragma component(mintypeinfo, off)
  410. #endif
  411. #endif //__AFXODLGS_H__
  412. /////////////////////////////////////////////////////////////////////////////