[32] | 1 | // TestProgDoc.cpp : implementation of the CTestProgDoc class
|
---|
| 2 | //
|
---|
| 3 |
|
---|
| 4 | #include "stdafx.h"
|
---|
| 5 | #include "TestProg.h"
|
---|
| 6 |
|
---|
| 7 | #include "TestProgDoc.h"
|
---|
| 8 | #include "CntrItem.h"
|
---|
| 9 | #include "SrvrItem.h"
|
---|
| 10 |
|
---|
| 11 | #ifdef _DEBUG
|
---|
| 12 | #define new DEBUG_NEW
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | // CTestProgDoc
|
---|
| 17 |
|
---|
| 18 | IMPLEMENT_DYNCREATE(CTestProgDoc, COleServerDoc)
|
---|
| 19 |
|
---|
| 20 | BEGIN_MESSAGE_MAP(CTestProgDoc, COleServerDoc)
|
---|
| 21 | // Enable default OLE container implementation
|
---|
| 22 | ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, &COleServerDoc::OnUpdatePasteMenu)
|
---|
| 23 | ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE_LINK, &COleServerDoc::OnUpdatePasteLinkMenu)
|
---|
| 24 | ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_CONVERT, &COleServerDoc::OnUpdateObjectVerbMenu)
|
---|
| 25 | ON_COMMAND(ID_OLE_EDIT_CONVERT, &COleServerDoc::OnEditConvert)
|
---|
| 26 | ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_LINKS, &COleServerDoc::OnUpdateEditLinksMenu)
|
---|
| 27 | ON_COMMAND(ID_OLE_EDIT_LINKS, &COleServerDoc::OnEditLinks)
|
---|
| 28 | ON_UPDATE_COMMAND_UI_RANGE(ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, &COleServerDoc::OnUpdateObjectVerbMenu)
|
---|
| 29 | END_MESSAGE_MAP()
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | // CTestProgDoc construction/destruction
|
---|
| 33 |
|
---|
| 34 | CTestProgDoc::CTestProgDoc()
|
---|
| 35 | {
|
---|
| 36 | // Use OLE compound files
|
---|
| 37 | EnableCompoundFile();
|
---|
| 38 |
|
---|
| 39 | // TODO: add one-time construction code here
|
---|
| 40 |
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | CTestProgDoc::~CTestProgDoc()
|
---|
| 44 | {
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | BOOL CTestProgDoc::OnNewDocument()
|
---|
| 48 | {
|
---|
| 49 | if (!COleServerDoc::OnNewDocument())
|
---|
| 50 | return FALSE;
|
---|
| 51 |
|
---|
| 52 | // TODO: add reinitialization code here
|
---|
| 53 | // (SDI documents will reuse this document)
|
---|
| 54 |
|
---|
| 55 | return TRUE;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 | // CTestProgDoc server implementation
|
---|
| 60 |
|
---|
| 61 | COleServerItem* CTestProgDoc::OnGetEmbeddedItem()
|
---|
| 62 | {
|
---|
| 63 | // OnGetEmbeddedItem is called by the framework to get the COleServerItem
|
---|
| 64 | // that is associated with the document. It is only called when necessary.
|
---|
| 65 |
|
---|
| 66 | CTestProgSrvrItem* pItem = new CTestProgSrvrItem(this);
|
---|
| 67 | ASSERT_VALID(pItem);
|
---|
| 68 | return pItem;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 | // CTestProgDoc serialization
|
---|
| 75 |
|
---|
| 76 | void CTestProgDoc::Serialize(CArchive& ar)
|
---|
| 77 | {
|
---|
| 78 | if (ar.IsStoring())
|
---|
| 79 | {
|
---|
| 80 | // TODO: add storing code here
|
---|
| 81 | }
|
---|
| 82 | else
|
---|
| 83 | {
|
---|
| 84 | // TODO: add loading code here
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | // Calling the base class COleServerDoc enables serialization
|
---|
| 88 | // of the container document's COleClientItem objects.
|
---|
| 89 | COleServerDoc::Serialize(ar);
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | // CTestProgDoc diagnostics
|
---|
| 94 |
|
---|
| 95 | #ifdef _DEBUG
|
---|
| 96 | void CTestProgDoc::AssertValid() const
|
---|
| 97 | {
|
---|
| 98 | COleServerDoc::AssertValid();
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | void CTestProgDoc::Dump(CDumpContext& dc) const
|
---|
| 102 | {
|
---|
| 103 | COleServerDoc::Dump(dc);
|
---|
| 104 | }
|
---|
| 105 | #endif //_DEBUG
|
---|
| 106 |
|
---|
| 107 |
|
---|
| 108 | // CTestProgDoc commands
|
---|