www.pudn.com > 在控件的客户区中使用textout.rar > vueDoc.cpp


// vueDoc.cpp : implementation of the CVueDoc class 
// 
 
#include "stdafx.h" 
#include "vue.h" 
#include "vueView.h" 
#include "vueDoc.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CVueDoc 
 
IMPLEMENT_DYNCREATE(CVueDoc, CDocument) 
 
BEGIN_MESSAGE_MAP(CVueDoc, CDocument) 
	//{{AFX_MSG_MAP(CVueDoc) 
		// 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 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CVueDoc construction/destruction 
 
CVueDoc::CVueDoc() 
{ 
	// TODO: add one-time construction code here 
 
} 
 
CVueDoc::~CVueDoc() 
{ 
} 
 
BOOL CVueDoc::OnNewDocument() 
{ 
	if (!CDocument::OnNewDocument()) 
		return FALSE; 
 
	// TODO: add reinitialization code here 
	// (SDI documents will reuse this document) 
	 
	return TRUE; 
} 
 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CVueDoc serialization 
 
void CVueDoc::Serialize(CArchive& ar) 
{ 
	if (ar.IsStoring()) 
	{ 
		// TODO: add storing code here 
	} 
	else 
	{ 
		// TODO: add loading code here 
	} 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CVueDoc diagnostics 
 
#ifdef _DEBUG 
void CVueDoc::AssertValid() const 
{ 
	CDocument::AssertValid(); 
} 
 
void CVueDoc::Dump(CDumpContext& dc) const 
{ 
	CDocument::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CVueDoc commands 
BOOL CVueDoc::OnOpenDocument(LPCTSTR lpszPathName)  
{ 
	if (!CDocument::OnOpenDocument(lpszPathName)) 
		return FALSE; 
 
	// TODO: Add your specialized creation code here 
	POSITION pos = GetFirstViewPosition(); 
	CVueView* pView = NULL; 
	if (pos) { 
 		pView = (CVueView*)GetNextView(pos); 
		if (pView && pView->m_AvXCtrl.GetSafeHwnd()) { 
		// 	if(!pView->m_AvXCtrl.GetMode() == 1) {//Markup mode 
		// 	} 
			pView->m_AvXCtrl.SetSrc(lpszPathName); 
		} 
		 
	} 
	 
	return TRUE; 
} 
 
 
void CVueDoc::OnCloseDocument()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
 	POSITION pos = GetFirstViewPosition(); 
	CVueView* pView = NULL; 
	if (pos) { 
		pView = (CVueView*)GetNextView(pos); 
		if (pView && pView->m_AvXCtrl.GetSafeHwnd()) { 
			if(pView->m_AvXCtrl.GetMode() == 1) { 
				// Markup Mode 
				pView->m_AvXCtrl.ExitMarkupMode(); 
			} 
		} 
	} 
 
	CDocument::OnCloseDocument(); 
 
}