The OLE document server must provide persistence interfaces to the container item, so the linked or embedded document can be saved and restored by the container. This functionality is mapped by MFC to the COleServerItem::Serialize() method. You must override this method and make sure that it saves and restores the information in the document. If the item is embedded, then the entire document can be serialized using the Serialize() method of your COleServerDoc derived class. If the item is linked, then you must supply application-specific logic for serializing the link information.
void CMyAppSrvrItem::Serialize(CArchive& ar) { if (!IsLinkedItem()) { CMyAppDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDoc->Serialize(ar); } else { // Serialize information need to link to the // document. This could be just a filename or // some other information that points to the // document. } } |
Make sure the ColeServerDoc derived class serializes the model.
void CMyAppDoc::Serialize(CArchive& ar) { // Serialize the model. m_mdlCanvas.Serialize(ar); } |
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.