【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,TextViewerDoc.cpp,希望对大家有所帮助!
// TextViewerDoc.cpp : CTextViewerDoc 类的实现
//
#include "stdafx.h"
#include "TextViewer.h"
#include "TextViewerDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CTextViewerDoc
IMPLEMENT_DYNCREATE(CTextViewerDoc, CDocument)
BEGIN_MESSAGE_MAP(CTextViewerDoc, CDocument)
END_MESSAGE_MAP()
// CTextViewerDoc 构造/销毁
CTextViewerDoc::CTextViewerDoc()
{
// TODO:在此添加一次性构造代码
}
CTextViewerDoc::~CTextViewerDoc()
{
}
BOOL CTextViewerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO:在此添加重新初始化代码
// (SDI
文档将重用该
文档)
return TRUE;
}
// CTextViewerDoc 序列化
void CTextViewerDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO:在此添加存储代码
}
else
{
// TODO:在此添加加载代码
CString str;
while ( ar.ReadString( str ) )
{
m_strContent.Add( str ); // 将行文本添加到字符串集合类对象中
}
}
}
// CTextViewerDoc 诊断
#ifdef _DEBUG
void CTextViewerDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CTextViewerDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// CTextViewerDoc 命令
void CTextViewerDoc::DeleteContents()
{
// TODO: 在此添加专用代码和/或调用基类
m_strContent.RemoveAll(); // 清除集合类对象中的内容
CDocument::DeleteContents(); // 框加自动添加的基类调用
}