void DocumentViewerImpl::Notify(nsIImageGroup *aImageGroup, nsImageGroupNotification aNotificationType) {     if (aNotificationType == nsImageGroupNotification_kStartedLoading) { mIsPrinting = PR_TRUE;
NS_IMETHOD_(void) Notify(nsITimer *timer) { if (mPresContext && mDocViewer) { PRPackedBool initNewTimer = PR_TRUE;    PRBool donePrinting = mDocViewer->PrintPage(mPresContext, mPrintOptions, mPrintObj); if (donePrinting) {  if (mDocViewer->DonePrintingPages(mPrintObj)) { initNewTimer = PR_FALSE; } }  Stop(); if (initNewTimer) { nsresult result = StartTimer(); if (NS_FAILED(result)) { donePrinting = PR_TRUE; gCurrentlyPrinting = PR_FALSE; } } }
void DocumentViewerImpl::Notify(nsIImageGroup *aImageGroup,                                nsImageGroupNotification aNotificationType){  //  // Image are being loaded...  Set the flag to delay printing until  // all images are loaded.  //  if (aNotificationType == nsImageGroupNotification_kStartedLoading) {    mIsPrinting = PR_TRUE;  }  //  // All the images have been loaded, so the document is ready to print.  //  // However, at this point we are unable to release the resources that  // were allocated for printing...  This is because ImgLib resources will  // be deleted and *this* is an ImgLib notification routine.  So, fire an   // event to do the actual printing.  //  else if(aNotificationType == nsImageGroupNotification_kFinishedLoading) {    nsresult rv;    nsCOMPtr<nsIEventQueue> eventQ;    // Get the event queue of the current thread...    nsCOMPtr<nsIEventQueueService> eventQService =              do_GetService(kEventQueueService, &rv);    if (NS_FAILED(rv)) return;    rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD,                                             getter_AddRefs(eventQ));    if (NS_FAILED(rv)) return;    PRStatus status;    PLEvent *event = new PLEvent;      if (!event) return;    //    // AddRef this because it is being placed in the PLEvent struct.    // It will be Released when DestroyPLEvent is called...    //    NS_ADDREF_THIS();    PL_InitEvent(event,                  this,                 (PLHandleEventProc)  DocumentViewerImpl::HandlePLEvent,                 (PLDestroyEventProc) DocumentViewerImpl::DestroyPLEvent);    status = eventQ->PostEvent(event);  }}