Example #1
0
DviDoc *
DviDoc::GetActiveDocument ()
{
  ASSERT_VALID (AfxGetApp());
  MainFrame *
    pMain = reinterpret_cast<MainFrame*>((AfxGetApp())->m_pMainWnd);
  ASSERT_VALID (pMain);
  MIKTEX_ASSERT (pMain->IsKindOf(RUNTIME_CLASS(MainFrame)));
  CMDIChildWnd * pChild = pMain->MDIGetActive();
  ASSERT_VALID (pChild);
  DviDoc * pDviDoc = reinterpret_cast<DviDoc*>(pChild->GetActiveDocument());
  if (pDviDoc == 0)
    {
      pDviDoc = pLastDoc;
    }
  MIKTEX_ASSERT (pDviDoc != 0);
  MIKTEX_ASSERT (pDviDoc->IsKindOf(RUNTIME_CLASS(DviDoc)));
  return (pDviDoc);
}