if (!mPresShell || mIsDoingPrintPreview) { return NS_OK; }   if (mPreviousViewer) { mPreviousViewer->Destroy(); mPreviousViewer = nsnull; }  if (mDeviceContext) mDeviceContext->FlushFontCache();   mPresShell->EndObservingDocument(); nsCOMPtr<nsISelection> selection;  GetDocumentSelection(getter_AddRefs(selection));  nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));  if (selPrivate && mSelectionListener) selPrivate->RemoveSelectionListener(mSelectionListener);  mPresShell->Destroy();  mPresShell     = nsnull; mPresContext   = nsnull; mViewManager   = nsnull; mWindow        = nsnull; mDeviceContext = nsnull; mParentWidget  = nsnull;  nsCOMPtr<nsIBaseWindow> base_win(do_QueryInterface(mContainer));  if (base_win) { base_win->SetParentWidget(nsnull); }
DocumentViewerImpl::Hide(void){  NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);  NS_PRECONDITION(mWindow, "null window");  if (mWindow) {    mWindow->Show(PR_FALSE);  }  return NS_OK;}