Backing out changes - just as well, I forgot to but the bug # and r/sr/a anyway

This commit is contained in:
rods%netscape.com 2002-03-15 14:49:09 +00:00
Родитель 57487643b3
Коммит 347738ddff
16 изменённых файлов: 1368 добавлений и 959 удалений

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

@ -3828,7 +3828,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext,
rect.y += aY;
nscoord xMost = rect.XMost();
#ifdef DEBUG_PRINTING // keep this here but leave it turned off
#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off
nsAutoString tmp;
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) {
@ -3839,7 +3839,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext,
if (xMost > aMaxWidth) {
aMaxWidth = xMost;
#ifdef DEBUG_PRINTING // keep this here but leave it turned off
#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off
printf("%p - %d %s ", child, aMaxWidth, NS_LossyConvertUCS2toASCII(tmp).get());
if (aList == nsLayoutAtoms::overflowList) printf(" nsLayoutAtoms::overflowList\n");
if (aList == nsLayoutAtoms::floaterList) printf(" nsLayoutAtoms::floaterList\n");
@ -7354,6 +7354,36 @@ DocumentViewerImpl::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSet
return NS_OK;
}
/* attribute nsIPrintSettings globalPrintSettingsValues; */
NS_IMETHODIMP
DocumentViewerImpl::GetGlobalPrintSettingsValues(nsIPrintSettings * *aGlobalPrintSettingsValues)
{
NS_ENSURE_ARG_POINTER(aGlobalPrintSettingsValues);
NS_ENSURE_ARG_POINTER(*aGlobalPrintSettingsValues);
nsresult rv = NS_ERROR_FAILURE;
if (aGlobalPrintSettingsValues && *aGlobalPrintSettingsValues) {
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = printService->GetPrintSettingsValues(aGlobalPrintSettingsValues);
}
}
return rv;
}
NS_IMETHODIMP
DocumentViewerImpl::SetGlobalPrintSettingsValues(nsIPrintSettings * aGlobalPrintSettingsValues)
{
NS_ENSURE_ARG_POINTER(aGlobalPrintSettingsValues);
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = printService->SetPrintSettingsValues(aGlobalPrintSettingsValues);
}
return rv;
}
/* void cancel (); */
NS_IMETHODIMP
DocumentViewerImpl::Cancel()
@ -7366,29 +7396,6 @@ DocumentViewerImpl::Cancel()
return NS_OK;
}
/* void initPrintSettingsFromPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
DocumentViewerImpl::InitPrintSettingsFromPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
nsresult rv;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv) && printService) {
return printService->InitPrintSettingsFromPrefs(aPrintSettings, aUsePrinterNamePrefix, aFlags);
}
return NS_OK;
}
/* void savePrintSettingsToPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
DocumentViewerImpl::SavePrintSettingsToPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
nsresult rv;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv) && printService) {
return printService->SavePrintSettingsToPrefs(aPrintSettings, aUsePrinterNamePrefix, aFlags);
}
return NS_OK;
}
/** ---------------------------------------------------
* Get the Focused Frame for a documentviewer

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

@ -76,6 +76,7 @@ static HANDLE s_hHackedNonReentrancy = NULL;
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID);
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
// Macros to return errors from bad calls to the automation
// interfaces and sets a descriptive string on IErrorInfo so VB programmers
@ -1433,27 +1434,27 @@ HRESULT CMozillaBrowser::UnloadBrowserHelpers()
// Print document
HRESULT CMozillaBrowser::PrintDocument(BOOL promptUser)
{
// Print the contents
nsCOMPtr<nsIWebBrowserPrint> browserAsPrint = do_GetInterface(mWebBrowser);
NS_ASSERTION(browserAsPrint, "No nsIWebBrowserPrint!");
nsresult rv;
PRBool oldPrintSilent = PR_FALSE;
nsCOMPtr<nsIPrintSettings> printSettings;
browserAsPrint->GetGlobalPrintSettings(getter_AddRefs(printSettings));
if (printSettings)
nsCOMPtr<nsIPrintOptions> printService =
do_GetService(kPrintOptionsCID, &rv);
if (printService)
{
printSettings->GetPrintSilent(&oldPrintSilent);
printSettings->SetPrintSilent(promptUser ? PR_FALSE : PR_TRUE);
printService->GetPrintSilent(&oldPrintSilent);
printService->SetPrintSilent(promptUser ? PR_FALSE : PR_TRUE);
}
// Print the contents
nsCOMPtr<nsIWebBrowserPrint> browserAsPrint = do_GetInterface(mWebBrowser);
PrintListener *listener = new PrintListener;
nsCOMPtr<nsIWebProgressListener> printListener = do_QueryInterface(listener);
browserAsPrint->Print(printSettings, nsnull);
browserAsPrint->Print(nsnull, nsnull);
listener->WaitForComplete();
if (printSettings)
if (printService)
{
printSettings->SetPrintSilent(oldPrintSilent);
printService->SetPrintSilent(oldPrintSilent);
}
return S_OK;

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

@ -97,44 +97,15 @@ interface nsIWebBrowserPrint : nsISupports
void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings);
/**
* Reads PrintSettings values from Prefs,
* the values to be read are indicated by the "flags" arg.
*
* First it reads in the "generic" set of PrintSetings not associated with any printer
* then it uses the PrinterName in the PrinterSettings to read any settings that were saved
* just for that printer.
*
* aPS - PrintSettings to have its settings read
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
* aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the const values.
*
* Items not read:
* startPageRange, endPageRange, scaling, printRange, title
* docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
* printFrameType, printSilent, shrinkToFit, numCopies
*
* Use this to Set and Get the current values of the last print invocation
* of "print" or "printpreview". The print engine always sets the PrintSettings
* from whoever is printing (or printpreview'ing) into the global settings.
*
* It is the responsibilitity of those implementing page setup
* to set their setting into the global settings if they want those new value
* to available to other callers of "globalPrintSettingsValues"
*/
void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
/**
* Writes PrintSettings values to Prefs,
* the values to be written are indicated by the "flags" arg.
*
* If there is no PrinterName in the PrinterSettings
* the values are saved as the "generic" values not associated with any printer.
* If a PrinterName is there, then it saves the items qualified for that Printer
*
* aPS - PrintSettings to have its settings saved
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
* aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
*
* Items not written:
* startPageRange, endPageRange, scaling, printRange, title
* docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
* printFrameType, printSilent, shrinkToFit, numCopies
*
*/
void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
attribute nsIPrintSettings globalPrintSettingsValues;
/**
* This returns whether the current document is a frameset document

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

@ -62,11 +62,100 @@ interface nsISimpleEnumerator;
interface nsIPrintOptions : nsISupports
{
/* Print Option Flags for Bit Field*/
const long kOptPrintOddPages = 0x00000001;
const long kOptPrintEvenPages = 0x00000002;
const long kPrintOptionsEnableSelectionRB = 0x00000004;
/* Print Range Enums */
const long kRangeAllPages = 0;
const long kRangeSpecifiedPageRange = 1;
const long kRangeSelection = 2;
const long kRangeFocusFrame = 3;
/* Justification Enums */
const long kJustLeft = 0;
const long kJustCenter = 1;
const long kJustRight = 2;
/**
* Page Size Constants (NOTE: These have been deprecated!);
*/
const short kLetterPaperSize = 0;
const short kLegalPaperSize = 1;
const short kExecutivePaperSize = 2;
const short kA4PaperSize = 3;
const short kA3PaperSize = 4;
/**
* FrameSet Default Type Constants
*/
const short kUseInternalDefault = 0;
const short kUseSettingWhenPossible = 1;
/**
* Page Size Type Constants
*/
const short kPaperSizeNativeData = 0;
const short kPaperSizeDefined = 1;
/**
* Page Size Unit Constants
*/
const short kPaperSizeInches = 0;
const short kPaperSizeMillimeters = 1;
/**
* Orientation Constants
*/
const short kPortraitOrientation = 0;
const short kLandscapeOrientation = 1;
/**
* Print Frame Constants
*/
const short kNoFrames = 0;
const short kFramesAsIs = 1;
const short kSelectedFrame = 2;
const short kEachFrameSep = 3;
/**
* How to Enable Frame Set Printing Constants
*/
const short kFrameEnableNone = 0;
const short kFrameEnableAll = 1;
const short kFrameEnableAsIsAndEach = 2;
/**
* Show Native Print Options dialog, this may not be supported on all platforms
*/
void ShowPrintSetupDialog(in nsIPrintSettings aThePrintSettings);
/**
* Set PrintOptions
*/
void SetPrintOptions(in PRInt32 aType, in PRBool aTurnOnOff);
/**
* Get PrintOptions
*/
PRBool GetPrintOptions(in PRInt32 aType);
/**
* Set PrintOptions Bit field
*/
PRInt32 GetPrintOptionsBits();
/**
* Read Prefs
*/
void ReadPrefs();
/**
* Write Prefs
*/
void WritePrefs();
/**
* Creates a new PrintSettnigs Object
* and initializes it from prefs
@ -82,20 +171,79 @@ interface nsIPrintOptions : nsISupports
/**
* Initialize the values in the PrintSettings from Prefs
* aPS - PrintSettings to have its settings read
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
*/
void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
void InitPrintSettingsFromPrefs(in nsIPrintSettings aPO);
/**
* Save all the PrintSettings to Prefs.
* This is on a printer by printer basis
* Or saved generically if the printer name is null or empty
*
* aPS - PrintSettings to have its settings saved
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
* Data Members
*/
void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
attribute long startPageRange;
attribute long endPageRange;
attribute double marginTop; /* these are in inches */
attribute double marginLeft;
attribute double marginBottom;
attribute double marginRight;
attribute double scaling; /* values 0.0 - 1.0 */
attribute boolean printBGColors; /* Print Background Colors */
attribute boolean printBGImages; /* Print Background Images */
attribute short printRange;
attribute wstring title;
attribute wstring docURL;
attribute wstring headerStrLeft;
attribute wstring headerStrCenter;
attribute wstring headerStrRight;
attribute wstring footerStrLeft;
attribute wstring footerStrCenter;
attribute wstring footerStrRight;
attribute short howToEnableFrameUI;
attribute boolean isCancelled;
attribute short printFrameTypeUsage; /* indicates whether to use the interal value or not*/
attribute short printFrameType;
attribute boolean printSilent; /* print without putting up the dialog */
attribute nsIPrintSettings printSettingsValues; /* used copy the values to/from the settings obj*/
attribute nsIPrintSettings printSettings; /* used to set and get the current object */
/* Additional XP Related */
attribute short paperSizeType; /* use native data or is defined here */
attribute short paperData; /* native data value */
attribute double paperWidth; /* width of the paper in inches or mm */
attribute double paperHeight; /* height of the paper in inches or mm */
attribute short paperSizeUnit; /* paper is in inches or mm */
attribute long paperSize; /* This has been deprecated */
attribute boolean printReversed;
attribute boolean printInColor; /* a false means grayscale */
attribute long orientation; /* see orientation consts */
attribute wstring printCommand;
attribute long numCopies;
attribute wstring printerName;
attribute boolean printToFile;
attribute wstring toFileName;
attribute long printPageDelay; /* in milliseconds */
/* No Script Methods */
[noscript] void SetFontNamePointSize(in nsNativeStringRef aName, in PRInt32 aPointSize);
[noscript] void SetMarginInTwips(in nsNativeMarginRef aMargin);
/* Purposely made this an "in" arg */
[noscript] void GetMarginInTwips(in nsNativeMarginRef aMargin);
[noscript] void SetDefaultFont(in nsNativeFontRef aMargin);
/* Purposely made this an "in" arg */
[noscript] void GetDefaultFont(in nsNativeFontRef aMargin);
[noscript] void GetPageSizeInTwips(out long aWidth, out long aHeight);
/**
* available Printers
@ -107,22 +255,6 @@ 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);
[noscript] void SetDefaultFont(in nsNativeFontRef aFont);
/* Purposely made this an "in" arg */
[noscript] void GetDefaultFont(in nsNativeFontRef aFont);
/**
* Native data constants
*/

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

@ -59,36 +59,6 @@
interface nsIPrintSettings : nsISupports
{
/**
* PrintSettings to be Saved Navigation Constants
*/
const unsigned long kInitSaveOddEvenPages = 0x00000001;
const unsigned long kInitSaveHeaderLeft = 0x00000002;
const unsigned long kInitSaveHeaderCenter = 0x00000004;
const unsigned long kInitSaveHeaderRight = 0x00000008;
const unsigned long kInitSaveFooterLeft = 0x00000010;
const unsigned long kInitSaveFooterCenter = 0x00000020;
const unsigned long kInitSaveFooterRight = 0x00000040;
const unsigned long kInitSaveBGColors = 0x00000080;
const unsigned long kInitSaveBGImages = 0x00000100;
const unsigned long kInitSavePaperSize = 0x00000200;
const unsigned long kInitSavePaperName = 0x00000400;
const unsigned long kInitSavePaperSizeUnit = 0x00000800;
const unsigned long kInitSavePaperSizeType = 0x00001000;
const unsigned long kInitSavePaperData = 0x00002000;
const unsigned long kInitSavePaperWidth = 0x00004000;
const unsigned long kInitSavePaperHeight = 0x00008000;
const unsigned long kInitSaveReversed = 0x00010000;
const unsigned long kInitSaveInColor = 0x00020000;
const unsigned long kInitSaveOrientation = 0x00040000;
const unsigned long kInitSavePrintCommand = 0x00080000;
const unsigned long kInitSavePrinterName = 0x00100000;
const unsigned long kInitSavePrintToFile = 0x00200000;
const unsigned long kInitSaveToFileName = 0x00400000;
const unsigned long kInitSavePageDelay = 0x00800000;
const unsigned long kInitSaveMargins = 0x01000000;
const unsigned long kInitSaveAll = 0xFFFFFFFF;
/* Print Option Flags for Bit Field*/
const long kPrintOddPages = 0x00000001;
@ -201,7 +171,6 @@ interface nsIPrintSettings : nsISupports
attribute boolean shrinkToFit; /* shrinks content to fit on page */
/* Additional XP Related */
attribute wstring paperName; /* name of paper */
attribute short paperSizeType; /* use native data or is defined here */
attribute short paperData; /* native data value */
attribute double paperWidth; /* width of the paper in inches or mm */

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

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

@ -50,26 +50,62 @@ protected:
nsresult ReadPrefString(nsIPref * aPref, const char * aPrefId, nsString& aString);
nsresult WritePrefString(nsIPref * aPref, const char * aPrefId, nsString& aString);
nsresult WritePrefString(nsIPref* aPref, PRUnichar*& aStr, const char* aPrefId);
nsresult ReadPrefDouble(nsIPref * aPref, const char * aPrefId, double& aVal);
nsresult WritePrefDouble(nsIPref * aPref, const char * aPrefId, double aVal);
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);
typedef enum {
eHeader,
eFooter
} nsHeaderFooterEnum;
nsresult GetMarginStrs(PRUnichar * *aTitle, nsHeaderFooterEnum aType, PRInt16 aJust);
nsresult SetMarginStrs(const PRUnichar * aTitle, nsHeaderFooterEnum aType, PRInt16 aJust);
// Members
nsMargin mMargin;
PRInt32 mPrintOptions;
// scriptable data members
PRInt16 mPrintRange;
PRInt32 mStartPageNum; // only used for ePrintRange_SpecifiedRange
PRInt32 mEndPageNum;
double mScaling;
PRBool mPrintBGColors; // print background colors
PRBool mPrintBGImages; // print background images
PRInt16 mPrintFrameTypeUsage;
PRInt16 mPrintFrameType;
PRBool mHowToEnableFrameUI;
PRBool mIsCancelled;
PRBool mPrintSilent;
PRInt32 mPrintPageDelay;
nsString mTitle;
nsString mURL;
nsString mPageNumberFormat;
nsString mHeaderStrs[3];
nsString mFooterStrs[3];
nsIPrintSettings* mPrintSettingsObj; //weak ref, hold address only
PRInt16 mPaperData;
PRInt16 mPaperSizeType;
double mPaperWidth;
double mPaperHeight;
PRInt16 mPaperSizeUnit;
PRInt32 mPaperSize; // this has been deprecated
PRBool mPrintReversed;
PRBool mPrintInColor; // a false means grayscale
PRInt32 mOrientation; // see orientation consts
nsString mPrintCommand;
PRInt32 mNumCopies;
nsString mPrinter;
PRBool mPrintToFile;
nsString mToFileName;
nsCOMPtr<nsIPrintSettings> mGlobalPrintSettings;
nsCString mPrefName;
static nsFont* sDefaultFont;
};

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

@ -48,30 +48,30 @@ NS_IMPL_ISUPPORTS1(nsPrintSettings, nsIPrintSettings)
* @update 6/21/00 dwc
*/
nsPrintSettings::nsPrintSettings() :
mPrintOptions(0L),
mPrintRange(kRangeAllPages),
mStartPageNum(1),
mEndPageNum(1),
mScaling(1.0),
mNumCopies(1),
mPrintBGColors(PR_FALSE),
mPrintBGImages(PR_FALSE),
mPrintFrameTypeUsage(kUseInternalDefault),
mPrintFrameType(kFramesAsIs),
mHowToEnableFrameUI(kFrameEnableNone),
mIsCancelled(PR_FALSE),
mPrintSilent(PR_FALSE),
mShrinkToFit(PR_FALSE),
mPrintPageDelay(500),
mPaperData(0),
mPaperSizeType(kPaperSizeDefined),
mPaperWidth(8.5),
mPaperHeight(11.0),
mPaperSizeUnit(kPaperSizeInches),
mPrintOptions(0L),
mPrintReversed(PR_FALSE),
mPrintInColor(PR_TRUE),
mOrientation(kPortraitOrientation),
mNumCopies(1),
mPrintToFile(PR_FALSE)
mPrintToFile(PR_FALSE),
mPrintFrameTypeUsage(kUseInternalDefault),
mPrintFrameType(kFramesAsIs),
mPrintPageDelay(500),
mPaperSizeType(kPaperSizeDefined),
mPaperData(0),
mPaperWidth(8.5),
mPaperHeight(11.0),
mPaperSizeUnit(kPaperSizeInches),
mPrintSilent(PR_FALSE),
mShrinkToFit(PR_FALSE),
mHowToEnableFrameUI(kFrameEnableNone),
mIsCancelled(PR_FALSE)
{
NS_INIT_ISUPPORTS();
@ -591,24 +591,6 @@ NS_IMETHODIMP nsPrintSettings::SetShrinkToFit(PRBool aShrinkToFit)
return NS_OK;
}
/* attribute wstring paperName; */
NS_IMETHODIMP nsPrintSettings::GetPaperName(PRUnichar * *aPaperName)
{
NS_ENSURE_ARG_POINTER(aPaperName);
if (mPaperName.Length()) {
*aPaperName = ToNewUnicode(mPaperName);
} else {
*aPaperName = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP nsPrintSettings::SetPaperName(const PRUnichar * aPaperName)
{
NS_ENSURE_ARG_POINTER(aPaperName);
mPaperName = aPaperName;
return NS_OK;
}
/* attribute boolean howToEnableFrameUI; */
NS_IMETHODIMP nsPrintSettings::GetHowToEnableFrameUI(PRInt16 *aHowToEnableFrameUI)
{

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

@ -27,6 +27,8 @@
#include "nsMargin.h"
#include "nsString.h"
class nsIPrintSettings;
//*****************************************************************************
//*** nsPrintSettings
//*****************************************************************************
@ -74,7 +76,6 @@ protected:
nsString mHeaderStrs[3];
nsString mFooterStrs[3];
nsString mPaperName;
PRInt16 mPaperData;
PRInt16 mPaperSizeType;
double mPaperWidth;

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

@ -1528,8 +1528,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
nsresult rv = NS_ERROR_FAILURE;
if (!GlobalPrinters::GetInstance()->PrintersAreAllocated()) {
rv = GlobalPrinters::GetInstance()->EnumeratePrinterList();
NS_ENSURE_SUCCESS(rv, rv);
return rv;
}
HANDLE hPrinter = NULL;
@ -1795,7 +1794,7 @@ nsPrinterEnumeratorWin::EnumeratePrinters(PRUint32* aCount, PRUnichar*** aResult
PRInt32 count = 0;
PRInt32 printerInx = 0;
while( count < numItems ) {
LPTSTR name = GlobalPrinters::GetInstance()->GetItemFromList(printerInx++);
LPTSTR name = GlobalPrinters::GetInstance()->GetItemFromList(printerInx);
nsString newName;
newName.AssignWithConversion(name);
PRUnichar *str = ToNewUnicode(newName);

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

@ -3828,7 +3828,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext,
rect.y += aY;
nscoord xMost = rect.XMost();
#ifdef DEBUG_PRINTING // keep this here but leave it turned off
#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off
nsAutoString tmp;
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) {
@ -3839,7 +3839,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext,
if (xMost > aMaxWidth) {
aMaxWidth = xMost;
#ifdef DEBUG_PRINTING // keep this here but leave it turned off
#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off
printf("%p - %d %s ", child, aMaxWidth, NS_LossyConvertUCS2toASCII(tmp).get());
if (aList == nsLayoutAtoms::overflowList) printf(" nsLayoutAtoms::overflowList\n");
if (aList == nsLayoutAtoms::floaterList) printf(" nsLayoutAtoms::floaterList\n");
@ -7354,6 +7354,36 @@ DocumentViewerImpl::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSet
return NS_OK;
}
/* attribute nsIPrintSettings globalPrintSettingsValues; */
NS_IMETHODIMP
DocumentViewerImpl::GetGlobalPrintSettingsValues(nsIPrintSettings * *aGlobalPrintSettingsValues)
{
NS_ENSURE_ARG_POINTER(aGlobalPrintSettingsValues);
NS_ENSURE_ARG_POINTER(*aGlobalPrintSettingsValues);
nsresult rv = NS_ERROR_FAILURE;
if (aGlobalPrintSettingsValues && *aGlobalPrintSettingsValues) {
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = printService->GetPrintSettingsValues(aGlobalPrintSettingsValues);
}
}
return rv;
}
NS_IMETHODIMP
DocumentViewerImpl::SetGlobalPrintSettingsValues(nsIPrintSettings * aGlobalPrintSettingsValues)
{
NS_ENSURE_ARG_POINTER(aGlobalPrintSettingsValues);
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = printService->SetPrintSettingsValues(aGlobalPrintSettingsValues);
}
return rv;
}
/* void cancel (); */
NS_IMETHODIMP
DocumentViewerImpl::Cancel()
@ -7366,29 +7396,6 @@ DocumentViewerImpl::Cancel()
return NS_OK;
}
/* void initPrintSettingsFromPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
DocumentViewerImpl::InitPrintSettingsFromPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
nsresult rv;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv) && printService) {
return printService->InitPrintSettingsFromPrefs(aPrintSettings, aUsePrinterNamePrefix, aFlags);
}
return NS_OK;
}
/* void savePrintSettingsToPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
DocumentViewerImpl::SavePrintSettingsToPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
nsresult rv;
nsCOMPtr<nsIPrintOptions> printService = do_GetService(kPrintOptionsCID, &rv);
if (NS_SUCCEEDED(rv) && printService) {
return printService->SavePrintSettingsToPrefs(aPrintSettings, aUsePrinterNamePrefix, aFlags);
}
return NS_OK;
}
/** ---------------------------------------------------
* Get the Focused Frame for a documentviewer

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

@ -222,15 +222,12 @@ pref("print.print_footerright", "&D");
pref("print.show_print_progress", true);
// When this is set to false it means each window has its PrintSettings
// and a change in one browser window does not effect the others
// and a change in one browser window does not efect the others
pref("print.use_global_printsettings", false);
// This indicates whether it should use the native dialog or the XP Dialog50
// This indeicates whether it should use the native dialog or the XP Dialog50
pref("print.use_native_print_dialog", false);
// Save the Printings after each print job
pref("print.save_print_settings", true);
pref("print.whileInPrintPreview", true);
// Enables you to specify the gap from the edge of the paper to the margin

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

@ -115,6 +115,7 @@ pref("print.print_edge_left", 4); // 1/100 of an inch
pref("print.print_edge_right", 4); // 1/100 of an inch
pref("print.print_edge_bottom", 4); // 1/100 of an inch
// 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", 0); // twips

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

@ -843,6 +843,18 @@ PluginViewerImpl::GetGlobalPrintSettings(nsIPrintSettings * *aGlobalPrintSetting
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIPrintSettings globalPrintSettingsValues; */
NS_IMETHODIMP
PluginViewerImpl::GetGlobalPrintSettingsValues(nsIPrintSettings * *aGlobalPrintSettingsValues)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
PluginViewerImpl::SetGlobalPrintSettingsValues(nsIPrintSettings * aGlobalPrintSettingsValues)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void printPreview (in nsIPrintSettings aThePrintSettings); */
NS_IMETHODIMP
PluginViewerImpl::PrintPreview(nsIPrintSettings *aThePrintSettings)
@ -878,20 +890,6 @@ PluginViewerImpl::Cancel()
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void initPrintSettingsFromPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
PluginViewerImpl::InitPrintSettingsFromPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void savePrintSettingsToPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */
NS_IMETHODIMP
PluginViewerImpl::SavePrintSettingsToPrefs(nsIPrintSettings *aPrintSettings, PRBool aUsePrinterNamePrefix, PRUint32 aFlags)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void enumerateDocumentNames (out PRUint32 aCount, [array, size_is (aCount), retval] out wstring aResult); */
NS_IMETHODIMP
PluginViewerImpl::EnumerateDocumentNames(PRUint32 *aCount, PRUnichar ***aResult)

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

@ -31,7 +31,7 @@ var gOriginalNumCopies = 1;
var paramBlock;
var gPrintSettings = null;
var gPrinterName = "";
var gWebBrowserPrint = null;
var default_file = "mozilla.ps";
var gPrintSetInterface = Components.interfaces.nsIPrintSettings;
var doDebug = false;
@ -183,9 +183,6 @@ function getPrinters()
var strDefaultPrinterName = selectElement.appendPrinterNames(printerEnumerator);
selectElement.listElement.value = strDefaultPrinterName;
// make sure we load the prefs for the initially selected printer
setPrinterDefaultsForSelectedPrinter();
}
@ -197,18 +194,8 @@ function setPrinterDefaultsForSelectedPrinter()
gPrintSettings.printerName = dialog.printerList.value;
var ifreq = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
gWebBrowserPrint = ifreq.getInterface(Components.interfaces.nsIWebBrowserPrint);
// First get any defaults from the printer
gWebBrowserPrint.initPrintSettingsFromPrinter(gPrintSettings.printerName, gPrintSettings);
var flags = gPrintSetInterface.kInitSavePaperSizeType | gPrintSetInterface.kInitSavePaperSizeUnit |
gPrintSetInterface.kInitSavePaperWidth | gPrintSetInterface.kInitSavePaperHeight |
gPrintSetInterface.kInitSavePrintCommand;
// now augment them with any values from last time
gWebBrowserPrint.initPrintSettingsFromPrefs(gPrintSettings, true, flags);
var webBrowserPrint = ifreq.getInterface(Components.interfaces.nsIWebBrowserPrint);
webBrowserPrint.initPrintSettingsFromPrinter(gPrintSettings.printerName, gPrintSettings);
}
//---------------------------------------------------
@ -451,24 +438,11 @@ function onAccept()
}
}
var saveToPrefs = false;
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if (prefs) {
saveToPrefs = prefs.getBoolPref("print.save_print_settings");
}
if (saveToPrefs && gWebBrowserPrint != null) {
var flags = gPrintSetInterface.kInitSavePaperSizeType | gPrintSetInterface.kInitSavePaperSizeUnit |
gPrintSetInterface.kInitSavePaperWidth | gPrintSetInterface.kInitSavePaperHeight |
gPrintSetInterface.kInitSavePrintCommand;
gWebBrowserPrint.savePrintSettingsToPrefs(gPrintSettings, true, flags);
}
// set return value to "print"
if (paramBlock) {
paramBlock.SetInt(0, 1);
} else {
dump("*** FATAL ERROR: No paramBlock\n");
dump("*** FATAL ERROR: printService missing\n");
}
return true;

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

@ -271,8 +271,8 @@ function loadDialog()
print_paper_unit = gPrintSettings.paperSizeUnit;
print_paper_width = gPrintSettings.paperWidth;
print_paper_height = gPrintSettings.paperHeight;
print_color = gPrintSettings.printInColor;
print_command = gPrintSettings.printCommand;
print_color = gPrintSettings.printInColor;
print_command = gPrintSettings.printCommand;
if (print_paper_unit == gPrintSettingsInterface.kPaperSizeInches) {
print_paper_width_mm = gPrintSettings.paperWidth * 25.4;
@ -329,18 +329,10 @@ function loadDialog()
dialog.cmdInput.value = print_command;
try {
// first get the generic settings
dialog.topInput.value = gPrefs.getIntPref("print.print_edge_top") / 100.0;
dialog.bottomInput.value = gPrefs.getIntPref("print.print_edge_left") / 100.0;
dialog.leftInput.value = gPrefs.getIntPref("print.print_edge_right") / 100.0;
dialog.rightInput.value = gPrefs.getIntPref("print.print_edge_bottom") / 100.0;
// then the printer specific settings
var printername = gPrintSettings.printerName;
dialog.topInput.value = gPrefs.getIntPref("print."+printername+"print_edge_top") / 100.0;
dialog.bottomInput.value = gPrefs.getIntPref("print."+printername+"print_edge_left") / 100.0;
dialog.leftInput.value = gPrefs.getIntPref("print."+printername+"print_edge_right") / 100.0;
dialog.rightInput.value = gPrefs.getIntPref("print."+printername+"print_edge_bottom") / 100.0;
} catch (e) {
dialog.topInput.value = "0.04";
dialog.bottomInput.value = "0.04";
@ -349,6 +341,8 @@ function loadDialog()
}
}
var param;
//---------------------------------------------------
function onLoad()
{
@ -403,18 +397,17 @@ function onAccept()
//
try {
var printerName = gPrintSettings.printerName;
var i = dialog.topInput.value * 100;
gPrefs.setIntPref("print."+printerName+"print_edge_top", i);
gPrefs.setIntPref("print.print_edge_top", i);
i = dialog.bottomInput.value * 100;
gPrefs.setIntPref("print."+printerName+"print_edge_left", i);
gPrefs.setIntPref("print.print_edge_left", i);
i = dialog.leftInput.value * 100;
gPrefs.setIntPref("print."+printerName+"print_edge_right", i);
gPrefs.setIntPref("print.print_edge_right", i);
i = dialog.rightInput.value * 100;
gPrefs.setIntPref("print."+printerName+"print_edge_bottom", i);
gPrefs.setIntPref("print.print_edge_bottom", i);
} catch (e) {
}
@ -433,11 +426,11 @@ function onAccept()
dump("************ onAccept gPrintSettings: "+gPrintSettings+"\n");
}
if (paramBlock) {
if (param) {
// set return value to "ok"
paramBlock.SetInt(0, 1);
param.SetInt(0, 1);
} else {
dump("*** FATAL ERROR: paramBlock missing\n");
dump("*** FATAL ERROR: printService missing\n");
}
return true;