From d562b821c5db058b95fccaa6a356674108d0e924 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Wed, 24 Apr 2002 11:00:39 +0000 Subject: [PATCH] Fixing viewer so it can print again. --- webshell/tests/viewer/nsBrowserWindow.cpp | 13 ++++++++----- webshell/tests/viewer/nsBrowserWindow.h | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index 073410fbdcbc..bdc5af794415 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -76,6 +76,7 @@ #include "nsGUIEvent.h" #include "nsIWebProgress.h" #include "nsIWebBrowserSetup.h" +#include "nsIWebBrowserPrint.h" #include "nsCWebBrowser.h" #include "nsUnicharUtils.h" @@ -2206,11 +2207,13 @@ void nsBrowserWindow::DoPrint(void) mDocShell->GetContentViewer(getter_AddRefs(viewer)); - if (viewer) - { - nsCOMPtr viewerFile = do_QueryInterface(viewer); - if (viewerFile) { - //viewerFile->Print(PR_FALSE, nsnull, (nsIWebProgressListener*)nsnull); + if (viewer) { + nsCOMPtr webBrowserPrint = do_QueryInterface(viewer); + if (webBrowserPrint) { + if (!mPrintSettings) { + webBrowserPrint->GetNewPrintSettings(getter_AddRefs(mPrintSettings)); + } + webBrowserPrint->Print(mPrintSettings, (nsIWebProgressListener*)nsnull); } } } diff --git a/webshell/tests/viewer/nsBrowserWindow.h b/webshell/tests/viewer/nsBrowserWindow.h index fd1f5c2124dd..1a2b818ec8e0 100644 --- a/webshell/tests/viewer/nsBrowserWindow.h +++ b/webshell/tests/viewer/nsBrowserWindow.h @@ -65,6 +65,8 @@ #include "nsImageInspectorDialog.h" #include "nsITextWidget.h" +#include "nsIPrintSettings.h" + class nsILabel; class nsICheckButton; class nsIButton; @@ -276,6 +278,8 @@ protected: nsWebBrowserChrome* mWebBrowserChrome; PRBool mHaveMenuBar; + + nsCOMPtr mPrintSettings; }; // XXX This is bad; because we can't hang a closure off of the event