home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch08 / ocontain / contai~1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-22  |  2.5 KB  |  99 lines

  1. // ContainDoc.cpp : implementation of the CContainDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "OContain.h"
  6.  
  7. #include "ContainDoc.h"
  8. #include "CntrItem.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CContainDoc
  18.  
  19. IMPLEMENT_DYNCREATE(CContainDoc, COleDocument)
  20.  
  21. BEGIN_MESSAGE_MAP(CContainDoc, COleDocument)
  22.     //{{AFX_MSG_MAP(CContainDoc)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Enable default OLE container implementation
  27.     ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, COleDocument::OnUpdatePasteMenu)
  28.     ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE_LINK, COleDocument::OnUpdatePasteLinkMenu)
  29.     ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_CONVERT, COleDocument::OnUpdateObjectVerbMenu)
  30.     ON_COMMAND(ID_OLE_EDIT_CONVERT, COleDocument::OnEditConvert)
  31.     ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_LINKS, COleDocument::OnUpdateEditLinksMenu)
  32.     ON_COMMAND(ID_OLE_EDIT_LINKS, COleDocument::OnEditLinks)
  33.     ON_UPDATE_COMMAND_UI(ID_OLE_VERB_FIRST, COleDocument::OnUpdateObjectVerbMenu)
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CContainDoc construction/destruction
  38.  
  39. CContainDoc::CContainDoc()
  40. {
  41.     // Use OLE compound files
  42.     EnableCompoundFile();
  43.  
  44.     // TODO: add one-time construction code here
  45.  
  46. }
  47.  
  48. CContainDoc::~CContainDoc()
  49. {
  50. }
  51.  
  52. BOOL CContainDoc::OnNewDocument()
  53. {
  54.     if (!COleDocument::OnNewDocument())
  55.         return FALSE;
  56.  
  57.     // TODO: add reinitialization code here
  58.     // (SDI documents will reuse this document)
  59.  
  60.     return TRUE;
  61. }
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CContainDoc serialization
  65.  
  66. void CContainDoc::Serialize(CArchive& ar)
  67. {
  68.     if (ar.IsStoring())
  69.     {
  70.         // TODO: add storing code here
  71.     }
  72.     else
  73.     {
  74.         // TODO: add loading code here
  75.     }
  76.  
  77.     // Calling the base class COleDocument enables serialization
  78.     //  of the container document's COleClientItem objects.
  79.     COleDocument::Serialize(ar);
  80. }
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CContainDoc diagnostics
  84.  
  85. #ifdef _DEBUG
  86. void CContainDoc::AssertValid() const
  87. {
  88.     COleDocument::AssertValid();
  89. }
  90.  
  91. void CContainDoc::Dump(CDumpContext& dc) const
  92. {
  93.     COleDocument::Dump(dc);
  94. }
  95. #endif //_DEBUG
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CContainDoc commands
  99.