mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
backing out unwanted changes
This commit is contained in:
parent
6322913ff7
commit
473f2bde0d
@ -64,17 +64,24 @@ public:
|
||||
* means getting information about a printer. A previously
|
||||
* returned device context spec can be passed in and used as
|
||||
* a starting point for getting a new spec (or simply returning
|
||||
* the old spec again).
|
||||
* the old spec again). Additionally, if it is desirable to
|
||||
* get the device context spec without user intervention, any
|
||||
* dialog boxes can be supressed by passing in PR_TRUE for the
|
||||
* aQuiet parameter.
|
||||
* @param aWidget.. this is a widget a dialog can be hosted in
|
||||
* @param aNewSpec out parameter for device context spec returned. the
|
||||
* aOldSpec may be returned if the object is recyclable.
|
||||
* @param aIsPrintPreview if PR_TRUE, creating Spec for PrintPreview
|
||||
* @param aQuiet if PR_TRUE, prevent the need for user intervention
|
||||
* in obtaining device context spec. if nsnull is passed in for
|
||||
* the aOldSpec, this will typically result in getting a device
|
||||
* context spec for the default output device (i.e. default
|
||||
* printer).
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview) = 0;
|
||||
PRBool aQuiet) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -107,6 +107,15 @@ interface nsIPrintOptions : nsISupports
|
||||
*/
|
||||
void displayJobProperties (in wstring aPrinter, in nsIPrintSettings aPrintSettings, out boolean aDisplayed);
|
||||
|
||||
// Attributes
|
||||
attribute boolean isCancelled;
|
||||
|
||||
attribute wstring title;
|
||||
attribute wstring docURL;
|
||||
|
||||
attribute boolean printToFile;
|
||||
attribute wstring toFileName;
|
||||
|
||||
// no script methods
|
||||
[noscript] void SetFontNamePointSize(in nsNativeStringRef aName, in PRInt32 aPointSize);
|
||||
|
||||
|
@ -88,7 +88,6 @@ interface nsIPrintSettings : nsISupports
|
||||
const unsigned long kInitSaveToFileName = 0x00400000;
|
||||
const unsigned long kInitSavePageDelay = 0x00800000;
|
||||
const unsigned long kInitSaveMargins = 0x01000000;
|
||||
const unsigned long kInitSaveNativeData = 0x02000000;
|
||||
const unsigned long kInitSaveAll = 0xFFFFFFFF;
|
||||
|
||||
/* Print Option Flags for Bit Field*/
|
||||
@ -166,11 +165,6 @@ interface nsIPrintSettings : nsISupports
|
||||
*/
|
||||
void GetPageSizeInTwips(out long aWidth, out long aHeight);
|
||||
|
||||
/**
|
||||
* Makes a new copy
|
||||
*/
|
||||
nsIPrintSettings clone();
|
||||
|
||||
/**
|
||||
* Data Members
|
||||
*/
|
||||
|
@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Don Cone <dcone@netscape.com>
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include <Printing.h>
|
||||
%}
|
||||
|
||||
/**
|
||||
* Native types
|
||||
*/
|
||||
native nsTHPrint(THPrint);
|
||||
|
||||
/**
|
||||
* Simplified PrintSettings for Mac interface
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(3C85F9F5-3A9D-4bce-8CF8-A1B14E5E8508)]
|
||||
|
||||
interface nsIPrintSettingsMac : nsISupports
|
||||
{
|
||||
/*
|
||||
* thPrint attribute
|
||||
*
|
||||
* Getter returns a clone of the current data
|
||||
* Setter copies (does not take ownership of) the input
|
||||
*/
|
||||
|
||||
[noscript] attribute nsTHPrint tHPrint;
|
||||
|
||||
/*
|
||||
* readPageSetupFromPrefs and writePageSetupToPrefs
|
||||
*
|
||||
* Read and write a print record to/from prefs.
|
||||
*/
|
||||
[noscript] void readPageSetupFromPrefs();
|
||||
[noscript] void writePageSetupToPrefs();
|
||||
};
|
@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
* Don Cone <dcone@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include <PMApplication.h>
|
||||
%}
|
||||
|
||||
/**
|
||||
* Native types
|
||||
*/
|
||||
native nsPMPageFormat(PMPageFormat);
|
||||
native nsPMPrintSettings(PMPrintSettings);
|
||||
|
||||
|
||||
/**
|
||||
* Simplified PrintSettings for OSX interface
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(CD2A0A4F-0DE9-4c51-9232-42668F559F94)]
|
||||
|
||||
interface nsIPrintSettingsX : nsISupports
|
||||
{
|
||||
|
||||
/*
|
||||
* PMPageFormat and PMPrintSettings attributes
|
||||
*
|
||||
* Getter returns a clone of the current data
|
||||
* Setter copies (does not take ownership of) the input
|
||||
*/
|
||||
[noscript] attribute nsPMPageFormat pMPageFormat;
|
||||
|
||||
[noscript] attribute nsPMPrintSettings pMPrintSettings;
|
||||
|
||||
/*
|
||||
* readPageFormatFromPrefs and writePageFormatToPrefs
|
||||
*
|
||||
* Read and write a flattened PMPageFormat to/from prefs.
|
||||
* This also contains any custom data we appended to the dialog
|
||||
*/
|
||||
[noscript] void readPageFormatFromPrefs();
|
||||
[noscript] void writePageFormatToPrefs();
|
||||
};
|
@ -77,14 +77,14 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: Init(void)
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview)
|
||||
PRBool aQuiet)
|
||||
{
|
||||
nsresult rv;
|
||||
static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
nsCOMPtr<nsIDeviceContextSpec> devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings);
|
||||
rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings, aQuiet);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
aNewSpec = devSpec;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview);
|
||||
PRBool aQuiet);
|
||||
|
||||
protected:
|
||||
virtual ~nsDeviceContextSpecFactoryGTK();
|
||||
|
@ -51,9 +51,16 @@
|
||||
#include "nsIPref.h"
|
||||
#include "prenv.h" /* for PR_GetEnv */
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
#include "xprintutil.h"
|
||||
@ -247,6 +254,66 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
|
||||
#error "This should not happen"
|
||||
#endif
|
||||
|
||||
/** -------------------------------------------------------
|
||||
*/
|
||||
static nsresult DisplayXPDialog(nsIPrintSettings* aPS,
|
||||
const char* aChromeURL,
|
||||
PRBool& aClickedOK)
|
||||
{
|
||||
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::DisplayXPDialog()\n"));
|
||||
NS_ASSERTION(aPS, "Must have a print settings!");
|
||||
|
||||
aClickedOK = PR_FALSE;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// create a nsISupportsArray of the parameters
|
||||
// being passed to the window
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
NS_NewISupportsArray(getter_AddRefs(array));
|
||||
if (!array) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> ps = aPS;
|
||||
nsCOMPtr<nsISupports> psSupports(do_QueryInterface(ps));
|
||||
NS_ASSERTION(psSupports, "PrintSettings must be a supports");
|
||||
array->AppendElement(psSupports);
|
||||
|
||||
nsCOMPtr<nsIDialogParamBlock> ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1"));
|
||||
if (ioParamBlock) {
|
||||
ioParamBlock->SetInt(0, 0);
|
||||
nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(ioParamBlock));
|
||||
NS_ASSERTION(blkSupps, "IOBlk must be a supports");
|
||||
|
||||
array->AppendElement(blkSupps);
|
||||
nsCOMPtr<nsISupports> arguments(do_QueryInterface(array));
|
||||
NS_ASSERTION(array, "array must be a supports");
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch) {
|
||||
nsCOMPtr<nsIDOMWindow> active;
|
||||
wwatch->GetActiveWindow(getter_AddRefs(active));
|
||||
nsCOMPtr<nsIDOMWindowInternal> parent = do_QueryInterface(active);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = wwatch->OpenWindow(parent, aChromeURL,
|
||||
"_blank", "chrome,modal,centerscreen", array,
|
||||
getter_AddRefs(newWindow));
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PRInt32 buttonPressed = 0;
|
||||
ioParamBlock->GetInt(0, &buttonPressed);
|
||||
if (buttonPressed == 1) {
|
||||
aClickedOK = PR_TRUE;
|
||||
} else {
|
||||
rv = NS_ERROR_ABORT;
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_ABORT;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** -------------------------------------------------------
|
||||
* Initialize the nsDeviceContextSpecGTK
|
||||
* @update dc 2/15/98
|
||||
@ -256,19 +323,19 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
|
||||
* toolkits including:
|
||||
* - GTK+-toolkit:
|
||||
* file: mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init()
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet)
|
||||
* - GTK-toolkit:
|
||||
* file: mozilla/gfx/src/xlib/nsDeviceContextSpecGTK.cpp
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init()
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet)
|
||||
* - Qt-toolkit:
|
||||
* file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecQT::Init()
|
||||
* function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet)
|
||||
*
|
||||
* ** Please update the other toolkits when changing this function.
|
||||
*/
|
||||
NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS)
|
||||
NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS, PRBool aQuiet)
|
||||
{
|
||||
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::Init(aPS=%p)\n", aPS);
|
||||
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::Init(aPS=%p. qQuiet=%d)\n", aPS, (int)aQuiet));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
mPrintSettings = aPS;
|
||||
@ -283,76 +350,88 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS)
|
||||
}
|
||||
}
|
||||
|
||||
PRBool canPrint = PR_FALSE;
|
||||
|
||||
rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!aQuiet) {
|
||||
rv = DisplayXPDialog(mPrintSettings,
|
||||
"chrome://global/content/printdialog.xul", canPrint);
|
||||
} else {
|
||||
rv = NS_OK;
|
||||
canPrint = PR_TRUE;
|
||||
}
|
||||
|
||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
||||
|
||||
if (aPS) {
|
||||
PRBool reversed = PR_FALSE;
|
||||
PRBool color = PR_FALSE;
|
||||
PRBool tofile = PR_FALSE;
|
||||
PRInt16 printRange = nsIPrintSettings::kRangeAllPages;
|
||||
PRInt32 orientation = NS_PORTRAIT;
|
||||
PRInt32 fromPage = 1;
|
||||
PRInt32 toPage = 1;
|
||||
PRUnichar *command = nsnull;
|
||||
PRInt32 copies = 1;
|
||||
PRUnichar *printer = nsnull;
|
||||
PRUnichar *papername = nsnull;
|
||||
PRUnichar *printfile = nsnull;
|
||||
double dleft = 0.5;
|
||||
double dright = 0.5;
|
||||
double dtop = 0.5;
|
||||
double dbottom = 0.5;
|
||||
if (NS_SUCCEEDED(rv) && canPrint) {
|
||||
if (aPS) {
|
||||
PRBool reversed = PR_FALSE;
|
||||
PRBool color = PR_FALSE;
|
||||
PRBool tofile = PR_FALSE;
|
||||
PRInt16 printRange = nsIPrintSettings::kRangeAllPages;
|
||||
PRInt32 orientation = NS_PORTRAIT;
|
||||
PRInt32 fromPage = 1;
|
||||
PRInt32 toPage = 1;
|
||||
PRUnichar *command = nsnull;
|
||||
PRInt32 copies = 1;
|
||||
PRUnichar *printer = nsnull;
|
||||
PRUnichar *papername = nsnull;
|
||||
PRUnichar *printfile = nsnull;
|
||||
double dleft = 0.5;
|
||||
double dright = 0.5;
|
||||
double dtop = 0.5;
|
||||
double dbottom = 0.5;
|
||||
|
||||
aPS->GetPrinterName(&printer);
|
||||
aPS->GetPrintReversed(&reversed);
|
||||
aPS->GetPrintInColor(&color);
|
||||
aPS->GetPaperName(&papername);
|
||||
aPS->GetOrientation(&orientation);
|
||||
aPS->GetPrintCommand(&command);
|
||||
aPS->GetPrintRange(&printRange);
|
||||
aPS->GetToFileName(&printfile);
|
||||
aPS->GetPrintToFile(&tofile);
|
||||
aPS->GetStartPageRange(&fromPage);
|
||||
aPS->GetEndPageRange(&toPage);
|
||||
aPS->GetNumCopies(&copies);
|
||||
aPS->GetMarginTop(&dtop);
|
||||
aPS->GetMarginLeft(&dleft);
|
||||
aPS->GetMarginBottom(&dbottom);
|
||||
aPS->GetMarginRight(&dright);
|
||||
aPS->GetPrinterName(&printer);
|
||||
aPS->GetPrintReversed(&reversed);
|
||||
aPS->GetPrintInColor(&color);
|
||||
aPS->GetPaperName(&papername);
|
||||
aPS->GetOrientation(&orientation);
|
||||
aPS->GetPrintCommand(&command);
|
||||
aPS->GetPrintRange(&printRange);
|
||||
aPS->GetToFileName(&printfile);
|
||||
aPS->GetPrintToFile(&tofile);
|
||||
aPS->GetStartPageRange(&fromPage);
|
||||
aPS->GetEndPageRange(&toPage);
|
||||
aPS->GetNumCopies(&copies);
|
||||
aPS->GetMarginTop(&dtop);
|
||||
aPS->GetMarginLeft(&dleft);
|
||||
aPS->GetMarginBottom(&dbottom);
|
||||
aPS->GetMarginRight(&dright);
|
||||
|
||||
if (printfile)
|
||||
strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get());
|
||||
if (command)
|
||||
strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get());
|
||||
if (printer)
|
||||
strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get());
|
||||
if (papername)
|
||||
strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get());
|
||||
if (printfile)
|
||||
strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get());
|
||||
if (command)
|
||||
strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get());
|
||||
if (printer)
|
||||
strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get());
|
||||
if (papername)
|
||||
strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get());
|
||||
|
||||
DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright));
|
||||
DO_PR_DEBUG_LOG(("printRange %d\n", printRange));
|
||||
DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage));
|
||||
DO_PR_DEBUG_LOG(("toPage %d\n", toPage));
|
||||
DO_PR_DEBUG_LOG(("tofile %d\n", tofile));
|
||||
DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright));
|
||||
DO_PR_DEBUG_LOG(("printRange %d\n", printRange));
|
||||
DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage));
|
||||
DO_PR_DEBUG_LOG(("toPage %d\n", toPage));
|
||||
DO_PR_DEBUG_LOG(("tofile %d\n", tofile));
|
||||
DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"<NULL>"));
|
||||
DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"<NULL>"));
|
||||
|
||||
mTop = dtop;
|
||||
mBottom = dbottom;
|
||||
mLeft = dleft;
|
||||
mRight = dright;
|
||||
mFpf = !reversed;
|
||||
mGrayscale = !color;
|
||||
mOrientation = orientation;
|
||||
mToPrinter = !tofile;
|
||||
mCopies = copies;
|
||||
mTop = dtop;
|
||||
mBottom = dbottom;
|
||||
mLeft = dleft;
|
||||
mRight = dright;
|
||||
mFpf = !reversed;
|
||||
mGrayscale = !color;
|
||||
mOrientation = orientation;
|
||||
mToPrinter = !tofile;
|
||||
mCopies = copies;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -914,7 +993,19 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich
|
||||
|
||||
NS_IMETHODIMP nsPrinterEnumeratorGTK::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings)
|
||||
{
|
||||
return NS_OK;
|
||||
/* fixme: We simply ignore the |aPrinter| argument here
|
||||
* We should get the supported printer attributes from the printer and
|
||||
* populate the print job options dialog with these data instead of using
|
||||
* the "default set" here.
|
||||
* However, this requires changes on all platforms and is another big chunk
|
||||
* of patches ... ;-(
|
||||
*/
|
||||
|
||||
PRBool pressedOK;
|
||||
return DisplayXPDialog(aPrintSettings,
|
||||
"chrome://global/content/printjoboptions.xul",
|
||||
pressedOK);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init(nsIPrintSettings* aPS);
|
||||
NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet);
|
||||
NS_IMETHOD ClosePrintManager();
|
||||
|
||||
NS_IMETHOD GetToPrinter(PRBool &aToPrinter);
|
||||
|
@ -66,7 +66,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: Init(void)
|
||||
NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview)
|
||||
PRBool aQuiet)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWidget);
|
||||
|
||||
@ -77,7 +77,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget
|
||||
|
||||
if (nsnull != devspec){
|
||||
nsDeviceContextSpecWin* specWin = NS_STATIC_CAST(nsDeviceContextSpecWin*, devspec);
|
||||
rv = specWin->Init(aWidget, aPrintSettings, aIsPrintPreview);
|
||||
rv = specWin->Init(aWidget, aPrintSettings, aQuiet);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aNewSpec = devspec;
|
||||
} else {
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
nsIDeviceContextSpec *&aNewSpec,
|
||||
PRBool aIsPrintPreview);
|
||||
PRBool aQuiet);
|
||||
|
||||
protected:
|
||||
~nsDeviceContextSpecFactoryWin();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,7 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, PRBool aIsPrintPreview);
|
||||
NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, PRBool aQuiet);
|
||||
|
||||
void GetDriverName(char *&aDriverName) const { aDriverName = mDriverName; }
|
||||
void GetDeviceName(char *&aDeviceName) const { aDeviceName = mDeviceName; }
|
||||
@ -70,6 +70,12 @@ public:
|
||||
LPDEVMODE aDevMode);
|
||||
|
||||
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);
|
||||
@ -87,6 +93,9 @@ protected:
|
||||
PRBool mIsDEVMODEGlobalHandle;
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
|
||||
// For PrintDlgEx
|
||||
FARPROC mUseExtendedPrintDlg;
|
||||
};
|
||||
|
||||
|
||||
|
@ -55,26 +55,6 @@ nsPrintSettingsWin::nsPrintSettingsWin() :
|
||||
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsPrintSettingsWin.h
|
||||
* @update
|
||||
*/
|
||||
nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin* aPS) :
|
||||
nsPrintSettings(aPS),
|
||||
mDeviceName(nsnull),
|
||||
mDriverName(nsnull),
|
||||
mDevMode(nsnull)
|
||||
{
|
||||
if (aPS->mDeviceName) mDeviceName = nsCRT::strdup(aPS->mDeviceName);
|
||||
if (aPS->mDriverName) mDriverName = nsCRT::strdup(aPS->mDriverName);
|
||||
|
||||
if (aPS->mDevMode) {
|
||||
size_t size = sizeof(*aPS->mDevMode);
|
||||
mDevMode = (LPDEVMODE)malloc(size);
|
||||
memcpy(mDevMode, aPS->mDevMode, size);
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsPrintSettingsWin.h
|
||||
* @update
|
||||
@ -146,11 +126,3 @@ NS_IMETHODIMP nsPrintSettingsWin::SetDevMode(DEVMODE * aDevMode)
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIPrintSettings clone (); */
|
||||
nsresult
|
||||
nsPrintSettingsWin::CloneObj(nsIPrintSettings **_retval)
|
||||
{
|
||||
nsPrintSettingsWin* printSettings = new nsPrintSettingsWin(this);
|
||||
return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
|
||||
}
|
||||
|
@ -32,21 +32,15 @@
|
||||
//*** nsPrintSettingsWin
|
||||
//*****************************************************************************
|
||||
class nsPrintSettingsWin : public nsPrintSettings,
|
||||
public nsIPrintSettingsWin
|
||||
public nsIPrintSettingsWin
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRINTSETTINGSWIN
|
||||
|
||||
nsPrintSettingsWin();
|
||||
nsPrintSettingsWin(const nsPrintSettingsWin* aPS);
|
||||
virtual ~nsPrintSettingsWin();
|
||||
|
||||
/**
|
||||
* Makes a new copy
|
||||
*/
|
||||
virtual nsresult CloneObj(nsIPrintSettings **_retval);
|
||||
|
||||
protected:
|
||||
char* mDeviceName;
|
||||
char* mDriverName;
|
||||
|
@ -112,7 +112,9 @@ nsFont* nsPrintOptions::sDefaultFont = nsnull;
|
||||
* See documentation in nsPrintOptionsImpl.h
|
||||
* @update 6/21/00 dwc
|
||||
*/
|
||||
nsPrintOptions::nsPrintOptions()
|
||||
nsPrintOptions::nsPrintOptions() :
|
||||
mIsCancelled(PR_FALSE),
|
||||
mPrintToFile(PR_FALSE)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
@ -897,6 +899,79 @@ NS_IMETHODIMP nsPrintOptions::DisplayJobProperties( const PRUnichar *aPrinter, n
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute long isCancelled; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetIsCancelled(PRBool *aIsCancelled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsCancelled);
|
||||
*aIsCancelled = mIsCancelled;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintOptions::SetIsCancelled(PRBool aIsCancelled)
|
||||
{
|
||||
mIsCancelled = aIsCancelled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute boolean printToFile; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetPrintToFile(PRBool *aPrintToFile)
|
||||
{
|
||||
//NS_ENSURE_ARG_POINTER(aPrintToFile);
|
||||
*aPrintToFile = mPrintToFile;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintOptions::SetPrintToFile(PRBool aPrintToFile)
|
||||
{
|
||||
mPrintToFile = aPrintToFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute wstring toFileName; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetToFileName(PRUnichar * *aToFileName)
|
||||
{
|
||||
//NS_ENSURE_ARG_POINTER(aToFileName);
|
||||
*aToFileName = ToNewUnicode(mToFileName);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintOptions::SetToFileName(const PRUnichar * aToFileName)
|
||||
{
|
||||
mToFileName = aToFileName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute wstring docTitle; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetTitle(PRUnichar * *aTitle)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTitle);
|
||||
*aTitle = ToNewUnicode(mTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintOptions::SetTitle(const PRUnichar * aTitle)
|
||||
{
|
||||
if (aTitle) {
|
||||
mTitle = aTitle;
|
||||
} else {
|
||||
mTitle.SetLength(0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute wstring docURL; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetDocURL(PRUnichar * *aDocURL)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocURL);
|
||||
*aDocURL = ToNewUnicode(mURL);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintOptions::SetDocURL(const PRUnichar * aDocURL)
|
||||
{
|
||||
if (aDocURL) {
|
||||
mURL = aDocURL;
|
||||
} else {
|
||||
mURL.SetLength(0);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* [noscript] voidPtr GetNativeData (in short aDataType); */
|
||||
NS_IMETHODIMP nsPrintOptions::GetNativeData(PRInt16 aDataType, void * *_retval)
|
||||
{
|
||||
|
@ -54,12 +54,18 @@ protected:
|
||||
nsresult ReadPrefDouble(nsIPref * aPref, const char * aPrefId, double& aVal);
|
||||
nsresult WritePrefDouble(nsIPref * aPref, const char * aPrefId, double aVal);
|
||||
|
||||
virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags);
|
||||
virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags);
|
||||
nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags);
|
||||
nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags);
|
||||
const char* GetPrefName(const char * aPrefName,
|
||||
const nsString& aPrinterName);
|
||||
|
||||
// Members
|
||||
PRBool mIsCancelled;
|
||||
nsString mTitle;
|
||||
nsString mURL;
|
||||
PRBool mPrintToFile;
|
||||
nsString mToFileName;
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
|
||||
|
||||
nsCString mPrefName;
|
||||
|
@ -91,46 +91,6 @@ nsPrintSettings::nsPrintSettings() :
|
||||
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsPrintSettingsImpl.h
|
||||
* @update 6/21/00 dwc
|
||||
*/
|
||||
nsPrintSettings::nsPrintSettings(const nsPrintSettings* aPS) :
|
||||
mPrintOptions(aPS->mPrintOptions),
|
||||
mPrintRange(aPS->mPrintRange),
|
||||
mStartPageNum(aPS->mStartPageNum),
|
||||
mEndPageNum(aPS->mEndPageNum),
|
||||
mScaling(aPS->mScaling),
|
||||
mPrintBGColors(aPS->mPrintBGColors),
|
||||
mPrintBGImages(aPS->mPrintBGImages),
|
||||
mPrintFrameTypeUsage(aPS->mPrintFrameTypeUsage),
|
||||
mPrintFrameType(aPS->mPrintFrameType),
|
||||
mHowToEnableFrameUI(aPS->mHowToEnableFrameUI),
|
||||
mIsCancelled(aPS->mIsCancelled),
|
||||
mPrintSilent(aPS->mPrintSilent),
|
||||
mPrintPreview(aPS->mPrintPreview),
|
||||
mShrinkToFit(aPS->mShrinkToFit),
|
||||
mPrintPageDelay(aPS->mPrintPageDelay),
|
||||
mPaperData(aPS->mPaperData),
|
||||
mPaperSizeType(aPS->mPaperSizeType),
|
||||
mPaperWidth(aPS->mPaperWidth),
|
||||
mPaperHeight(aPS->mPaperHeight),
|
||||
mPaperSizeUnit(aPS->mPaperSizeUnit),
|
||||
mPrintReversed(aPS->mPrintReversed),
|
||||
mPrintInColor(aPS->mPrintInColor),
|
||||
mOrientation(aPS->mOrientation),
|
||||
mNumCopies(aPS->mNumCopies),
|
||||
mPrintToFile(aPS->mPrintToFile),
|
||||
mMargin(aPS->mMargin)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
for (PRInt32 i=0;i<3;i++) {
|
||||
mHeaderStrs[i] = aPS->mHeaderStrs[i];
|
||||
mFooterStrs[i] = aPS->mFooterStrs[i];
|
||||
}
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsPrintSettingsImpl.h
|
||||
* @update 6/21/00 dwc
|
||||
@ -809,16 +769,3 @@ nsPrintSettings::GetPageSizeInTwips(PRInt32 *aWidth, PRInt32 *aHeight)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintSettings::CloneObj(nsIPrintSettings **_retval)
|
||||
{
|
||||
nsPrintSettings* printSettings = new nsPrintSettings(this);
|
||||
return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
|
||||
}
|
||||
|
||||
/* nsIPrintSettings clone (); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettings::Clone(nsIPrintSettings **_retval)
|
||||
{
|
||||
return CloneObj(_retval);
|
||||
}
|
||||
|
@ -37,12 +37,9 @@ public:
|
||||
NS_DECL_NSIPRINTSETTINGS
|
||||
|
||||
nsPrintSettings();
|
||||
nsPrintSettings(const nsPrintSettings* aPS);
|
||||
virtual ~nsPrintSettings();
|
||||
|
||||
protected:
|
||||
virtual nsresult CloneObj(nsIPrintSettings **_retval);
|
||||
|
||||
typedef enum {
|
||||
eHeader,
|
||||
eFooter
|
||||
|
Loading…
Reference in New Issue
Block a user