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
This commit is contained in:
cbiesinger%web.de 2002-02-23 15:32:03 +00:00
parent cb447f80d2
commit 6889b4fa22
6 changed files with 57 additions and 90 deletions

View File

@ -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<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
if (wwatch) {
nsCOMPtr<nsIDOMWindow> active;
wwatch->GetActiveWindow(getter_AddRefs(active));
nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIDOMWindowInternal> parent(do_QueryInterface(active));
nsCOMPtr<nsIDOMWindow> active;
wwatch->GetActiveWindow(getter_AddRefs(active));
nsCOMPtr<nsIDOMWindowInternal> parent = do_QueryInterface(active, &rv);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIPrompt> dialog;
parent->GetPrompter(getter_AddRefs(dialog));
if (!dialog)
return;
if (parent) {
nsCOMPtr<nsIPrompt> dialog;
parent->GetPrompter(getter_AddRefs(dialog));
if (dialog) {
dialog->Alert(title, msg);
}
}
}
dialog->Alert(title, msg);
}
// nsIContentViewerFile interface

View File

@ -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)
/**

View File

@ -44,10 +44,6 @@ REQUIRES = xpcom \
unicharutil \
gfx2 \
imglib2 \
intl \
dom \
windowwatcher \
necko \
$(NULL)
# Sun's Complex Text Layout support

View File

@ -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<nsIStringBundleService> stringBundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
nsXPIDLString msg,
title;
nsCOMPtr<nsIStringBundle> 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<nsIWindowWatcher> wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIDOMWindow> active;
wwatch->GetActiveWindow(getter_AddRefs(active));
nsCOMPtr<nsIDOMWindowInternal> parent = do_QueryInterface(active, &rv);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIPrompt> 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));

View File

@ -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<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
if (wwatch) {
nsCOMPtr<nsIDOMWindow> active;
wwatch->GetActiveWindow(getter_AddRefs(active));
nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIDOMWindowInternal> parent(do_QueryInterface(active));
nsCOMPtr<nsIDOMWindow> active;
wwatch->GetActiveWindow(getter_AddRefs(active));
nsCOMPtr<nsIDOMWindowInternal> parent = do_QueryInterface(active, &rv);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIPrompt> dialog;
parent->GetPrompter(getter_AddRefs(dialog));
if (!dialog)
return;
if (parent) {
nsCOMPtr<nsIPrompt> dialog;
parent->GetPrompter(getter_AddRefs(dialog));
if (dialog) {
dialog->Alert(title, msg);
}
}
}
dialog->Alert(title, msg);
}
// nsIContentViewerFile interface

View File

@ -19,9 +19,6 @@
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
#
# 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.