afxodlgs.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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 MFC_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 DoModal();
  119. int DoModal(DWORD dwFlags);
  120. BOOL CreateItem(COleClientItem* pItem);
  121. // call after DoModal to create item based on dialog data
  122. // Attributes (after DoModal returns IDOK)
  123. enum Selection { createNewItem, insertFromFile, linkToFile };
  124. UINT GetSelectionType() const;
  125. // return type of selection made
  126. CString GetPathName() const; // return full path name
  127. REFCLSID GetClassID() const; // get class ID of new item
  128. DVASPECT GetDrawAspect() const;
  129. // DVASPECT_CONTENT or DVASPECT_ICON
  130. HGLOBAL GetIconicMetafile() const;
  131. // returns HGLOBAL to METAFILEPICT struct with iconic data
  132. // Implementation
  133. public:
  134. virtual ~COleInsertDialog();
  135. #ifdef MFC_DEBUG
  136. virtual void Dump(CDumpContext& dc) const;
  137. #endif
  138. enum FilterFlags {
  139. DocObjectsOnly = 1,
  140. ControlsOnly = 2,
  141. };
  142. protected:
  143. TCHAR m_szFileName[_MAX_PATH];
  144. // contains full path name after return
  145. void AddClassIDToList(LPCLSID& lpList, int& nListCount,
  146. int& nBufferLen, LPCLSID pNewID);
  147. };
  148. /////////////////////////////////////////////////////////////////////////////
  149. // COleConvertDialog
  150. class COleConvertDialog : public COleDialog
  151. {
  152. DECLARE_DYNAMIC(COleConvertDialog)
  153. // Attributes
  154. public:
  155. OLEUICONVERT m_cv; // structure for OleUIConvert
  156. // Constructors
  157. COleConvertDialog(COleClientItem* pItem,
  158. DWORD dwFlags = CF_SELECTCONVERTTO, CLSID* pClassID = NULL,
  159. CWnd* pParentWnd = NULL);
  160. // Operations
  161. virtual int DoModal();
  162. // just display the dialog and collect convert info
  163. BOOL DoConvert(COleClientItem* pItem);
  164. // do the conversion on pItem (after DoModal == IDOK)
  165. // Attributes (after DoModal returns IDOK)
  166. enum Selection { noConversion, convertItem, activateAs };
  167. UINT GetSelectionType() const;
  168. HGLOBAL GetIconicMetafile() const; // will return NULL if same as before
  169. REFCLSID GetClassID() const; // get class ID to convert or activate as
  170. DVASPECT GetDrawAspect() const; // get new draw aspect
  171. // Implementation
  172. public:
  173. virtual ~COleConvertDialog();
  174. #ifdef MFC_DEBUG
  175. virtual void Dump(CDumpContext& dc) const;
  176. #endif
  177. };
  178. /////////////////////////////////////////////////////////////////////////////
  179. // COleChangeIconDialog
  180. class COleChangeIconDialog : public COleDialog
  181. {
  182. DECLARE_DYNAMIC(COleChangeIconDialog)
  183. // Attributes
  184. public:
  185. OLEUICHANGEICON m_ci; // structure for OleUIChangeIcon
  186. // Constructors
  187. COleChangeIconDialog(COleClientItem* pItem,
  188. DWORD dwFlags = CIF_SELECTCURRENT,
  189. CWnd* pParentWnd = NULL);
  190. // Operations
  191. virtual int DoModal();
  192. BOOL DoChangeIcon(COleClientItem* pItem);
  193. // Attributes
  194. HGLOBAL GetIconicMetafile() const;
  195. // Implementation
  196. public:
  197. virtual ~COleChangeIconDialog();
  198. #ifdef MFC_DEBUG
  199. virtual void Dump(CDumpContext& dc) const;
  200. #endif
  201. };
  202. /////////////////////////////////////////////////////////////////////////////
  203. // COlePasteSpecialDialog
  204. class COlePasteSpecialDialog : public COleDialog
  205. {
  206. DECLARE_DYNAMIC(COlePasteSpecialDialog)
  207. // Attributes
  208. public:
  209. OLEUIPASTESPECIAL m_ps; // structure for OleUIPasteSpecial
  210. // Constructors
  211. COlePasteSpecialDialog(DWORD dwFlags = PSF_SELECTPASTE,
  212. COleDataObject* pDataObject = NULL, CWnd *pParentWnd = NULL);
  213. // Operations
  214. OLEUIPASTEFLAG AddLinkEntry(UINT cf);
  215. void AddFormat(const FORMATETC& formatEtc, LPTSTR lpszFormat,
  216. LPTSTR lpszResult, DWORD flags);
  217. void AddFormat(UINT cf, DWORD tymed, UINT nFormatID, BOOL bEnableIcon,
  218. BOOL bLink);
  219. void AddStandardFormats(BOOL bEnableLink = TRUE);
  220. virtual int DoModal();
  221. BOOL CreateItem(COleClientItem *pNewItem);
  222. // creates a standard OLE item from selection data
  223. // Attributes (after DoModal returns IDOK)
  224. int GetPasteIndex() const; // resulting index to use for paste
  225. enum Selection { pasteLink = 1, pasteNormal = 2, pasteStatic = 3, pasteOther = 4};
  226. UINT GetSelectionType() const;
  227. // get selection type (pasteLink, pasteNormal, pasteStatic)
  228. DVASPECT GetDrawAspect() const;
  229. // DVASPECT_CONTENT or DVASPECT_ICON
  230. HGLOBAL GetIconicMetafile() const;
  231. // returns HGLOBAL to METAFILEPICT struct with iconic data
  232. // Implementation
  233. public:
  234. virtual ~COlePasteSpecialDialog();
  235. #ifdef MFC_DEBUG
  236. virtual void Dump(CDumpContext& dc) const;
  237. virtual void AssertValid() const;
  238. #endif
  239. unsigned int m_arrLinkTypes[8];
  240. // size limit imposed by MFCUIx32.DLL library
  241. };
  242. /////////////////////////////////////////////////////////////////////////////
  243. // COleLinksDialog
  244. class COleLinksDialog : public COleDialog
  245. {
  246. DECLARE_DYNAMIC(COleLinksDialog)
  247. // Attributes
  248. public:
  249. OLEUIEDITLINKS m_el; // structure for OleUIEditLinks
  250. // Constructors
  251. COleLinksDialog(COleDocument* pDoc, CView* pView, DWORD dwFlags = 0,
  252. CWnd* pParentWnd = NULL);
  253. // Operations
  254. virtual int DoModal(); // display the dialog and edit links
  255. // Implementation
  256. public:
  257. virtual ~COleLinksDialog();
  258. #ifdef MFC_DEBUG
  259. virtual void Dump(CDumpContext& dc) const;
  260. virtual void AssertValid() const;
  261. #endif
  262. public:
  263. COleUILinkInfo m_xLinkInfo; // implements IOleUILinkContainer
  264. };
  265. /////////////////////////////////////////////////////////////////////////////
  266. // COleUpdateDialog
  267. class COleUpdateDialog : public COleLinksDialog
  268. {
  269. DECLARE_DYNAMIC(COleUpdateDialog)
  270. // Constructors
  271. public:
  272. COleUpdateDialog(COleDocument* pDoc,
  273. BOOL bUpdateLinks = TRUE, BOOL bUpdateEmbeddings = FALSE,
  274. CWnd* pParentWnd = NULL);
  275. // Operations
  276. virtual int DoModal();
  277. // Implementation
  278. public:
  279. virtual ~COleUpdateDialog();
  280. #ifdef MFC_DEBUG
  281. virtual void Dump(CDumpContext& dc) const;
  282. #endif
  283. protected:
  284. CString m_strCaption; // caption for the dialog
  285. };
  286. /////////////////////////////////////////////////////////////////////////////
  287. // COleBusyDialog - useful in managing concurrency
  288. class COleBusyDialog : public COleDialog
  289. {
  290. DECLARE_DYNAMIC(COleBusyDialog)
  291. // Attributes
  292. public:
  293. OLEUIBUSY m_bz;
  294. // Constructors
  295. COleBusyDialog(HTASK htaskBusy, BOOL bNotResponding = FALSE,
  296. DWORD dwFlags = 0, CWnd* pParentWnd = NULL);
  297. // Operations
  298. virtual int DoModal();
  299. enum Selection { switchTo = 1, retry = 2, callUnblocked = 3 };
  300. UINT GetSelectionType() const;
  301. // Implementation
  302. public:
  303. ~COleBusyDialog();
  304. #ifdef MFC_DEBUG
  305. virtual void Dump(CDumpContext& dc) const;
  306. #endif
  307. protected:
  308. Selection m_selection; // selection after DoModal returns IDOK
  309. };
  310. /////////////////////////////////////////////////////////////////////////////
  311. // COleEditProperties
  312. class COlePropertiesDialog : public COleDialog
  313. {
  314. DECLARE_DYNAMIC(COlePropertiesDialog)
  315. // Attributes
  316. public:
  317. OLEUIOBJECTPROPS m_op; // structure for OleUIObjectProperties
  318. OLEUIGNRLPROPS m_gp; // specific to "General" page
  319. OLEUIVIEWPROPS m_vp; // specific to "View" page
  320. OLEUILINKPROPS m_lp; // specific to "Link" page
  321. PROPSHEETHEADER m_psh; // PROPSHEETHEADER for customization
  322. // Constructors
  323. public:
  324. COlePropertiesDialog(COleClientItem* pItem,
  325. UINT nScaleMin = 10, UINT nScaleMax = 500, CWnd* pParentWnd = NULL);
  326. // Operations
  327. virtual int DoModal();
  328. // Overridables
  329. virtual BOOL OnApplyScale(
  330. COleClientItem* pItem, int nCurrentScale, BOOL bRelativeToOrig);
  331. // Implementation
  332. public:
  333. #ifdef MFC_DEBUG
  334. virtual void Dump(CDumpContext& dc) const;
  335. virtual void AssertValid() const;
  336. #endif
  337. virtual BOOL OnInitDialog();
  338. BEGIN_INTERFACE_PART(OleUIObjInfo, IOleUIObjInfo)
  339. INIT_INTERFACE_PART(COlePropertiesDialog, OleUIObjInfo)
  340. STDMETHOD(GetObjectInfo) (THIS_ DWORD dwObject,
  341. DWORD* lpdwObjSize, LPTSTR* lplpszLabel,
  342. LPTSTR* lplpszType, LPTSTR* lplpszShortType,
  343. LPTSTR* lplpszLocation);
  344. STDMETHOD(GetConvertInfo) (THIS_ DWORD dwObject,
  345. CLSID* lpClassID, WORD* lpwFormat,
  346. CLSID* lpConvertDefaultClassID,
  347. LPCLSID* lplpClsidExclude, UINT* lpcClsidExclude);
  348. STDMETHOD(ConvertObject) (THIS_ DWORD dwObject, REFCLSID clsidNew);
  349. STDMETHOD(GetViewInfo) (THIS_ DWORD dwObject,
  350. HGLOBAL* phMetaPict, DWORD* pdvAspect, int* pnCurrentScale);
  351. STDMETHOD(SetViewInfo) (THIS_ DWORD dwObject,
  352. HGLOBAL hMetaPict, DWORD dvAspect,
  353. int nCurrentScale, BOOL bRelativeToOrig);
  354. END_INTERFACE_PART(OleUIObjInfo)
  355. COleUILinkInfo m_xLinkInfo; // implements IOleUILinkContainer
  356. };
  357. /////////////////////////////////////////////////////////////////////////////
  358. // COleChangeSourceDialog
  359. class COleChangeSourceDialog : public COleDialog
  360. {
  361. DECLARE_DYNAMIC(COleChangeSourceDialog)
  362. // Attributes
  363. public:
  364. OLEUICHANGESOURCE m_cs; // structure for OleUIChangeSource
  365. // Constructors
  366. public:
  367. COleChangeSourceDialog(COleClientItem* pItem, CWnd* pParentWnd = NULL);
  368. // Operations
  369. virtual int DoModal();
  370. // Attributes (after DoModal returns IDOK)
  371. BOOL IsValidSource();
  372. CString GetDisplayName();
  373. CString GetFileName();
  374. CString GetItemName();
  375. CString GetFromPrefix();
  376. CString GetToPrefix();
  377. // Implementation
  378. public:
  379. COleUILinkInfo m_xLinkInfo;
  380. virtual ~COleChangeSourceDialog();
  381. #ifdef MFC_DEBUG
  382. virtual void Dump(CDumpContext& dc) const;
  383. virtual void AssertValid() const;
  384. #endif
  385. virtual void PreInitDialog();
  386. };
  387. /////////////////////////////////////////////////////////////////////////////
  388. // Inline function declarations
  389. #ifdef _AFX_PACKING
  390. #pragma pack(pop)
  391. #endif
  392. #ifdef _AFX_ENABLE_INLINES
  393. #define _AFXODLGS_INLINE AFX_INLINE
  394. #include <afxole.inl>
  395. #undef _AFXODLGS_INLINE
  396. #endif
  397. #undef AFX_DATA
  398. #define AFX_DATA
  399. #ifdef _AFX_MINREBUILD
  400. #pragma component(minrebuild, on)
  401. #endif
  402. #ifndef _AFX_FULLTYPEINFO
  403. #pragma component(mintypeinfo, off)
  404. #endif
  405. #endif //__AFXODLGS_H__
  406. /////////////////////////////////////////////////////////////////////////////