зеркало из https://github.com/mozilla/pjs.git
191346 patch by Roland.Mainz@informatik.med.uni-giessen.de r=jkeiser sr=roc+moz RFE: "No printers found" when Xprint not installed should be "Xprint not installed" / there should be only one print error dialog for "no printers found" instead of two
This commit is contained in:
Родитель
bdc381e82e
Коммит
1bdbf1e104
|
@ -598,13 +598,12 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
|||
mPrt->mPrintOptions = do_GetService(sPrintOptionsContractID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mPrt->mPrintOptions && mPrt->mPrintSettings) {
|
||||
// Get the default printer name and set it into the PrintSettings
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE, PR_TRUE);
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings);
|
||||
} else {
|
||||
NS_ASSERTION(mPrt->mPrintSettings, "You can't Print without a PrintSettings!");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CHECK_RUNTIME_ERROR_CONDITION(nsIDebugObject::PRT_RUNTIME_CHECKFORPRINTERS, rv, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_PL(("NS_ERROR_FAILURE - CheckForPrinters for Printers failed"));
|
||||
return CleanupOnFailure(rv, PR_FALSE);
|
||||
|
@ -1094,12 +1093,13 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
mPrt->mPrintOptions = do_GetService(sPrintOptionsContractID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mPrt->mPrintOptions && mPrt->mPrintSettings) {
|
||||
// Get the default printer name and set it into the PrintSettings
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE, PR_TRUE);
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings);
|
||||
} else {
|
||||
NS_ASSERTION(mPrt->mPrintSettings, "You can't Print without a PrintSettings!");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
ShowPrintErrorDialog(rv, PR_TRUE);
|
||||
CloseProgressDialog(aWebProgressListener);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1543,17 +1543,15 @@ nsPrintEngine::Cancel()
|
|||
// in the PrintSettings which is then used for Printer Preview
|
||||
nsresult
|
||||
nsPrintEngine::CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
PRUint32 aErrorCode,
|
||||
PRBool aIsPrinting)
|
||||
nsIPrintSettings* aPrintSettings)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrintOptions);
|
||||
NS_ENSURE_ARG_POINTER(aPrintSettings);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> simpEnum;
|
||||
aPrintOptions->AvailablePrinters(getter_AddRefs(simpEnum));
|
||||
rv = aPrintOptions->AvailablePrinters(getter_AddRefs(simpEnum));
|
||||
if (simpEnum) {
|
||||
PRBool fndPrinter = PR_FALSE;
|
||||
simpEnum->HasMoreElements(&fndPrinter);
|
||||
|
@ -1578,17 +1576,12 @@ nsPrintEngine::CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
|||
nsMemory::Free(defPrinterName);
|
||||
}
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
// this means there were no printers
|
||||
ShowPrintErrorDialog(aErrorCode, aIsPrinting);
|
||||
}
|
||||
} else {
|
||||
// this means there were no printers
|
||||
// XXX the ifdefs are temporary until they correctly implement Available Printers
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
rv = NS_OK;
|
||||
#else
|
||||
ShowPrintErrorDialog(aErrorCode, aIsPrinting);
|
||||
#endif
|
||||
}
|
||||
return rv;
|
||||
|
@ -2315,6 +2308,7 @@ nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrinting)
|
|||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND)
|
||||
|
||||
default:
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE)
|
||||
|
|
|
@ -191,9 +191,7 @@ public:
|
|||
nsIPrintProgressParams* aParams);
|
||||
void ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront);
|
||||
nsresult CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
PRUint32 aErrorCode,
|
||||
PRBool aIsPrinting);
|
||||
nsIPrintSettings* aPrintSettings);
|
||||
void CleanupDocTitleArray(PRUnichar**& aArray, PRInt32& aCount);
|
||||
void CheckForHiddenFrameSetFrames();
|
||||
|
||||
|
|
|
@ -54,9 +54,11 @@ interface nsISimpleEnumerator;
|
|||
[ref] native nsNativeStringRef(nsString);
|
||||
|
||||
/**
|
||||
* Simplified graphics interface for JS rendering.
|
||||
* Print options interface
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
* Do not attempt to freeze this API - it still needs lots of work. Consult
|
||||
* John Keiser <jkeiser@netscape.com> and Roland Mainz
|
||||
* <roland.mainz@informatik.med.uni-giessen.de> for futher details.
|
||||
*/
|
||||
[scriptable, uuid(CAE87E20-479E-11d4-A856-00105A183419)]
|
||||
|
||||
|
@ -75,6 +77,8 @@ interface nsIPrintOptions : nsISupports
|
|||
|
||||
/**
|
||||
* available Printers
|
||||
* It returns an enumerator object or throws an exception on error cases
|
||||
* like if internal setup failed and/or no printers are available.
|
||||
*/
|
||||
nsISimpleEnumerator availablePrinters ();
|
||||
|
||||
|
|
|
@ -144,7 +144,9 @@ typedef void * nsNativeDeviceContext;
|
|||
/* The was wasn't any Print Prompt service registered (this shouldn't happen) */
|
||||
#define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
|
||||
|
||||
/* Xprint module specific: No Xprint servers found */
|
||||
#define NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
|
||||
|
||||
/**
|
||||
* Conts need for Print Preview
|
||||
|
|
|
@ -947,7 +947,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
|||
}
|
||||
|
||||
XpuFreePrinterList(plist);
|
||||
}
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
#ifdef USE_POSTSCRIPT
|
||||
|
@ -1002,8 +1002,21 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
|||
}
|
||||
#endif /* USE_POSTSCRIPT */
|
||||
|
||||
/* If there are no printers available after all checks, return an error */
|
||||
if (mGlobalNumPrinters == 0)
|
||||
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
||||
{
|
||||
/* Make sure we do not cache an empty printer list */
|
||||
FreeGlobalPrinters();
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
/* Check if there are actually any Xprint servers available */
|
||||
if (!XpuXprintServersAvailable()) {
|
||||
return NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND;
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -800,13 +800,12 @@ NS_IMETHODIMP nsPrintOptions::AvailablePrinters(nsISimpleEnumerator **aPrinterEn
|
|||
nsCOMPtr<nsPrinterListEnumerator> printerListEnum = new nsPrinterListEnumerator();
|
||||
NS_ENSURE_TRUE(printerListEnum.get(), NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// if Init fails NS_OK is return (script needs NS_OK) but the enumerator will be null
|
||||
nsresult rv = printerListEnum->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aPrinterEnumerator = NS_STATIC_CAST(nsISimpleEnumerator*, printerListEnum);
|
||||
NS_ADDREF(*aPrinterEnumerator);
|
||||
}
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintOptions::DisplayJobProperties( const PRUnichar *aPrinter, nsIPrintSettings* aPrintSettings, PRBool *aDisplayed)
|
||||
|
|
|
@ -955,7 +955,7 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
|||
}
|
||||
|
||||
XpuFreePrinterList(plist);
|
||||
}
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
#ifdef USE_POSTSCRIPT
|
||||
|
@ -1010,8 +1010,21 @@ nsresult GlobalPrinters::InitializeGlobalPrinters ()
|
|||
}
|
||||
#endif /* USE_POSTSCRIPT */
|
||||
|
||||
/* If there are no printers available after all checks, return an error */
|
||||
if (mGlobalNumPrinters == 0)
|
||||
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
||||
{
|
||||
/* Make sure we do not cache an empty printer list */
|
||||
FreeGlobalPrinters();
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
/* Check if there are actually any Xprint servers available */
|
||||
if (!XpuXprintServersAvailable()) {
|
||||
return NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND;
|
||||
}
|
||||
#endif /* USE_XPRINT */
|
||||
|
||||
return NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,220 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
#ifndef XPRINTUTIL_H
|
||||
#define XPRINTUTIL_H 1
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (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/MPL/
|
||||
*
|
||||
* 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 the X11 print system utilities library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Roland Mainz
|
||||
* <roland.mainz@informatik.med.uni-giessen.de>.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU General Public License Version 2 or later (the
|
||||
* "GPL"), in which case the provisions of the GPL are applicable
|
||||
* instead of those above. If you wish to allow use of your
|
||||
* version of this file only under the terms of the GPL and not to
|
||||
* allow others to use your version of this file under the MPL,
|
||||
* indicate your decision by deleting the provisions above and
|
||||
* replace them with the notice and other provisions required by
|
||||
* the GPL. If you do not delete the provisions above, a recipient
|
||||
* may use your version of this file under either the MPL or the
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
/* Force ANSI C prototypes from X11 headers */
|
||||
#ifndef FUNCPROTO
|
||||
#define FUNCPROTO 15
|
||||
#endif /* !FUNCPROTO */
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/Print.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
|
||||
/* I don't know how to make this "better" yet... ;-( */
|
||||
#ifdef USE_MOZILLA_TYPES
|
||||
#include <prtypes.h>
|
||||
#include <prmem.h>
|
||||
#include <prthread.h>
|
||||
#define XPU_USE_NSPR 1
|
||||
/*
|
||||
* Disabled for now - Threaded codepath does not work properly always.
|
||||
* See bug 134570 ("Print-to-file not working with threaded XprintUtil")
|
||||
* #define XPU_USE_THREADS 1
|
||||
*/
|
||||
#endif /* USE_MOZILLA_TYPES */
|
||||
|
||||
#ifdef DEBUG
|
||||
/* trace function calls */
|
||||
#define XPU_TRACE(EX) (puts(#EX),EX)
|
||||
/* trace function calls in child */
|
||||
#define XPU_TRACE_CHILD(EX) (puts("child: " #EX),EX)
|
||||
/* execute function EX only in debug mode */
|
||||
#define XPU_DEBUG_ONLY(EX) (EX)
|
||||
#else
|
||||
#define XPU_TRACE(EX) (EX)
|
||||
#define XPU_TRACE_CHILD(EX) (EX)
|
||||
#define XPU_DEBUG_ONLY(EX)
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* debug/logging: replace NULLptrs with "<NULL>" string */
|
||||
#define XPU_NULLXSTR(s) (((s)!=NULL)?(s):("<NULL>"))
|
||||
|
||||
/*
|
||||
* Struct for XpuGetMediumSourceSizeList(), XpuFreeMediumSourceSizeList(),
|
||||
* XpuSetDocMediumSourceSize(), XpuSetPageMediumSourceSize(),
|
||||
* XpuFindMediumSourceSizeBy*()
|
||||
*/
|
||||
typedef struct {
|
||||
const char *tray_name;
|
||||
const char *medium_name;
|
||||
int mbool;
|
||||
float ma1;
|
||||
float ma2;
|
||||
float ma3;
|
||||
float ma4;
|
||||
} XpuMediumSourceSizeRec, *XpuMediumSourceSizeList;
|
||||
|
||||
/*
|
||||
* Struct for XpuGetResolutionList(), XpuFreeResolutionList(),
|
||||
* XpuGetResolution(), XpuSetPageResolution(), XpuSetDocResolution(),
|
||||
* XpuFindResolution()
|
||||
*/
|
||||
typedef struct {
|
||||
long dpi;
|
||||
/* ToDo: Support for Xdpi != Ydpi */
|
||||
} XpuResolutionRec, *XpuResolutionList;
|
||||
|
||||
/*
|
||||
* Struct for XpuGetOrientationList(), XpuFreeOrientationList(),
|
||||
* XpuFindOrientationBy*(), XpuSetPageResolution(),
|
||||
* XpuSetDocOrientation()
|
||||
*/
|
||||
typedef struct {
|
||||
const char *orientation;
|
||||
} XpuOrientationRec, *XpuOrientationList;
|
||||
|
||||
/*
|
||||
* Struct for XpuGetPlexList(), XpuFreePlexList(), XpuFindPlexBy*(),
|
||||
* XpuSetDocPlex(), XpuSetPagePlex()
|
||||
*/
|
||||
typedef struct {
|
||||
const char *plex;
|
||||
} XpuPlexRec, *XpuPlexList;
|
||||
|
||||
|
||||
/* XPUATTRIBUTESUPPORTED_*:
|
||||
* Flags which indicate whether it is allowed to set/change a specific attribute
|
||||
*/
|
||||
typedef long XpuSupportedFlags;
|
||||
/* Job attributes */
|
||||
#define XPUATTRIBUTESUPPORTED_JOB_NAME (1L<<0)
|
||||
#define XPUATTRIBUTESUPPORTED_JOB_OWNER (1L<<1)
|
||||
#define XPUATTRIBUTESUPPORTED_NOTIFICATION_PROFILE (1L<<2)
|
||||
/* Document/Page attributes */
|
||||
#define XPUATTRIBUTESUPPORTED_COPY_COUNT (1L<<3)
|
||||
#define XPUATTRIBUTESUPPORTED_DOCUMENT_FORMAT (1L<<4)
|
||||
#define XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION (1L<<5)
|
||||
#define XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION (1L<<6)
|
||||
#define XPUATTRIBUTESUPPORTED_DEFAULT_INPUT_TRAY (1L<<7)
|
||||
#define XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM (1L<<8)
|
||||
#define XPUATTRIBUTESUPPORTED_PLEX (1L<<9)
|
||||
|
||||
/* prototypes */
|
||||
_XFUNCPROTOBEGIN
|
||||
|
||||
int XpuCheckExtension( Display *pdpy );
|
||||
|
||||
/* Create/destroy connection to printer */
|
||||
int XpuGetPrinter( const char *printername, Display **pdpyptr, XPContext *pcontextptr );
|
||||
void XpuClosePrinterDisplay(Display *pdpy, XPContext pcontext);
|
||||
|
||||
/* Misc. functions */
|
||||
void XpuSetOneAttribute( Display *pdpy, XPContext pcontext,
|
||||
XPAttributes type, const char *attribute_name, const char *value, XPAttrReplacement replacement_rule );
|
||||
void XpuSetOneLongAttribute( Display *pdpy, XPContext pcontext,
|
||||
XPAttributes type, const char *attribute_name, long value, XPAttrReplacement replacement_rule );
|
||||
int XpuCheckSupported( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, const char *query );
|
||||
int XpuSetJobTitle( Display *pdpy, XPContext pcontext, const char *title );
|
||||
int XpuGetOneLongAttribute( Display *pdpy, XPContext pcontext, XPAttributes type, const char *attribute_name, long *result );
|
||||
#ifdef DEBUG
|
||||
void dumpXpAttributes( Display *pdpy, XPContext pcontext );
|
||||
#endif /* DEBUG */
|
||||
void XpuWaitForPrintNotify( Display *pdpy, int xp_event_base, int detail );
|
||||
|
||||
/* Get list of printers */
|
||||
XPPrinterList XpuGetPrinterList( const char *printer, int *res_list_count );
|
||||
void XpuFreePrinterList( XPPrinterList list );
|
||||
|
||||
/* Set number of document copies */
|
||||
int XpuSetDocumentCopies( Display *pdpy, XPContext pcontext, long num_copies );
|
||||
|
||||
/* Get/Set/Query supported mediums (paper sizes) */
|
||||
XpuMediumSourceSizeList XpuGetMediumSourceSizeList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
|
||||
void XpuFreeMediumSourceSizeList( XpuMediumSourceSizeList list );
|
||||
int XpuSetDocMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec );
|
||||
int XpuSetPageMediumSourceSize( Display *pdpy, XPContext pcontext, XpuMediumSourceSizeRec *medium_spec );
|
||||
XpuMediumSourceSizeRec *
|
||||
XpuFindMediumSourceSizeBySize( XpuMediumSourceSizeList mlist, int mlist_count,
|
||||
float page_width_mm, float page_height_mm, float tolerance );
|
||||
XpuMediumSourceSizeRec *
|
||||
XpuFindMediumSourceSizeByBounds( XpuMediumSourceSizeList mlist, int mlist_count,
|
||||
float m1, float m2, float m3, float m4, float tolerance );
|
||||
XpuMediumSourceSizeRec *
|
||||
XpuFindMediumSourceSizeByName( XpuMediumSourceSizeList mlist, int mlist_count,
|
||||
const char *tray_name, const char *medium_name );
|
||||
|
||||
/* Get/Set resolution */
|
||||
XpuResolutionList XpuGetResolutionList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
|
||||
void XpuFreeResolutionList( XpuResolutionList list );
|
||||
Bool XpuGetResolution( Display *pdpy, XPContext pcontext, long *dpi );
|
||||
Bool XpuSetPageResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * );
|
||||
Bool XpuSetDocResolution( Display *pdpy, XPContext pcontext, XpuResolutionRec * );
|
||||
XpuResolutionRec *XpuFindResolution( XpuResolutionList list, int list_count, long min_dpi, long max_dpi );
|
||||
|
||||
/* Get/Set orientation */
|
||||
XpuOrientationList XpuGetOrientationList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
|
||||
void XpuFreeOrientationList( XpuOrientationList list );
|
||||
XpuOrientationRec *
|
||||
XpuFindOrientationByName( XpuOrientationList list, int list_count, const char *orientation );
|
||||
int XpuSetDocOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec );
|
||||
int XpuSetPageOrientation( Display *pdpy, XPContext pcontext, XpuOrientationRec *rec );
|
||||
|
||||
/* Get/set plex modes */
|
||||
XpuPlexList XpuGetPlexList( Display *pdpy, XPContext pcontext, int *numEntriesPtr );
|
||||
void XpuFreePlexList( XpuPlexList list );
|
||||
XpuPlexRec *XpuFindPlexByName( XpuPlexList list, int list_count, const char *plex );
|
||||
int XpuSetDocPlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec );
|
||||
int XpuSetPagePlex( Display *pdpy, XPContext pcontext, XpuPlexRec *rec );
|
||||
|
||||
/* Start job to printer (spooler) or file */
|
||||
void XpuStartJobToSpooler(Display *pdpy);
|
||||
void *XpuStartJobToFile( Display *pdpy, XPContext pcontext, const char *filename );
|
||||
XPGetDocStatus XpuWaitForPrintFileChild( void *handle );
|
||||
|
||||
/* Get flags which indicate whether it is allowed to set/change a specific attribute */
|
||||
XpuSupportedFlags XpuGetSupportedJobAttributes(Display *pdpy, XPContext pcontext);
|
||||
XpuSupportedFlags XpuGetSupportedDocAttributes(Display *pdpy, XPContext pcontext);
|
||||
XpuSupportedFlags XpuGetSupportedPageAttributes(Display *pdpy, XPContext pcontext);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
||||
#define XpuGetJobAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPJobAttr )
|
||||
#define XpuGetDocAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPDocAttr )
|
||||
#define XpuGetPageAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPageAttr )
|
||||
#define XpuGetPrinterAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPPrinterAttr )
|
||||
#define XpuGetServerAttributes( pdpy, pcontext ) XpGetAttributes( (pdpy), (pcontext), XPServerAttr )
|
||||
|
||||
#endif /* !XPRINTUTIL_H */
|
||||
/* EOF. */
|
|
@ -85,6 +85,7 @@ NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP=The browser cannot print preview right now.\
|
|||
NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED=The page was replaced while you were trying to print.\nPlease try again.
|
||||
NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT=Either pluggable dialogs were not properly installed\nOr this GFX Toolkit no longer supports native Print Dialogs
|
||||
NS_ERROR_GFX_NO_PRINTROMPTSERVICE=The Printing Prompt Service is missing.
|
||||
NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND=There was a problem printing. No Xprint server(s) could be found.\nCheck whether the XPSERVERLIST environment variable contains any valid Xprint servers.
|
||||
# No printers available
|
||||
noprinter=No printers available.
|
||||
PrintToFile=Print To File
|
||||
|
|
|
@ -598,13 +598,12 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
|||
mPrt->mPrintOptions = do_GetService(sPrintOptionsContractID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mPrt->mPrintOptions && mPrt->mPrintSettings) {
|
||||
// Get the default printer name and set it into the PrintSettings
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE, PR_TRUE);
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings);
|
||||
} else {
|
||||
NS_ASSERTION(mPrt->mPrintSettings, "You can't Print without a PrintSettings!");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CHECK_RUNTIME_ERROR_CONDITION(nsIDebugObject::PRT_RUNTIME_CHECKFORPRINTERS, rv, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_PL(("NS_ERROR_FAILURE - CheckForPrinters for Printers failed"));
|
||||
return CleanupOnFailure(rv, PR_FALSE);
|
||||
|
@ -1094,12 +1093,13 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
mPrt->mPrintOptions = do_GetService(sPrintOptionsContractID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mPrt->mPrintOptions && mPrt->mPrintSettings) {
|
||||
// Get the default printer name and set it into the PrintSettings
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE, PR_TRUE);
|
||||
rv = CheckForPrinters(mPrt->mPrintOptions, mPrt->mPrintSettings);
|
||||
} else {
|
||||
NS_ASSERTION(mPrt->mPrintSettings, "You can't Print without a PrintSettings!");
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
ShowPrintErrorDialog(rv, PR_TRUE);
|
||||
CloseProgressDialog(aWebProgressListener);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1543,17 +1543,15 @@ nsPrintEngine::Cancel()
|
|||
// in the PrintSettings which is then used for Printer Preview
|
||||
nsresult
|
||||
nsPrintEngine::CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
PRUint32 aErrorCode,
|
||||
PRBool aIsPrinting)
|
||||
nsIPrintSettings* aPrintSettings)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrintOptions);
|
||||
NS_ENSURE_ARG_POINTER(aPrintSettings);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> simpEnum;
|
||||
aPrintOptions->AvailablePrinters(getter_AddRefs(simpEnum));
|
||||
rv = aPrintOptions->AvailablePrinters(getter_AddRefs(simpEnum));
|
||||
if (simpEnum) {
|
||||
PRBool fndPrinter = PR_FALSE;
|
||||
simpEnum->HasMoreElements(&fndPrinter);
|
||||
|
@ -1578,17 +1576,12 @@ nsPrintEngine::CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
|||
nsMemory::Free(defPrinterName);
|
||||
}
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
// this means there were no printers
|
||||
ShowPrintErrorDialog(aErrorCode, aIsPrinting);
|
||||
}
|
||||
} else {
|
||||
// this means there were no printers
|
||||
// XXX the ifdefs are temporary until they correctly implement Available Printers
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
rv = NS_OK;
|
||||
#else
|
||||
ShowPrintErrorDialog(aErrorCode, aIsPrinting);
|
||||
#endif
|
||||
}
|
||||
return rv;
|
||||
|
@ -2315,6 +2308,7 @@ nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrinting)
|
|||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE)
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_NO_XPRINT_SERVERS_FOUND)
|
||||
|
||||
default:
|
||||
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE)
|
||||
|
|
|
@ -191,9 +191,7 @@ public:
|
|||
nsIPrintProgressParams* aParams);
|
||||
void ElipseLongString(PRUnichar *& aStr, const PRUint32 aLen, PRBool aDoFront);
|
||||
nsresult CheckForPrinters(nsIPrintOptions* aPrintOptions,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
PRUint32 aErrorCode,
|
||||
PRBool aIsPrinting);
|
||||
nsIPrintSettings* aPrintSettings);
|
||||
void CleanupDocTitleArray(PRUnichar**& aArray, PRInt32& aCount);
|
||||
void CheckForHiddenFrameSetFrames();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче