www.pudn.com > 0621CAchive.rar > 0621CAchiveDoc.cpp
// 0621CAchiveDoc.cpp : implementation of the CMy0621CAchiveDoc class
//
#include "stdafx.h"
#include "0621CAchive.h"
#include "Line.h"
#include "0621CAchiveDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMy0621CAchiveDoc
IMPLEMENT_DYNCREATE(CMy0621CAchiveDoc, CDocument)
BEGIN_MESSAGE_MAP(CMy0621CAchiveDoc, CDocument)
//{{AFX_MSG_MAP(CMy0621CAchiveDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CMy0621CAchiveDoc construction/destruction
CMy0621CAchiveDoc::CMy0621CAchiveDoc()
{
// TODO: add one-time construction code here
}
CMy0621CAchiveDoc::~CMy0621CAchiveDoc()
{
}
BOOL CMy0621CAchiveDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMy0621CAchiveDoc serialization
void CMy0621CAchiveDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
// ar<> m_ptFrom>>m_ptTo;
}
m_oaLine.Serialize(ar);
}
/////////////////////////////////////////////////////////////////////////////
// CMy0621CAchiveDoc diagnostics
#ifdef _DEBUG
void CMy0621CAchiveDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMy0621CAchiveDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMy0621CAchiveDoc commands
CLine * CMy0621CAchiveDoc::AddLine(CPoint ptFrom, CPoint ptTo)
{
CLine* pLine=new CLine(ptFrom, ptTo);
/*try
{*/
m_oaLine.Add(pLine);
SetModifiedFlag();
/*}
catch(CMemoryException *perr)
{
if(pLine)
{
delete pLine;
pLine=NULL;
}
perr->Delete();
}*/
return pLine;
}
int CMy0621CAchiveDoc::GetLineCount()
{
return m_oaLine.GetSize();
}
CLine * CMy0621CAchiveDoc::GetLine(int index)
{
return (CLine*) m_oaLine[index];
}