The document class in your application must derive from COleServerDoc. It should declare at least one member variable that is derived from CODModel. It should override the OnGetEmbeddedItem() method for creating server items. It should also override OnDeactivate(). The declaration of your COleServerDoc derived class should look like Example 20.
class CMyAppDoc : public COleServerDoc { protected: // create from serialization only CMyAppDoc(); VIEWS_DECLARE_DYNCREATE(CMyAppDoc) // Attributes public: CMyAppSrvrItem* GetEmbeddedItem() { return (CMyAppSrvrItem*)COleServerDoc::GetEmbeddedItem(); } protected: CMyAppModel m_mdlCanvas; public: // Gets a pointer to the model of the diagram. CMyAppModel* GetModel() { return &m_mdlDiagram; } // Determines if the diagram has been modified. virtual BOOL IsModified(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyAppDoc) virtual void DeleteContents(); protected: virtual COleServerItem* OnGetEmbeddedItem(); public: virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar); virtual void OnDeactivate(); //}}AFX_VIRTUAL ... } |
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.