home *** CD-ROM | disk | FTP | other *** search
- // $$VAL:BaseDocCpp$$ : implementation of the $$VAL:BaseDocClass$$ class
- //
-
- #include "stdafx.h"
- #include "$$VAL:ResInclude$$"
-
- #include "$$VAL:BaseDocHeader$$"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // $$VAL:BaseDocClass$$
-
- IMPLEMENT_DYNCREATE($$VAL:BaseDocClass$$, CDocument)
-
- BEGIN_MESSAGE_MAP($$VAL:BaseDocClass$$, CDocument)
- //{{AFX_MSG_MAP($$VAL:BaseDocClass$$)
- // 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()
-
- /////////////////////////////////////////////////////////////////////////////
- // $$VAL:BaseDocClass$$ construction/destruction
-
- $$VAL:BaseDocClass$$::$$VAL:BaseDocClass$$()
- {
- m_hMetaFile = NULL;
- }
-
- $$VAL:BaseDocClass$$::~$$VAL:BaseDocClass$$()
- {
- }
-
- BOOL $$VAL:BaseDocClass$$::OnNewDocument()
- {
- if (!CDocument::OnNewDocument())
- return FALSE;
-
- // TODO: add reinitialization code here
- // (SDI documents will reuse this document)
-
- m_hMetaFile = NULL;
-
- return TRUE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // $$VAL:BaseDocClass$$ diagnostics
-
- #ifdef _DEBUG
- void $$VAL:BaseDocClass$$::AssertValid() const
- {
- CDocument::AssertValid();
- }
-
- void $$VAL:BaseDocClass$$::Dump(CDumpContext& dc) const
- {
- CDocument::Dump(dc);
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // $$VAL:BaseDocClass$$ commands
-
- void $$VAL:BaseDocClass$$::OnCloseDocument()
- {
- if (m_hMetaFile != NULL)
- {
- VERIFY (::DeleteEnhMetaFile (m_hMetaFile));
- m_hMetaFile = NULL;
- }
-
- CDocument::OnCloseDocument();
- }
-
- BOOL $$VAL:BaseDocClass$$::OnOpenDocument(LPCTSTR lpszPathName)
- {
- if (IsModified())
- TRACE0("Warning: OnOpenDocument replaces an unsaved document.\n");
-
- DeleteContents();
- m_hMetaFile = ::GetEnhMetaFile (lpszPathName);
-
- SetModifiedFlag(FALSE); // start off with unmodified
-
- #ifdef _MAC
- WIN32_FIND_DATA fileData;
- HANDLE hFind = FindFirstFile(lpszPathName, &fileData);
- ASSERT(hFind != (HANDLE)-1);
- VERIFY(FindClose(hFind));
-
- if ((fileData.wFinderFlags & kIsStationery) != 0)
- {
- SetModifiedFlag();
- if (m_pDocTemplate != NULL)
- m_pDocTemplate->SetDefaultTitle(this);
-
- // normally SetPathName would do this, but we aren't calling it
- AfxGetApp()->AddToRecentFileList(lpszPathName);
- }
- #endif
-
- return (m_hMetaFile != NULL);
- }
-