1) Removes the EnumeratePrinterExtended from nsIPrintOptions and all impls of it
2) Sets the Windows platform to once again use the native print dialog
3) The nsDeviceContextSpecWin will detect at runtime whether to use the standard PRINTDLG or the new PRINTDLGEX (supported by XP and WIN2k), this new code is only compiled in when the ifdef MOZ_REQUIRE_CURRENT_SDK is defined.
4) It adds an extra Property Sheet to the new dialog for Frameset Printing options
5) Now creates a DEVMODE before the diaog is created, this is used for setting different options in the print dialog before it comes up.
122530 r=dcone sr=hyatt
This commit is contained in:
rods%netscape.com 2002-01-31 14:30:22 +00:00
Родитель df7eee0ab3
Коммит f2c2102329
23 изменённых файлов: 680 добавлений и 450 удалений

Просмотреть файл

@ -243,14 +243,6 @@ interface nsIPrintOptions : nsISupports
*/
nsISimpleEnumerator availablePrinters ();
/**
* Indicates whether the list of printers contains the extended
* information. i.e. That there are "pairs" of values returned. Where the second
* value is either "FILE", "PRINTER", "BOTH"
*
*/
readonly attribute boolean isExtended;
/**
* display Printer Job Properties dialog
*/
@ -276,25 +268,6 @@ interface nsIPrinterEnumerator : nsISupports
*/
void enumeratePrinters(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult);
/**
* Returns an array of "pairs" of strings
* The first string in the pair is the printer name
* the second string in the pair is can be "FILE", "PRINTER", or "BOTH"
* which indicates whether the printer driver associated with this printer
* ALWAYS "spools" to a file or to a printer.
*
* If this type of information is not available, it should return zero items
*
* Note: On some platforms any given driveris able to spool to either
*
* @param aCount returns number of printers AND info strings returned
* i.e If there are 5 printers define the
* "count" returned will be 10
* @param aResult returns array of names
* @return void
*/
void enumeratePrintersExtended(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult);
/* takes printer selected and will display job properties dlg for that printer
* returns true if dialog displays
*/

Просмотреть файл

@ -487,15 +487,6 @@ nsPrinterEnumeratorBeOS::nsPrinterEnumeratorBeOS()
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorBeOS, nsIPrinterEnumerator)
NS_IMETHODIMP nsPrinterEnumeratorBeOS::EnumeratePrintersExtended(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);
NS_ENSURE_ARG_POINTER(aResult);
*aCount = 0;
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsPrinterEnumeratorBeOS::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);

Просмотреть файл

@ -480,15 +480,6 @@ nsPrinterEnumeratorGTK::nsPrinterEnumeratorGTK()
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorGTK, nsIPrinterEnumerator)
NS_IMETHODIMP nsPrinterEnumeratorGTK::EnumeratePrintersExtended(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);
NS_ENSURE_ARG_POINTER(aResult);
*aCount = 0;
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsPrinterEnumeratorGTK::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);

Просмотреть файл

@ -128,8 +128,7 @@ nsPrintOptions::nsPrintOptions() :
mPrintReversed(PR_FALSE),
mPrintInColor(PR_TRUE),
mOrientation(kPortraitOrientation),
mPrintToFile(PR_FALSE),
mIsExtendedInfo(PR_FALSE)
mPrintToFile(PR_FALSE)
{
NS_INIT_ISUPPORTS();
@ -183,7 +182,7 @@ nsPrinterListEnumerator : public nsISimpleEnumerator
//nsISimpleEnumerator interface
NS_DECL_NSISIMPLEENUMERATOR
NS_IMETHOD Init(PRBool& aIsExtendedInfo);
NS_IMETHOD Init();
protected:
PRUnichar **mPrinters;
@ -210,7 +209,7 @@ nsPrinterListEnumerator::~nsPrinterListEnumerator()
NS_IMPL_ISUPPORTS1(nsPrinterListEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP nsPrinterListEnumerator::Init(PRBool& aIsExtended)
NS_IMETHODIMP nsPrinterListEnumerator::Init()
{
nsresult rv;
nsCOMPtr<nsIPrinterEnumerator> printerEnumerator;
@ -219,17 +218,7 @@ NS_IMETHODIMP nsPrinterListEnumerator::Init(PRBool& aIsExtended)
if (NS_FAILED(rv))
return rv;
// First check to see if we can get the extended printer informations
// if not then get the regular
rv = printerEnumerator->EnumeratePrintersExtended(&mCount, &mPrinters);
if (NS_SUCCEEDED(rv) && mCount > 0) {
aIsExtended = PR_TRUE;
} else {
aIsExtended = PR_FALSE;
rv = printerEnumerator->EnumeratePrinters(&mCount, &mPrinters);
}
return rv;
return printerEnumerator->EnumeratePrinters(&mCount, &mPrinters);
}
NS_IMETHODIMP nsPrinterListEnumerator::HasMoreElements(PRBool *result)
@ -708,7 +697,7 @@ NS_IMETHODIMP nsPrintOptions::AvailablePrinters(nsISimpleEnumerator **aPrinterEn
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(mIsExtendedInfo);
nsresult rv = printerListEnum->Init();
if (NS_SUCCEEDED(rv)) {
*aPrinterEnumerator = NS_STATIC_CAST(nsISimpleEnumerator*, printerListEnum);
NS_ADDREF(*aPrinterEnumerator);
@ -716,15 +705,6 @@ NS_IMETHODIMP nsPrintOptions::AvailablePrinters(nsISimpleEnumerator **aPrinterEn
return NS_OK;
}
/* readonly attribute boolean isExtended; */
NS_IMETHODIMP nsPrintOptions::GetIsExtended(PRBool *aIsExtended)
{
NS_ENSURE_ARG(aIsExtended);
*aIsExtended = mIsExtendedInfo;
return NS_OK;
}
NS_IMETHODIMP nsPrintOptions::DisplayJobProperties( const PRUnichar *aPrinter, nsIPrintSettings* aPrintSettings, PRBool *aDisplayed)
{
NS_ENSURE_ARG(aPrinter);

Просмотреть файл

@ -104,8 +104,6 @@ protected:
PRBool mPrintToFile;
nsString mToFileName;
PRBool mIsExtendedInfo;
static nsFont* sDefaultFont;
};

Просмотреть файл

@ -345,15 +345,6 @@ nsPrinterEnumeratorOS2::nsPrinterEnumeratorOS2()
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorOS2, nsIPrinterEnumerator)
NS_IMETHODIMP nsPrinterEnumeratorOS2::EnumeratePrintersExtended(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);
NS_ENSURE_ARG_POINTER(aResult);
*aCount = 0;
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsPrinterEnumeratorOS2::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);

Просмотреть файл

@ -139,11 +139,6 @@ nsPrinterEnumeratorPh::~nsPrinterEnumeratorPh()
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorPh, nsIPrinterEnumerator)
NS_IMETHODIMP nsPrinterEnumeratorPh::EnumeratePrintersExtended(PRUint32* aCount, PRUnichar*** aResult)
{
return DoEnumeratePrinters(PR_TRUE, aCount, aResult);
}
//----------------------------------------------------------------------------------
// Enumerate all the Printers from the global array and pass their
// names back (usually to script)
@ -175,9 +170,8 @@ static void CleanupArray(PRUnichar**& aArray, PRInt32& aCount)
nsresult
nsPrinterEnumeratorPh::DoEnumeratePrinters(PRBool aDoExtended,
PRUint32* aCount,
PRUnichar*** aResult)
nsPrinterEnumeratorPh::DoEnumeratePrinters(PRUint32* aCount,
PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);
NS_ENSURE_ARG_POINTER(aResult);

Просмотреть файл

@ -75,7 +75,7 @@ public:
private:
// helper
nsresult DoEnumeratePrinters(PRBool aDoExtended, PRUint32* aCount, PRUnichar*** aResult);
nsresult DoEnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult);
};

Просмотреть файл

@ -31,3 +31,4 @@ PrintFrames=Print Frames
Aslaid=As &laid out on the screen
selectedframe=The selected &frame
Eachframe=&Each frame separately
options=Options

Просмотреть файл

@ -100,6 +100,7 @@ WIN_LIBS= \
ole32.lib \
!endif
winspool.lib \
comctl32.lib \
comdlg32.lib
LLFLAGS = $(LLFLAGS)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -63,6 +63,10 @@ protected:
nsresult ShowXPPrintDialog(PRBool aQuiet);
nsresult ShowNativePrintDialog(nsIWidget* aWidget, PRBool aQuiet);
#ifdef MOZ_REQUIRE_CURRENT_SDK
nsresult ShowNativePrintDialogEx(nsIWidget* aWidget, PRBool aQuiet);
#endif
void SetDeviceName(char* aDeviceName);
void SetDriverName(char* aDriverName);
void SetGlobalDevMode(HGLOBAL aHGlobal);
@ -80,6 +84,9 @@ protected:
PRBool mIsDEVMODEGlobalHandle;
nsCOMPtr<nsIPrintSettings> mPrintSettings;
// For PrintDlgEx
FARPROC mUseExtendedPrintDlg;
};

Просмотреть файл

@ -1035,7 +1035,7 @@ NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle)
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = title != nsnull?title:"Mozilla Document";
#ifdef DEBUG_rodsX
#ifdef DEBUG_rods
docinfo.lpszOutput = "p.ps";
#else
docinfo.lpszOutput = docName;

Просмотреть файл

@ -466,15 +466,6 @@ nsPrinterEnumeratorXlib::nsPrinterEnumeratorXlib()
NS_IMPL_ISUPPORTS1(nsPrinterEnumeratorXlib, nsIPrinterEnumerator)
NS_IMETHODIMP nsPrinterEnumeratorXlib::EnumeratePrintersExtended(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);
NS_ENSURE_ARG_POINTER(aResult);
*aCount = 0;
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsPrinterEnumeratorXlib::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult)
{
NS_ENSURE_ARG(aCount);

Просмотреть файл

@ -84,5 +84,3 @@ pref("font.size.fixed.zh-CN", 16);
pref("font.size.variable.zh-TW", 16);
pref("font.size.fixed.zh-TW", 16);
pref("print.whileInPrintPreview", true);

Просмотреть файл

@ -224,6 +224,8 @@ pref("print.use_global_printsettings", false);
// This indeicates whether it should use the native dialog or the XP Dialog50
pref("print.use_native_print_dialog", false);
pref("print.whileInPrintPreview", true);
// Default Capability Preferences: Security-Critical!
// Editing these may create a security risk - be sure you know what you're doing
//pref("capability.policy.default.barprop.visible.set", "UniversalBrowserWrite");

Просмотреть файл

@ -241,4 +241,6 @@ pref("print.print_headerfooter_gap", 0); // twips
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
pref("print.whileInPrintPreview", true);
// This indicates whether it should use the native dialog or the XP Dialog
pref("print.use_native_print_dialog", true);

Просмотреть файл

@ -213,5 +213,3 @@ pref("print.print_headerfooter_gap", 0); // twips
// print_extra_margin enables platforms to specify an extra gap or margin
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
pref("print.whileInPrintPreview", true);

Просмотреть файл

@ -54,16 +54,5 @@ pref("applications.rlogin_with_user", "create /term /detach \"rlogin %h -l %u\""
pref("print.print_command", "print");
pref("print.print_color", false);
// print_headerfooter_gap enables platforms to specify an extra "gap" in twips
// between the H/F and the edge of the paper,
// this is used by both Printing and Print Preview
pref("print.print_headerfooter_gap", 0); // twips
// print_extra_margin enables platforms to specify an extra gap or margin
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
pref("print.whileInPrintPreview", true);
pref("browser.cache.disk.capacity", 4000);

Просмотреть файл

@ -70,5 +70,3 @@ pref("print.print_headerfooter_gap", 0); // twips
// print_extra_margin enables platforms to specify an extra gap or margin
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
pref("print.whileInPrintPreview", true);

Просмотреть файл

@ -187,4 +187,6 @@ pref("print.print_headerfooter_gap", 0); // twips
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
pref("print.whileInPrintPreview", true);
// This indicates whether it should use the native dialog or the XP Dialog
pref("print.use_native_print_dialog", true);

Просмотреть файл

@ -52,3 +52,13 @@ IDC_GRABBING CURSOR DISCARDABLE "res\\grabbing.cur"
IDC_CELL CURSOR DISCARDABLE "res\\cell.cur"
IDC_COPY CURSOR DISCARDABLE "res\\copy.cur"
IDC_ALIAS CURSOR DISCARDABLE "res\\aliasb.cur"
OPTPROPSHEET DIALOG DISCARDABLE 32, 32, 288, 226
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Sans Serif"
BEGIN
END

Просмотреть файл

@ -29,8 +29,6 @@ var gOriginalNumCopies = 1;
var paramBlock;
var gPrintSettings = null;
var gIsExtended = false;
var gExtendedArray = new Array();
var gPrinterName = "";
var gPrintToFile = false;
@ -104,20 +102,6 @@ function stripTrailingWhitespace(element)
element.value = value;
}
//---------------------------------------------------
function doEnablePrintToFile(value)
{
if (value) {
dialog.fileLabel.removeAttribute("disabled");
dialog.fileInput.removeAttribute("disabled");
dialog.chooseButton.removeAttribute("disabled");
} else {
dialog.fileLabel.setAttribute("disabled","true");
dialog.fileInput.setAttribute("disabled","true");
dialog.chooseButton.setAttribute("disabled","true");
}
}
//---------------------------------------------------
function listElement(aListElement)
{
@ -134,7 +118,7 @@ listElement.prototype =
},
appendPrinterNames:
function (aDataObject, isExtended)
function (aDataObject)
{
var popupNode = document.createElement("menupopup");
var strDefaultPrinterName = "";
@ -151,13 +135,6 @@ listElement.prototype =
itemNode.setAttribute("value", printerNameStr);
itemNode.setAttribute("label", printerNameStr);
popupNode.appendChild(itemNode);
if (isExtended) {
itemNode.setAttribute("oncommand", "printerSelected();");
var infoObj = aDataObject.getNext();
infoObj = infoObj.QueryInterface(Components.interfaces.nsISupportsWString);
var infoStr = infoObj.toString();
gExtendedArray[printerNameStr] = infoStr;
}
}
if (strDefaultPrinterName != "") {
this.listElement.removeAttribute("disabled");
@ -173,7 +150,6 @@ listElement.prototype =
dialog.printerLabel.setAttribute("disabled","true");
dialog.propertiesButton.setAttribute("disabled","true");
dialog.fileRadio.setAttribute("disabled","true");
doEnablePrintToFile(false);
dialog.printButton.setAttribute("disabled","true");
}
@ -186,61 +162,13 @@ listElement.prototype =
function getPrinters()
{
var printerEnumerator = printService.availablePrinters();
gIsExtended = printService.isExtended;
var selectElement = new listElement(dialog.printerList);
selectElement.clearList();
var strDefaultPrinterName = selectElement.appendPrinterNames(printerEnumerator, gIsExtended);
var strDefaultPrinterName = selectElement.appendPrinterNames(printerEnumerator);
var printerObj = gExtendedArray[gPrinterName];
if (printerObj) {
selectElement.listElement.value = gPrinterName;
} else {
selectElement.listElement.value = strDefaultPrinterName;
}
printerSelected();
}
//---------------------------------------------------
function printerSelected()
{
var printerName = dialog.printerList.value
var info = gExtendedArray[printerName];
if (info == "FILE") {
gPrintToFile = dialog.destGroup.selectedItem == dialog.fileRadio;
dialog.destGroup.selectedItem = dialog.fileRadio;
doEnablePrintToFile(true);
doEnableFileRadios(false);
} else if (info == "PRINTER") {
gPrintToFile = dialog.destGroup.selectedItem == dialog.fileRadio;
dialog.destGroup.selectedItem = dialog.printerRadio;
doEnablePrintToFile(false);
doEnableFileRadios(false);
} else { // BOTH
if (gPrintToFile) {
dialog.destGroup.selectedItem = dialog.fileRadio;
} else {
dialog.destGroup.selectedItem = dialog.printerRadio;
}
doEnablePrintToFile(gPrintToFile);
doEnableFileRadios(true);
}
}
//---------------------------------------------------
function doEnableFileRadios(enable)
{
if (enable) {
dialog.fileRadio.removeAttribute("disabled");
dialog.printerRadio.removeAttribute("disabled");
dialog.destGroup.removeAttribute("disabled");
} else {
dialog.fileRadio.setAttribute("disabled","true");
dialog.printerRadio.setAttribute("disabled","true");
dialog.destGroup.setAttribute("disabled","true");
}
selectElement.listElement.value = strDefaultPrinterName;
dialog.fileRadio.selected = true;
}
//---------------------------------------------------
@ -263,9 +191,6 @@ function displayPropertiesDialog()
//---------------------------------------------------
function doPrintRange(inx)
{
dialog.fileRadio.setAttribute("disabled","true");
dialog.printerRadio.setAttribute("disabled","true");
if (inx == 1) {
dialog.frompageInput.removeAttribute("disabled");
dialog.frompageLabel.removeAttribute("disabled");