home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxole.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  68KB  |  1,960 lines

  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.  
  11. #ifndef __AFXOLE_H__
  12. #define __AFXOLE_H__
  13.  
  14. #ifdef _AFX_NO_OLE_SUPPORT
  15.     #error OLE classes not supported in this library variant.
  16. #endif
  17.  
  18. #ifndef __AFXEXT_H__
  19.     #include <afxext.h>
  20. #endif
  21.  
  22. #ifndef __AFXDISP_H__
  23.     #include <afxdisp.h>
  24. #endif
  25.  
  26. // include OLE Compound Document headers
  27. #ifndef _OLE2_H_
  28.     #include <ole2.h>
  29. #endif
  30.  
  31. // ActiveX Document support
  32. #ifndef __docobj_h__
  33.     #include <docobj.h>
  34. #endif
  35.  
  36. // URL Monikers support
  37. #ifndef __urlmon_h__
  38.     #include <urlmon.h>
  39. #endif
  40.  
  41. #ifndef __AFXCOM_H__
  42. #include <afxcom_.h>
  43. #endif
  44.  
  45. #ifdef _AFX_MINREBUILD
  46. #pragma component(minrebuild, off)
  47. #endif
  48. #ifndef _AFX_FULLTYPEINFO
  49. #pragma component(mintypeinfo, on)
  50. #endif
  51.  
  52. #ifdef _AFX_PACKING
  53. #pragma pack(push, _AFX_PACKING)
  54. #endif
  55.  
  56.  
  57. #ifndef _AFX_NOFORCE_LIBS
  58.  
  59. #pragma comment(lib, "urlmon.lib")
  60.  
  61. #endif // !_AFX_NOFORCE_LIBS
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // AFXOLE.H - MFC OLE support
  65.  
  66. // Classes declared in this file
  67.  
  68. //CDocument
  69.     class COleDocument;             // OLE container document
  70.         class COleLinkingDoc;       // supports links to embeddings
  71.             class COleServerDoc;    // OLE server document
  72.     class CDocObjectServer;         // might be owned by a COleServerDoc
  73.  
  74. //CCmdTarget
  75.     class CDocItem;                 // part of a document
  76.         class COleClientItem;       // embedded ole object from outside
  77.             class COleDocObjectItem;// ActiveX Document item
  78.         class COleServerItem;       // ole object to export
  79.     class COleDataSource;           // clipboard data source mechanism
  80.     class COleDropSource;           // drag/drop source
  81.     class COleDropTarget;           // drag/drop target
  82.     class COleMessageFilter;        // concurrency management
  83.  
  84. //CFrameWnd
  85.     class COleIPFrameWnd;           // frame window for in-place servers
  86.  
  87. //CControlBar
  88.     class COleResizeBar;            // implements in-place resizing
  89.  
  90. //CFile
  91.     class COleStreamFile;           // CFile wrapper for IStream interface
  92.         class CMonikerFile;         // bound to via IMoniker
  93.             class CAsyncMonikerFile;// asynchronous IMoniker
  94.  
  95. class COleDataObject;               // wrapper for IDataObject interface
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98.  
  99. // AFXDLL support
  100. #undef AFX_DATA
  101. #define AFX_DATA AFX_OLE_DATA
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104. // backward compatibility
  105.  
  106. // COleClientDoc is now obsolete -- use COleDocument instead
  107. #define COleClientDoc COleDocument
  108.  
  109. // COleServer has been replaced by the more general COleObjectFactory
  110. #define COleServer  COleObjectFactory
  111.  
  112. /////////////////////////////////////////////////////////////////////////////
  113. // Useful OLE specific types (some from OLE 1.0 headers)
  114.  
  115. // Codes for CallBack events
  116. enum OLE_NOTIFICATION
  117. {
  118.     OLE_CHANGED,        // representation of a draw aspect has changed
  119.     OLE_SAVED,          // the item has committed its storage
  120.     OLE_CLOSED,         // the item has closed
  121.     OLE_RENAMED,        // the item has changed its moniker
  122.     OLE_CHANGED_STATE,  // the item state (open, active, etc.) has changed
  123.     OLE_CHANGED_ASPECT, // the item draw aspect has changed
  124. };
  125.  
  126. // Object types
  127. enum OLE_OBJTYPE
  128. {
  129.     OT_UNKNOWN = 0,
  130.  
  131.     // These are OLE 1.0 types and OLE 2.0 types as returned from GetType().
  132.     OT_LINK = 1,
  133.     OT_EMBEDDED = 2,
  134.     OT_STATIC = 3,
  135.  
  136.     // All OLE2 objects are written with this tag when serialized.  This
  137.     //  differentiates them from OLE 1.0 objects written with MFC 2.0.
  138.     //  This value will never be returned from GetType().
  139.     OT_OLE2 = 256,
  140. };
  141.  
  142. /////////////////////////////////////////////////////////////////////////////
  143. // COleDataObject -- simple wrapper for IDataObject
  144.  
  145. class COleDataObject
  146. {
  147. // Constructors
  148. public:
  149.     COleDataObject();
  150.  
  151. // Operations
  152.     void Attach(LPDATAOBJECT lpDataObject, BOOL bAutoRelease = TRUE);
  153.     LPDATAOBJECT Detach();  // detach and get ownership of m_lpDataObject
  154.     void Release(); // detach and Release ownership of m_lpDataObject
  155.     BOOL AttachClipboard(); // attach to current clipboard object
  156.  
  157. // Attributes
  158.     void BeginEnumFormats();
  159.     BOOL GetNextFormat(LPFORMATETC lpFormatEtc);
  160.     CFile* GetFileData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  161.     HGLOBAL GetGlobalData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  162.     BOOL GetData(CLIPFORMAT cfFormat, LPSTGMEDIUM lpStgMedium,
  163.         LPFORMATETC lpFormatEtc = NULL);
  164.     BOOL IsDataAvailable(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  165.  
  166. // Implementation
  167. public:
  168.     LPDATAOBJECT m_lpDataObject;
  169.     LPENUMFORMATETC m_lpEnumerator;
  170.     ~COleDataObject();
  171.  
  172.     // advanced use and implementation
  173.     LPDATAOBJECT GetIDataObject(BOOL bAddRef);
  174.     void EnsureClipboardObject();
  175.     BOOL m_bClipboard;      // TRUE if represents the Win32 clipboard
  176.  
  177. protected:
  178.     BOOL m_bAutoRelease;    // TRUE if destructor should call Release
  179.  
  180. private:
  181.     // Disable the copy constructor and assignment by default so you will get
  182.     //   compiler errors instead of unexpected behaviour if you pass objects
  183.     //   by value or assign objects.
  184.     COleDataObject(const COleDataObject&);  // no implementation
  185.     void operator=(const COleDataObject&);  // no implementation
  186. };
  187.  
  188. /////////////////////////////////////////////////////////////////////////////
  189. // COleDataSource -- wrapper for implementing IDataObject
  190. //  (works similar to how data is provided on the clipboard)
  191.  
  192. struct AFX_DATACACHE_ENTRY;
  193. class COleDropSource;
  194.  
  195. class COleDataSource : public CCmdTarget
  196. {
  197. // Constructors
  198. public:
  199.     COleDataSource();
  200.  
  201. // Operations
  202.     void Empty();   // empty cache (similar to ::EmptyClipboard)
  203.  
  204.     // CacheData & DelayRenderData operations similar to ::SetClipboardData
  205.     void CacheGlobalData(CLIPFORMAT cfFormat, HGLOBAL hGlobal,
  206.         LPFORMATETC lpFormatEtc = NULL);    // for HGLOBAL based data
  207.     void DelayRenderFileData(CLIPFORMAT cfFormat,
  208.         LPFORMATETC lpFormatEtc = NULL);    // for CFile* based delayed render
  209.  
  210.     // Clipboard and Drag/Drop access
  211.     DROPEFFECT DoDragDrop(
  212.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE|DROPEFFECT_LINK,
  213.         LPCRECT lpRectStartDrag = NULL,
  214.         COleDropSource* pDropSource = NULL);
  215.     void SetClipboard();
  216.     static void PASCAL FlushClipboard();
  217.     static COleDataSource* PASCAL GetClipboardOwner();
  218.  
  219.     // Advanced: STGMEDIUM based cached data
  220.     void CacheData(CLIPFORMAT cfFormat, LPSTGMEDIUM lpStgMedium,
  221.         LPFORMATETC lpFormatEtc = NULL);    // for LPSTGMEDIUM based data
  222.     // Advanced: STGMEDIUM or HGLOBAL based delayed render
  223.     void DelayRenderData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  224.  
  225.     // Advanced: support for SetData in COleServerItem
  226.     //  (not generally useful for clipboard or drag/drop operations)
  227.     void DelaySetData(CLIPFORMAT cfFormat, LPFORMATETC lpFormatEtc = NULL);
  228.  
  229. // Overidables
  230.     virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  231.     virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  232.     virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  233.         // OnRenderFileData and OnRenderGlobalData are called by
  234.         //  the default implementation of OnRenderData.
  235.  
  236.     virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  237.         BOOL bRelease);
  238.         // used only in COleServerItem implementation
  239.  
  240. // Implementation
  241. public:
  242.     virtual ~COleDataSource();
  243. #ifdef _DEBUG
  244.     virtual void AssertValid() const;
  245.     virtual void Dump(CDumpContext& dc) const;
  246. #endif
  247.  
  248. protected:
  249.     AFX_DATACACHE_ENTRY* m_pDataCache;  // data cache itself
  250.     UINT m_nMaxSize;    // current allocated size
  251.     UINT m_nSize;       // current size of the cache
  252.     UINT m_nGrowBy;     // number of cache elements to grow by for new allocs
  253.  
  254.     AFX_DATACACHE_ENTRY* Lookup(
  255.         LPFORMATETC lpFormatEtc, DATADIR nDataDir) const;
  256.     AFX_DATACACHE_ENTRY* GetCacheEntry(
  257.         LPFORMATETC lpFormatEtc, DATADIR nDataDir);
  258.  
  259. // Interface Maps
  260. public:
  261.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  262.         INIT_INTERFACE_PART(COleDataSource, DataObject)
  263.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  264.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  265.         STDMETHOD(QueryGetData)(LPFORMATETC);
  266.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  267.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  268.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  269.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  270.         STDMETHOD(DUnadvise)(DWORD);
  271.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  272.     END_INTERFACE_PART(DataObject)
  273.  
  274.     DECLARE_INTERFACE_MAP()
  275.  
  276.     friend class COleServerItem;
  277. };
  278.  
  279. //////////////////////////////////////////////////////////////////////////////
  280. // DocItem support
  281.  
  282. #ifdef _AFXDLL
  283. class CDocItem : public CCmdTarget
  284. #else
  285. class AFX_NOVTABLE CDocItem : public CCmdTarget
  286. #endif
  287. {
  288.     DECLARE_SERIAL(CDocItem)
  289.  
  290. // Constructors
  291. protected:      // abstract class
  292.     CDocItem();
  293.  
  294. // Attributes
  295. public:
  296.     CDocument* GetDocument() const; // return container document
  297.  
  298. // Overridables
  299. public:
  300.     // Raw data access (native format)
  301.     virtual BOOL IsBlank() const;
  302.  
  303. // Implementation
  304. protected:
  305.     COleDocument* m_pDocument;
  306.  
  307. public:
  308.     virtual void Serialize(CArchive& ar);   // for Native data
  309.     virtual ~CDocItem();
  310. #ifdef _DEBUG
  311.     virtual void AssertValid() const;
  312.     virtual void Dump(CDumpContext& dc) const;
  313. #endif
  314.  
  315.     friend class COleDocument;              // for access to back pointer
  316. };
  317.  
  318. //////////////////////////////////////////////////////////////////////////////
  319. // COleDocument - common OLE container behavior (enables server functionality)
  320.  
  321. class COleDocument : public CDocument
  322. {
  323.     DECLARE_DYNAMIC(COleDocument)
  324.  
  325. // Constructors
  326. public:
  327.     COleDocument();
  328.  
  329. // Attributes
  330.     BOOL HasBlankItems() const; // check for BLANK items
  331.     virtual COleClientItem* GetInPlaceActiveItem(CWnd* pWnd);
  332.         // return in-place active item for this view or NULL if none
  333.  
  334. // Operations
  335.     // iterating over existing items
  336.     virtual POSITION GetStartPosition() const;
  337.     virtual CDocItem* GetNextItem(POSITION& pos) const;
  338.  
  339.     // iterator helpers (helpers use virtual GetNextItem above)
  340.     COleClientItem* GetNextClientItem(POSITION& pos) const;
  341.     COleServerItem* GetNextServerItem(POSITION& pos) const;
  342.  
  343.     // adding new items - called from item constructors
  344.     virtual void AddItem(CDocItem* pItem);
  345.     virtual void RemoveItem(CDocItem* pItem);
  346.  
  347.     void EnableCompoundFile(BOOL bEnable = TRUE);
  348.         // enable compound file support (only call during constructor)
  349.     virtual void UpdateModifiedFlag();
  350.         // scan for modified items -- mark document modified
  351.  
  352.     // printer-device caching/control
  353.     BOOL ApplyPrintDevice(const DVTARGETDEVICE* ptd);
  354.     BOOL ApplyPrintDevice(const PRINTDLG* ppd);
  355.         // these apply the target device to all COleClientItem objects
  356.  
  357. // Overridables
  358.     virtual COleClientItem* GetPrimarySelectedItem(CView* pView);
  359.         // return primary selected item or NULL if none
  360.     virtual void OnShowViews(BOOL bVisible);
  361.         // called during app-idle when visibility of a document has changed
  362.  
  363. // Implementation
  364. public:
  365.     CObList m_docItemList;  // not owned items
  366.  
  367. #ifdef _DEBUG
  368.     virtual void AssertValid() const;
  369.     virtual void Dump(CDumpContext& dc) const;
  370. #endif
  371.     CFrameWnd* GetFirstFrame();
  372.  
  373.     // document handling overrides
  374.     virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
  375.     virtual ~COleDocument();
  376.     virtual void DeleteContents(); // delete client items in list
  377.     virtual void Serialize(CArchive& ar);   // serialize items to file
  378.     virtual void PreCloseFrame(CFrameWnd* pFrame);
  379.     virtual BOOL SaveModified();
  380.     virtual void OnIdle();
  381.  
  382.     // compound file implementation
  383.     virtual BOOL OnNewDocument();
  384.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  385.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  386.     virtual void OnCloseDocument();
  387.     void CommitItems(BOOL bSuccess);    // called during File.Save & File.Save As
  388.  
  389.     // minimal linking protocol
  390.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  391.     virtual LPOLEITEMCONTAINER GetContainer();
  392.  
  393. protected:
  394.     // document state implementation
  395.     UINT m_dwNextItemNumber;// serial number for next item in this document
  396.     BOOL m_bLastVisible;    // TRUE if one or more views was last visible
  397.  
  398.     // 'docfile' support
  399.     BOOL m_bCompoundFile;   // TRUE if use compound files
  400.     LPSTORAGE m_lpRootStg;  // root storage for the document
  401.     BOOL m_bSameAsLoad;     // TRUE = file-save, FALSE = Save [Copy] As
  402.     BOOL m_bRemember;       // if FALSE, indicates Save Copy As
  403.  
  404.     DVTARGETDEVICE* m_ptd;  // current document target device
  405.  
  406.     // implementation helpers
  407.     virtual void LoadFromStorage();
  408.     virtual void SaveToStorage(CObject* pObject = NULL);
  409.     CDocItem* GetNextItemOfKind(POSITION& pos, CRuntimeClass* pClass) const;
  410.  
  411.     // command handling
  412. public:
  413.     virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  414.         AFX_CMDHANDLERINFO* pHandlerInfo);
  415.  
  416. protected:
  417.     afx_msg void OnUpdatePasteMenu(CCmdUI* pCmdUI);
  418.     afx_msg void OnUpdatePasteLinkMenu(CCmdUI* pCmdUI);
  419.     afx_msg void OnUpdateEditLinksMenu(CCmdUI* pCmdUI);
  420.     afx_msg void OnEditLinks();
  421.     afx_msg void OnEditConvert();
  422.     afx_msg void OnUpdateEditChangeIcon(CCmdUI* pCmdUI);
  423.     afx_msg void OnEditChangeIcon();
  424.     afx_msg void OnUpdateObjectVerbMenu(CCmdUI* pCmdUI);
  425.     afx_msg void OnFileSendMail();
  426.  
  427.     friend class COleClientItem;
  428.     friend class COleServerItem;
  429. };
  430.  
  431. /////////////////////////////////////////////////////////////////////////////
  432. // COleClientItem - Supports OLE2 non-inplace editing.
  433. //      implements IOleClientSite, IAdviseSink, and IOleInPlaceSite
  434.  
  435. class COleFrameHook;    // forward reference (see ..\src\oleimpl2.h)
  436.  
  437. class COleClientItem : public CDocItem
  438. {
  439.     DECLARE_DYNAMIC(COleClientItem)
  440.  
  441. // Constructors
  442. public:
  443.     COleClientItem(COleDocument* pContainerDoc = NULL);
  444.  
  445.     // create from the clipboard
  446.     BOOL CreateFromClipboard(OLERENDER render = OLERENDER_DRAW,
  447.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  448.     BOOL CreateLinkFromClipboard(OLERENDER render = OLERENDER_DRAW,
  449.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  450.     BOOL CreateStaticFromClipboard(OLERENDER render = OLERENDER_DRAW,
  451.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  452.  
  453.     // create from a class ID (Insert New Object dialog)
  454.     BOOL CreateNewItem(REFCLSID clsid, OLERENDER render = OLERENDER_DRAW,
  455.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  456.  
  457.     // create from COleDataObject
  458.     BOOL CreateFromData(COleDataObject* pDataObject,
  459.         OLERENDER render = OLERENDER_DRAW,
  460.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  461.     BOOL CreateLinkFromData(COleDataObject* pDataObject,
  462.         OLERENDER render = OLERENDER_DRAW,
  463.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  464.     BOOL CreateStaticFromData(COleDataObject* pDataObject,
  465.         OLERENDER render = OLERENDER_DRAW,
  466.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  467.  
  468.     // create from file (package support)
  469.     BOOL CreateFromFile(LPCTSTR lpszFileName, REFCLSID clsid = CLSID_NULL,
  470.         OLERENDER render = OLERENDER_DRAW,
  471.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  472.     BOOL CreateLinkFromFile(LPCTSTR lpszFileName,
  473.         OLERENDER render = OLERENDER_DRAW,
  474.         CLIPFORMAT cfFormat = 0, LPFORMATETC lpFormatEtc = NULL);
  475.  
  476.     // create a copy
  477.     BOOL CreateCloneFrom(const COleClientItem* pSrcItem);
  478.  
  479. // General Attributes
  480. public:
  481.     HICON GetIconFromRegistry() const;
  482.     static HICON GetIconFromRegistry(CLSID& clsid);
  483.     SCODE GetLastStatus() const;
  484.     OLE_OBJTYPE GetType() const; // OT_LINK, OT_EMBEDDED, OT_STATIC
  485.     void GetClassID(CLSID* pClassID) const;
  486.     void GetUserType(USERCLASSTYPE nUserClassType, CString& rString);
  487.     BOOL GetExtent(LPSIZE lpSize, DVASPECT nDrawAspect = (DVASPECT)-1);
  488.         // will return FALSE if item is BLANK
  489.     BOOL GetCachedExtent(LPSIZE lpSize, DVASPECT nDrawAspect = (DVASPECT)-1);
  490.  
  491.     // getting/setting iconic cache
  492.     HGLOBAL GetIconicMetafile();
  493.     BOOL SetIconicMetafile(HGLOBAL hMetaPict);
  494.  
  495.     // setting/getting default display aspect
  496.     DVASPECT GetDrawAspect() const;
  497.     virtual void SetDrawAspect(DVASPECT nDrawAspect);
  498.  
  499.     // for printer presentation cache
  500.     BOOL SetPrintDevice(const DVTARGETDEVICE* ptd);
  501.     BOOL SetPrintDevice(const PRINTDLG* ppd);
  502.  
  503.     // Item state
  504.     enum ItemState
  505.         { emptyState, loadedState, openState, activeState, activeUIState };
  506.     UINT GetItemState() const;
  507.  
  508.     BOOL IsModified() const;
  509.     BOOL IsRunning() const;
  510.     BOOL IsInPlaceActive() const;
  511.     BOOL IsOpen() const;
  512.     CView* GetActiveView() const;
  513.  
  514.     // Data access
  515.     void AttachDataObject(COleDataObject& rDataObject) const;
  516.  
  517.     // other rare access information
  518.     COleDocument* GetDocument() const; // return container
  519.  
  520.     // helpers for checking clipboard data availability
  521.     static BOOL PASCAL CanPaste();
  522.     static BOOL PASCAL CanPasteLink();
  523.  
  524.     // helpers for checking COleDataObject, useful in drag drop
  525.     static BOOL PASCAL CanCreateFromData(const COleDataObject* pDataObject);
  526.     static BOOL PASCAL CanCreateLinkFromData(const COleDataObject* pDataObject);
  527.  
  528. // General Operations
  529.     virtual void Release(OLECLOSE dwCloseOption = OLECLOSE_NOSAVE);
  530.         // cleanup, detach (close if needed)
  531.     void Close(OLECLOSE dwCloseOption = OLECLOSE_SAVEIFDIRTY);
  532.         // close without releasing the item
  533.     void Delete(BOOL bAutoDelete = TRUE);
  534.         // logically delete from file -- not part of the document anymore
  535.     void Run(); // insure item is in running state
  536.  
  537.     // Drawing
  538.     BOOL Draw(CDC* pDC, LPCRECT lpBounds,
  539.         DVASPECT nDrawAspect = (DVASPECT)-1);   // defaults to m_nDrawAspect
  540.  
  541.     // Activation
  542.     virtual BOOL DoVerb(LONG nVerb, CView* pView, LPMSG lpMsg = NULL);
  543.     void Activate(LONG nVerb, CView* pView, LPMSG lpMsg = NULL);
  544.  
  545.     // In-place Activation
  546.     void Deactivate();          // completely deactivate
  547.     void DeactivateUI();        // deactivate the user interface
  548.     BOOL ReactivateAndUndo();   // reactivate then perform undo command
  549.     BOOL SetItemRects(LPCRECT lpPosRect = NULL, LPCRECT lpClipRect = NULL);
  550.     CWnd* GetInPlaceWindow();
  551.  
  552.     // Clipboard operations
  553.     void CopyToClipboard(BOOL bIncludeLink = FALSE);
  554.     DROPEFFECT DoDragDrop(LPCRECT lpItemRect, CPoint ptOffset,
  555.         BOOL bIncludeLink = FALSE,
  556.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE,
  557.         LPCRECT lpRectStartDrag = NULL);
  558.     void GetClipboardData(COleDataSource* pDataSource,
  559.         BOOL bIncludeLink = FALSE, LPPOINT lpOffset = NULL,
  560.         LPSIZE lpSize = NULL);
  561.  
  562.     // called for creating a COleDataSource by CopyToClipboard and DoDragDrop
  563.     virtual COleDataSource* OnGetClipboardData(BOOL bIncludeLink,
  564.         LPPOINT lpOffset, LPSIZE lpSize);
  565.  
  566.     // Operations that apply to embedded items only
  567.     void SetHostNames(LPCTSTR lpszHost, LPCTSTR lpszHostObj);
  568.     void SetExtent(const CSize& size, DVASPECT nDrawAspect = DVASPECT_CONTENT);
  569.  
  570.     // Operations that apply to linked items only
  571.     //  (link options are rarely changed, except through Links dialog)
  572.     OLEUPDATE GetLinkUpdateOptions();
  573.     void SetLinkUpdateOptions(OLEUPDATE dwUpdateOpt);
  574.  
  575.     // Link-source update status (also useful for embeddings that contain links)
  576.     BOOL UpdateLink();  // make up-to-date
  577.     BOOL IsLinkUpToDate() const;    // is link up-to-date
  578.  
  579.     // object conversion
  580.     virtual BOOL ConvertTo(REFCLSID clsidNew);
  581.     virtual BOOL ActivateAs(LPCTSTR lpszUserType, REFCLSID clsidOld, REFCLSID clsidNew);
  582.     BOOL Reload();  // for lazy reload after ActivateAs
  583.  
  584. // Overridables (notifications of IAdviseSink, IOleClientSite and IOleInPlaceSite)
  585.     // Callbacks/notifications from the server you must/should implement
  586.     virtual void OnChange(OLE_NOTIFICATION nCode, DWORD dwParam);
  587.         // implement OnChange to invalidate when item changes
  588.  
  589. protected:
  590.     virtual void OnGetItemPosition(CRect& rPosition);
  591.         // implement OnGetItemPosition if you support in-place activation
  592.  
  593.     // Common overrides for in-place activation
  594.     virtual BOOL OnScrollBy(CSize sizeExtent);
  595.  
  596.     // Common overrides for applications supporting undo
  597.     virtual void OnDiscardUndoState();
  598.     virtual void OnDeactivateAndUndo();
  599.  
  600. public:
  601.     virtual void OnDeactivateUI(BOOL bUndoable);
  602.  
  603. protected:
  604.     // Common overrides for applications supporting links to embeddings
  605.     virtual void OnShowItem();
  606.  
  607.     // Advanced overrides for in-place activation
  608.     virtual void OnGetClipRect(CRect& rClipRect);
  609.     virtual BOOL CanActivate();
  610.  
  611. public:
  612.     virtual void OnActivate();
  613.     virtual void OnActivateUI();
  614.     virtual void OnDeactivate();
  615.  
  616. protected:
  617.     virtual BOOL OnGetWindowContext(CFrameWnd** ppMainFrame,
  618.         CFrameWnd** ppDocFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  619.     virtual BOOL OnChangeItemPosition(const CRect& rectPos);
  620.         // default calls SetItemRects and caches the pos rect
  621.  
  622. public:
  623.     // Advanced overrides for menu/title handling (rarely overridden)
  624.     virtual void OnInsertMenus(CMenu* pMenuShared,
  625.         LPOLEMENUGROUPWIDTHS lpMenuWidths);
  626.     virtual void OnSetMenu(CMenu* pMenuShared, HOLEMENU holemenu,
  627.         HWND hwndActiveObject);
  628.     virtual void OnRemoveMenus(CMenu* pMenuShared);
  629.     virtual BOOL OnUpdateFrameTitle();
  630.  
  631.     // Advanced override for control bar handling
  632.     virtual BOOL OnShowControlBars(CFrameWnd* pFrameWnd, BOOL bShow);
  633.  
  634. // Implementation
  635. public:
  636.     // data to support non-inplace activated items
  637.     LPOLEOBJECT m_lpObject; // in case you want direct access to the OLE object
  638.     LPVIEWOBJECT2 m_lpViewObject;// IViewObject for IOleObject above
  639.     DWORD m_dwItemNumber;   // serial number for this item in this document
  640.     DVASPECT m_nDrawAspect; // current default display aspect
  641.     SCODE m_scLast;         // last error code encountered
  642.     LPSTORAGE m_lpStorage;  // provides storage for m_lpObject
  643.     LPLOCKBYTES m_lpLockBytes;  // part of implementation of m_lpStorage
  644.     DWORD m_dwConnection;   // advise connection to the m_lpObject
  645.     BYTE m_bLinkUnavail;    // TRUE if link is currently unavailable
  646.     BYTE m_bMoniker;        // TRUE if moniker is assigned
  647.     BYTE m_bLocked;         // TRUE if object has external lock
  648.     BYTE m_bNeedCommit;     // TRUE if need CommitItem
  649.     BYTE m_bClosing;        // TRUE if currently doing COleClientItem::Close
  650.     BYTE m_bReserved[3];    // (reserved for future use)
  651.  
  652.     // for compound file support
  653.     LPSTORAGE m_lpNewStorage;   // used during Save As situations
  654.  
  655.     // item state & item type
  656.     ItemState m_nItemState; // item state (see ItemState enumeration)
  657.     OLE_OBJTYPE m_nItemType;    // item type (depends on how created)
  658.  
  659.     // data valid when in-place activated
  660.     CView* m_pView; // view when object is in-place activated
  661.     DWORD m_dwContainerStyle;   // style of the container wnd before activation
  662.     COleFrameHook* m_pInPlaceFrame;// frame window when in-place active
  663.     COleFrameHook* m_pInPlaceDoc;   // doc window when in-place (may be NULL)
  664.     HWND m_hWndServer;  // HWND of in-place server window
  665.  
  666. public:
  667.     virtual ~COleClientItem();
  668.     virtual void Serialize(CArchive& ar);
  669. #ifdef _DEBUG
  670.     virtual void AssertValid() const;
  671.     virtual void Dump(CDumpContext& dc) const;
  672. #endif
  673.  
  674. // Implementation
  675. public:
  676.     virtual BOOL ReportError(SCODE sc) const;
  677.     virtual BOOL FreezeLink();  // converts to static: for edit links dialog
  678.  
  679.     DWORD GetNewItemNumber();   // generates new item number
  680.     void GetItemName(LPTSTR lpszItemName) const; // gets readable item name
  681.  
  682.     void UpdateItemType();  // update m_nItemType
  683.  
  684. protected:
  685.     // clipboard helpers
  686.     void GetEmbeddedItemData(LPSTGMEDIUM lpStgMedium);
  687.     void AddCachedData(COleDataSource* pDataSource);
  688.     BOOL GetLinkSourceData(LPSTGMEDIUM lpStgMedium);
  689.     void GetObjectDescriptorData(LPPOINT lpOffset, LPSIZE lpSize,
  690.         LPSTGMEDIUM lpStgMedium);
  691.  
  692.     // interface helpers
  693.     virtual LPOLECLIENTSITE GetClientSite();
  694.  
  695.     // helpers for printer-cached representation
  696.     BOOL GetPrintDeviceInfo(LPOLECACHE* plpOleCache,
  697.         DVTARGETDEVICE** pptd, DWORD* pdwConnection);
  698.  
  699. // Advanced Overridables for implementation
  700. protected:
  701.     virtual BOOL FinishCreate(SCODE sc);
  702.     virtual void CheckGeneral(SCODE sc);
  703.  
  704.     virtual void OnDataChange(LPFORMATETC lpFormatEtc,
  705.         LPSTGMEDIUM lpStgMedium);
  706.  
  707. public:
  708.     // for storage hookability (override to use 'docfiles')
  709.     virtual void GetItemStorage();  // allocate storage for new item
  710.     virtual void ReadItem(CArchive& ar);    // read item from archive
  711.     virtual void WriteItem(CArchive& ar);   // write item to archive
  712.     virtual void CommitItem(BOOL bSuccess); // commit item's storage
  713.  
  714.     // compound & flat file implementations of above
  715.     void GetItemStorageFlat();
  716.     void ReadItemFlat(CArchive& ar);
  717.     void WriteItemFlat(CArchive& ar);
  718.     void GetItemStorageCompound();
  719.     void ReadItemCompound(CArchive& ar);
  720.     void WriteItemCompound(CArchive& ar);
  721.  
  722. // Interface Maps
  723. public:
  724.     BEGIN_INTERFACE_PART(OleClientSite, IOleClientSite)
  725.         INIT_INTERFACE_PART(COleClientItem, OleClientSite)
  726.         STDMETHOD(SaveObject)();
  727.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  728.         STDMETHOD(GetContainer)(LPOLECONTAINER*);
  729.         STDMETHOD(ShowObject)();
  730.         STDMETHOD(OnShowWindow)(BOOL);
  731.         STDMETHOD(RequestNewObjectLayout)();
  732.     END_INTERFACE_PART(OleClientSite)
  733.  
  734.     BEGIN_INTERFACE_PART(AdviseSink, IAdviseSink)
  735.         INIT_INTERFACE_PART(COleClientItem, AdviseSink)
  736.         STDMETHOD_(void,OnDataChange)(LPFORMATETC, LPSTGMEDIUM);
  737.         STDMETHOD_(void,OnViewChange)(DWORD, LONG);
  738.         STDMETHOD_(void,OnRename)(LPMONIKER);
  739.         STDMETHOD_(void,OnSave)();
  740.         STDMETHOD_(void,OnClose)();
  741.     END_INTERFACE_PART(AdviseSink)
  742.  
  743.     BEGIN_INTERFACE_PART(OleIPSite, IOleInPlaceSite)
  744.         INIT_INTERFACE_PART(COleClientItem, OleIPSite)
  745.         STDMETHOD(GetWindow)(HWND*);
  746.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  747.         STDMETHOD(CanInPlaceActivate)();
  748.         STDMETHOD(OnInPlaceActivate)();
  749.         STDMETHOD(OnUIActivate)();
  750.         STDMETHOD(GetWindowContext)(LPOLEINPLACEFRAME*,
  751.             LPOLEINPLACEUIWINDOW*, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO);
  752.         STDMETHOD(Scroll)(SIZE);
  753.         STDMETHOD(OnUIDeactivate)(BOOL);
  754.         STDMETHOD(OnInPlaceDeactivate)();
  755.         STDMETHOD(DiscardUndoState)();
  756.         STDMETHOD(DeactivateAndUndo)();
  757.         STDMETHOD(OnPosRectChange)(LPCRECT);
  758.     END_INTERFACE_PART(OleIPSite)
  759.  
  760.     DECLARE_INTERFACE_MAP()
  761.  
  762. // Friendship declarations (to avoid many public members)
  763.     friend class COleUIWindow;
  764.     friend class COleFrameWindow;
  765.     friend class COleLinkingDoc;
  766. };
  767.  
  768. class COleDocObjectItem : public COleClientItem
  769. {
  770.     friend class COleFrameHook;
  771.     DECLARE_DYNAMIC(COleDocObjectItem)
  772.  
  773. // Constructors
  774. public:
  775.     COleDocObjectItem(COleDocument* pContainerDoc = NULL);
  776.  
  777. //Overridables
  778. public:
  779.     LPOLEDOCUMENTVIEW GetActiveView() const;
  780.     virtual void Release(OLECLOSE dwCloseOption = OLECLOSE_NOSAVE);
  781.     virtual void OnInsertMenus(CMenu* pMenuShared,
  782.         LPOLEMENUGROUPWIDTHS lpMenuWidths);
  783.     virtual void OnRemoveMenus(CMenu *pMenuShared);
  784.  
  785. // Operations
  786. public:
  787.     static BOOL OnPreparePrinting(CView* pCaller, CPrintInfo* pInfo,
  788.         BOOL bPrintAll = TRUE);
  789.     static void OnPrint(CView* pCaller, CPrintInfo* pInfo,
  790.         BOOL bPrintAll = TRUE);
  791.     BOOL GetPageCount(LPLONG pnFirstPage, LPLONG pcPages);
  792.     HRESULT ExecCommand(DWORD nCmdID,
  793.         DWORD nCmdExecOpt = OLECMDEXECOPT_DONTPROMPTUSER,
  794.         const GUID* pguidCmdGroup = NULL);
  795.  
  796. // Implementation
  797. public:
  798.     virtual ~COleDocObjectItem();
  799.     CMenu* m_pHelpPopupMenu;
  800.  
  801. protected:
  802.     virtual void OnGetItemPosition(CRect& rPosition);
  803.     virtual CMenu* GetHelpMenu(UINT& nPosition);
  804.     void ActivateAndShow();
  805.     LPOLEDOCUMENTVIEW m_pActiveView;
  806.     LPPRINT m_pIPrint;
  807.     BOOL SupportsIPrint();
  808.     BOOL m_bInHelpMenu;
  809.  
  810.     BEGIN_INTERFACE_PART(OleDocumentSite, IOleDocumentSite)
  811.         INIT_INTERFACE_PART(COleDocObjectItem, OleDocumentSite)
  812.         STDMETHOD(ActivateMe)(LPOLEDOCUMENTVIEW pViewToActivate);
  813.     END_INTERFACE_PART(OleDocumentSite)
  814.  
  815.     DECLARE_INTERFACE_MAP()
  816. };
  817.  
  818. /////////////////////////////////////////////////////////////////////////////
  819. // COleServerItem - IOleObject & IDataObject OLE component
  820.  
  821. #ifdef _AFXDLL
  822. class COleServerItem : public CDocItem
  823. #else
  824. class AFX_NOVTABLE COleServerItem : public CDocItem
  825. #endif
  826. {
  827.     DECLARE_DYNAMIC(COleServerItem)
  828. protected:
  829.     // NOTE: many members in this class are protected - since everything
  830.     //   in this class is designed for implementing an OLE server.
  831.     // Requests will come from OLE containers through non-C++ mechanisms,
  832.     //   which will result in virtual functions in this class being called.
  833.  
  834. // Constructors
  835.     COleServerItem(COleServerDoc* pServerDoc, BOOL bAutoDelete);
  836.         // If your COleServerItem is an integral part of your data,
  837.         //  bAutoDelete should be FALSE.  If your COleServerItem can be
  838.         //  deleted when a link is released, it can be TRUE.
  839.  
  840.     COleDataSource* GetDataSource();
  841.         // Use this data source to add conversion formats that your
  842.         //  server should support.  Usually such formats are
  843.         //  added in the item's constructor.
  844.  
  845. // Public Attributes
  846. public:
  847.     COleServerDoc* GetDocument() const; // return server document
  848.  
  849.     // naming (for links only)
  850.     const CString& GetItemName() const; // get name of linked item
  851.     void SetItemName(LPCTSTR lpszItemName);  // set name of linked item
  852.  
  853.     // link state
  854.     BOOL IsConnected() const;   // returns TRUE if item has a client
  855.     BOOL IsLinkedItem() const;  // returns TRUE if item is not embedded item
  856.  
  857.     // extents
  858.     CSize m_sizeExtent;
  859.         // HIMETRIC size -- the default implementation of OnSetExtent
  860.         //  updates this member variable.  This member tells the server how
  861.         //  much of the object is visible in the container document.
  862.  
  863. // Operations
  864. public:
  865.     void NotifyChanged(DVASPECT nDrawAspect = DVASPECT_CONTENT);
  866.         // call this after you change item
  867.     void CopyToClipboard(BOOL bIncludeLink = FALSE);
  868.         // helper for implementing server 'copy to clipboard'
  869.     DROPEFFECT DoDragDrop(LPCRECT lpRectItem, CPoint ptOffset,
  870.         BOOL bIncludeLink = FALSE,
  871.         DWORD dwEffects = DROPEFFECT_COPY|DROPEFFECT_MOVE,
  872.         LPCRECT lpRectStartDrag = NULL);
  873.     void GetClipboardData(COleDataSource* pDataSource,
  874.         BOOL bIncludeLink = FALSE, LPPOINT lpOffset = NULL,
  875.         LPSIZE lpSize = NULL);
  876.  
  877. // Overridables
  878.     // overridables you must implement for yourself
  879.     virtual BOOL OnDraw(CDC* pDC, CSize& rSize) = 0;
  880.         // drawing for metafile format (return FALSE if not supported or error)
  881.         //  (called for DVASPECT_CONTENT only)
  882.  
  883.     // overridables you may want to implement yourself
  884.     virtual void OnUpdate(COleServerItem* pSender,
  885.         LPARAM lHint, CObject* pHint, DVASPECT nDrawAspect);
  886.         // the default implementation always calls NotifyChanged
  887.  
  888.     virtual BOOL OnDrawEx(CDC* pDC, DVASPECT nDrawAspect, CSize& rSize);
  889.         // advanced drawing -- called for DVASPECT other than DVASPECT_CONTENT
  890.     virtual BOOL OnSetExtent(DVASPECT nDrawAspect, const CSize& size);
  891.     virtual BOOL OnGetExtent(DVASPECT nDrawAspect, CSize& rSize);
  892.         // default implementation uses m_sizeExtent
  893.  
  894.     // overridables you do not have to implement
  895.     virtual void OnDoVerb(LONG iVerb);
  896.         // default routes to OnShow &/or OnOpen
  897.     virtual BOOL OnSetColorScheme(const LOGPALETTE* lpLogPalette);
  898.         // default does nothing
  899.     virtual COleDataSource* OnGetClipboardData(BOOL bIncludeLink,
  900.         LPPOINT lpOffset, LPSIZE lpSize);
  901.         // called for access to clipboard data
  902.     virtual BOOL OnQueryUpdateItems();
  903.         // called to determine if there are any contained out-of-date links
  904.     virtual void OnUpdateItems();
  905.         // called to update any out-of-date links
  906.  
  907. protected:
  908.     virtual void OnShow();
  909.         // show item in the user interface (may edit in-place)
  910.     virtual void OnOpen();
  911.         // show item in the user interface (must open fully)
  912.     virtual void OnHide();
  913.         // hide document (and sometimes application)
  914.  
  915.     // very advanced overridables
  916. public:
  917.     virtual BOOL OnInitFromData(COleDataObject* pDataObject, BOOL bCreation);
  918.         // initialize object from IDataObject
  919.  
  920.     // see COleDataSource for a description of these overridables
  921.     virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  922.     virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  923.     virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  924.         // HGLOBAL version will be called first, then CFile* version
  925.  
  926.     virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  927.         BOOL bRelease);
  928.         // Rare -- only if you support SetData (programmatic paste)
  929.  
  930.     // advanced helpers for CopyToClipboard
  931.     void GetEmbedSourceData(LPSTGMEDIUM lpStgMedium);
  932.     void AddOtherClipboardData(COleDataSource* pDataSource);
  933.     BOOL GetLinkSourceData(LPSTGMEDIUM lpStgMedium);
  934.     void GetObjectDescriptorData(LPPOINT lpOffset, LPSIZE lpSize,
  935.         LPSTGMEDIUM lpStgMedium);
  936.  
  937. // Implementation
  938. public:
  939.     BOOL m_bNeedUnlock;             // if TRUE need to pDoc->LockExternal(FALSE)
  940.     BOOL m_bAutoDelete;             // if TRUE will OnRelease will 'delete this'
  941.  
  942.     // special version of OnFinalRelease to implement document locking
  943.     virtual void OnFinalRelease();
  944.  
  945. protected:
  946.     CString m_strItemName;          // simple item name
  947.  
  948. public:
  949.     LPOLEADVISEHOLDER m_lpOleAdviseHolder;  // may be NULL
  950.     LPDATAADVISEHOLDER m_lpDataAdviseHolder;    // may be NULL
  951.  
  952.     virtual ~COleServerItem();
  953. #ifdef _DEBUG
  954.     virtual void AssertValid() const;
  955.     virtual void Dump(CDumpContext& dc) const;
  956. #endif
  957.  
  958.     // implementation helpers
  959.     void NotifyClient(OLE_NOTIFICATION wNotification, DWORD dwParam);
  960.     LPDATAOBJECT GetDataObject();
  961.     LPOLEOBJECT GetOleObject();
  962.     LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  963.  
  964. protected:
  965.     virtual BOOL GetMetafileData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM pmedium);
  966.         // calls OnDraw or OnDrawEx
  967.     virtual void OnSaveEmbedding(LPSTORAGE lpStorage);
  968.     virtual BOOL IsBlank() const;
  969.  
  970.     // CItemDataSource implements OnRender reflections to COleServerItem
  971.     class CItemDataSource : public COleDataSource
  972.     {
  973.     protected:
  974.         // the GetData and SetData interfaces forward to m_pItem
  975.         virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
  976.         virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
  977.         virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
  978.             // HGLOBAL version will be called first, then CFile* version
  979.  
  980.         virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
  981.             BOOL bRelease);
  982.     };
  983.     CItemDataSource m_dataSource;
  984.         // data source used to implement IDataObject
  985.  
  986. // Interface Maps
  987. //  (Note: these interface maps are used just for link implementation)
  988. public:
  989.     BEGIN_INTERFACE_PART(OleObject, IOleObject)
  990.         INIT_INTERFACE_PART(COleServerItem, OleObject)
  991.         STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  992.         STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  993.         STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  994.         STDMETHOD(Close)(DWORD);
  995.         STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  996.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  997.         STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  998.         STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  999.         STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  1000.         STDMETHOD(EnumVerbs)(LPENUMOLEVERB*);
  1001.         STDMETHOD(Update)();
  1002.         STDMETHOD(IsUpToDate)();
  1003.         STDMETHOD(GetUserClassID)(LPCLSID);
  1004.         STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  1005.         STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  1006.         STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  1007.         STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  1008.         STDMETHOD(Unadvise)(DWORD);
  1009.         STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  1010.         STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  1011.         STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  1012.     END_INTERFACE_PART(OleObject)
  1013.  
  1014.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  1015.         INIT_INTERFACE_PART(COleServerItem, DataObject)
  1016.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  1017.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  1018.         STDMETHOD(QueryGetData)(LPFORMATETC);
  1019.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  1020.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  1021.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  1022.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  1023.         STDMETHOD(DUnadvise)(DWORD);
  1024.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  1025.     END_INTERFACE_PART(DataObject)
  1026.  
  1027.     DECLARE_INTERFACE_MAP()
  1028.  
  1029.     friend class CItemDataSource;
  1030.     friend class COleServerDoc;
  1031.     friend class COleLinkingDoc;
  1032. };
  1033.  
  1034. /////////////////////////////////////////////////////////////////////////////
  1035. // COleLinkingDoc -
  1036. //  (enables linking to embeddings - beginnings of server fuctionality)
  1037.  
  1038. class COleLinkingDoc : public COleDocument
  1039. {
  1040.     DECLARE_DYNAMIC(COleLinkingDoc)
  1041.  
  1042. // Constructors
  1043. public:
  1044.     COleLinkingDoc();
  1045.  
  1046. // Operations
  1047.     BOOL Register(COleObjectFactory* pFactory, LPCTSTR lpszPathName);
  1048.         // notify the running object table and connect to pServer
  1049.     void Revoke();
  1050.         // revoke from running object table
  1051.  
  1052. // Overridables
  1053. protected:
  1054.     virtual COleServerItem* OnGetLinkedItem(LPCTSTR lpszItemName);
  1055.         // return item for the named linked item (for supporting links)
  1056.     virtual COleClientItem* OnFindEmbeddedItem(LPCTSTR lpszItemName);
  1057.         // return item for the named embedded item (for links to embeddings)
  1058.  
  1059. // Implementation
  1060. public:
  1061.     COleObjectFactory* m_pFactory;  // back-pointer to server
  1062.  
  1063. #ifdef _DEBUG
  1064.     virtual void AssertValid() const;
  1065.     virtual void Dump(CDumpContext& dc) const;
  1066. #endif
  1067.     virtual ~COleLinkingDoc();
  1068.  
  1069.     // overrides for updating of monikers & running object table registration
  1070.     virtual BOOL OnNewDocument();
  1071.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  1072.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  1073.     virtual void OnCloseDocument();
  1074.     virtual LPOLEITEMCONTAINER GetContainer();
  1075.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  1076.  
  1077.     // special handling of error messages during save/load
  1078.     virtual void ReportSaveLoadException(LPCTSTR lpszPathName,
  1079.         CException* e, BOOL bSaving, UINT nIDPDefault);
  1080.     void BeginDeferErrors();
  1081.     SCODE EndDeferErrors(SCODE sc);
  1082.  
  1083. protected:
  1084.     BOOL m_bDeferErrors;    // TRUE if in non-interactive OLE mode
  1085.     CException* m_pLastException;
  1086.  
  1087.     DWORD m_dwRegister;     // file moniker's registration in the ROT
  1088.     LPMONIKER m_lpMonikerROT; // file moniker that is registered
  1089.     CString m_strMoniker;   // filename used to create moniker
  1090.     BOOL m_bVisibleLock;    // TRUE if user is holding lock on document
  1091.  
  1092.     // implementation helpers
  1093.     virtual BOOL RegisterIfServerAttached(LPCTSTR lpszPathName, BOOL bMessage);
  1094.     void LockExternal(BOOL bLock, BOOL bRemoveRefs);
  1095.     void UpdateVisibleLock(BOOL bVisible, BOOL bRemoveRefs);
  1096.     virtual void OnShowViews(BOOL bVisible);
  1097.  
  1098.     virtual void SaveToStorage(CObject* pObject = NULL);
  1099.  
  1100. // Interface Maps
  1101. public:
  1102.     BEGIN_INTERFACE_PART(PersistFile, IPersistFile)
  1103.         INIT_INTERFACE_PART(COleLinkingDoc, PersistFile)
  1104.         STDMETHOD(GetClassID)(LPCLSID);
  1105.         STDMETHOD(IsDirty)();
  1106.         STDMETHOD(Load)(LPCOLESTR, DWORD);
  1107.         STDMETHOD(Save)(LPCOLESTR, BOOL);
  1108.         STDMETHOD(SaveCompleted)(LPCOLESTR);
  1109.         STDMETHOD(GetCurFile)(LPOLESTR*);
  1110.     END_INTERFACE_PART(PersistFile)
  1111.  
  1112.     BEGIN_INTERFACE_PART(OleItemContainer, IOleItemContainer)
  1113.         INIT_INTERFACE_PART(COleLinkingDoc, OleItemContainer)
  1114.         STDMETHOD(ParseDisplayName)(LPBC, LPOLESTR, ULONG*, LPMONIKER*);
  1115.         STDMETHOD(EnumObjects)(DWORD, LPENUMUNKNOWN*);
  1116.         STDMETHOD(LockContainer)(BOOL);
  1117.         STDMETHOD(GetObject)(LPOLESTR, DWORD, LPBINDCTX, REFIID, LPVOID*);
  1118.         STDMETHOD(GetObjectStorage)(LPOLESTR, LPBINDCTX, REFIID, LPVOID*);
  1119.         STDMETHOD(IsRunning)(LPOLESTR);
  1120.     END_INTERFACE_PART(OleItemContainer)
  1121.  
  1122.     DECLARE_INTERFACE_MAP()
  1123.  
  1124.     friend class COleClientItem;
  1125.     friend class COleClientItem::XOleClientSite;
  1126.     friend class COleServerItem::XOleObject;
  1127. };
  1128.  
  1129. //////////////////////////////////////////////////////////////////////////////
  1130. // COleServerDoc - registered server document containing COleServerItems
  1131.  
  1132. #ifdef _AFXDLL
  1133. class COleServerDoc : public COleLinkingDoc
  1134. #else
  1135. class AFX_NOVTABLE COleServerDoc : public COleLinkingDoc
  1136. #endif
  1137. {
  1138.     DECLARE_DYNAMIC(COleServerDoc)
  1139.  
  1140. // Constructors and Destructors
  1141. public:
  1142.     COleServerDoc();
  1143.  
  1144. // Attributes
  1145.     BOOL IsEmbedded() const;    // TRUE if document is an embedding
  1146.     BOOL IsDocObject() const;   // TRUE if document is a DocObject
  1147.     COleServerItem* GetEmbeddedItem();
  1148.         // return embedded item for document (will allocate if necessary)
  1149.  
  1150.     // attributes specific to in-place activation
  1151.     BOOL IsInPlaceActive() const;
  1152.     void GetItemPosition(LPRECT lpPosRect) const;
  1153.         // get current position rectangle of in-place edit
  1154.     void GetItemClipRect(LPRECT lpClipRect) const;
  1155.         // get current clipping rectangle of in-place edit
  1156.     BOOL GetZoomFactor(LPSIZE lpSizeNum = NULL, LPSIZE lpSizeDenom = NULL,
  1157.         LPCRECT lpPosRect = NULL) const;
  1158.         // returns the zoom factor in pixels
  1159.  
  1160. // Operations
  1161.     void NotifyChanged();
  1162.         // call this after you change some global attribute like
  1163.         //  document dimensions
  1164.     void UpdateAllItems(COleServerItem* pSender,
  1165.         LPARAM lHint = 0L, CObject* pHint = NULL,
  1166.         DVASPECT nDrawAspect = DVASPECT_CONTENT);
  1167.  
  1168.     // changes to the entire document (automatically notifies clients)
  1169.     void NotifyRename(LPCTSTR lpszNewName);
  1170.     void NotifySaved();
  1171.     void NotifyClosed();        // call this after you close document
  1172.  
  1173.     // specific operations for embedded documents
  1174.     void SaveEmbedding();       // call this to save embedded (before closing)
  1175.  
  1176.     // specific to in-place activation
  1177.     BOOL ActivateInPlace();
  1178.     void ActivateDocObject();
  1179.     void RequestPositionChange(LPCRECT lpPosRect);
  1180.     BOOL ScrollContainerBy(CSize sizeScroll);
  1181.     BOOL DeactivateAndUndo();
  1182.     BOOL DiscardUndoState();
  1183.  
  1184. public:
  1185. // Overridables for standard user interface (full server)
  1186.     virtual BOOL OnUpdateDocument(); // implementation of embedded update
  1187.  
  1188. protected:
  1189. // Overridables you must implement for yourself
  1190.     virtual COleServerItem* OnGetEmbeddedItem() = 0;
  1191.         // return item representing entire (embedded) document
  1192.  
  1193. // Overridables you do not have to implement
  1194.     virtual void OnClose(OLECLOSE dwCloseOption);
  1195.     virtual void OnSetHostNames(LPCTSTR lpszHost, LPCTSTR lpszHostObj);
  1196.     virtual HRESULT OnExecOleCmd(const GUID* pguidCmdGroup, DWORD nCmdID,
  1197.         DWORD nCmdExecOpt, VARIANTARG* pvarargIn, VARIANTARG* pvarargOut);
  1198.     virtual CDocObjectServer* GetDocObjectServer(LPOLEDOCUMENTSITE pDocSite);
  1199.  
  1200. // Advanced overridables
  1201.     LPUNKNOWN GetInterfaceHook(const void* piid);
  1202.     virtual void OnShowDocument(BOOL bShow);
  1203.         // show first frame for document or hide all frames for document
  1204.  
  1205. // Advanced overridables for in-place activation
  1206. public:
  1207.     virtual void OnDeactivate();
  1208.     virtual void OnDeactivateUI(BOOL bUndoable);
  1209.  
  1210. protected:
  1211.     virtual void OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect);
  1212.     virtual BOOL OnReactivateAndUndo();
  1213.  
  1214.     virtual void OnFrameWindowActivate(BOOL bActivate);
  1215.     virtual void OnDocWindowActivate(BOOL bActivate);
  1216.     virtual void OnShowControlBars(CFrameWnd* pFrameWnd, BOOL bShow);
  1217.     virtual COleIPFrameWnd* CreateInPlaceFrame(CWnd* pParentWnd);
  1218.     virtual void DestroyInPlaceFrame(COleIPFrameWnd* pFrameWnd);
  1219. public:
  1220.     virtual void OnResizeBorder(LPCRECT lpRectBorder,
  1221.         LPOLEINPLACEUIWINDOW lpUIWindow, BOOL bFrame);
  1222.  
  1223. // Implementation
  1224. protected:
  1225.     LPOLECLIENTSITE m_lpClientSite;     // for embedded item
  1226.     CString m_strHostObj;               // name of document in container
  1227.     BOOL m_bCntrVisible;                // TRUE if OnShowWindow(TRUE) called
  1228.     BOOL m_bClosing;                    // TRUE if shutting down
  1229.     COleServerItem* m_pEmbeddedItem;    // pointer to embedded item for document
  1230.  
  1231.     COleIPFrameWnd* m_pInPlaceFrame;    // not NULL if in-place activated
  1232.     CWnd* m_pOrigParent;                // not NULL if existing view used
  1233.     DWORD m_dwOrigStyle;                // original style of in-place view
  1234.     DWORD m_dwOrigStyleEx;              // original extended style
  1235.  
  1236.     CDocObjectServer* m_pDocObjectServer;  // if DocObject, ptr to doc site
  1237.  
  1238. public:
  1239.     virtual ~COleServerDoc();
  1240. #ifdef _DEBUG
  1241.     virtual void AssertValid() const;
  1242.     virtual void Dump(CDumpContext& dc) const;
  1243. #endif
  1244.  
  1245.     // overridables for implementation
  1246.     virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
  1247.     virtual void OnCloseDocument();
  1248.     virtual void DeleteContents(); // delete auto-delete server items
  1249.     virtual LPMONIKER GetMoniker(OLEGETMONIKER nAssign);
  1250.     virtual COleServerItem* OnGetLinkedItem(LPCTSTR lpszItemName);
  1251.         // return item for the named linked item (only if supporting links)
  1252.     virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
  1253.  
  1254. protected:
  1255.     // overrides to handle server user-interface
  1256.     virtual BOOL SaveModified();        // return TRUE if ok to continue
  1257.     virtual HMENU GetDefaultMenu();     // return menu based on doc type
  1258.     virtual HACCEL GetDefaultAccelerator(); // return accel table based on doc type
  1259.     virtual BOOL GetFileTypeString(CString& rString);
  1260.  
  1261.     // IPersistStorage implementation
  1262.     virtual void OnNewEmbedding(LPSTORAGE lpStorage);
  1263.     virtual void OnOpenEmbedding(LPSTORAGE lpStorage);
  1264.     virtual void OnSaveEmbedding(LPSTORAGE lpStorage);
  1265.  
  1266.     // Implementation helpers
  1267.     void NotifyAllItems(OLE_NOTIFICATION wNotification, DWORD dwParam);
  1268.     BOOL SaveModifiedPrompt();
  1269.     void ConnectView(CWnd* pParentWnd, CView* pView);
  1270.     void UpdateUsingHostObj(UINT nIDS, CCmdUI* pCmdUI);
  1271.  
  1272. // Message Maps
  1273.     //{{AFX_MSG(COleServerDoc)
  1274.     afx_msg void OnFileUpdate();
  1275.     afx_msg void OnFileSaveCopyAs();
  1276.     afx_msg void OnUpdateFileUpdate(CCmdUI* pCmdUI);
  1277.     afx_msg void OnUpdateFileExit(CCmdUI* pCmdUI);
  1278.     //}}AFX_MSG
  1279.     DECLARE_MESSAGE_MAP()
  1280.  
  1281. // Interface Maps
  1282. public:
  1283.     BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
  1284.         INIT_INTERFACE_PART(COleServerDoc, PersistStorage)
  1285.         STDMETHOD(GetClassID)(LPCLSID);
  1286.         STDMETHOD(IsDirty)();
  1287.         STDMETHOD(InitNew)(LPSTORAGE);
  1288.         STDMETHOD(Load)(LPSTORAGE);
  1289.         STDMETHOD(Save)(LPSTORAGE, BOOL);
  1290.         STDMETHOD(SaveCompleted)(LPSTORAGE);
  1291.         STDMETHOD(HandsOffStorage)();
  1292.     END_INTERFACE_PART(PersistStorage)
  1293.  
  1294.     BEGIN_INTERFACE_PART(OleObject, IOleObject)
  1295.         INIT_INTERFACE_PART(COleServerDoc, OleObject)
  1296.         STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
  1297.         STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
  1298.         STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
  1299.         STDMETHOD(Close)(DWORD);
  1300.         STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
  1301.         STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
  1302.         STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
  1303.         STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
  1304.         STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
  1305.         STDMETHOD(EnumVerbs)(IEnumOLEVERB**);
  1306.         STDMETHOD(Update)();
  1307.         STDMETHOD(IsUpToDate)();
  1308.         STDMETHOD(GetUserClassID)(CLSID*);
  1309.         STDMETHOD(GetUserType)(DWORD, LPOLESTR*);
  1310.         STDMETHOD(SetExtent)(DWORD, LPSIZEL);
  1311.         STDMETHOD(GetExtent)(DWORD, LPSIZEL);
  1312.         STDMETHOD(Advise)(LPADVISESINK, LPDWORD);
  1313.         STDMETHOD(Unadvise)(DWORD);
  1314.         STDMETHOD(EnumAdvise)(LPENUMSTATDATA*);
  1315.         STDMETHOD(GetMiscStatus)(DWORD, LPDWORD);
  1316.         STDMETHOD(SetColorScheme)(LPLOGPALETTE);
  1317.     END_INTERFACE_PART(OleObject)
  1318.  
  1319.     BEGIN_INTERFACE_PART(DataObject, IDataObject)
  1320.         INIT_INTERFACE_PART(COleServerDoc, DataObject)
  1321.         STDMETHOD(GetData)(LPFORMATETC, LPSTGMEDIUM);
  1322.         STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM);
  1323.         STDMETHOD(QueryGetData)(LPFORMATETC);
  1324.         STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC, LPFORMATETC);
  1325.         STDMETHOD(SetData)(LPFORMATETC, LPSTGMEDIUM, BOOL);
  1326.         STDMETHOD(EnumFormatEtc)(DWORD, LPENUMFORMATETC*);
  1327.         STDMETHOD(DAdvise)(LPFORMATETC, DWORD, LPADVISESINK, LPDWORD);
  1328.         STDMETHOD(DUnadvise)(DWORD);
  1329.         STDMETHOD(EnumDAdvise)(LPENUMSTATDATA*);
  1330.     END_INTERFACE_PART(DataObject)
  1331.  
  1332.     BEGIN_INTERFACE_PART(OleInPlaceObject, IOleInPlaceObject)
  1333.         INIT_INTERFACE_PART(COleServerDoc, OleInPlaceObject)
  1334.         STDMETHOD(GetWindow)(HWND*);
  1335.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  1336.         STDMETHOD(InPlaceDeactivate)();
  1337.         STDMETHOD(UIDeactivate)();
  1338.         STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT);
  1339.         STDMETHOD(ReactivateAndUndo)();
  1340.     END_INTERFACE_PART(OleInPlaceObject)
  1341.  
  1342.     BEGIN_INTERFACE_PART(OleInPlaceActiveObject, IOleInPlaceActiveObject)
  1343.         INIT_INTERFACE_PART(COleServerDoc, OleInPlaceActiveObject)
  1344.         STDMETHOD(GetWindow)(HWND*);
  1345.         STDMETHOD(ContextSensitiveHelp)(BOOL);
  1346.         STDMETHOD(TranslateAccelerator)(LPMSG);
  1347.         STDMETHOD(OnFrameWindowActivate)(BOOL);
  1348.         STDMETHOD(OnDocWindowActivate)(BOOL);
  1349.         STDMETHOD(ResizeBorder)(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
  1350.         STDMETHOD(EnableModeless)(BOOL);
  1351.     END_INTERFACE_PART(OleInPlaceActiveObject)
  1352.  
  1353.     DECLARE_INTERFACE_MAP()
  1354.  
  1355.     friend class COleServer;
  1356.     friend class COleServerItem;
  1357.     friend class CDocObjectServer;
  1358. };
  1359.  
  1360. //////////////////////////////////////////////////////////////////////////////
  1361. // COleIPFrameWnd
  1362.  
  1363. class COleCntrFrameWnd;
  1364.  
  1365. class COleIPFrameWnd : public CFrameWnd
  1366. {
  1367.     DECLARE_DYNCREATE(COleIPFrameWnd)
  1368.  
  1369. // Constructors
  1370. public:
  1371.     COleIPFrameWnd();
  1372.  
  1373. // Overridables
  1374. public:
  1375.     virtual BOOL OnCreateControlBars(CWnd* pWndFrame, CWnd* pWndDoc);
  1376.         // create control bars on container windows (pWndDoc can be NULL)
  1377.     virtual BOOL OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc);
  1378.         // create control bars on container windows (pWndDoc can be NULL)
  1379.  
  1380.     virtual void RepositionFrame(LPCRECT lpPosRect, LPCRECT lpClipRect);
  1381.         // Advanced: reposition frame to wrap around new lpPosRect
  1382.  
  1383. // Implementation
  1384. public:
  1385.     BOOL m_bUIActive;   // TRUE if currently in uiacitve state
  1386.  
  1387.     virtual BOOL LoadFrame(UINT nIDResource,
  1388.         DWORD dwDefaultStyle = WS_CHILD|WS_BORDER|WS_CLIPSIBLINGS,
  1389.         CWnd* pParentWnd = NULL,
  1390.         CCreateContext* pContext = NULL);
  1391.     virtual void RecalcLayout(BOOL bNotify = TRUE);
  1392.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  1393.     virtual LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
  1394.     virtual ~COleIPFrameWnd();
  1395. #ifdef _DEBUG
  1396.     virtual void AssertValid() const;
  1397.     virtual void Dump(CDumpContext& dc) const;
  1398. #endif
  1399.  
  1400. protected:
  1401.     // in-place state
  1402.     OLEINPLACEFRAMEINFO m_frameInfo;
  1403.     LPOLEINPLACEFRAME m_lpFrame;
  1404.     LPOLEINPLACEUIWINDOW m_lpDocFrame;
  1405.     COleCntrFrameWnd* m_pMainFrame;
  1406.     COleCntrFrameWnd* m_pDocFrame;
  1407.  
  1408.     HMENU m_hSharedMenu;
  1409.     OLEMENUGROUPWIDTHS m_menuWidths;
  1410.     HOLEMENU m_hOleMenu;
  1411.     CRect m_rectPos;            // client area rect of the item
  1412.     CRect m_rectClip;           // area to which frame should be clipped
  1413.     BOOL m_bInsideRecalc;
  1414.  
  1415.     HMENU _m_Reserved;
  1416.  
  1417.     // Advanced: in-place activation virtual implementation
  1418.     virtual BOOL BuildSharedMenu();
  1419.     virtual void DestroySharedMenu();
  1420.     virtual HMENU GetInPlaceMenu();
  1421.  
  1422.     // Advanced: possible override to change in-place sizing behavior
  1423.     virtual void OnRequestPositionChange(LPCRECT lpRect);
  1424.  
  1425. protected:
  1426.     //{{AFX_MSG(COleIPFrameWnd)
  1427.     afx_msg void OnSize(UINT nType, int cx, int cy);
  1428.     afx_msg LRESULT OnRecalcParent(WPARAM wParam, LPARAM lParam);
  1429.     afx_msg void OnIdleUpdateCmdUI();
  1430.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  1431.     afx_msg void OnDestroy();
  1432.     afx_msg LRESULT OnResizeChild(WPARAM wParam, LPARAM lParam);
  1433.     afx_msg void OnContextHelp();
  1434.     afx_msg void OnUpdateControlBarMenu(CCmdUI* pCmdUI);
  1435.     afx_msg BOOL OnBarCheck(UINT nID);
  1436.     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  1437.     //}}AFX_MSG
  1438.     DECLARE_MESSAGE_MAP()
  1439.  
  1440.     friend class COleServerDoc;
  1441.     friend class COleCntrFrameWnd;
  1442.     friend class CDocObjectServer;
  1443. };
  1444.  
  1445. /////////////////////////////////////////////////////////////////////////////
  1446. // COleResizeBar - supports in-place resizing in server applications
  1447.  
  1448. class COleResizeBar : public CControlBar
  1449. {
  1450.     DECLARE_DYNAMIC(COleResizeBar)
  1451.  
  1452. // Constructors
  1453. public:
  1454.     COleResizeBar();
  1455.     BOOL Create(CWnd* pParentWnd, DWORD dwStyle = WS_CHILD | WS_VISIBLE,
  1456.         UINT nID = AFX_IDW_RESIZE_BAR);
  1457.  
  1458. // Implementation
  1459. public:
  1460.     virtual ~COleResizeBar();
  1461.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  1462.  
  1463. protected:
  1464.     CRectTracker m_tracker;     // implemented with a tracker
  1465.  
  1466. protected:
  1467.     //{{AFX_MSG(COleResizeBar)
  1468.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  1469.     afx_msg void OnPaint();
  1470.     afx_msg void OnSize(UINT nType, int cx, int cy);
  1471.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  1472.     afx_msg void OnLButtonDown(UINT, CPoint point);
  1473.     afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
  1474.     //}}AFX_MSG
  1475.     DECLARE_MESSAGE_MAP()
  1476. };
  1477.  
  1478. /////////////////////////////////////////////////////////////////////////////
  1479. // COleStreamFile - implementation of CFile which uses an IStream
  1480.  
  1481. class COleStreamFile : public CFile
  1482. {
  1483.     DECLARE_DYNAMIC(COleStreamFile)
  1484.  
  1485. // Constructors and Destructors
  1486. public:
  1487.     COleStreamFile(LPSTREAM lpStream = NULL);
  1488.  
  1489. // Operations
  1490.     // Note: OpenStream and CreateStream can accept eith STGM_ flags or
  1491.     //  CFile::OpenFlags bits since common values are guaranteed to have
  1492.     //  the same semantics.
  1493.     BOOL OpenStream(LPSTORAGE lpStorage, LPCTSTR lpszStreamName,
  1494.         DWORD nOpenFlags = modeReadWrite|shareExclusive,
  1495.         CFileException* pError = NULL);
  1496.     BOOL CreateStream(LPSTORAGE lpStorage, LPCTSTR lpszStreamName,
  1497.         DWORD nOpenFlags = modeReadWrite|shareExclusive|modeCreate,
  1498.         CFileException* pError = NULL);
  1499.  
  1500.     BOOL CreateMemoryStream(CFileException* pError = NULL);
  1501.  
  1502.     // attach & detach can be used when Open/Create functions aren't adequate
  1503.     void Attach(LPSTREAM lpStream);
  1504.     LPSTREAM Detach();
  1505.  
  1506.     IStream* GetStream() const;
  1507.     // Returns the current stream
  1508.  
  1509. // Implementation
  1510. public:
  1511.     LPSTREAM m_lpStream;
  1512. #ifdef _DEBUG
  1513.     virtual void AssertValid() const;
  1514.     virtual void Dump(CDumpContext& dc) const;
  1515. #endif
  1516.     virtual ~COleStreamFile();
  1517.  
  1518.     // attributes for implementation
  1519.     BOOL GetStatus(CFileStatus& rStatus) const;
  1520.     virtual DWORD GetPosition() const;
  1521.  
  1522.     virtual const CString GetStorageName() const;
  1523.  
  1524.     // overrides for implementation
  1525.     virtual CFile* Duplicate() const;
  1526.     virtual LONG Seek(LONG lOff, UINT nFrom);
  1527.     virtual void SetLength(DWORD dwNewLen);
  1528.     virtual DWORD GetLength() const;
  1529.     virtual UINT Read(void* lpBuf, UINT nCount);
  1530.     virtual void Write(const void* lpBuf, UINT nCount);
  1531.     virtual void LockRange(DWORD dwPos, DWORD dwCount);
  1532.     virtual void UnlockRange(DWORD dwPos, DWORD dwCount);
  1533.     virtual void Abort();
  1534.     virtual void Flush();
  1535.     virtual void Close();
  1536.  
  1537. protected:
  1538.     CString m_strStorageName;
  1539. };
  1540.  
  1541. /////////////////////////////////////////////////////////////////////////////
  1542. // CMonikerFile - implementation of COleStreamFile that uses an IMoniker to
  1543. //                get the IStream
  1544.  
  1545. class CMonikerFile: public COleStreamFile
  1546. {
  1547.     DECLARE_DYNAMIC(CMonikerFile)
  1548.  
  1549. public:
  1550.     CMonikerFile();
  1551.  
  1552.     virtual BOOL Open(LPCTSTR lpszURL, CFileException* pError=NULL);
  1553.     // Uses synchronous URLMonikers to create a moniker.
  1554.     // Opens the URL specified.
  1555.     // If provided, pError will be set in case of error.
  1556.     // Return value: TRUE if successful, FALSE otherwise.
  1557.  
  1558.     virtual BOOL Open(IMoniker* pMoniker, CFileException* pError=NULL);
  1559.     // Binds to the provided moniker to obtain a stream.
  1560.     // If provided, pError will be set in case of error.
  1561.     // Return value: TRUE if successful, FALSE otherwise.
  1562.  
  1563.     virtual void Close();
  1564.     // Detaches the stream, Release()s it, and the moniker.  Close may be
  1565.     // called on unopened, or already closed streams.
  1566.  
  1567.     BOOL Detach(CFileException* pError = NULL);
  1568.     // Closes the stream.  If there is an error when closing, then the
  1569.     // error code will be placed in pError and the function will return FALSE.
  1570.  
  1571.     IMoniker* GetMoniker() const;
  1572.     // Returns the current moniker.  The moniker returned is not AddRef()'ed.
  1573.  
  1574. protected:
  1575. // Overidables
  1576.     IBindCtx* CreateBindContext(CFileException* pError);
  1577.     // A hook so users can provide a particular IBindCtx, potentially one
  1578.     // on which the user has registered one or more objects.
  1579.  
  1580. // Implementation
  1581. protected:
  1582.     virtual BOOL Open(LPCTSTR lpszUrl, IBindHost* pBindHost,
  1583.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1584.     BOOL Attach(LPCTSTR lpszUrl, IBindHost* pBindHost,
  1585.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1586.     virtual BOOL Open(IMoniker* pMoniker, IBindHost* pBindHost,
  1587.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1588.  
  1589.     BOOL Attach(IMoniker* pMoniker, IBindHost* pBindHost,
  1590.         IBindStatusCallback* pBSC, IBindCtx* pBindCtx, CFileException* pError);
  1591.  
  1592.     virtual BOOL PostBindToStream(CFileException* pError);
  1593.  
  1594.     static IBindHost* CreateBindHost();
  1595. public:
  1596.     virtual ~CMonikerFile();
  1597.     // Closes the stream, and releases the moniker if needed.
  1598.  
  1599.     virtual void Flush();
  1600.  
  1601. #ifdef _DEBUG
  1602.     virtual void AssertValid() const;
  1603.     virtual void Dump(CDumpContext& dc) const;
  1604.     // Calls COleStreamFile::Dump(), and prints out moniker value.
  1605. #endif
  1606.  
  1607. protected:
  1608.     IPTR(IMoniker) m_Moniker;
  1609.     // The moniker provided or created to which this class is bound.
  1610.  
  1611.     CMonikerFile(const CMonikerFile&);
  1612.     // Prevents copying.
  1613. };
  1614.  
  1615. /////////////////////////////////////////////////////////////////////////////
  1616. // CAsyncMonikerFile - implementation of COleStreamFile that uses an
  1617. //                     asynchronous IMoniker to get the IStream
  1618.  
  1619. class _AfxBindStatusCallback; // Forward declaration
  1620.  
  1621. class CAsyncMonikerFile: public CMonikerFile
  1622. {
  1623.     DECLARE_DYNAMIC(CAsyncMonikerFile)
  1624.  
  1625. public:
  1626.     CAsyncMonikerFile();
  1627.     // Creates the IBindStatusCallback used internally to provide asynchronous
  1628.     // operation.
  1629.  
  1630.     //All Open overloads call one of these two.
  1631.     virtual BOOL Open(LPCTSTR lpszURL, IBindHost* pBindHost,
  1632.         CFileException* pError=NULL);
  1633.     virtual BOOL Open(IMoniker* pMoniker, IBindHost* pBindHost,
  1634.         CFileException* pError=NULL);
  1635.  
  1636.     //Open overloads that take monikers
  1637.     virtual BOOL Open(IMoniker* pMoniker, CFileException* pError=NULL);
  1638.     virtual BOOL Open(IMoniker* pMoniker, IServiceProvider* pServiceProvider,
  1639.         CFileException* pError=NULL);
  1640.     virtual BOOL Open(IMoniker* pMoniker, IUnknown* pUnknown,
  1641.         CFileException* pError=NULL);
  1642.  
  1643.     //Open overloads that take strings
  1644.     virtual BOOL Open(LPCTSTR lpszURL, CFileException* pError=NULL);
  1645.     virtual BOOL Open(LPCTSTR lpszURL, IServiceProvider* pServiceProvider,
  1646.         CFileException* pError=NULL);
  1647.     virtual BOOL Open(LPCTSTR lpszURL, IUnknown* pUnknown,
  1648.         CFileException* pError=NULL);
  1649.  
  1650.     virtual void Close();
  1651.  
  1652.     IBinding* GetBinding() const;
  1653.     // Returns the binding provided when the asychronous transfer begins.
  1654.     // With the IBinding*, the user may abort, or pause the transfer.
  1655.     // NULL may be returned if for any reason the transfer could not be
  1656.     // made asynchronous, or if the IBinding* has not yet been provided by
  1657.     // the system.
  1658.  
  1659.     FORMATETC* GetFormatEtc() const;
  1660.     // Returns the FORMATETC for the currently opened stream.  NULL will be
  1661.     // returned if this is called from outside the context of OnDataAvailable.
  1662.     // If you want to keep the FORMATETC beyond this call, make a copy of it.
  1663.     // The FORMATETC indicates the format of the data in the stream.
  1664.  
  1665. protected:
  1666. // Overidables
  1667.     virtual IUnknown* CreateBindStatusCallback(IUnknown* pUnkControlling);
  1668.  
  1669.     virtual DWORD GetBindInfo() const;
  1670.     // Returns the settings returned by IBindStatusCallback::GetBindInfo.
  1671.     // The default values returned should work for most cases and should not
  1672.     // be changed lightly.
  1673.  
  1674.     virtual LONG GetPriority() const;
  1675.     // Returns the priority at which the asynchronous transfer will take
  1676.     // place.  The value is one of the standard thread priority flags.
  1677.     // By default THREAD_PRIORITY_NORMAL is returned.
  1678.  
  1679.     virtual void OnDataAvailable(DWORD dwSize, DWORD bscfFlag);
  1680.     // Called when there is data available to be read.  dwSize indicates
  1681.     // the cumulative number of bytes which can be read.  The bscfFlag may be used
  1682.     // to identify first, last, and intermediate blocks of data.
  1683.  
  1684.     virtual void OnLowResource();
  1685.     // This is called when resources are low.
  1686.  
  1687.     virtual void OnStartBinding();
  1688.     // Called when the binding is starting up.
  1689.  
  1690.     virtual void OnProgress(ULONG ulProgress, ULONG ulProgressMax,
  1691.         ULONG ulStatusCode, LPCTSTR szStatusText);
  1692.  
  1693.     virtual void OnStopBinding(HRESULT hresult, LPCTSTR szError);
  1694.     // Called when the transfer is stopped.  This function releases the
  1695.     // IBinding and should nearly always be call when overidden.
  1696.  
  1697. // Implementation
  1698. public:
  1699.     virtual ~CAsyncMonikerFile();
  1700. #ifdef _DEBUG
  1701.     virtual void AssertValid() const;
  1702.     virtual void Dump(CDumpContext& dc) const;
  1703.     // Calls CMonikerFile::Dump(), and prints out IBinding,
  1704.     // IBindStatusCallback, and m_pFormatEtc values.
  1705. #endif
  1706.     virtual UINT Read(void* lpBuf, UINT nCount);
  1707.  
  1708. protected:
  1709.     friend class _AfxBindStatusCallback;
  1710.     _AfxBindStatusCallback* m_pAfxBSCCurrent;
  1711.     BOOL m_bStopBindingReceived;
  1712.     void EndCallbacks();
  1713.  
  1714.     IPTR(IBinding) m_Binding;
  1715.     FORMATETC* m_pFormatEtc;
  1716.  
  1717.     void SetBinding(IBinding* pBinding);
  1718.     // Sets and AddRefs m_Binding
  1719.  
  1720.     void SetFormatEtc(FORMATETC* pFormatEtc);
  1721.     // Sets the FORMATETC for the current stream.
  1722.  
  1723.     virtual BOOL PostBindToStream(CFileException* pError);
  1724. };
  1725.  
  1726. /////////////////////////////////////////////////////////////////////////////
  1727. // COleDropSource (advanced drop source support)
  1728.  
  1729. class COleDropSource : public CCmdTarget
  1730. {
  1731. // Constructors
  1732. public:
  1733.     COleDropSource();
  1734.  
  1735. // Overridables
  1736.     virtual SCODE QueryContinueDrag(BOOL bEscapePressed, DWORD dwKeyState);
  1737.     virtual SCODE GiveFeedback(DROPEFFECT dropEffect);
  1738.     virtual BOOL OnBeginDrag(CWnd* pWnd);
  1739.  
  1740. // Implementation
  1741. public:
  1742. #ifdef _DEBUG
  1743.     virtual void Dump(CDumpContext& dc) const;
  1744. #endif
  1745.  
  1746. public:
  1747.     BEGIN_INTERFACE_PART(DropSource, IDropSource)
  1748.         INIT_INTERFACE_PART(COleDropSource, DropSource)
  1749.         STDMETHOD(QueryContinueDrag)(BOOL, DWORD);
  1750.         STDMETHOD(GiveFeedback)(DWORD);
  1751.     END_INTERFACE_PART(DropSource)
  1752.  
  1753.     DECLARE_INTERFACE_MAP()
  1754.  
  1755.     CRect m_rectStartDrag;  // when mouse leaves this rect, drag drop starts
  1756.     BOOL m_bDragStarted;    // has drag really started yet?
  1757.     DWORD m_dwButtonCancel; // which button will cancel (going down)
  1758.     DWORD m_dwButtonDrop;   // which button will confirm (going up)
  1759.  
  1760.     // metrics for drag start determination
  1761.     static AFX_DATA UINT nDragMinDist;  // min. amount mouse must move for drag
  1762.     static AFX_DATA UINT nDragDelay;    // delay before drag starts
  1763.  
  1764.     friend class COleDataSource;
  1765. };
  1766.  
  1767. /////////////////////////////////////////////////////////////////////////////
  1768. // COleDropTarget (advanced drop target support)
  1769.  
  1770. class COleDropTarget : public CCmdTarget
  1771. {
  1772. // Constructors
  1773. public:
  1774.     COleDropTarget();
  1775.  
  1776. // Operations
  1777.     BOOL Register(CWnd* pWnd);
  1778.     virtual void Revoke();  // virtual for implementation
  1779.  
  1780. // Overridables
  1781.     virtual DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject,
  1782.         DWORD dwKeyState, CPoint point);
  1783.     virtual DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject,
  1784.         DWORD dwKeyState, CPoint point);
  1785.     virtual BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject,
  1786.         DROPEFFECT dropEffect, CPoint point);
  1787.     virtual DROPEFFECT OnDropEx(CWnd* pWnd, COleDataObject* pDataObject,
  1788.         DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
  1789.     virtual void OnDragLeave(CWnd* pWnd);
  1790.     virtual DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState,
  1791.         CPoint point);
  1792.  
  1793. // Implementation
  1794. public:
  1795.     virtual ~COleDropTarget();
  1796. #ifdef _DEBUG
  1797.     virtual void AssertValid() const;
  1798.     virtual void Dump(CDumpContext& dc) const;
  1799. #endif
  1800.  
  1801. protected:
  1802.     HWND m_hWnd;            // HWND this IDropTarget is attached to
  1803.     LPDATAOBJECT m_lpDataObject;    // != NULL between OnDragEnter, OnDragLeave
  1804.     UINT m_nTimerID;        // != MAKEWORD(-1, -1) when in scroll area
  1805.     DWORD m_dwLastTick;     // only valid when m_nTimerID valid
  1806.     UINT m_nScrollDelay;    // time to next scroll
  1807.  
  1808.     // metrics for drag-scrolling
  1809.     static AFX_DATA int nScrollInset;
  1810.     static AFX_DATA UINT nScrollDelay;
  1811.     static AFX_DATA UINT nScrollInterval;
  1812.  
  1813.     // implementation helpers
  1814.     void SetupTimer(CView* pView, UINT nTimerID);
  1815.     void CancelTimer(CWnd* pWnd);
  1816.  
  1817. // Interface Maps
  1818. public:
  1819.     BEGIN_INTERFACE_PART(DropTarget, IDropTarget)
  1820.         INIT_INTERFACE_PART(COleDropTarget, DropTarget)
  1821.         STDMETHOD(DragEnter)(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
  1822.         STDMETHOD(DragOver)(DWORD, POINTL, LPDWORD);
  1823.         STDMETHOD(DragLeave)();
  1824.         STDMETHOD(Drop)(LPDATAOBJECT, DWORD, POINTL pt, LPDWORD);
  1825.     END_INTERFACE_PART(DropTarget)
  1826.  
  1827.     DECLARE_INTERFACE_MAP()
  1828. };
  1829.  
  1830. /////////////////////////////////////////////////////////////////////////////
  1831. // COleMessageFilter (implements IMessageFilter)
  1832.  
  1833. class COleMessageFilter : public CCmdTarget
  1834. {
  1835. // Constructors
  1836. public:
  1837.     COleMessageFilter();
  1838.  
  1839. // Operations
  1840.     BOOL Register();
  1841.     void Revoke();
  1842.  
  1843.     // for controlling the busy state of the server application (called app)
  1844.     virtual void BeginBusyState();
  1845.     virtual void EndBusyState();
  1846.     void SetBusyReply(SERVERCALL nBusyReply);
  1847.  
  1848.     // for controlling actions taken against rejected/retried calls
  1849.     void SetRetryReply(DWORD nRetryReply = 0);
  1850.         // only used when the "not responding" dialog is disabled
  1851.     void SetMessagePendingDelay(DWORD nTimeout = 5000);
  1852.         // used to determine amount of time before significant message
  1853.     void EnableBusyDialog(BOOL bEnableBusy = TRUE);
  1854.     void EnableNotRespondingDialog(BOOL bEnableNotResponding = TRUE);
  1855.         // used to enable/disable the two types of busy dialogs
  1856.  
  1857. // Overridables
  1858.     virtual BOOL OnMessagePending(const MSG* pMsg);
  1859.         // return TRUE to eat the message (usually only if processed)
  1860.  
  1861. // Implementation
  1862. public:
  1863. #ifdef _DEBUG
  1864.     virtual void AssertValid() const;
  1865.     virtual void Dump(CDumpContext& dc) const;
  1866. #endif
  1867.     virtual ~COleMessageFilter();
  1868.     virtual BOOL IsSignificantMessage(MSG* pMsg);
  1869.         // determine if any significant messages are present in the queue
  1870.     virtual int OnBusyDialog(HTASK htaskBusy);
  1871.     virtual int OnNotRespondingDialog(HTASK htaskBusy);
  1872.         // these functions display the busy dialog
  1873.  
  1874. protected:
  1875.     BOOL m_bRegistered;
  1876.     LONG m_nBusyCount;  // for BeginBusyState & EndBusyState
  1877.     BOOL m_bEnableBusy;
  1878.     BOOL m_bEnableNotResponding;
  1879.     BOOL m_bUnblocking;
  1880.     DWORD m_nRetryReply;    // only used if m_bEnableNotResponding == FALSE
  1881.     DWORD m_nBusyReply;
  1882.     DWORD m_nTimeout;
  1883.  
  1884. // Interface Maps
  1885. public:
  1886.     BEGIN_INTERFACE_PART(MessageFilter, IMessageFilter)
  1887.         INIT_INTERFACE_PART(COleMessageFilter, MessageFilter)
  1888.         STDMETHOD_(DWORD, HandleInComingCall)(DWORD, HTASK, DWORD,
  1889.             LPINTERFACEINFO);
  1890.         STDMETHOD_(DWORD, RetryRejectedCall)(HTASK, DWORD, DWORD);
  1891.         STDMETHOD_(DWORD, MessagePending)(HTASK, DWORD, DWORD);
  1892.     END_INTERFACE_PART(MessageFilter)
  1893.  
  1894.     DECLARE_INTERFACE_MAP()
  1895. };
  1896.  
  1897. /////////////////////////////////////////////////////////////////////////////
  1898. // message map entries for OLE verbs
  1899.  
  1900. #define ON_STDOLEVERB(iVerb, memberFxn) \
  1901.     { 0xC002, 0, (UINT)iVerb, (UINT)iVerb, (UINT)-1, \
  1902.         (AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*)(LPMSG, HWND, LPCRECT))&memberFxn },
  1903.  
  1904. #define ON_OLEVERB(idsVerbName, memberFxn) \
  1905.     { 0xC002, 0, 1, 1, idsVerbName, \
  1906.         (AFX_PMSG)(BOOL (AFX_MSG_CALL CCmdTarget::*)(LPMSG, HWND, LPCRECT))&memberFxn },
  1907.  
  1908. /////////////////////////////////////////////////////////////////////////////
  1909. // global helpers and debugging
  1910.  
  1911. void AFXAPI AfxOleSetEditMenu(COleClientItem* pClient, CMenu* pMenu,
  1912.     UINT iMenuItem, UINT nIDVerbMin, UINT nIDVerbMax = 0, UINT nIDConvert = 0);
  1913.  
  1914. #ifdef _DEBUG
  1915. // Mapping SCODEs to readable text
  1916. LPCTSTR AFXAPI AfxGetFullScodeString(SCODE sc);
  1917. LPCTSTR AFXAPI AfxGetScodeString(SCODE sc);
  1918. LPCTSTR AFXAPI AfxGetScodeRangeString(SCODE sc);
  1919. LPCTSTR AFXAPI AfxGetSeverityString(SCODE sc);
  1920. LPCTSTR AFXAPI AfxGetFacilityString(SCODE sc);
  1921.  
  1922. // Mapping IIDs to readable text
  1923. LPCTSTR AFXAPI AfxGetIIDString(REFIID iid);
  1924. #endif
  1925.  
  1926. /////////////////////////////////////////////////////////////////////////////
  1927. // Inline function declarations
  1928.  
  1929. #ifdef _AFX_PACKING
  1930. #pragma pack(pop)
  1931. #endif
  1932.  
  1933. #ifdef _AFX_ENABLE_INLINES
  1934. #define _AFXOLE_INLINE AFX_INLINE
  1935. #define _AFXOLECLI_INLINE AFX_INLINE
  1936. #define _AFXOLESVR_INLINE AFX_INLINE
  1937. #define _AFXOLEDOBJ_INLINE AFX_INLINE
  1938. #define _AFXOLEMONIKER_INLINE AFX_INLINE
  1939. #include <afxole.inl>
  1940. #undef _AFXOLE_INLINE
  1941. #undef _AFXOLECLI_INLINE
  1942. #undef _AFXOLESVR_INLINE
  1943. #undef _AFXOLEDOBJ_INLINE
  1944. #undef _AFXOLEMONIKER_INLINE
  1945. #endif
  1946.  
  1947. #undef AFX_DATA
  1948. #define AFX_DATA
  1949.  
  1950. #ifdef _AFX_MINREBUILD
  1951. #pragma component(minrebuild, on)
  1952. #endif
  1953. #ifndef _AFX_FULLTYPEINFO
  1954. #pragma component(mintypeinfo, off)
  1955. #endif
  1956.  
  1957. #endif //__AFXOLE_H__
  1958.  
  1959. /////////////////////////////////////////////////////////////////////////////x
  1960.