// RGSMRKDoc.cpp : implementation of the CRGSMRKDoc class // #include "stdafx.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CRGSMRKApp theApp; extern void ExitMFCApp(); ///////////////////////////////////////////////////////////////////////////// // CRGSMRKDoc IMPLEMENT_DYNCREATE(CRGSMRKDoc, CDocument) BEGIN_MESSAGE_MAP(CRGSMRKDoc, CDocument) //{{AFX_MSG_MAP(CRGSMRKDoc) // 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() ///////////////////////////////////////////////////////////////////////////// // CRGSMRKDoc construction/destruction CRGSMRKDoc::CRGSMRKDoc() { HRESULT hr; //Create the licensed LTRaster COM object m_pRaster = NULL; hr = theApp.CreateRasterObjectLic(&m_pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER);ExitMFCApp(); return;} m_pRasterFloaterBackground=NULL; hr = theApp.CreateRasterObjectLic(&m_pRasterFloaterBackground); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER);ExitMFCApp(); return;} } CRGSMRKDoc::~CRGSMRKDoc() { m_pRasterFloaterBackground->Release(); m_pRaster->Release(); } BOOL CRGSMRKDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; switch(theApp.m_nOpenMode) { case OPENMODE_PASTE: return OnOpenPaste(); } return TRUE; } BOOL CRGSMRKDoc::OnOpenPaste() { m_pRaster->Paste(PASTE_DOPASTE); return(TRUE); } ///////////////////////////////////////////////////////////////////////////// // CRGSMRKDoc serialization void CRGSMRKDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // TODO: add storing code here } else { // TODO: add loading code here } } ///////////////////////////////////////////////////////////////////////////// // CRGSMRKDoc diagnostics #ifdef _DEBUG void CRGSMRKDoc::AssertValid() const { CDocument::AssertValid(); } void CRGSMRKDoc::Dump(CDumpContext& dc) const { CDocument::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CRGSMRKDoc commands BOOL CRGSMRKDoc::OnOpenDocument(LPCTSTR lpszPathName) { int nRet; if(lpszPathName) { UNLOCKSUPPORT(*m_pRaster); if(((CMainFrame*)theApp.m_pMainWnd)->m_pRaster->GetBitmap()) { m_pRaster->put_RefBitmap(TRUE); m_pRaster->put_Bitmap(((CMainFrame*)theApp.m_pMainWnd)->m_pRaster->GetBitmap()); m_pRaster->put_RefBitmap(FALSE); nRet = m_pRaster->GetBitmap()?0:ERROR_NO_BITMAP; } else { nRet = theApp.m_pRasterIO->Load(m_pRaster, lpszPathName, 0, theApp.m_iPage, 1); } theApp.m_iPage = 1; if(nRet) { theApp.DisplayLEADError(nRet); return(FALSE); } theApp.m_pRasterIO->GetFileInfo(m_pRaster, lpszPathName, theApp.m_iPage, 0); return(TRUE); } return(FALSE); }