📄 sdbmsdemodoc.cpp
字号:
// SdbmsDemoDoc.cpp : implementation of the CSdbmsDemoDoc class
//
#include "stdafx.h"
#include "SdbmsDemo.h"
#include "SdbmsDemoDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSdbmsDemoDoc
IMPLEMENT_DYNCREATE(CSdbmsDemoDoc, CDocument)
BEGIN_MESSAGE_MAP(CSdbmsDemoDoc, CDocument)
//{{AFX_MSG_MAP(CSdbmsDemoDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CSdbmsDemoDoc construction/destruction
#pragma warning(disable:4355)
CSdbmsDemoDoc::CSdbmsDemoDoc() : m_xTextBuffer(this)
{
// TODO: add one-time construction code here
}
CSdbmsDemoDoc::~CSdbmsDemoDoc()
{
}
BOOL CSdbmsDemoDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
// m_xTextBuffer.FreeAll();
m_xTextBuffer.InitNew();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CSdbmsDemoDoc serialization
void CSdbmsDemoDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CSdbmsDemoDoc diagnostics
#ifdef _DEBUG
void CSdbmsDemoDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CSdbmsDemoDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSdbmsDemoDoc commands
BOOL CSdbmsDemoDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
m_xTextBuffer.FreeAll();
return m_xTextBuffer.LoadFromFile(lpszPathName);
// return TRUE;
}
void CSdbmsDemoDoc::OnCloseDocument()
{
// TODO: Add your specialized code here and/or call the base class
m_xTextBuffer.FreeAll();
CDocument::OnCloseDocument();
}
BOOL CSdbmsDemoDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
// TODO: Add your specialized code here and/or call the base class
m_xTextBuffer.SaveToFile(lpszPathName);
return TRUE;
// return CDocument::OnSaveDocument(lpszPathName);
}
void CSdbmsDemoDoc::SetModifiedFlag(BOOL bModified/*=TRUE*/)
{
CString strTitle = GetTitle();
CString strDirtyFlag = "*";
if (!IsModified() && bModified)
SetTitle(strTitle + strDirtyFlag);
else if (IsModified() && !bModified)
{
int nTitleLength = strTitle.GetLength();
int nDirtyLength = strDirtyFlag.GetLength();
SetTitle(strTitle.Left(nTitleLength - nDirtyLength));
}
CDocument::SetModifiedFlag(bModified);
}
void CSdbmsDemoDoc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
CDocument::DeleteContents();
m_xTextBuffer.FreeAll();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -