home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / MFCINC.PAK / AFXODLGS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  13.4 KB  |  503 lines

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