home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / OTEXT / OTEXTDOC.CPP < prev    next >
C/C++ Source or Header  |  1994-01-01  |  3KB  |  100 lines

  1. // otextdoc.cpp : implementation of the COTextDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "otext.h"
  6.  
  7. #include "otextdoc.h"
  8. #include "srvritem.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // COTextDoc
  17.  
  18. IMPLEMENT_DYNCREATE(COTextDoc, COleServerDoc)
  19.  
  20. BEGIN_MESSAGE_MAP(COTextDoc, COleServerDoc)
  21.     //{{AFX_MSG_MAP(COTextDoc)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25. END_MESSAGE_MAP()
  26.  
  27. BEGIN_DISPATCH_MAP(COTextDoc, COleServerDoc)
  28.     //{{AFX_DISPATCH_MAP(COTextDoc)
  29.         // NOTE - the ClassWizard will add and remove mapping macros here.
  30.         //      DO NOT EDIT what you see in these blocks of generated code!
  31.     //}}AFX_DISPATCH_MAP
  32. END_DISPATCH_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // COTextDoc construction/destruction
  36.  
  37. COTextDoc::COTextDoc()
  38. {
  39.     EnableAutomation();
  40.  
  41.     // TODO: add one-time construction code here
  42.  
  43.     AfxOleLockApp();
  44. }
  45.  
  46. COTextDoc::~COTextDoc()
  47. {
  48.     AfxOleUnlockApp();
  49. }
  50.  
  51. BOOL COTextDoc::OnNewDocument()
  52. {
  53.     if (!COleServerDoc::OnNewDocument())
  54.         return FALSE;
  55.  
  56.     // TODO: add reinitialization code here
  57.     // (SDI documents will reuse this document)
  58.  
  59.     return TRUE;
  60. }
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // COTextDoc server implementation
  64.  
  65. COleServerItem* COTextDoc::OnGetEmbeddedItem()
  66. {
  67.     // OnGetEmbeddedItem is called by the framework to get the COleServerItem
  68.     //  that is associated with the document.  It is only called when necessary.
  69.  
  70.     COTextSrvrItem* pItem = new COTextSrvrItem(this);
  71.     ASSERT_VALID(pItem);
  72.     return pItem;
  73. }
  74.  
  75. /////////////////////////////////////////////////////////////////////////////
  76. // COTextDoc serialization
  77.  
  78. void COTextDoc::Serialize(CArchive& ar)
  79. {
  80.     ((CEditView *)m_viewList.GetHead())->SerializeRaw(ar);
  81. }
  82.  
  83. /////////////////////////////////////////////////////////////////////////////
  84. // COTextDoc diagnostics
  85.  
  86. #ifdef _DEBUG
  87. void COTextDoc::AssertValid() const
  88. {
  89.     COleServerDoc::AssertValid();
  90. }
  91.  
  92. void COTextDoc::Dump(CDumpContext& dc) const
  93. {
  94.     COleServerDoc::Dump(dc);
  95. }
  96. #endif //_DEBUG
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // COTextDoc commands
  100.