home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch08 / oserver / oserve~1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-16  |  2.2 KB  |  100 lines

  1. // OServerDoc.cpp : implementation of the COServerDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "OServer.h"
  6.  
  7. #include "OServerDoc.h"
  8. #include "SrvrItem.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. // COServerDoc
  18.  
  19. IMPLEMENT_DYNCREATE(COServerDoc, COleServerDoc)
  20.  
  21. BEGIN_MESSAGE_MAP(COServerDoc, COleServerDoc)
  22.     //{{AFX_MSG_MAP(COServerDoc)
  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. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // COServerDoc construction/destruction
  30.  
  31. COServerDoc::COServerDoc()
  32. {
  33.     // Use OLE compound files
  34.     EnableCompoundFile();
  35.  
  36.     // TODO: add one-time construction code here
  37.  
  38. }
  39.  
  40. COServerDoc::~COServerDoc()
  41. {
  42. }
  43.  
  44. BOOL COServerDoc::OnNewDocument()
  45. {
  46.     if (!COleServerDoc::OnNewDocument())
  47.         return FALSE;
  48.  
  49.     // TODO: add reinitialization code here
  50.     // (SDI documents will reuse this document)
  51.  
  52.     return TRUE;
  53. }
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // COServerDoc server implementation
  57.  
  58. COleServerItem* COServerDoc::OnGetEmbeddedItem()
  59. {
  60.     // OnGetEmbeddedItem is called by the framework to get the COleServerItem
  61.     //  that is associated with the document.  It is only called when necessary.
  62.  
  63.     COServerSrvrItem* pItem = new COServerSrvrItem(this);
  64.     ASSERT_VALID(pItem);
  65.     return pItem;
  66. }
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // COServerDoc serialization
  70.  
  71. void COServerDoc::Serialize(CArchive& ar)
  72. {
  73.     if (ar.IsStoring())
  74.     {
  75.         // TODO: add storing code here
  76.     }
  77.     else
  78.     {
  79.         // TODO: add loading code here
  80.     }
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84. // COServerDoc diagnostics
  85.  
  86. #ifdef _DEBUG
  87. void COServerDoc::AssertValid() const
  88. {
  89.     COleServerDoc::AssertValid();
  90. }
  91.  
  92. void COServerDoc::Dump(CDumpContext& dc) const
  93. {
  94.     COleServerDoc::Dump(dc);
  95. }
  96. #endif //_DEBUG
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // COServerDoc commands
  100.