aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyBrowser.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-06-19 02:52:03 +0800
committerChristian Persch <chpe@src.gnome.org>2006-06-19 02:52:03 +0800
commitc6573cb04bdc216e7e5ea3657cb1186eaf0f1095 (patch)
tree769cc33a1564a50d1414cb6b6b6f7306c1635840 /embed/mozilla/EphyBrowser.cpp
parent0db1af2c76d4cae33992f82a1736f6ed743b7dc1 (diff)
downloadgsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.gz
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.bz2
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.lz
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.xz
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.zst
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.zip
A embed/mozilla/GeckoPrintService.cpp: A
2006-06-18 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * data/default-prefs-common.js: * embed/Makefile.am: * embed/ephy-embed-shell.c: (ephy_embed_shell_dispose), (ephy_embed_shell_set_page_setup), (ephy_embed_shell_get_page_setup), (ephy_embed_shell_set_print_settings), (ephy_embed_shell_get_print_settings): * embed/ephy-embed-shell.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/EphyUtils.cpp: * embed/mozilla/EphyUtils.h: * embed/mozilla/Makefile.am: A embed/mozilla/GeckoPrintService.cpp: A embed/mozilla/GeckoPrintService.h: A embed/mozilla/GeckoPrintSession.cpp: A embed/mozilla/GeckoPrintSession.h: * embed/mozilla/MozRegisterComponents.cpp: R embed/mozilla/PrintingPromptService.cpp: R embed/mozilla/PrintingPromptService.h: * embed/mozilla/mozilla-embed-single.cpp: R embed/print-dialog.c: R embed/print-dialog.h: * src/ephy-shell.c: (ephy_shell_dispose), (ephy_shell_get_prefs_dialog): * src/ephy-shell.h: * src/epiphany.defs: * src/window-commands.c: (page_setup_done_cb), (window_cmd_file_print_setup): Drop libgnomeprint[ui] and use gtk printing.
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r--embed/mozilla/EphyBrowser.cpp48
1 files changed, 37 insertions, 11 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index afcc2b175..bfd3b9e92 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -67,6 +67,8 @@
#include <nsIHistoryEntry.h>
#include <nsIInterfaceRequestor.h>
#include <nsIInterfaceRequestorUtils.h>
+#include <nsIPrintSettings.h>
+#include <nsIPrintSettingsService.h>
#include <nsIScriptSecurityManager.h>
#include <nsIServiceManager.h>
#include <nsISHEntry.h>
@@ -98,14 +100,16 @@
#include "ephy-debug.h"
#include "ephy-embed.h"
+#include "ephy-embed-shell.h"
#include "ephy-string.h"
#include "ephy-zoom.h"
#include "mozilla-embed-event.h"
#include "mozilla-embed.h"
-#include "print-dialog.h"
+#include "AutoJSContextStack.h"
#include "EphyUtils.h"
#include "EventContext.h"
+#include "GeckoPrintService.h"
#include "EphyBrowser.h"
@@ -673,7 +677,20 @@ nsresult EphyBrowser::Print ()
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser));
NS_ENSURE_TRUE (print, NS_ERROR_FAILURE);
- return print->Print (nsnull, nsnull);
+ nsCOMPtr<nsIPrintSettingsService> printSettingsService
+ (do_GetService("@mozilla.org/gfx/printsettings-service;1"));
+ NS_ENSURE_STATE (printSettingsService);
+
+ nsCOMPtr<nsIPrintSettings> settings;
+ printSettingsService->GetNewPrintSettings (getter_AddRefs (settings));
+ NS_ENSURE_STATE (settings);
+
+ nsresult rv;
+ AutoJSContextStack stack;
+ rv = stack.Init ();
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ return print->Print (settings, nsnull);
}
nsresult EphyBrowser::SetPrintPreviewMode (PRBool previewMode)
@@ -682,21 +699,30 @@ nsresult EphyBrowser::SetPrintPreviewMode (PRBool previewMode)
NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE);
- nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser));
- NS_ENSURE_TRUE (print, NS_ERROR_FAILURE);
+ nsCOMPtr<nsIWebBrowserPrint> print (do_GetInterface (mWebBrowser));
+ NS_ENSURE_STATE (print);
if (previewMode)
{
- EmbedPrintInfo *info;
+ nsCOMPtr<nsIPrintSettingsService> printSettingsService
+ (do_GetService("@mozilla.org/gfx/printsettings-service;1"));
+ NS_ENSURE_STATE (printSettingsService);
nsCOMPtr<nsIPrintSettings> settings;
- print->GetGlobalPrintSettings (getter_AddRefs(settings));
+ printSettingsService->GetNewPrintSettings (getter_AddRefs (settings));
+ NS_ENSURE_STATE (settings);
- info = ephy_print_get_print_info ();
- EphyUtils::CollatePrintSettings (info, settings, TRUE);
- ephy_print_info_free (info);
+ EphyEmbedShell *shell = ephy_embed_shell_get_default ();
+ rv = GeckoPrintService::TranslateSettings (ephy_embed_shell_get_print_settings (shell),
+ ephy_embed_shell_get_page_setup (shell),
+ nsCString(),
+ PR_FALSE,
+ settings);
- rv = print->PrintPreview (nsnull, mDOMWindow, nsnull);
+ if (NS_SUCCEEDED (rv))
+ {
+ rv = print->PrintPreview (settings, mDOMWindow, nsnull);
+ }
}
else
{
@@ -705,7 +731,7 @@ nsresult EphyBrowser::SetPrintPreviewMode (PRBool previewMode)
rv = print->GetDoingPrintPreview(&isPreview);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
- if (isPreview == PR_TRUE)
+ if (isPreview)
{
rv = print->ExitPrintPreview();
}