// myex35aDoc.cpp : implementation of the CMyex35aDoc class
//

#include "stdafx.h"
#include "myex35a.h"

#include "myex35aDoc.h"
#include "CntrItem.h"
#include "SrvrItem.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc

IMPLEMENT_DYNCREATE(CMyex35aDoc, CRichEditDoc)

BEGIN_MESSAGE_MAP(CMyex35aDoc, CRichEditDoc)
	//{{AFX_MSG_MAP(CMyex35aDoc)
		// 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_RANGE(ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, CRichEditDoc::OnUpdateObjectVerbMenu)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc construction/destruction

CMyex35aDoc::CMyex35aDoc()
{
	// Use OLE compound files
	EnableCompoundFile();

	// TODO: add one-time construction code here

}

CMyex35aDoc::~CMyex35aDoc()
{
}

BOOL CMyex35aDoc::OnNewDocument()
{
	if (!CRichEditDoc::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}

CRichEditCntrItem* CMyex35aDoc::CreateClientItem(REOBJECT* preo) const
{
	// cast away constness of this
	return new CMyex35aCntrItem(preo, (CMyex35aDoc*) this);
}

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc server implementation

COleServerItem* CMyex35aDoc::OnGetEmbeddedItem()
{
	// OnGetEmbeddedItem is called by the framework to get the COleServerItem
	//  that is associated with the document.  It is only called when necessary.

	CMyex35aSrvrItem* pItem = new CMyex35aSrvrItem(this);
	ASSERT_VALID(pItem);
	return pItem;
}

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc Active Document server implementation

CDocObjectServer *CMyex35aDoc::GetDocObjectServer(LPOLEDOCUMENTSITE pDocSite)
{
	return new CDocObjectServer(this, pDocSite);
}



/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc serialization

void CMyex35aDoc::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.
	// TODO: set CRichEditDoc::m_bRTF = FALSE if you are serializing as text
	CRichEditDoc::Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc diagnostics

#ifdef _DEBUG
void CMyex35aDoc::AssertValid() const
{
	CRichEditDoc::AssertValid();
}

void CMyex35aDoc::Dump(CDumpContext& dc) const
{
	CRichEditDoc::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMyex35aDoc commands

