if (!isCancelled && !mIsAborted) { rv = mPrintDC->EndDocument(); } else { rv = mPrintDC->AbortDocument(); } if (NS_FAILED(rv)) { DocumentViewerImpl::ShowPrintErrorDialog(rv);
if (mType == eIsPrinting) { if (!isCancelled && !mIsAborted) { rv = mPrintDC->EndDocument(); } else { rv = mPrintDC->AbortDocument(); } if (NS_FAILED(rv)) { DocumentViewerImpl::ShowPrintErrorDialog(rv); }
PrintData::~PrintData(){  // Set the cached Zoom value back into the DC  if (mPrintDC) {    mPrintDC->SetTextZoom(mOrigTextZoom);    mPrintDC->SetZoom(mOrigZoom);  }  // removed any cached  if (mCachedPresObj) {    delete mCachedPresObj;  }  // remove the event listeners  if (mPPEventListeners) {    mPPEventListeners->RemoveListeners();    NS_RELEASE(mPPEventListeners);  }  // Only Send an OnEndPrinting if we have started printing  if (mOnStartSent) {    OnEndPrinting();  }  if (mPrintDC && !mDebugFilePtr) {#ifdef DEBUG_PRINTING    fprintf(mDebugFD, "****************** End Document ************************\n");#endif    PRBool isCancelled = PR_FALSE;    mPrintSettings->GetIsCancelled(&isCancelled);    nsresult rv = NS_OK;    if (!isCancelled && !mIsAborted) {      rv = mPrintDC->EndDocument();    } else {      rv = mPrintDC->AbortDocument();    }    if (NS_FAILED(rv)) {      DocumentViewerImpl::ShowPrintErrorDialog(rv);    }  }  delete mPrintObject;  if (mPrintDocList != nsnull) {    mPrintDocList->Clear();    delete mPrintDocList;  }  if (mBrandName) {    nsCRT::free(mBrandName);  }#ifdef DEBUG_PRINTING  fclose(mDebugFD);#endif  DocumentViewerImpl::mIsDoingPrinting = PR_FALSE;  for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {    nsIWebProgressListener* wpl = NS_STATIC_CAST(nsIWebProgressListener*, mPrintProgressListeners.ElementAt(i));    NS_ASSERTION(wpl, "nsIWebProgressListener is NULL!");    NS_RELEASE(wpl);  }}