From 9712894a192f2daaebc2fb4c243c91d786265cb1 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Tue, 9 Jul 2002 12:39:02 +0000 Subject: [PATCH] Implement progress dialog for printing and PP that show before reflow Bug 154136 r=dcone/sgehani sr=alecf git-svn-id: svn://10.0.0.236/trunk@124840 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 271 +++++++++++++----- .../printingui/src/mac/nsPrintProgress.cpp | 7 +- .../printingui/src/mac/nsPrintProgress.h | 2 + .../printingui/src/os2/nsPrintProgress.cpp | 6 +- .../printingui/src/os2/nsPrintProgress.h | 2 + .../src/os2/nsPrintingPromptService.cpp | 5 +- .../src/unixshared/nsPrintProgress.cpp | 6 +- .../src/unixshared/nsPrintProgress.h | 2 + .../unixshared/nsPrintingPromptService.cpp | 5 +- .../printingui/src/win/nsPrintProgress.cpp | 7 +- .../printingui/src/win/nsPrintProgress.h | 1 + .../src/win/nsPrintingPromptService.cpp | 62 +++- mozilla/layout/base/nsDocumentViewer.cpp | 271 +++++++++++++----- .../xpfe/browser/resources/content/browser.js | 99 +++++-- .../content/printPreviewBindings.xml | 112 +++++++- .../resources/content/utilityOverlay.js | 1 + mozilla/xpfe/global/jar.mn | 3 + .../resources/content/printPreviewProgress.js | 203 +++++++++++++ .../content/printPreviewProgress.xul | 62 ++++ .../global/resources/content/printProgress.js | 78 ++++- .../resources/content/printProgress.xul | 13 +- .../global/resources/locale/en-US/MANIFEST | 1 + .../locale/en-US/printPreviewProgress.dtd | 6 + .../resources/locale/en-US/printProgress.dtd | 9 +- 24 files changed, 1011 insertions(+), 223 deletions(-) create mode 100644 mozilla/xpfe/global/resources/content/printPreviewProgress.js create mode 100644 mozilla/xpfe/global/resources/content/printPreviewProgress.xul create mode 100644 mozilla/xpfe/global/resources/locale/en-US/printPreviewProgress.dtd diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index d0a784c7d71..dc0f868e070 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -158,7 +158,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset // Print Progress #include "nsIPrintProgress.h" #include "nsIPrintProgressParams.h" - +#include "nsIObserver.h" // Print error dialog #include "nsIPrompt.h" @@ -433,7 +433,8 @@ public: nsCOMPtr mPrintProgressListener; nsCOMPtr mPrintProgress; nsCOMPtr mPrintProgressParams; - PRBool mShowProgressDialog; + PRBool mShowProgressDialog; // means we should try to show it + PRPackedBool mProgressDialogIsShown; // means it is already being shown nsCOMPtr mCurrentFocusWin; // cache a pointer to the currently focused window @@ -484,7 +485,8 @@ class DocumentViewerImpl : public nsIDocumentViewer, public nsIContentViewerEdit, public nsIContentViewerFile, public nsIMarkupDocumentViewer, - public nsIWebBrowserPrint + public nsIWebBrowserPrint, + public nsIObserver { friend class nsDocViewerSelectionListener; friend class nsPagePrintTimer; @@ -522,6 +524,9 @@ public: // nsIWebBrowserPrint NS_DECL_NSIWEBBROWSERPRINT + // nsIObserver + NS_DECL_NSIOBSERVER + typedef void (*CallChildFunc)(nsIMarkupDocumentViewer* aViewer, void* aClosure); nsresult CallChildren(CallChildFunc aFunc, void* aClosure); @@ -612,9 +617,14 @@ private: void CalcNumPrintableDocsAndPages(PRInt32& aNumDocs, PRInt32& aNumPages); void DoProgressForAsIsFrames(); void DoProgressForSeparateFrames(); - void DoPrintProgress(PRBool aIsForPrinting); + void ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify); + void CleanUpBeforeReflow(nsresult aResult); + nsresult FinishPrintPreview(); + void CloseProgressDialog(nsIWebProgressListener* aWebProgressListener); + void SetDocAndURLIntoProgress(PrintObject* aPO, nsIPrintProgressParams* aParams); + void ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront); nsresult CheckForPrinters(nsIPrintOptions* aPrintOptions, nsIPrintSettings* aPrintSettings, PRUint32 aErrorCode, @@ -888,7 +898,7 @@ static nsresult NS_NewUpdateTimer(nsPagePrintTimer **aResult) //--------------------------------------------------- PrintData::PrintData(ePrintDataType aType) : mType(aType), mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), - mShowProgressDialog(PR_TRUE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), + mShowProgressDialog(PR_TRUE), mProgressDialogIsShown(PR_FALSE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), mIsParentAFrameSet(PR_FALSE), mPrintingAsIsSubDoc(PR_FALSE), mOnStartSent(PR_FALSE), mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE), mShrinkToFit(PR_FALSE), mPrintFrameType(nsIPrintSettings::kFramesAsIs), @@ -933,7 +943,7 @@ PrintData::~PrintData() } // Only Send an OnEndPrinting if we have started printing - if (mOnStartSent) { + if (mOnStartSent && mType != eIsPrintPreview) { OnEndPrinting(); } @@ -980,7 +990,7 @@ PrintData::~PrintData() void PrintData::OnStartPrinting() { if (!mOnStartSent) { - DoOnProgressChange(mPrintProgressListeners, 100, 100, PR_TRUE, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT); + DoOnProgressChange(mPrintProgressListeners, 0, 0, PR_TRUE, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT); mOnStartSent = PR_TRUE; } } @@ -1128,13 +1138,14 @@ DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext) PrepareToStartLoad(); } -NS_IMPL_ISUPPORTS6(DocumentViewerImpl, +NS_IMPL_ISUPPORTS7(DocumentViewerImpl, nsIContentViewer, nsIDocumentViewer, nsIMarkupDocumentViewer, nsIContentViewerFile, nsIContentViewerEdit, - nsIWebBrowserPrint) + nsIWebBrowserPrint, + nsIObserver) DocumentViewerImpl::~DocumentViewerImpl() { @@ -3916,7 +3927,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink) } } - if (!adjRect.width || !adjRect.height) { + if (!adjRect.width || !adjRect.height || !width || !height) { aPO->mDontPrint = PR_TRUE; return NS_OK; } @@ -4559,6 +4570,11 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, PR_PL(("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages)); DUMP_DOC_TREELAYOUT; + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); + } + mPrt->mPrintDocDW = aCurrentFocusedDOMWin; PRUnichar* fileName = nsnull; @@ -6323,6 +6339,13 @@ void DocumentViewerImpl::CheckForHiddenFrameSetFrames() } } +void +DocumentViewerImpl::CloseProgressDialog(nsIWebProgressListener* aWebProgressListener) +{ + if (aWebProgressListener) { + aWebProgressListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_DOCUMENT, nsnull); + } +} /** --------------------------------------------------- * See documentation above in the nsIContentViewerfile class definition @@ -6336,13 +6359,16 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, nsIDOMWindow *aChildDOMWin, nsIWebProgressListener* aWebProgressListener) { + nsresult rv = NS_OK; + +#ifdef NS_PRINT_PREVIEW if (!mPresShell) { // A frame that's not displayed can't be printed! - return NS_OK; } if (mIsDoingPrinting) { + CloseProgressDialog(aWebProgressListener); return NS_ERROR_FAILURE; } @@ -6352,6 +6378,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, // Temporary code for Bug 136185 nsCOMPtr xulDoc(do_QueryInterface(mDocument)); if (xulDoc) { + CloseProgressDialog(aWebProgressListener); ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL, PR_FALSE); return NS_ERROR_FAILURE; } @@ -6368,12 +6395,11 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) || busyFlags != nsIDocShell::BUSY_FLAGS_NONE) { + CloseProgressDialog(aWebProgressListener); ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP, PR_FALSE); return NS_ERROR_FAILURE; } - nsresult rv = NS_OK; - #if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING) if (!mIsDoingPrintPreview) { if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) { @@ -6382,7 +6408,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, } #endif -#ifdef NS_PRINT_PREVIEW if (mIsDoingPrintPreview) { mOldPrtPreview = mPrtPreview; mPrtPreview = nsnull; @@ -6390,10 +6415,16 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, mPrt = new PrintData(PrintData::eIsPrintPreview); if (!mPrt) { + CloseProgressDialog(aWebProgressListener); mIsCreatingPrintPreview = PR_FALSE; return NS_ERROR_OUT_OF_MEMORY; } + // The WebProgressListener can be QI'ed to nsIPrintingPromptService + // then that means the progress dialog is already being shown. + nsCOMPtr pps(do_QueryInterface(aWebProgressListener)); + mPrt->mProgressDialogIsShown = pps != nsnull; + // Check to see if we need to transfer any of our old values // over to the new PrintData object if (mOldPrtPreview) { @@ -6437,6 +6468,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, rv = NS_ERROR_FAILURE; } if (NS_FAILED(rv)) { + CloseProgressDialog(aWebProgressListener); delete mPrt; mPrt = nsnull; return NS_ERROR_FAILURE; @@ -6588,33 +6620,61 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, mPresShell->EndObservingDocument(); } + if (aWebProgressListener != nsnull) { + mPrt->mPrintProgressListeners.AppendElement((void*)aWebProgressListener); + NS_ADDREF(aWebProgressListener); + } + + PRBool notifyOnInit = PR_FALSE; + ShowPrintProgress(PR_FALSE, notifyOnInit); + + if (!notifyOnInit) { + rv = FinishPrintPreview(); + } else { + rv = NS_OK; + } + +#endif // NS_PRINT_PREVIEW + + return rv; +} + +nsresult +DocumentViewerImpl::FinishPrintPreview() +{ + nsresult rv = NS_OK; + +#ifdef NS_PRINT_PREVIEW + rv = DocumentReadyForPrinting(); mIsCreatingPrintPreview = PR_FALSE; + /* cleaup on failure + notify user */ if (NS_FAILED(rv)) { + /* cleanup done, let's fire-up an error dialog to notify the user + * what went wrong... + */ + mIsCreatingPrintPreview = PR_FALSE; + mIsDoingPrintPreview = PR_FALSE; + mPrt->OnEndPrinting(); + ShowPrintErrorDialog(rv, PR_FALSE); + TurnScriptingOn(PR_TRUE); + if (mPrt) { delete mPrt; mPrt = nsnull; } - - /* cleanup done, let's fire-up an error dialog to notify the user - * what went wrong... - */ - ShowPrintErrorDialog(rv, PR_FALSE); - TurnScriptingOn(PR_TRUE); - mIsCreatingPrintPreview = PR_FALSE; - mIsDoingPrintPreview = PR_FALSE; return rv; } - // At this point we are done preparing everything // before it is to be created // Noew create the new Presentation and display it InstallNewPresentation(); + mPrt->OnEndPrinting(); // PrintPreview was built using the mPrt (code reuse) // then we assign it over mPrtPreview = mPrt; @@ -6634,6 +6694,28 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, } +void +DocumentViewerImpl::ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront) +{ + // Make sure the URLS don't get too long for the progress dialog + if (aStr && nsCRT::strlen(aStr) > aLen) { + if (aDoFront) { + PRUnichar * ptr = &aStr[nsCRT::strlen(aStr)-aLen+3]; + nsAutoString newStr; + newStr.AppendWithConversion("..."); + newStr += ptr; + nsMemory::Free(aStr); + aStr = ToNewUnicode(newStr); + } else { + nsAutoString newStr(aStr); + newStr.SetLength(aLen-3); + newStr.AppendWithConversion("..."); + nsMemory::Free(aStr); + aStr = ToNewUnicode(newStr); + } + } +} + void DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, nsIPrintProgressParams* aParams) @@ -6651,15 +6733,9 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); - // Make sure the URLS don't get too long for the progress dialog - if (docURLStr && nsCRT::strlen(docURLStr) > kTitleLength) { - PRUnichar * ptr = &docURLStr[nsCRT::strlen(docURLStr)-kTitleLength+3]; - nsAutoString newURLStr; - newURLStr.AppendWithConversion("..."); - newURLStr += ptr; - nsMemory::Free(docURLStr); - docURLStr = ToNewUnicode(newURLStr); - } + // Make sure the Titles & URLS don't get too long for the progress dialog + ElipseLongString(docTitleStr, kTitleLength, PR_FALSE); + ElipseLongString(docURLStr, kTitleLength, PR_TRUE); aParams->SetDocTitle((const PRUnichar*) docTitleStr); aParams->SetDocURL((const PRUnichar*) docURLStr); @@ -6671,14 +6747,23 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, //---------------------------------------------------------------------- // Set up to use the "pluggable" Print Progress Dialog void -DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) +DocumentViewerImpl::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify) { + // default to not notifying, that if something here goes wrong + // or we aren't going to show the progress dialog we can straight into + // reflowing the doc for printing. + aDoNotify = PR_FALSE; + // Assume we can't do progress and then see if we can mPrt->mShowProgressDialog = PR_FALSE; - nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); - if (prefs) { - prefs->GetBoolPref("print.show_print_progress", &mPrt->mShowProgressDialog); + // if it is already being shown then don't bother to find out if it should be + // so skip this and leave mShowProgressDialog set to FALSE + if (!mPrt->mProgressDialogIsShown) { + nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); + if (prefs) { + prefs->GetBoolPref("print.show_print_progress", &mPrt->mShowProgressDialog); + } } // Turning off the showing of Print Progress in Prefs overrides @@ -6689,18 +6774,20 @@ DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) } // Now open the service to get the progress dialog - nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); - if (printPromptService) { - nsCOMPtr scriptGlobalObject; - mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); - if (!scriptGlobalObject) return; - nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); - if (!domWin) return; + // If we don't get a service, that's ok, then just don't show progress + if (mPrt->mShowProgressDialog) { + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return; - // If we don't get a service, that's ok, then just don't show progress - if (mPrt->mShowProgressDialog) { - PRBool notifyOnOpen; - nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, nsnull, PR_TRUE, getter_AddRefs(mPrt->mPrintProgressListener), getter_AddRefs(mPrt->mPrintProgressParams), ¬ifyOnOpen); + nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, this, aIsForPrinting, + getter_AddRefs(mPrt->mPrintProgressListener), + getter_AddRefs(mPrt->mPrintProgressParams), + &aDoNotify); if (NS_SUCCEEDED(rv)) { mPrt->mShowProgressDialog = mPrt->mPrintProgressListener != nsnull && mPrt->mPrintProgressParams != nsnull; @@ -6753,6 +6840,35 @@ DocumentViewerImpl::Print(PRBool aSilent, } +/** --------------------------------------------------- + * Cleans up when an error occurred + */ +void DocumentViewerImpl::CleanUpBeforeReflow(nsresult aResult) +{ + /* cleanup... */ + if (mPagePrintTimer) { + mPagePrintTimer->Stop(); + NS_RELEASE(mPagePrintTimer); + } + + if (mPrt) { + delete mPrt; + mPrt = nsnull; + } + mIsDoingPrinting = PR_FALSE; + + /* cleanup done, let's fire-up an error dialog to notify the user + * what went wrong... + * + * When rv == NS_ERROR_ABORT, it means we want out of the + * print job without displaying any error messages + */ + if (aResult != NS_ERROR_ABORT) { + ShowPrintErrorDialog(aResult); + } + +} + /** --------------------------------------------------- * From nsIWebBrowserPrint */ @@ -7169,15 +7285,16 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, if (docURLStr) nsMemory::Free(docURLStr); NS_ENSURE_SUCCESS(rv, rv); - DoPrintProgress(PR_TRUE); + PRBool doNotify; + ShowPrintProgress(PR_TRUE, doNotify); - // Print listener setup... - if (mPrt != nsnull) { - mPrt->OnStartPrinting(); + if (!doNotify) { + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); + } + rv = DocumentReadyForPrinting(); } - - rv = DocumentReadyForPrinting(); - PR_PL(("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n")); } } } @@ -7188,28 +7305,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, /* cleaup on failure + notify user */ if (NS_FAILED(rv)) { - /* cleanup... */ - if (mPagePrintTimer) { - mPagePrintTimer->Stop(); - NS_RELEASE(mPagePrintTimer); - } - - if (mPrt) { - delete mPrt; - mPrt = nsnull; - } - mIsDoingPrinting = PR_FALSE; - - /* cleanup done, let's fire-up an error dialog to notify the user - * what went wrong... - * - * When rv == NS_ERROR_ABORT, it means we want out of the - * print job without displaying any error messages - */ - if (rv != NS_ERROR_ABORT) { - ShowPrintErrorDialog(rv); - } - PR_PL(("**** Printing Failed - rv 0x%X", rv)); + CleanUpBeforeReflow(rv); } return rv; @@ -8422,3 +8518,26 @@ DocumentViewerImpl::StartPagePrintTimer(nsIPresContext * aPresContext, return mPagePrintTimer->Start(this, aPresContext, aPrintSettings, aPOect, aDelay); } +/*=============== nsIObserver Interface ======================*/ +NS_IMETHODIMP DocumentViewerImpl::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +{ + nsresult rv = NS_ERROR_FAILURE; + + if (mIsDoingPrinting) { + rv = DocumentReadyForPrinting(); + + /* cleaup on failure + notify user */ + if (NS_FAILED(rv)) { + CleanUpBeforeReflow(rv); + } + } else { + rv = FinishPrintPreview(); + if (mPrtPreview) { + mPrtPreview->OnEndPrinting(); + } + rv = NS_OK; + } + + return rv; + +} diff --git a/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.cpp b/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.cpp index 37252ef3a9b..32faa23aff8 100644 --- a/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.cpp +++ b/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.cpp @@ -76,7 +76,9 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, nsIObserver *openDialogObserver, PRBool *notifyOnOpen) { - *notifyOnOpen = PR_FALSE; + *notifyOnOpen = PR_TRUE; + m_observer = openDialogObserver; + nsresult rv = NS_ERROR_FAILURE; if (m_dialog) @@ -186,6 +188,9 @@ NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listen /* void doneIniting (); */ NS_IMETHODIMP nsPrintProgress::DoneIniting() { + if (m_observer) { + m_observer->Observe(nsnull, nsnull, nsnull); + } return NS_OK; } diff --git a/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.h b/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.h index 3dfda452021..51be473405f 100644 --- a/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.h +++ b/mozilla/embedding/components/printingui/src/mac/nsPrintProgress.h @@ -46,6 +46,7 @@ #include "nsISupportsArray.h" #include "nsIDOMWindowInternal.h" #include "nsIPrintStatusFeedback.h" +#include "nsIObserver.h" #include "nsString.h" class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback @@ -69,6 +70,7 @@ private: PRInt32 m_pendingStateValue; nsCOMPtr m_dialog; nsCOMPtr m_listenerList; + nsCOMPtr m_observer; }; #endif diff --git a/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.cpp index 37252ef3a9b..0910c6c4079 100644 --- a/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ b/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.cpp @@ -76,7 +76,8 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, nsIObserver *openDialogObserver, PRBool *notifyOnOpen) { - *notifyOnOpen = PR_FALSE; + *notifyOnOpen = PR_TRUE; + m_observer = openDialogObserver; nsresult rv = NS_ERROR_FAILURE; if (m_dialog) @@ -186,6 +187,9 @@ NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listen /* void doneIniting (); */ NS_IMETHODIMP nsPrintProgress::DoneIniting() { + if (m_observer) { + m_observer->Observe(nsnull, nsnull, nsnull); + } return NS_OK; } diff --git a/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.h b/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.h index 3dfda452021..51be473405f 100644 --- a/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.h +++ b/mozilla/embedding/components/printingui/src/os2/nsPrintProgress.h @@ -46,6 +46,7 @@ #include "nsISupportsArray.h" #include "nsIDOMWindowInternal.h" #include "nsIPrintStatusFeedback.h" +#include "nsIObserver.h" #include "nsString.h" class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback @@ -69,6 +70,7 @@ private: PRInt32 m_pendingStateValue; nsCOMPtr m_dialog; nsCOMPtr m_listenerList; + nsCOMPtr m_observer; }; #endif diff --git a/mozilla/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/mozilla/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp index 6cc70941b22..70ebc0e57ca 100644 --- a/mozilla/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ b/mozilla/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp @@ -59,6 +59,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-se static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul"; static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; +static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; #define NS_DIALOGPARAMBLOCK_CONTRACTID \ @@ -170,7 +171,9 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, if (parentDOMIntl) { - mPrintProgress->OpenProgressDialog(parentDOMIntl, kPrintProgressDialogURL, *printProgressParams, openDialogObserver, notifyOnOpen); + mPrintProgress->OpenProgressDialog(parentDOMIntl, + isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL, + *printProgressParams, openDialogObserver, notifyOnOpen); } } diff --git a/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp b/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp index 8b126ede70c..17cb096e8f5 100644 --- a/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp +++ b/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp @@ -76,7 +76,8 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, nsIObserver *openDialogObserver, PRBool *notifyOnOpen) { - *notifyOnOpen = PR_FALSE; + *notifyOnOpen = PR_TRUE; + m_observer = openDialogObserver; nsresult rv = NS_ERROR_FAILURE; if (m_dialog) @@ -186,6 +187,9 @@ NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listen /* void doneIniting (); */ NS_IMETHODIMP nsPrintProgress::DoneIniting() { + if (m_observer) { + m_observer->Observe(nsnull, nsnull, nsnull); + } return NS_OK; } diff --git a/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.h b/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.h index 3dfda452021..51be473405f 100644 --- a/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.h +++ b/mozilla/embedding/components/printingui/src/unixshared/nsPrintProgress.h @@ -46,6 +46,7 @@ #include "nsISupportsArray.h" #include "nsIDOMWindowInternal.h" #include "nsIPrintStatusFeedback.h" +#include "nsIObserver.h" #include "nsString.h" class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback @@ -69,6 +70,7 @@ private: PRInt32 m_pendingStateValue; nsCOMPtr m_dialog; nsCOMPtr m_listenerList; + nsCOMPtr m_observer; }; #endif diff --git a/mozilla/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp b/mozilla/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp index 9ab066dfdc8..7d1f44d1583 100644 --- a/mozilla/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp +++ b/mozilla/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp @@ -53,6 +53,7 @@ static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul"; static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; +static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; static const char *kPrinterPropertiesURL = "chrome://global/content/printjoboptions.xul"; @@ -165,7 +166,9 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, if (parentDOMIntl) { - mPrintProgress->OpenProgressDialog(parentDOMIntl, kPrintProgressDialogURL, *printProgressParams, openDialogObserver, notifyOnOpen); + mPrintProgress->OpenProgressDialog(parentDOMIntl, + isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL, + *printProgressParams, openDialogObserver, notifyOnOpen); } } diff --git a/mozilla/embedding/components/printingui/src/win/nsPrintProgress.cpp b/mozilla/embedding/components/printingui/src/win/nsPrintProgress.cpp index 516e075b2e4..f08e03135c4 100644 --- a/mozilla/embedding/components/printingui/src/win/nsPrintProgress.cpp +++ b/mozilla/embedding/components/printingui/src/win/nsPrintProgress.cpp @@ -77,7 +77,9 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, nsIObserver *openDialogObserver, PRBool *notifyOnOpen) { - *notifyOnOpen = PR_FALSE; + *notifyOnOpen = PR_TRUE; + m_observer = openDialogObserver; + nsresult rv = NS_ERROR_FAILURE; if (m_dialog) @@ -187,6 +189,9 @@ NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listen /* void doneIniting (); */ NS_IMETHODIMP nsPrintProgress::DoneIniting() { + if (m_observer) { + m_observer->Observe(nsnull, nsnull, nsnull); + } return NS_OK; } diff --git a/mozilla/embedding/components/printingui/src/win/nsPrintProgress.h b/mozilla/embedding/components/printingui/src/win/nsPrintProgress.h index b361d7ad614..5d1e9eaf940 100644 --- a/mozilla/embedding/components/printingui/src/win/nsPrintProgress.h +++ b/mozilla/embedding/components/printingui/src/win/nsPrintProgress.h @@ -71,6 +71,7 @@ private: PRInt32 m_pendingStateValue; nsCOMPtr m_dialog; nsCOMPtr m_listenerList; + nsCOMPtr m_observer; }; #endif diff --git a/mozilla/embedding/components/printingui/src/win/nsPrintingPromptService.cpp b/mozilla/embedding/components/printingui/src/win/nsPrintingPromptService.cpp index 1839484d21f..9df7d4a1434 100644 --- a/mozilla/embedding/components/printingui/src/win/nsPrintingPromptService.cpp +++ b/mozilla/embedding/components/printingui/src/win/nsPrintingPromptService.cpp @@ -56,8 +56,9 @@ #define NS_DIALOGPARAMBLOCK_CONTRACTID "@mozilla.org/embedcomp/dialogparam;1" -static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; -static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; +static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; +static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; +static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; // Static Data static HINSTANCE gInstance; @@ -186,7 +187,7 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin } -//----------------------------------------------------------- +/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */ NS_IMETHODIMP nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, nsIWebBrowserPrint* webBrowserPrint, // ok to be null @@ -201,6 +202,14 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, NS_ENSURE_ARG(printProgressParams); NS_ENSURE_ARG(notifyOnOpen); + if (mPrintProgress) + { + *webProgressListener = nsnull; + *printProgressParams = nsnull; + *notifyOnOpen = PR_FALSE; + return NS_ERROR_FAILURE; + } + nsPrintProgress* prtProgress = new nsPrintProgress(); nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrintProgress)); NS_ENSURE_SUCCESS(rv, rv); @@ -226,7 +235,9 @@ nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, if (parentDOMIntl) { - mPrintProgress->OpenProgressDialog(parentDOMIntl, kPrintProgressDialogURL, *printProgressParams, openDialogObserver, notifyOnOpen); + mPrintProgress->OpenProgressDialog(parentDOMIntl, + isForPrinting?kPrintProgressDialogURL:kPrtPrvProgressDialogURL, + *printProgressParams, openDialogObserver, notifyOnOpen); } } @@ -250,6 +261,15 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p block->SetInt(0, 0); rv = DoDialog(parent, block, printSettings, kPageSetupDialogURL); + // if aWebBrowserPrint is not null then we are printing + // so we want to pass back NS_ERROR_ABORT on cancel + if (NS_SUCCEEDED(rv)) + { + PRInt32 status; + block->GetInt(0, &status); + return status == 0?NS_ERROR_ABORT:NS_OK; + } + return rv; } @@ -321,11 +341,15 @@ nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent, NS_IMETHODIMP nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus) { - if (aStateFlags & STATE_STOP) + if ((aStateFlags & STATE_STOP) && mWebProgressListener) { mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); - mPrintProgress->CloseProgressDialog(PR_TRUE); - mPrintProgress = nsnull; + if (mPrintProgress) + { + mPrintProgress->CloseProgressDialog(PR_TRUE); + } + mPrintProgress = nsnull; + mWebProgressListener = nsnull; } return NS_OK; } @@ -334,28 +358,44 @@ nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest NS_IMETHODIMP nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) { - return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); + if (mWebProgressListener) + { + return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress); + } + return NS_ERROR_FAILURE; } /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */ NS_IMETHODIMP nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location) { - return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location); + if (mWebProgressListener) + { + return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location); + } + return NS_ERROR_FAILURE; } /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ NS_IMETHODIMP nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage) { - return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); + if (mWebProgressListener) + { + return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage); + } + return NS_ERROR_FAILURE; } /* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ NS_IMETHODIMP nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state) { - return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); + if (mWebProgressListener) + { + return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state); + } + return NS_ERROR_FAILURE; } diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index d0a784c7d71..dc0f868e070 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -158,7 +158,7 @@ static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printset // Print Progress #include "nsIPrintProgress.h" #include "nsIPrintProgressParams.h" - +#include "nsIObserver.h" // Print error dialog #include "nsIPrompt.h" @@ -433,7 +433,8 @@ public: nsCOMPtr mPrintProgressListener; nsCOMPtr mPrintProgress; nsCOMPtr mPrintProgressParams; - PRBool mShowProgressDialog; + PRBool mShowProgressDialog; // means we should try to show it + PRPackedBool mProgressDialogIsShown; // means it is already being shown nsCOMPtr mCurrentFocusWin; // cache a pointer to the currently focused window @@ -484,7 +485,8 @@ class DocumentViewerImpl : public nsIDocumentViewer, public nsIContentViewerEdit, public nsIContentViewerFile, public nsIMarkupDocumentViewer, - public nsIWebBrowserPrint + public nsIWebBrowserPrint, + public nsIObserver { friend class nsDocViewerSelectionListener; friend class nsPagePrintTimer; @@ -522,6 +524,9 @@ public: // nsIWebBrowserPrint NS_DECL_NSIWEBBROWSERPRINT + // nsIObserver + NS_DECL_NSIOBSERVER + typedef void (*CallChildFunc)(nsIMarkupDocumentViewer* aViewer, void* aClosure); nsresult CallChildren(CallChildFunc aFunc, void* aClosure); @@ -612,9 +617,14 @@ private: void CalcNumPrintableDocsAndPages(PRInt32& aNumDocs, PRInt32& aNumPages); void DoProgressForAsIsFrames(); void DoProgressForSeparateFrames(); - void DoPrintProgress(PRBool aIsForPrinting); + void ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify); + void CleanUpBeforeReflow(nsresult aResult); + nsresult FinishPrintPreview(); + void CloseProgressDialog(nsIWebProgressListener* aWebProgressListener); + void SetDocAndURLIntoProgress(PrintObject* aPO, nsIPrintProgressParams* aParams); + void ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront); nsresult CheckForPrinters(nsIPrintOptions* aPrintOptions, nsIPrintSettings* aPrintSettings, PRUint32 aErrorCode, @@ -888,7 +898,7 @@ static nsresult NS_NewUpdateTimer(nsPagePrintTimer **aResult) //--------------------------------------------------- PrintData::PrintData(ePrintDataType aType) : mType(aType), mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), - mShowProgressDialog(PR_TRUE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), + mShowProgressDialog(PR_TRUE), mProgressDialogIsShown(PR_FALSE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), mIsParentAFrameSet(PR_FALSE), mPrintingAsIsSubDoc(PR_FALSE), mOnStartSent(PR_FALSE), mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE), mShrinkToFit(PR_FALSE), mPrintFrameType(nsIPrintSettings::kFramesAsIs), @@ -933,7 +943,7 @@ PrintData::~PrintData() } // Only Send an OnEndPrinting if we have started printing - if (mOnStartSent) { + if (mOnStartSent && mType != eIsPrintPreview) { OnEndPrinting(); } @@ -980,7 +990,7 @@ PrintData::~PrintData() void PrintData::OnStartPrinting() { if (!mOnStartSent) { - DoOnProgressChange(mPrintProgressListeners, 100, 100, PR_TRUE, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT); + DoOnProgressChange(mPrintProgressListeners, 0, 0, PR_TRUE, nsIWebProgressListener::STATE_START|nsIWebProgressListener::STATE_IS_DOCUMENT); mOnStartSent = PR_TRUE; } } @@ -1128,13 +1138,14 @@ DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext) PrepareToStartLoad(); } -NS_IMPL_ISUPPORTS6(DocumentViewerImpl, +NS_IMPL_ISUPPORTS7(DocumentViewerImpl, nsIContentViewer, nsIDocumentViewer, nsIMarkupDocumentViewer, nsIContentViewerFile, nsIContentViewerEdit, - nsIWebBrowserPrint) + nsIWebBrowserPrint, + nsIObserver) DocumentViewerImpl::~DocumentViewerImpl() { @@ -3916,7 +3927,7 @@ DocumentViewerImpl::ReflowPrintObject(PrintObject * aPO, PRBool aDoCalcShrink) } } - if (!adjRect.width || !adjRect.height) { + if (!adjRect.width || !adjRect.height || !width || !height) { aPO->mDontPrint = PR_TRUE; return NS_OK; } @@ -4559,6 +4570,11 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, PR_PL(("--- Printing %d docs and %d pages\n", mPrt->mNumPrintableDocs, mPrt->mNumPrintablePages)); DUMP_DOC_TREELAYOUT; + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); + } + mPrt->mPrintDocDW = aCurrentFocusedDOMWin; PRUnichar* fileName = nsnull; @@ -6323,6 +6339,13 @@ void DocumentViewerImpl::CheckForHiddenFrameSetFrames() } } +void +DocumentViewerImpl::CloseProgressDialog(nsIWebProgressListener* aWebProgressListener) +{ + if (aWebProgressListener) { + aWebProgressListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP|nsIWebProgressListener::STATE_IS_DOCUMENT, nsnull); + } +} /** --------------------------------------------------- * See documentation above in the nsIContentViewerfile class definition @@ -6336,13 +6359,16 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, nsIDOMWindow *aChildDOMWin, nsIWebProgressListener* aWebProgressListener) { + nsresult rv = NS_OK; + +#ifdef NS_PRINT_PREVIEW if (!mPresShell) { // A frame that's not displayed can't be printed! - return NS_OK; } if (mIsDoingPrinting) { + CloseProgressDialog(aWebProgressListener); return NS_ERROR_FAILURE; } @@ -6352,6 +6378,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, // Temporary code for Bug 136185 nsCOMPtr xulDoc(do_QueryInterface(mDocument)); if (xulDoc) { + CloseProgressDialog(aWebProgressListener); ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL, PR_FALSE); return NS_ERROR_FAILURE; } @@ -6368,12 +6395,11 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) || busyFlags != nsIDocShell::BUSY_FLAGS_NONE) { + CloseProgressDialog(aWebProgressListener); ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP, PR_FALSE); return NS_ERROR_FAILURE; } - nsresult rv = NS_OK; - #if defined(XP_PC) && defined(EXTENDED_DEBUG_PRINTING) if (!mIsDoingPrintPreview) { if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) { @@ -6382,7 +6408,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, } #endif -#ifdef NS_PRINT_PREVIEW if (mIsDoingPrintPreview) { mOldPrtPreview = mPrtPreview; mPrtPreview = nsnull; @@ -6390,10 +6415,16 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, mPrt = new PrintData(PrintData::eIsPrintPreview); if (!mPrt) { + CloseProgressDialog(aWebProgressListener); mIsCreatingPrintPreview = PR_FALSE; return NS_ERROR_OUT_OF_MEMORY; } + // The WebProgressListener can be QI'ed to nsIPrintingPromptService + // then that means the progress dialog is already being shown. + nsCOMPtr pps(do_QueryInterface(aWebProgressListener)); + mPrt->mProgressDialogIsShown = pps != nsnull; + // Check to see if we need to transfer any of our old values // over to the new PrintData object if (mOldPrtPreview) { @@ -6437,6 +6468,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, rv = NS_ERROR_FAILURE; } if (NS_FAILED(rv)) { + CloseProgressDialog(aWebProgressListener); delete mPrt; mPrt = nsnull; return NS_ERROR_FAILURE; @@ -6588,33 +6620,61 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, mPresShell->EndObservingDocument(); } + if (aWebProgressListener != nsnull) { + mPrt->mPrintProgressListeners.AppendElement((void*)aWebProgressListener); + NS_ADDREF(aWebProgressListener); + } + + PRBool notifyOnInit = PR_FALSE; + ShowPrintProgress(PR_FALSE, notifyOnInit); + + if (!notifyOnInit) { + rv = FinishPrintPreview(); + } else { + rv = NS_OK; + } + +#endif // NS_PRINT_PREVIEW + + return rv; +} + +nsresult +DocumentViewerImpl::FinishPrintPreview() +{ + nsresult rv = NS_OK; + +#ifdef NS_PRINT_PREVIEW + rv = DocumentReadyForPrinting(); mIsCreatingPrintPreview = PR_FALSE; + /* cleaup on failure + notify user */ if (NS_FAILED(rv)) { + /* cleanup done, let's fire-up an error dialog to notify the user + * what went wrong... + */ + mIsCreatingPrintPreview = PR_FALSE; + mIsDoingPrintPreview = PR_FALSE; + mPrt->OnEndPrinting(); + ShowPrintErrorDialog(rv, PR_FALSE); + TurnScriptingOn(PR_TRUE); + if (mPrt) { delete mPrt; mPrt = nsnull; } - - /* cleanup done, let's fire-up an error dialog to notify the user - * what went wrong... - */ - ShowPrintErrorDialog(rv, PR_FALSE); - TurnScriptingOn(PR_TRUE); - mIsCreatingPrintPreview = PR_FALSE; - mIsDoingPrintPreview = PR_FALSE; return rv; } - // At this point we are done preparing everything // before it is to be created // Noew create the new Presentation and display it InstallNewPresentation(); + mPrt->OnEndPrinting(); // PrintPreview was built using the mPrt (code reuse) // then we assign it over mPrtPreview = mPrt; @@ -6634,6 +6694,28 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings, } +void +DocumentViewerImpl::ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront) +{ + // Make sure the URLS don't get too long for the progress dialog + if (aStr && nsCRT::strlen(aStr) > aLen) { + if (aDoFront) { + PRUnichar * ptr = &aStr[nsCRT::strlen(aStr)-aLen+3]; + nsAutoString newStr; + newStr.AppendWithConversion("..."); + newStr += ptr; + nsMemory::Free(aStr); + aStr = ToNewUnicode(newStr); + } else { + nsAutoString newStr(aStr); + newStr.SetLength(aLen-3); + newStr.AppendWithConversion("..."); + nsMemory::Free(aStr); + aStr = ToNewUnicode(newStr); + } + } +} + void DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, nsIPrintProgressParams* aParams) @@ -6651,15 +6733,9 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); - // Make sure the URLS don't get too long for the progress dialog - if (docURLStr && nsCRT::strlen(docURLStr) > kTitleLength) { - PRUnichar * ptr = &docURLStr[nsCRT::strlen(docURLStr)-kTitleLength+3]; - nsAutoString newURLStr; - newURLStr.AppendWithConversion("..."); - newURLStr += ptr; - nsMemory::Free(docURLStr); - docURLStr = ToNewUnicode(newURLStr); - } + // Make sure the Titles & URLS don't get too long for the progress dialog + ElipseLongString(docTitleStr, kTitleLength, PR_FALSE); + ElipseLongString(docURLStr, kTitleLength, PR_TRUE); aParams->SetDocTitle((const PRUnichar*) docTitleStr); aParams->SetDocURL((const PRUnichar*) docURLStr); @@ -6671,14 +6747,23 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, //---------------------------------------------------------------------- // Set up to use the "pluggable" Print Progress Dialog void -DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) +DocumentViewerImpl::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify) { + // default to not notifying, that if something here goes wrong + // or we aren't going to show the progress dialog we can straight into + // reflowing the doc for printing. + aDoNotify = PR_FALSE; + // Assume we can't do progress and then see if we can mPrt->mShowProgressDialog = PR_FALSE; - nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); - if (prefs) { - prefs->GetBoolPref("print.show_print_progress", &mPrt->mShowProgressDialog); + // if it is already being shown then don't bother to find out if it should be + // so skip this and leave mShowProgressDialog set to FALSE + if (!mPrt->mProgressDialogIsShown) { + nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); + if (prefs) { + prefs->GetBoolPref("print.show_print_progress", &mPrt->mShowProgressDialog); + } } // Turning off the showing of Print Progress in Prefs overrides @@ -6689,18 +6774,20 @@ DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) } // Now open the service to get the progress dialog - nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); - if (printPromptService) { - nsCOMPtr scriptGlobalObject; - mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); - if (!scriptGlobalObject) return; - nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); - if (!domWin) return; + // If we don't get a service, that's ok, then just don't show progress + if (mPrt->mShowProgressDialog) { + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return; - // If we don't get a service, that's ok, then just don't show progress - if (mPrt->mShowProgressDialog) { - PRBool notifyOnOpen; - nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, nsnull, PR_TRUE, getter_AddRefs(mPrt->mPrintProgressListener), getter_AddRefs(mPrt->mPrintProgressParams), ¬ifyOnOpen); + nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, this, aIsForPrinting, + getter_AddRefs(mPrt->mPrintProgressListener), + getter_AddRefs(mPrt->mPrintProgressParams), + &aDoNotify); if (NS_SUCCEEDED(rv)) { mPrt->mShowProgressDialog = mPrt->mPrintProgressListener != nsnull && mPrt->mPrintProgressParams != nsnull; @@ -6753,6 +6840,35 @@ DocumentViewerImpl::Print(PRBool aSilent, } +/** --------------------------------------------------- + * Cleans up when an error occurred + */ +void DocumentViewerImpl::CleanUpBeforeReflow(nsresult aResult) +{ + /* cleanup... */ + if (mPagePrintTimer) { + mPagePrintTimer->Stop(); + NS_RELEASE(mPagePrintTimer); + } + + if (mPrt) { + delete mPrt; + mPrt = nsnull; + } + mIsDoingPrinting = PR_FALSE; + + /* cleanup done, let's fire-up an error dialog to notify the user + * what went wrong... + * + * When rv == NS_ERROR_ABORT, it means we want out of the + * print job without displaying any error messages + */ + if (aResult != NS_ERROR_ABORT) { + ShowPrintErrorDialog(aResult); + } + +} + /** --------------------------------------------------- * From nsIWebBrowserPrint */ @@ -7169,15 +7285,16 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, if (docURLStr) nsMemory::Free(docURLStr); NS_ENSURE_SUCCESS(rv, rv); - DoPrintProgress(PR_TRUE); + PRBool doNotify; + ShowPrintProgress(PR_TRUE, doNotify); - // Print listener setup... - if (mPrt != nsnull) { - mPrt->OnStartPrinting(); + if (!doNotify) { + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); + } + rv = DocumentReadyForPrinting(); } - - rv = DocumentReadyForPrinting(); - PR_PL(("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n")); } } } @@ -7188,28 +7305,7 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, /* cleaup on failure + notify user */ if (NS_FAILED(rv)) { - /* cleanup... */ - if (mPagePrintTimer) { - mPagePrintTimer->Stop(); - NS_RELEASE(mPagePrintTimer); - } - - if (mPrt) { - delete mPrt; - mPrt = nsnull; - } - mIsDoingPrinting = PR_FALSE; - - /* cleanup done, let's fire-up an error dialog to notify the user - * what went wrong... - * - * When rv == NS_ERROR_ABORT, it means we want out of the - * print job without displaying any error messages - */ - if (rv != NS_ERROR_ABORT) { - ShowPrintErrorDialog(rv); - } - PR_PL(("**** Printing Failed - rv 0x%X", rv)); + CleanUpBeforeReflow(rv); } return rv; @@ -8422,3 +8518,26 @@ DocumentViewerImpl::StartPagePrintTimer(nsIPresContext * aPresContext, return mPagePrintTimer->Start(this, aPresContext, aPrintSettings, aPOect, aDelay); } +/*=============== nsIObserver Interface ======================*/ +NS_IMETHODIMP DocumentViewerImpl::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) +{ + nsresult rv = NS_ERROR_FAILURE; + + if (mIsDoingPrinting) { + rv = DocumentReadyForPrinting(); + + /* cleaup on failure + notify user */ + if (NS_FAILED(rv)) { + CleanUpBeforeReflow(rv); + } + } else { + rv = FinishPrintPreview(); + if (mPrtPreview) { + mPrtPreview->OnEndPrinting(); + } + rv = NS_OK; + } + + return rv; + +} diff --git a/mozilla/xpfe/browser/resources/content/browser.js b/mozilla/xpfe/browser/resources/content/browser.js index 821949203d4..f072c3975de 100644 --- a/mozilla/xpfe/browser/resources/content/browser.js +++ b/mozilla/xpfe/browser/resources/content/browser.js @@ -45,6 +45,7 @@ var gPrintSettings = null; var gChromeState = null; // chrome state before we went into print preview var gOldCloseHandler = null; // close handler before we went into print preview var gInPrintPreviewMode = false; +var gWebProgress = null; function getWebNavigation() { @@ -205,32 +206,95 @@ function GetPrintSettings() return gPrintSettings; } +// This observer is called once the progress dialog has been "opened" +var gPrintPreviewObs = { + observe: function(aSubject, aTopic, aData) + { + setTimeout(FinishPrintPreview, 0); + }, + + QueryInterface : function(iid) + { + if (iid.equals(Components.interfaces.nsIObserver) || iid.equals(Components.interfaces.nsISupportsWeakReference)) + return this; + + throw Components.results.NS_NOINTERFACE; + } +}; + function BrowserPrintPreview() +{ + var ifreq; + var webBrowserPrint; + try { + ifreq = _content.QueryInterface(Components.interfaces.nsIInterfaceRequestor); + webBrowserPrint = ifreq.getInterface(Components.interfaces.nsIWebBrowserPrint); + gPrintSettings = GetPrintSettings(); + + } catch (e) { + // Pressing cancel is expressed as an NS_ERROR_ABORT return value, + // causing an exception to be thrown which we catch here. + // Unfortunately this will also consume helpful failures, so add a + // dump(e); // if you need to debug + } + + // Here we get the PrintingPromptService tso we can display the PP Progress from script + // For the browser implemented via XUL with the PP toolbar we cannot let it be + // automatically opened from the print engine because the XUL scrollbars in the PP window + // will layout before the content window and a crash will occur. + // + // Doing it all from script, means it lays out before hand and we can let printing do it's own thing + gWebProgress = new Object(); + + var printPreviewParams = new Object(); + var notifyOnOpen = new Object(); + var printingPromptService = Components.classes["@mozilla.org/embedcomp/printingprompt-service;1"] + .getService(Components.interfaces.nsIPrintingPromptService); + if (printingPromptService) { + // just in case we are already printing, + // an error code could be returned if the Prgress Dialog is already displayed + try { + printingPromptService.showProgress(this, webBrowserPrint, gPrintSettings, gPrintPreviewObs, false, gWebProgress, + printPreviewParams, notifyOnOpen); + if (printPreviewParams.value) { + var webNav = getWebNavigation(); + printPreviewParams.value.docTitle = webNav.document.title; + printPreviewParams.value.docURL = webNav.currentURI.spec; + } + + // this tells us whether we should continue on with PP or + // wait for the callback via the observer + if (!notifyOnOpen.value.valueOf() || gWebProgress.value == null) { + FinishPrintPreview(); + } + } catch (e) {} + } +} + +function FinishPrintPreview() { gInPrintPreviewMode = true; var browser = getBrowser(); - browser.setAttribute("handleCtrlPageUpDown", "false"); - - var mainWin = document.getElementById("main-window"); - - // save previous close handler to restoreon exiting print preview mode - if (mainWin.hasAttribute("onclose")) - gOldCloseHandler = mainWin.getAttribute("onclose"); - else - gOldCloseHandler = null; - mainWin.setAttribute("onclose", "BrowserExitPrintPreview(); return false;"); - try { - var ifreq = _content.QueryInterface( - Components.interfaces.nsIInterfaceRequestor); - var webBrowserPrint = ifreq.getInterface( - Components.interfaces.nsIWebBrowserPrint); + var ifreq = _content.QueryInterface(Components.interfaces.nsIInterfaceRequestor); + var webBrowserPrint = ifreq.getInterface(Components.interfaces.nsIWebBrowserPrint); if (webBrowserPrint) { gPrintSettings = GetPrintSettings(); - webBrowserPrint.printPreview(gPrintSettings, null, null); + webBrowserPrint.printPreview(gPrintSettings, null, gWebProgress.value); } + browser.setAttribute("handleCtrlPageUpDown", "false"); + + var mainWin = document.getElementById("main-window"); + + // save previous close handler to restoreon exiting print preview mode + if (mainWin.hasAttribute("onclose")) + gOldCloseHandler = mainWin.getAttribute("onclose"); + else + gOldCloseHandler = null; + mainWin.setAttribute("onclose", "BrowserExitPrintPreview(); return false;"); + // show the toolbar after we go into print preview mode so // that we can initialize the toolbar with total num pages showPrintPreviewToolbar(); @@ -264,9 +328,6 @@ function BrowserPrintSetup() .getService(Components.interfaces.nsIPrintSettingsService); psService.savePrintSettingsToPrefs(gPrintSettings, false, gPrintSettings.kInitSaveNativeData); } - if (webBrowserPrint.doingPrintPreview) { - webBrowserPrint.printPreview(gPrintSettings, null, null); - } } } } catch (e) { diff --git a/mozilla/xpfe/communicator/resources/content/printPreviewBindings.xml b/mozilla/xpfe/communicator/resources/content/printPreviewBindings.xml index fb5251a3634..1d76461e02b 100644 --- a/mozilla/xpfe/communicator/resources/content/printPreviewBindings.xml +++ b/mozilla/xpfe/communicator/resources/content/printPreviewBindings.xml @@ -154,7 +154,11 @@ document.getAnonymousNodes(this)[16].firstChild - + + + + + @@ -317,6 +327,92 @@ + + + + + + + + + + + @@ -328,10 +424,7 @@ if (aValue == "ShrinkToFit") { if (!settings.shrinkToFit) { settings.shrinkToFit = true; - print.printPreview(settings, null, null); - this.mScaleCombobox.setAttribute('lastValidInx', this.mScaleCombobox.selectedIndex); - // update total number of pages since this could have changed - this.mTotalPages.value = print.printPreviewNumPages; + this.doPrintPreview(print, settings, this.mTotalPages, this.mScaleCombobox); return; } else { return; @@ -354,9 +447,7 @@ settings.shrinkToFit = false; settings.scaling = aValue; - print.printPreview(settings, null, null); - // update total number of pages since this could have changed - this.mTotalPages.value = print.printPreviewNumPages; + this.doPrintPreview(print, settings, this.mTotalPages, null); ]]> @@ -385,10 +476,7 @@ var print = this._getWebBrowserPrint(); var settings = print.currentPrintSettings; settings.orientation = orientValue; - print.printPreview(settings, null, null); - - // update total number of pages since this could have changed - this.mTotalPages.value = print.printPreviewNumPages; + this.doPrintPreview(print, settings, this.mTotalPages, null); ]]> diff --git a/mozilla/xpfe/communicator/resources/content/utilityOverlay.js b/mozilla/xpfe/communicator/resources/content/utilityOverlay.js index 3b534a08f08..490f0b7bedb 100644 --- a/mozilla/xpfe/communicator/resources/content/utilityOverlay.js +++ b/mozilla/xpfe/communicator/resources/content/utilityOverlay.js @@ -142,6 +142,7 @@ function goPageSetup(domwin, printSettings) } catch(e) { return false; } + return true; } function goPreferences(containerID, paneURL, itemID) diff --git a/mozilla/xpfe/global/jar.mn b/mozilla/xpfe/global/jar.mn index 86fea6cb61f..2f9f812763a 100644 --- a/mozilla/xpfe/global/jar.mn +++ b/mozilla/xpfe/global/jar.mn @@ -43,6 +43,8 @@ toolkit.jar: content/global/printdialog.js (resources/content/printdialog.js) content/global/printProgress.xul (resources/content/printProgress.xul) content/global/printProgress.js (resources/content/printProgress.js) + content/global/printPreviewProgress.xul (resources/content/printPreviewProgress.xul) + content/global/printPreviewProgress.js (resources/content/printPreviewProgress.js) content/global/fullScreen.js (resources/content/fullScreen.js) content/global/build.dtd (build.dtd) content/global/MPL-1.1.html (resources/content/MPL-1.1.html) @@ -102,6 +104,7 @@ en-US.jar: locale/en-US/global/dialog.properties (resources/locale/en-US/dialog.properties) locale/en-US/global/printdialog.dtd (resources/locale/en-US/printdialog.dtd) locale/en-US/global/printProgress.dtd (resources/locale/en-US/printProgress.dtd) + locale/en-US/global/printPreviewProgress.dtd (resources/locale/en-US/printPreviewProgress.dtd) US.jar: locale/US/global-region/contents.rdf (resources/locale/en-US/contents-region.rdf) diff --git a/mozilla/xpfe/global/resources/content/printPreviewProgress.js b/mozilla/xpfe/global/resources/content/printPreviewProgress.js new file mode 100644 index 00000000000..4b6730bde2a --- /dev/null +++ b/mozilla/xpfe/global/resources/content/printPreviewProgress.js @@ -0,0 +1,203 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, + * released March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + * + * Contributors: + * Rod Spears + */ + +// dialog is just an array we'll use to store various properties from the dialog document... +var dialog; + +// the printProgress is a nsIPrintProgress object +var printProgress = null; + +// random global variables... +var targetFile; + +var docTitle = ""; +var docURL = ""; +var progressParams = null; + +function elipseString(aStr, doFront) +{ + if (aStr.length > 3 && (aStr.substr(0, 3) == "..." || aStr.substr(aStr.length-4, 3) == "...")) { + return aStr; + } + + var fixedLen = 64; + if (aStr.length > fixedLen) { + if (doFront) { + var endStr = aStr.substr(aStr.length-fixedLen, fixedLen); + var str = "..." + endStr; + return str; + } else { + var frontStr = aStr.substr(0, fixedLen); + var str = frontStr + "..."; + return str; + } + } + return aStr; +} + +// all progress notifications are done through the nsIWebProgressListener implementation... +var progressListener = { + onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) + { + + if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) + { + window.close(); + } + }, + + onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) + { + if (progressParams) + { + var docTitleStr = elipseString(progressParams.docTitle, false); + if (docTitleStr != docTitle) { + docTitle = docTitleStr; + dialog.title.value = docTitle; + } + var docURLStr = elipseString(rogressParams.docURL, true); + if (docURLStr != docURL && dialog.title != null) { + docURL = docURLStr; + if (docTitle == "") { + dialog.title.value = docURLStr; + } + } + } + }, + + onLocationChange: function(aWebProgress, aRequest, aLocation) + { + // we can ignore this notification + }, + + onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) + { + if (aMessage != "") + dialog.title.setAttribute("value", aMessage); + }, + + onSecurityChange: function(aWebProgress, aRequest, state) + { + // we can ignore this notification + }, + + QueryInterface : function(iid) + { + if (iid.equals(Components.interfaces.nsIWebProgressListener) || iid.equals(Components.interfaces.nsISupportsWeakReference)) + return this; + + throw Components.results.NS_NOINTERFACE; + } +}; + +function onLoad() { + // Set global variables. + printProgress = window.arguments[0]; + if (window.arguments[1]) + { + progressParams = window.arguments[1].QueryInterface(Components.interfaces.nsIPrintProgressParams) + if (progressParams) + { + docTitle = elipseString(progressParams.docTitle, false); + docURL = elipseString(progressParams.docURL, true); + } + } + + if ( !printProgress ) { + dump( "Invalid argument to printPreviewProgress.xul\n" ); + window.close() + return; + } + + dialog = new Object; + dialog.strings = new Array; + dialog.title = document.getElementById("dialog.title"); + dialog.titleLabel = document.getElementById("dialog.titleLabel"); + + dialog.title.value = docTitle; + + // set our web progress listener on the helper app launcher + printProgress.registerListener(progressListener); + moveToAlertPosition(); + + //We need to delay the set title else dom will overwrite it + window.setTimeout(doneIniting, 100); +} + +function onUnload() +{ + if (printProgress) + { + try + { + printProgress.unregisterListener(progressListener); + printProgress = null; + } + + catch( exception ) {} + } +} + +function getString( stringId ) { + // Check if we've fetched this string already. + if (!(stringId in dialog.strings)) { + // Try to get it. + var elem = document.getElementById( "dialog.strings."+stringId ); + try { + if ( elem + && + elem.childNodes + && + elem.childNodes[0] + && + elem.childNodes[0].nodeValue ) { + dialog.strings[ stringId ] = elem.childNodes[0].nodeValue; + } else { + // If unable to fetch string, use an empty string. + dialog.strings[ stringId ] = ""; + } + } catch (e) { dialog.strings[ stringId ] = ""; } + } + return dialog.strings[ stringId ]; +} + +// If the user presses cancel, tell the app launcher and close the dialog... +function onCancel () +{ + // Cancel app launcher. + try + { + printProgress.processCanceledByUser = true; + } + catch( exception ) {return true;} + + // don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted. + return false; +} + +function doneIniting() +{ + // called by function timeout in onLoad + printProgress.doneIniting(); +} diff --git a/mozilla/xpfe/global/resources/content/printPreviewProgress.xul b/mozilla/xpfe/global/resources/content/printPreviewProgress.xul new file mode 100644 index 00000000000..c22b39b72d4 --- /dev/null +++ b/mozilla/xpfe/global/resources/content/printPreviewProgress.xul @@ -0,0 +1,62 @@ + + + + + + + + + + + + +