1 // HelpEdDoc.cpp : implementation of the CHelpEdDoc class
12 static char THIS_FILE[] = __FILE__;
15 /////////////////////////////////////////////////////////////////////////////
18 IMPLEMENT_DYNCREATE(CHelpEdDoc, CDocument)
20 BEGIN_MESSAGE_MAP(CHelpEdDoc, CDocument)
21 //{{AFX_MSG_MAP(CHelpEdDoc)
22 // NOTE - the ClassWizard will add and remove mapping macros here.
23 // DO NOT EDIT what you see in these blocks of generated code!
27 /////////////////////////////////////////////////////////////////////////////
28 // CHelpEdDoc construction/destruction
30 CHelpEdDoc::CHelpEdDoc()
32 // TODO: add one-time construction code here
36 CHelpEdDoc::~CHelpEdDoc()
40 BOOL CHelpEdDoc::OnNewDocument()
42 if (!CDocument::OnNewDocument())
45 // TODO: add reinitialization code here
46 // (SDI documents will reuse this document)
53 /////////////////////////////////////////////////////////////////////////////
54 // CHelpEdDoc serialization
56 void CHelpEdDoc::Serialize(CArchive& ar)
60 // TODO: add storing code here
64 // TODO: add loading code here
68 /////////////////////////////////////////////////////////////////////////////
69 // CHelpEdDoc diagnostics
72 void CHelpEdDoc::AssertValid() const
74 CDocument::AssertValid();
77 void CHelpEdDoc::Dump(CDumpContext& dc) const
83 /////////////////////////////////////////////////////////////////////////////
84 // CHelpEdDoc commands
86 HelpEdLine * CHelpEdDoc::AddLine(CPoint pointFrom, CPoint pointTo)
89 HelpEdLine *newline = new HelpEdLine(pointFrom, pointTo);
91 // add this line to object array
92 line_array.Add(newline);
93 // mark document dirty
96 // check for memory exception
97 catch (CMemoryException* addlineerror) {
98 // display error message in pop box
99 AfxMessageBox("Out of memory", MB_ICONSTOP | MB_OK);
100 // if we created a HelpEdLine object, we should delete it
105 // delete the error message
106 addlineerror->Delete();
111 int CHelpEdDoc::get_line_count()
113 // return line_array size
114 return line_array.GetSize();