⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activdocdoc.cpp

📁 Visual C++ From the Ground Up Second Edition 例程源代码
💻 CPP
字号:
// ActivDocDoc.cpp : implementation of the CActivDocDoc class
//

#include "stdafx.h"
#include "ActivDoc.h"

#include "ActivDocDoc.h"
#include "CntrItem.h"
#include "SrvrItem.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc

IMPLEMENT_DYNCREATE(CActivDocDoc, CRichEditDoc)

BEGIN_MESSAGE_MAP(CActivDocDoc, CRichEditDoc)
	//{{AFX_MSG_MAP(CActivDocDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Enable default OLE container implementation
	ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_LINKS, CRichEditDoc::OnUpdateEditLinksMenu)
	ON_COMMAND(ID_OLE_EDIT_LINKS, CRichEditDoc::OnEditLinks)
	ON_UPDATE_COMMAND_UI(ID_OLE_VERB_FIRST, CRichEditDoc::OnUpdateObjectVerbMenu)
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CActivDocDoc, CRichEditDoc)
	//{{AFX_DISPATCH_MAP(CActivDocDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//      DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IActivDoc to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {5C13C4E7-A6E7-11D0-9887-00A024DA5F0B}
static const IID IID_IActivDoc =
{ 0x5c13c4e7, 0xa6e7, 0x11d0, { 0x98, 0x87, 0x0, 0xa0, 0x24, 0xda, 0x5f, 0xb } };

BEGIN_INTERFACE_MAP(CActivDocDoc, CRichEditDoc)
	INTERFACE_PART(CActivDocDoc, IID_IActivDoc, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc construction/destruction

CActivDocDoc::CActivDocDoc()
{
	// Use OLE compound files
	EnableCompoundFile();

	// TODO: add one-time construction code here

	EnableAutomation();

	AfxOleLockApp();
}

CActivDocDoc::~CActivDocDoc()
{
	AfxOleUnlockApp();
}

BOOL CActivDocDoc::OnNewDocument()
{
	if (!CRichEditDoc::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}

CRichEditCntrItem* CActivDocDoc::CreateClientItem(REOBJECT* preo) const
{
	// cast away constness of this
	return new CActivDocCntrItem(preo, (CActivDocDoc*) this);
}

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc server implementation

COleServerItem* CActivDocDoc::OnGetEmbeddedItem()
{
	// OnGetEmbeddedItem is called by the framework to get the COleServerItem
	//  that is associated with the document.  It is only called when necessary.

	CActivDocSrvrItem* pItem = new CActivDocSrvrItem(this);
	ASSERT_VALID(pItem);
	return pItem;
}

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc ActiveX Document server implementation

CDocObjectServer *CActivDocDoc::GetDocObjectServer(LPOLEDOCUMENTSITE pDocSite)
{
	return new CDocObjectServer(this, pDocSite);
}



/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc serialization

void CActivDocDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}

	// Calling the base class CRichEditDoc enables serialization
	//  of the container document's COleClientItem objects.
	CRichEditDoc::Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc diagnostics

#ifdef _DEBUG
void CActivDocDoc::AssertValid() const
{
	CRichEditDoc::AssertValid();
}

void CActivDocDoc::Dump(CDumpContext& dc) const
{
	CRichEditDoc::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CActivDocDoc commands

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -