BOOL COXChildFrameState::ComputeProperties(CFrameWnd* pFrameWnd) { ASSERT_VALID(this); // Get the position of the frame window ::ZeroMemory(&m_framePlacement, sizeof(WINDOWPLACEMENT)); m_framePlacement.length = sizeof(WINDOWPLACEMENT); if (pFrameWnd != NULL) { VERIFY(pFrameWnd->GetWindowPlacement(&m_framePlacement)); if(!pFrameWnd->IsWindowVisible()) { m_framePlacement.showCmd=SW_HIDE; } } // Get the document and view of this frame CDocument* pDoc = NULL; CView* pView = NULL; if (!GetDocView(pFrameWnd, pDoc, pView)) { TRACE0("COXChildFrameState::ComputeProperties : Failed to get the doc-view for this frame, failing\n"); return FALSE; } // Get the file path of the document if (pDoc != NULL) m_sDocPath = pDoc->GetPathName(); // Store the name of the classes of doc, frame and view if (pDoc != NULL) m_sDocClassName = pDoc->GetRuntimeClass()->m_lpszClassName; if (pFrameWnd != NULL) m_sFrameClassName = pFrameWnd->GetRuntimeClass()->m_lpszClassName; if (pView != NULL) m_sViewClassName = pView->GetRuntimeClass()->m_lpszClassName; EmptySplitterPanes(m_pSplitterPanes); if (m_bSaveSplitterPanes) ComputeSplitterPanes(pFrameWnd); ASSERT_VALID(this); return TRUE; }
void AppState::TellScriptsToSave() { if (_pApp && _fSaveScriptsBeforeRun) { POSITION posDocTemplate = _pApp->GetFirstDocTemplatePosition(); while (posDocTemplate) { CDocTemplate* pDocTemplate = _pApp->GetNextDocTemplate(posDocTemplate); // get each document open in given document template POSITION posDoc = pDocTemplate->GetFirstDocPosition(); while (posDoc) { CDocument* pDoc = pDocTemplate->GetNextDoc(posDoc); if (pDoc->GetRuntimeClass() == RUNTIME_CLASS(CScriptDocument)) { static_cast<CScriptDocument*>(pDoc)->SaveIfModified(); } } } } }