2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
|
|
|
|
%{ C++
|
|
|
|
#include "nsMargin.h"
|
2011-12-06 20:45:06 -08:00
|
|
|
#include "nsTArray.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
%}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Native types
|
|
|
|
*/
|
2009-01-14 19:27:09 -08:00
|
|
|
[ref] native nsNativeIntMarginRef(nsIntMargin);
|
2012-08-22 08:56:38 -07:00
|
|
|
[ref] native IntegerArray(nsTArray<int32_t>);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
interface nsIPrintSession;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Simplified graphics interface for JS rendering.
|
|
|
|
*/
|
2015-06-10 14:34:27 -07:00
|
|
|
[scriptable, uuid(04dd3a01-a74e-44aa-8d49-2c30478fd7b8)]
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
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;
|
2013-04-11 06:10:42 -07:00
|
|
|
const unsigned long kInitSaveResolution = 0x00000400;
|
|
|
|
const unsigned long kInitSaveDuplex = 0x00000800;
|
2007-08-26 17:19:15 -07:00
|
|
|
/* Flag 0x00001000 is unused */
|
2007-03-22 10:30:00 -07:00
|
|
|
const unsigned long kInitSavePaperData = 0x00002000;
|
2008-03-19 13:51:42 -07:00
|
|
|
const unsigned long kInitSaveUnwriteableMargins = 0x00004000;
|
2007-11-13 11:14:07 -08:00
|
|
|
const unsigned long kInitSaveEdges = 0x00008000;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
const unsigned long kInitSaveReversed = 0x00010000;
|
|
|
|
const unsigned long kInitSaveInColor = 0x00020000;
|
|
|
|
const unsigned long kInitSaveOrientation = 0x00040000;
|
2015-06-09 23:10:28 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
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 kInitSaveNativeData = 0x02000000;
|
2015-06-10 14:34:27 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
const unsigned long kInitSaveShrinkToFit = 0x08000000;
|
|
|
|
const unsigned long kInitSaveScaling = 0x10000000;
|
2015-06-10 14:34:27 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
const unsigned long kInitSaveAll = 0xFFFFFFFF;
|
|
|
|
|
|
|
|
/* Print Option Flags for Bit Field*/
|
|
|
|
const long kPrintOddPages = 0x00000001;
|
|
|
|
const long kPrintEvenPages = 0x00000002;
|
|
|
|
const long kEnableSelectionRB = 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Output file format
|
|
|
|
*/
|
|
|
|
const short kOutputFormatNative = 0;
|
|
|
|
const short kOutputFormatPS = 1;
|
|
|
|
const short kOutputFormatPDF = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set PrintOptions
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetPrintOptions(in int32_t aType, in boolean aTurnOnOff);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get PrintOptions
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
boolean GetPrintOptions(in int32_t aType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
2015-05-06 12:35:35 -07:00
|
|
|
* Get PrintOptions Bit field
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetPrintOptionsBits();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-05-06 12:35:35 -07:00
|
|
|
/**
|
|
|
|
* Set PrintOptions Bit field
|
|
|
|
*/
|
|
|
|
void SetPrintOptionsBits(in int32_t bits);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
2007-07-16 16:16:48 -07:00
|
|
|
* Get the page size in twips, considering the
|
|
|
|
* orientation (portrait or landscape).
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2007-07-16 16:16:48 -07:00
|
|
|
void GetEffectivePageSize(out double aWidth, out double aHeight);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Makes a new copy
|
|
|
|
*/
|
|
|
|
nsIPrintSettings clone();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assigns the internal values from the "in" arg to the current object
|
|
|
|
*/
|
|
|
|
void assign(in nsIPrintSettings aPS);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data Members
|
|
|
|
*/
|
|
|
|
[noscript] attribute nsIPrintSession printSession; /* We hold a weak reference */
|
|
|
|
|
|
|
|
attribute long startPageRange;
|
|
|
|
attribute long endPageRange;
|
|
|
|
|
2007-11-13 11:14:07 -08:00
|
|
|
/**
|
2008-03-19 13:51:42 -07:00
|
|
|
* The edge measurements define the positioning of the headers
|
|
|
|
* and footers on the page. They're measured as an offset from
|
|
|
|
* the "unwriteable margin" (described below).
|
2007-11-13 11:14:07 -08:00
|
|
|
*/
|
|
|
|
attribute double edgeTop; /* these are in inches */
|
|
|
|
attribute double edgeLeft;
|
|
|
|
attribute double edgeBottom;
|
|
|
|
attribute double edgeRight;
|
|
|
|
|
|
|
|
/**
|
2008-03-19 13:51:42 -07:00
|
|
|
* The margins define the positioning of the content on the page.
|
|
|
|
* They're treated as an offset from the "unwriteable margin"
|
|
|
|
* (described below).
|
2007-11-13 11:14:07 -08:00
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
attribute double marginTop; /* these are in inches */
|
|
|
|
attribute double marginLeft;
|
|
|
|
attribute double marginBottom;
|
|
|
|
attribute double marginRight;
|
2008-03-19 13:51:42 -07:00
|
|
|
/**
|
|
|
|
* The unwriteable margin defines the printable region of the paper, creating
|
|
|
|
* an invisible border from which the edge and margin attributes are measured.
|
|
|
|
*/
|
|
|
|
attribute double unwriteableMarginTop; /* these are in inches */
|
|
|
|
attribute double unwriteableMarginLeft;
|
|
|
|
attribute double unwriteableMarginBottom;
|
|
|
|
attribute double unwriteableMarginRight;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
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; /* indicates how to enable the frameset UI */
|
|
|
|
attribute boolean isCancelled; /* indicates whether the print job has been cancelled */
|
|
|
|
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 boolean shrinkToFit; /* shrinks content to fit on page */
|
|
|
|
attribute boolean showPrintProgress; /* indicates whether the progress dialog should be shown */
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
attribute double paperHeight; /* height of the paper in inches or mm */
|
|
|
|
attribute short paperSizeUnit; /* paper is in inches or mm */
|
|
|
|
|
|
|
|
attribute boolean printReversed;
|
|
|
|
attribute boolean printInColor; /* a false means grayscale */
|
|
|
|
attribute long orientation; /* see orientation consts */
|
|
|
|
attribute long numCopies;
|
|
|
|
|
|
|
|
attribute wstring printerName; /* name of destination printer */
|
|
|
|
|
|
|
|
attribute boolean printToFile;
|
|
|
|
attribute wstring toFileName;
|
|
|
|
attribute short outputFormat;
|
|
|
|
|
|
|
|
attribute long printPageDelay; /* in milliseconds */
|
2013-04-11 06:10:42 -07:00
|
|
|
|
|
|
|
attribute long resolution; /* print resolution (dpi) */
|
|
|
|
|
|
|
|
attribute long duplex; /* duplex mode */
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* initialize helpers */
|
|
|
|
/**
|
|
|
|
* This attribute tracks whether the PS has been initialized
|
|
|
|
* from a printer specified by the "printerName" attr.
|
|
|
|
* If a different name is set into the "printerName"
|
|
|
|
* attribute than the one it was initialized with the PS
|
|
|
|
* will then get intialized from that printer.
|
|
|
|
*/
|
|
|
|
attribute boolean isInitializedFromPrinter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This attribute tracks whether the PS has been initialized
|
|
|
|
* from prefs. If a different name is set into the "printerName"
|
|
|
|
* attribute than the one it was initialized with the PS
|
|
|
|
* will then get intialized from prefs again.
|
|
|
|
*/
|
|
|
|
attribute boolean isInitializedFromPrefs;
|
|
|
|
|
2013-02-20 07:50:21 -08:00
|
|
|
/**
|
|
|
|
* This attribute tracks if the settings made on the margin box is
|
|
|
|
* stored in the prefs or not.
|
|
|
|
*/
|
|
|
|
attribute boolean persistMarginBoxSettings;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* C++ Helper Functions */
|
2009-01-14 19:27:09 -08:00
|
|
|
[noscript] void SetMarginInTwips(in nsNativeIntMarginRef aMargin);
|
|
|
|
[noscript] void SetEdgeInTwips(in nsNativeIntMarginRef aEdge);
|
2007-03-22 10:30:00 -07:00
|
|
|
/* Purposely made this an "in" arg */
|
2009-01-14 19:27:09 -08:00
|
|
|
[noscript] void GetMarginInTwips(in nsNativeIntMarginRef aMargin);
|
|
|
|
[noscript] void GetEdgeInTwips(in nsNativeIntMarginRef aEdge);
|
2008-01-20 19:47:25 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* We call this function so that anything that requires a run of the event loop
|
|
|
|
* can do so safely. The print dialog runs the event loop but in silent printing
|
|
|
|
* that doesn't happen.
|
|
|
|
*
|
|
|
|
* Either this or ShowPrintDialog (but not both) MUST be called by the print engine
|
|
|
|
* before printing, otherwise printing can fail on some platforms.
|
|
|
|
*/
|
|
|
|
[noscript] void SetupSilentPrinting();
|
2008-03-19 13:51:42 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets/Gets the "unwriteable margin" for the page format. This defines
|
|
|
|
* the boundary from which we'll measure the EdgeInTwips and MarginInTwips
|
|
|
|
* attributes, to place the headers and content, respectively.
|
|
|
|
*
|
|
|
|
* Note: Implementations of SetUnwriteableMarginInTwips should handle
|
|
|
|
* negative margin values by falling back on the system default for
|
|
|
|
* that margin.
|
|
|
|
*/
|
2009-01-14 19:27:09 -08:00
|
|
|
[noscript] void SetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
|
|
|
|
[noscript] void GetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
|
2011-12-06 20:45:06 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get more accurate print ranges from the superior interval
|
|
|
|
* (startPageRange, endPageRange). The aPages array is populated with a
|
|
|
|
* list of pairs (start, end), where the endpoints are included. The print
|
|
|
|
* ranges (start, end), must not overlap and must be in the
|
|
|
|
* (startPageRange, endPageRange) scope.
|
|
|
|
*
|
|
|
|
* If there are no print ranges the aPages array is cleared.
|
|
|
|
*/
|
|
|
|
[noscript] void GetPageRanges(in IntegerArray aPages);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|