From 6889b4fa22634fcc808bb5de7e140fe5adb5298d Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Sat, 23 Feb 2002 15:32:03 +0000 Subject: [PATCH] Bug 126303 patch by Roland.Mainz@informatik.med.uni-giessen.de r=rods sr=attinasi a=roc+moz Remove the DOM dependendecies from gfx/src/xprint/ git-svn-id: svn://10.0.0.236/trunk@115277 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 42 ++++++++-------- mozilla/gfx/public/nsIDeviceContext.h | 6 +++ mozilla/gfx/src/xprint/Makefile.in | 4 -- mozilla/gfx/src/xprint/nsXPrintContext.cpp | 48 ++----------------- mozilla/layout/base/nsDocumentViewer.cpp | 42 ++++++++-------- .../layout/html/base/src/printing.properties | 5 +- 6 files changed, 57 insertions(+), 90 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 1890c8f1fa8..7fa8e585b0e 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -6231,9 +6231,9 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin if (NS_FAILED(rv)) return; - PRUnichar *msg = nsnull, - *title = nsnull; - nsAutoString stringName; + nsXPIDLString msg, + title; + nsAutoString stringName; switch(aPrintError) { @@ -6264,37 +6264,41 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT) default: NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE) #undef NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG } - myStringBundle->GetStringFromName(stringName.get(), &msg); + myStringBundle->GetStringFromName(stringName.get(), getter_Copies(msg)); if (aIsPrinting) { - myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), &title); + myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), getter_Copies(title)); } else { - myStringBundle->GetStringFromName(NS_LITERAL_STRING("printpreview_error_dialog_title").get(), &title); + myStringBundle->GetStringFromName(NS_LITERAL_STRING("printpreview_error_dialog_title").get(), getter_Copies(title)); } if (!msg) return; - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); + nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv); + if (NS_FAILED(rv)) + return; - nsCOMPtr parent(do_QueryInterface(active)); + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + + nsCOMPtr parent = do_QueryInterface(active, &rv); + if (NS_FAILED(rv)) + return; + + nsCOMPtr dialog; + parent->GetPrompter(getter_AddRefs(dialog)); + if (!dialog) + return; - if (parent) { - nsCOMPtr dialog; - parent->GetPrompter(getter_AddRefs(dialog)); - if (dialog) { - dialog->Alert(title, msg); - } - } - } + dialog->Alert(title, msg); } // nsIContentViewerFile interface diff --git a/mozilla/gfx/public/nsIDeviceContext.h b/mozilla/gfx/public/nsIDeviceContext.h index bf4eb726117..92386433c80 100644 --- a/mozilla/gfx/public/nsIDeviceContext.h +++ b/mozilla/gfx/public/nsIDeviceContext.h @@ -123,6 +123,12 @@ typedef void * nsNativeDeviceContext; /* too many copies requested */ #define NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES \ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+22) +/* driver configuration error */ +#define NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+23) +/* Xprint module specific: Xprt server broken */ +#define NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24) /** diff --git a/mozilla/gfx/src/xprint/Makefile.in b/mozilla/gfx/src/xprint/Makefile.in index ef1e4636ce4..7eb6d571453 100644 --- a/mozilla/gfx/src/xprint/Makefile.in +++ b/mozilla/gfx/src/xprint/Makefile.in @@ -44,10 +44,6 @@ REQUIRES = xpcom \ unicharutil \ gfx2 \ imglib2 \ - intl \ - dom \ - windowwatcher \ - necko \ $(NULL) # Sun's Complex Text Layout support diff --git a/mozilla/gfx/src/xprint/nsXPrintContext.cpp b/mozilla/gfx/src/xprint/nsXPrintContext.cpp index cff3f919ee8..c908c3e27de 100644 --- a/mozilla/gfx/src/xprint/nsXPrintContext.cpp +++ b/mozilla/gfx/src/xprint/nsXPrintContext.cpp @@ -57,15 +57,6 @@ #include "xprintutil.h" #include "prenv.h" /* for PR_GetEnv */ -/* "Broken Xprt" warning dialog */ -#include "nsIStringBundle.h" -#include "nsIWindowWatcher.h" -#include "nsIDOMWindowInternal.h" -#include "nsIPrompt.h" -#include "nsIServiceManagerUtils.h" - -#define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://communicator/locale/printing.properties" - /* misc defines */ #define XPRINT_MAKE_24BIT_VISUAL_AVAILABLE_FOR_TESTING 1 @@ -180,41 +171,8 @@ AlertBrokenXprt(Display *pdpy) /* Dialog disabled ? */ if (PR_GetEnv("MOZILLA_XPRINT_DISABLE_BROKEN_XFREE86_WARNING") != nsnull) return NS_OK; - - nsCOMPtr stringBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - - nsXPIDLString msg, - title; - - nsCOMPtr myStringBundle; - rv = stringBundleService->CreateBundle(NS_ERROR_GFX_PRINTER_BUNDLE_URL, getter_AddRefs(myStringBundle)); - if (NS_FAILED(rv)) - return rv; - - myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), getter_Copies(title)); - myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_xprint_broken_xprt_msg").get(), getter_Copies(msg)); - - nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - - nsCOMPtr parent = do_QueryInterface(active, &rv); - if (NS_FAILED(rv)) - return rv; - - nsCOMPtr dialog; - rv = parent->GetPrompter(getter_AddRefs(dialog)); - if (NS_FAILED(rv)) - return rv; - - dialog->Alert(title, msg); - - return NS_OK; + + return NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT; } NS_IMETHODIMP @@ -572,7 +530,7 @@ nsXPrintContext::SetupPrintContext(nsIDeviceContextSpecXp *aSpec) * ToDo: Report error to user (dialog) */ if( XpuGetResolution(mPDisplay, mPContext, &mPrintResolution) == False ) - return NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE; + return NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR; PR_LOG(nsXPrintContextLM, PR_LOG_DEBUG, ("print resolution %ld\n", (long)mPrintResolution)); diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 1890c8f1fa8..7fa8e585b0e 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -6231,9 +6231,9 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin if (NS_FAILED(rv)) return; - PRUnichar *msg = nsnull, - *title = nsnull; - nsAutoString stringName; + nsXPIDLString msg, + title; + nsAutoString stringName; switch(aPrintError) { @@ -6264,37 +6264,41 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT) default: NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE) #undef NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG } - myStringBundle->GetStringFromName(stringName.get(), &msg); + myStringBundle->GetStringFromName(stringName.get(), getter_Copies(msg)); if (aIsPrinting) { - myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), &title); + myStringBundle->GetStringFromName(NS_LITERAL_STRING("print_error_dialog_title").get(), getter_Copies(title)); } else { - myStringBundle->GetStringFromName(NS_LITERAL_STRING("printpreview_error_dialog_title").get(), &title); + myStringBundle->GetStringFromName(NS_LITERAL_STRING("printpreview_error_dialog_title").get(), getter_Copies(title)); } if (!msg) return; - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); + nsCOMPtr wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv); + if (NS_FAILED(rv)) + return; - nsCOMPtr parent(do_QueryInterface(active)); + nsCOMPtr active; + wwatch->GetActiveWindow(getter_AddRefs(active)); + + nsCOMPtr parent = do_QueryInterface(active, &rv); + if (NS_FAILED(rv)) + return; + + nsCOMPtr dialog; + parent->GetPrompter(getter_AddRefs(dialog)); + if (!dialog) + return; - if (parent) { - nsCOMPtr dialog; - parent->GetPrompter(getter_AddRefs(dialog)); - if (dialog) { - dialog->Alert(title, msg); - } - } - } + dialog->Alert(title, msg); } // nsIContentViewerFile interface diff --git a/mozilla/layout/html/base/src/printing.properties b/mozilla/layout/html/base/src/printing.properties index 460db43149a..8fdf956e3fe 100644 --- a/mozilla/layout/html/base/src/printing.properties +++ b/mozilla/layout/html/base/src/printing.properties @@ -19,9 +19,6 @@ # Roland Mainz # -# Xprint module warnings -print_xprint_broken_xprt_msg=A broken version of the X print server (Xprt) has been detected. Note that printing using this Xprt server may not work properly. Please contact the server vendor for a fixed version. - # Page number formating ## @page_number The current page number #LOCALIZATION NOTE (pageofpages): Do not translate %ld in the following line. @@ -79,6 +76,8 @@ NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED=There was a problem printing becau NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED=There was a problem printing because the page orientation you specified is not supported by your printer. NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED=There was a problem printing because the print job requires color capabilities that your printer does not support. NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES=There was a problem printing because you requested too many copies. +NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR=There was a problem printing. The printer driver is not properly configured. +NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT=A broken version of the X print server (Xprt) has been detected. Note that printing using this Xprt server may not work properly. Please contact the server vendor for a fixed version. # No printers available noprinter=No printers available. # EOF.