зеркало из https://github.com/mozilla/gecko-dev.git
Fixed up nsIPrintSettings interface and add a Get/Set method to nsIPrintOptions
(only the setter is implemented at this time) Bug 107399 r=kmcclusk sr=alexf/attinasi
This commit is contained in:
Родитель
c660181dd1
Коммит
78a059bcdd
|
@ -8,3 +8,4 @@ nsIScriptableRegion.idl
|
|||
nsIScreen.idl
|
||||
nsIScreenManager.idl
|
||||
nsIPrintOptions.idl
|
||||
nsIPrintSettings.idl
|
||||
|
|
|
@ -37,6 +37,7 @@ XPIDLSRCS = \
|
|||
nsIScreen.idl \
|
||||
nsIScreenManager.idl \
|
||||
nsIPrintOptions.idl \
|
||||
nsIPrintSettings.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -32,6 +32,7 @@ XPIDLSRCS = \
|
|||
.\nsIScreen.idl \
|
||||
.\nsIScreenManager.idl \
|
||||
.\nsIPrintOptions.idl \
|
||||
.\nsIPrintSettings.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS= \
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIPrintSettings.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsMargin.h"
|
||||
|
@ -133,7 +134,6 @@ interface nsIPrintOptions : nsISupports
|
|||
*/
|
||||
void WritePrefs();
|
||||
|
||||
|
||||
/**
|
||||
* Data Members
|
||||
*/
|
||||
|
@ -163,6 +163,7 @@ interface nsIPrintOptions : nsISupports
|
|||
attribute boolean isCancelled;
|
||||
attribute boolean PrintSilent; /* print without putting up the dialog */
|
||||
|
||||
attribute nsIPrintSettings printSettings;
|
||||
|
||||
/* Additional XP Related */
|
||||
attribute boolean printReversed;
|
||||
|
|
|
@ -39,18 +39,6 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsMargin.h"
|
||||
#include "nsFont.h"
|
||||
%}
|
||||
|
||||
/**
|
||||
* Native types
|
||||
*/
|
||||
[ref] native nsNativeMarginRef(nsMargin);
|
||||
[ref] native nsNativeFontRef(nsFont);
|
||||
[ref] native nsNativeStringRef(nsString);
|
||||
|
||||
/**
|
||||
* Simplified graphics interface for JS rendering.
|
||||
*
|
||||
|
@ -63,14 +51,9 @@
|
|||
interface nsIPrintSettings : nsISupports
|
||||
{
|
||||
/* Print Option Flags for Bit Field*/
|
||||
const long kOptPrintOddPages = 0x00000001;
|
||||
const long kOptPrintEvenPages = 0x00000002;
|
||||
const long kOptPrintDocTitle = 0x00000004;
|
||||
const long kOptPrintDocLoc = 0x00000008;
|
||||
const long kOptPrintPageNums = 0x00000010;
|
||||
const long kOptPrintPageTotal = 0x00000020;
|
||||
const long kOptPrintDatePrinted = 0x00000040;
|
||||
const long kPrintOptionsEnableSelectionRB = 0x00000080;
|
||||
const long kOptPrintOddPages = 0x00000001;
|
||||
const long kOptPrintEvenPages = 0x00000002;
|
||||
const long kPrintOptionsEnableSelectionRB = 0x00000004;
|
||||
|
||||
/* Print Range Enums */
|
||||
const long kRangeAllPages = 0;
|
||||
|
@ -92,13 +75,19 @@ interface nsIPrintSettings : nsISupports
|
|||
const short kA4PaperSize = 3;
|
||||
const short kA3PaperSize = 4;
|
||||
|
||||
/**
|
||||
* Orientation Constants
|
||||
*/
|
||||
const short kPortraitOrientation = 0;
|
||||
const short kLandscapeOrientation = 1;
|
||||
|
||||
/**
|
||||
* Print Frame Constants
|
||||
*/
|
||||
const short kFramesAsIs = 0;
|
||||
const short kSelectedFrame = 1;
|
||||
const short kEachFrameSep = 2;
|
||||
|
||||
const short kNoFrames = 0;
|
||||
const short kFramesAsIs = 1;
|
||||
const short kSelectedFrame = 2;
|
||||
const short kEachFrameSep = 3;
|
||||
|
||||
/**
|
||||
* Set PrintOptions
|
||||
|
@ -115,44 +104,42 @@ interface nsIPrintSettings : nsISupports
|
|||
*/
|
||||
PRInt32 GetPrintOptionsBits();
|
||||
|
||||
|
||||
/**
|
||||
* Data Members
|
||||
*/
|
||||
attribute long startPageRange;
|
||||
attribute long endPageRange;
|
||||
|
||||
attribute boolean printReversed;
|
||||
attribute boolean printInColor; /* a false means grayscale */
|
||||
attribute long paperSize; /* see page size consts */
|
||||
attribute wstring printCommand;
|
||||
attribute boolean printToFile;
|
||||
attribute wstring toFileName;
|
||||
|
||||
attribute double marginTop; /* these are in inches */
|
||||
attribute double marginLeft;
|
||||
attribute double marginBottom;
|
||||
attribute double marginRight;
|
||||
|
||||
attribute long printRange;
|
||||
attribute long pageNumJust;
|
||||
attribute short printRange;
|
||||
|
||||
attribute wstring title;
|
||||
attribute wstring docURL;
|
||||
|
||||
attribute boolean isPrintFrame;
|
||||
attribute long printFrameType;
|
||||
attribute wstring headerStrLeft;
|
||||
attribute wstring headerStrCenter;
|
||||
attribute wstring headerStrRight;
|
||||
|
||||
/* No Script Methods */
|
||||
attribute wstring footerStrLeft;
|
||||
attribute wstring footerStrCenter;
|
||||
attribute wstring footerStrRight;
|
||||
|
||||
[noscript] void SetFontNamePointSize(in nsNativeStringRef aName, in PRInt32 aPointSize);
|
||||
attribute short printFrameType;
|
||||
attribute boolean PrintSilent; /* print without putting up the dialog */
|
||||
|
||||
[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);
|
||||
/* Additional XP Related */
|
||||
attribute boolean printReversed;
|
||||
attribute boolean printInColor; /* a false means grayscale */
|
||||
attribute long paperSize; /* see page size consts */
|
||||
attribute long orientation; /* see orientation consts */
|
||||
attribute wstring printCommand;
|
||||
attribute boolean printToFile;
|
||||
attribute wstring toFileName;
|
||||
|
||||
attribute long printPageDelay; /* in milliseconds */
|
||||
|
||||
};
|
||||
|
|
|
@ -723,6 +723,95 @@ NS_IMETHODIMP nsPrintOptions::GetNativeData(PRInt16 aDataType, void * *_retval)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* attribute nsIPrintSettings printSettings; */
|
||||
NS_IMETHODIMP nsPrintOptions::GetPrintSettings(nsIPrintSettings * *aPrintSettings)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrintSettings);
|
||||
*aPrintSettings = nsnull;
|
||||
|
||||
/* This may need to be implemented in the future */
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintOptions::SetPrintSettings(nsIPrintSettings * aPrintSettings)
|
||||
{
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aPrintSettings);
|
||||
|
||||
aPrintSettings->GetStartPageRange(&mStartPageNum);
|
||||
aPrintSettings->GetEndPageRange(&mEndPageNum);
|
||||
|
||||
double dblVal;
|
||||
aPrintSettings->GetMarginTop(&dblVal);
|
||||
SetMarginTop(dblVal);
|
||||
|
||||
aPrintSettings->GetMarginLeft(&dblVal);
|
||||
SetMarginLeft(dblVal);
|
||||
|
||||
aPrintSettings->GetMarginBottom(&dblVal);
|
||||
SetMarginBottom(dblVal);
|
||||
|
||||
aPrintSettings->GetMarginRight(&dblVal);
|
||||
SetMarginRight(dblVal);
|
||||
|
||||
aPrintSettings->GetPrintRange(&mPrintRange);
|
||||
|
||||
PRUnichar* uniChar;
|
||||
aPrintSettings->GetTitle(&uniChar);
|
||||
SetTitle(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetDocURL(&uniChar);
|
||||
SetDocURL(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetHeaderStrLeft(&uniChar);
|
||||
SetHeaderStrLeft(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetHeaderStrCenter(&uniChar);
|
||||
SetHeaderStrCenter(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetHeaderStrRight(&uniChar);
|
||||
SetHeaderStrRight(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetFooterStrLeft(&uniChar);
|
||||
SetFooterStrLeft(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetFooterStrCenter(&uniChar);
|
||||
SetFooterStrCenter(uniChar);
|
||||
|
||||
aPrintSettings->GetFooterStrRight(&uniChar);
|
||||
SetFooterStrRight(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetPrintFrameType(&mPrintFrameType);
|
||||
aPrintSettings->GetPrintSilent(&mPrintSilent);
|
||||
aPrintSettings->GetPrintReversed(&mPrintReversed);
|
||||
aPrintSettings->GetPrintInColor(&mPrintInColor);
|
||||
aPrintSettings->GetPaperSize(&mPaperSize);
|
||||
aPrintSettings->GetOrientation(&mOrientation);
|
||||
|
||||
aPrintSettings->GetPrintCommand(&uniChar);
|
||||
SetPrintCommand(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetPrintToFile(&mPrintToFile);
|
||||
|
||||
aPrintSettings->GetToFileName(&uniChar);
|
||||
SetToFileName(uniChar);
|
||||
if (uniChar != nsnull) nsMemory::Free(uniChar);
|
||||
|
||||
aPrintSettings->GetPrintPageDelay(&mPrintPageDelay);
|
||||
SetPrintPageDelay(mPrintPageDelay);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
//-- Protected Methods
|
||||
//-----------------------------------------------------
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIPrintOptions.h"
|
||||
|
||||
class nsIPref;
|
||||
class nsIPrintSettings;
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsPrintOptions
|
||||
|
|
Загрузка…
Ссылка в новой задаче