2006-02-07 04:12:56 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2006-02-07 04:11:45 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
|
|
|
|
%{ C++
|
|
|
|
#include "nsMargin.h"
|
2011-12-07 08:45:06 +04:00
|
|
|
#include "nsTArray.h"
|
2006-02-07 04:13:12 +03:00
|
|
|
%}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Native types
|
|
|
|
*/
|
2020-09-10 18:25:59 +03:00
|
|
|
native nsNativeIntMargin(nsIntMargin);
|
2019-04-21 04:47:00 +03:00
|
|
|
[ref] native nsNativeIntMarginRef(nsIntMargin);
|
|
|
|
[ref] native IntegerArray(nsTArray<int32_t>);
|
|
|
|
|
2006-02-07 04:14:12 +03:00
|
|
|
interface nsIPrintSession;
|
2006-02-07 04:13:12 +03:00
|
|
|
|
2006-02-07 04:11:45 +03:00
|
|
|
/**
|
|
|
|
* Simplified graphics interface for JS rendering.
|
|
|
|
*/
|
2020-09-10 18:25:59 +03:00
|
|
|
[scriptable, builtinclass, uuid(ecc5cbad-57fc-4731-b0bd-09e865bd62ad)]
|
2006-02-07 04:11:45 +03:00
|
|
|
interface nsIPrintSettings : nsISupports
|
|
|
|
{
|
2006-02-07 04:13:37 +03:00
|
|
|
/**
|
|
|
|
* 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 17:10:42 +04:00
|
|
|
const unsigned long kInitSaveResolution = 0x00000400;
|
|
|
|
const unsigned long kInitSaveDuplex = 0x00000800;
|
2007-08-27 04:19:15 +04:00
|
|
|
/* Flag 0x00001000 is unused */
|
2020-09-18 18:28:46 +03:00
|
|
|
/* Flag 0x00002000 is unused */
|
2008-03-19 23:51:42 +03:00
|
|
|
const unsigned long kInitSaveUnwriteableMargins = 0x00004000;
|
2007-11-13 22:14:07 +03:00
|
|
|
const unsigned long kInitSaveEdges = 0x00008000;
|
2006-02-07 04:13:37 +03:00
|
|
|
|
|
|
|
const unsigned long kInitSaveReversed = 0x00010000;
|
|
|
|
const unsigned long kInitSaveInColor = 0x00020000;
|
|
|
|
const unsigned long kInitSaveOrientation = 0x00040000;
|
2015-06-10 09:10:28 +03:00
|
|
|
|
2006-02-07 04:13:37 +03: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;
|
2006-02-07 04:13:52 +03:00
|
|
|
const unsigned long kInitSaveNativeData = 0x02000000;
|
2015-06-11 00:34:27 +03:00
|
|
|
|
2006-02-07 04:14:46 +03:00
|
|
|
const unsigned long kInitSaveShrinkToFit = 0x08000000;
|
|
|
|
const unsigned long kInitSaveScaling = 0x10000000;
|
2015-06-11 00:34:27 +03:00
|
|
|
|
2006-02-07 04:13:37 +03:00
|
|
|
const unsigned long kInitSaveAll = 0xFFFFFFFF;
|
2006-02-07 04:13:12 +03:00
|
|
|
|
2006-02-07 04:11:45 +03:00
|
|
|
/* Print Option Flags for Bit Field*/
|
2006-02-07 04:13:12 +03:00
|
|
|
const long kPrintOddPages = 0x00000001;
|
|
|
|
const long kPrintEvenPages = 0x00000002;
|
|
|
|
const long kEnableSelectionRB = 0x00000004;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
|
|
|
/* Print Range Enums */
|
|
|
|
const long kRangeAllPages = 0;
|
|
|
|
const long kRangeSpecifiedPageRange = 1;
|
|
|
|
const long kRangeSelection = 2;
|
|
|
|
|
|
|
|
/* Justification Enums */
|
|
|
|
const long kJustLeft = 0;
|
|
|
|
const long kJustCenter = 1;
|
|
|
|
const long kJustRight = 2;
|
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
/**
|
|
|
|
* Page Size Unit Constants
|
|
|
|
*/
|
|
|
|
const short kPaperSizeInches = 0;
|
|
|
|
const short kPaperSizeMillimeters = 1;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2006-02-07 04:13:03 +03:00
|
|
|
/**
|
2006-02-07 04:13:05 +03:00
|
|
|
* Orientation Constants
|
2006-02-07 04:13:03 +03:00
|
|
|
*/
|
2006-02-07 04:13:05 +03:00
|
|
|
const short kPortraitOrientation = 0;
|
|
|
|
const short kLandscapeOrientation = 1;
|
2006-02-07 04:13:04 +03:00
|
|
|
|
2007-03-01 03:02:27 +03:00
|
|
|
/**
|
|
|
|
* Output file format
|
|
|
|
*/
|
|
|
|
const short kOutputFormatNative = 0;
|
|
|
|
const short kOutputFormatPS = 1;
|
|
|
|
const short kOutputFormatPDF = 2;
|
|
|
|
|
2020-08-25 23:31:56 +03:00
|
|
|
/**
|
|
|
|
* Simplex/Duplex printing options
|
|
|
|
*/
|
|
|
|
const short kSimplex = 0;
|
|
|
|
const short kDuplexHorizontal = 1;
|
|
|
|
const short kDuplexVertical = 2;
|
|
|
|
|
2006-02-07 04:11:45 +03:00
|
|
|
/**
|
2019-04-21 04:47:00 +03:00
|
|
|
* Set PrintOptions
|
2006-02-07 04:11:45 +03:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetPrintOptions(in int32_t aType, in boolean aTurnOnOff);
|
2006-02-07 04:11:45 +03:00
|
|
|
|
|
|
|
/**
|
2019-04-21 04:47:00 +03:00
|
|
|
* Get PrintOptions
|
2006-02-07 04:11:45 +03:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
boolean GetPrintOptions(in int32_t aType);
|
2006-02-07 04:11:45 +03:00
|
|
|
|
|
|
|
/**
|
2015-05-06 22:35:35 +03:00
|
|
|
* Get PrintOptions Bit field
|
2006-02-07 04:11:45 +03:00
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetPrintOptionsBits();
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2015-05-06 22:35:35 +03:00
|
|
|
/**
|
|
|
|
* Set PrintOptions Bit field
|
|
|
|
*/
|
|
|
|
void SetPrintOptionsBits(in int32_t bits);
|
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
/**
|
2007-07-17 03:16:48 +04:00
|
|
|
* Get the page size in twips, considering the
|
|
|
|
* orientation (portrait or landscape).
|
2006-02-07 04:13:12 +03:00
|
|
|
*/
|
2007-07-17 03:16:48 +04:00
|
|
|
void GetEffectivePageSize(out double aWidth, out double aHeight);
|
2006-02-07 04:13:12 +03:00
|
|
|
|
2006-02-07 04:13:52 +03:00
|
|
|
/**
|
|
|
|
* Makes a new copy
|
|
|
|
*/
|
2020-09-16 14:21:41 +03:00
|
|
|
nsIPrintSettings clone();
|
2006-02-07 04:13:52 +03:00
|
|
|
|
2006-02-07 04:14:05 +03:00
|
|
|
/**
|
|
|
|
* Assigns the internal values from the "in" arg to the current object
|
|
|
|
*/
|
2020-09-16 14:21:41 +03:00
|
|
|
void assign(in nsIPrintSettings aPS);
|
2006-02-07 04:14:05 +03:00
|
|
|
|
2006-02-07 04:11:45 +03:00
|
|
|
/**
|
|
|
|
* Data Members
|
|
|
|
*/
|
2006-02-07 04:14:12 +03:00
|
|
|
[noscript] attribute nsIPrintSession printSession; /* We hold a weak reference */
|
|
|
|
|
2019-04-21 04:47:00 +03:00
|
|
|
attribute long startPageRange;
|
|
|
|
attribute long endPageRange;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2007-11-13 22:14:07 +03:00
|
|
|
/**
|
2008-03-19 23:51:42 +03:00
|
|
|
* The edge measurements define the positioning of the headers
|
2020-09-10 21:03:04 +03:00
|
|
|
* and footers on the page. They're treated as an offset from the edges of
|
|
|
|
* the page, but are forced to be at least the "unwriteable margin"
|
|
|
|
* (described below).
|
2007-11-13 22:14:07 +03:00
|
|
|
*/
|
|
|
|
attribute double edgeTop; /* these are in inches */
|
|
|
|
attribute double edgeLeft;
|
|
|
|
attribute double edgeBottom;
|
|
|
|
attribute double edgeRight;
|
|
|
|
|
|
|
|
/**
|
2008-03-19 23:51:42 +03:00
|
|
|
* The margins define the positioning of the content on the page.
|
2020-09-10 21:03:04 +03:00
|
|
|
* and footers on the page. They're treated as an offset from the edges of
|
|
|
|
* the page, but are forced to be at least the "unwriteable margin"
|
2008-03-19 23:51:42 +03:00
|
|
|
* (described below).
|
2007-11-13 22:14:07 +03:00
|
|
|
*/
|
2006-02-07 04:11:45 +03:00
|
|
|
attribute double marginTop; /* these are in inches */
|
|
|
|
attribute double marginLeft;
|
|
|
|
attribute double marginBottom;
|
|
|
|
attribute double marginRight;
|
2008-03-19 23:51:42 +03:00
|
|
|
/**
|
2020-09-10 21:03:04 +03:00
|
|
|
* The unwriteable margin defines the printable region of the paper.
|
2008-03-19 23:51:42 +03:00
|
|
|
*/
|
|
|
|
attribute double unwriteableMarginTop; /* these are in inches */
|
|
|
|
attribute double unwriteableMarginLeft;
|
|
|
|
attribute double unwriteableMarginBottom;
|
|
|
|
attribute double unwriteableMarginRight;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2006-02-07 04:13:10 +03:00
|
|
|
attribute double scaling; /* values 0.0 - 1.0 */
|
2020-09-16 14:21:41 +03:00
|
|
|
[infallible] attribute boolean printBGColors; /* Print Background Colors */
|
|
|
|
[infallible] attribute boolean printBGImages; /* Print Background Images */
|
2006-02-07 04:13:10 +03:00
|
|
|
|
2020-10-01 16:18:01 +03:00
|
|
|
/** Whether @page rule margins should be honored or not. */
|
|
|
|
[infallible] attribute boolean honorPageRuleMargins;
|
|
|
|
|
2019-04-21 04:47:00 +03:00
|
|
|
attribute short printRange;
|
2006-02-07 04:13:05 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
attribute AString title;
|
|
|
|
attribute AString docURL;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
attribute AString headerStrLeft;
|
|
|
|
attribute AString headerStrCenter;
|
|
|
|
attribute AString headerStrRight;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
attribute AString footerStrLeft;
|
|
|
|
attribute AString footerStrCenter;
|
|
|
|
attribute AString footerStrRight;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
attribute boolean isCancelled; /* indicates whether the print job has been cancelled */
|
2019-04-01 17:42:24 +03:00
|
|
|
readonly attribute boolean saveOnCancel; /* indicates whether the print settings should be saved after a cancel */
|
2019-04-21 04:47:00 +03:00
|
|
|
attribute boolean printSilent; /* print without putting up the dialog */
|
|
|
|
attribute boolean shrinkToFit; /* shrinks content to fit on page */
|
2006-02-07 04:13:49 +03:00
|
|
|
attribute boolean showPrintProgress; /* indicates whether the progress dialog should be shown */
|
2020-07-20 20:39:12 +03:00
|
|
|
attribute boolean showMarginGuides; /* whether to draw guidelines showing the margin settings */
|
2006-02-07 04:13:04 +03:00
|
|
|
|
2006-02-07 04:13:05 +03:00
|
|
|
/* Additional XP Related */
|
2020-09-20 00:31:05 +03:00
|
|
|
attribute AString paperId; /* identifier of paper (not display name) */
|
2006-02-07 04:13:12 +03:00
|
|
|
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 */
|
|
|
|
|
2006-02-07 04:13:05 +03:00
|
|
|
attribute boolean printReversed;
|
|
|
|
attribute boolean printInColor; /* a false means grayscale */
|
|
|
|
attribute long orientation; /* see orientation consts */
|
2006-02-07 04:13:12 +03:00
|
|
|
attribute long numCopies;
|
2006-02-07 04:15:09 +03:00
|
|
|
|
2017-10-09 02:08:09 +03:00
|
|
|
attribute AString printerName; /* name of destination printer */
|
2006-02-07 04:15:09 +03:00
|
|
|
|
2006-02-07 04:13:05 +03:00
|
|
|
attribute boolean printToFile;
|
2017-10-09 02:08:09 +03:00
|
|
|
attribute AString toFileName;
|
2007-03-01 03:02:27 +03:00
|
|
|
attribute short outputFormat;
|
2006-02-07 04:11:45 +03:00
|
|
|
|
2006-02-07 04:13:05 +03:00
|
|
|
attribute long printPageDelay; /* in milliseconds */
|
2013-04-11 17:10:42 +04:00
|
|
|
|
|
|
|
attribute long resolution; /* print resolution (dpi) */
|
|
|
|
|
|
|
|
attribute long duplex; /* duplex mode */
|
|
|
|
|
2006-02-07 04:14:23 +03:00
|
|
|
/* initialize helpers */
|
|
|
|
/**
|
2019-04-21 04:47:00 +03:00
|
|
|
* 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"
|
2006-02-07 04:14:23 +03:00
|
|
|
* attribute than the one it was initialized with the PS
|
|
|
|
* will then get intialized from that printer.
|
|
|
|
*/
|
|
|
|
attribute boolean isInitializedFromPrinter;
|
|
|
|
|
|
|
|
/**
|
2019-04-21 04:47:00 +03:00
|
|
|
* This attribute tracks whether the PS has been initialized
|
|
|
|
* from prefs. If a different name is set into the "printerName"
|
2006-02-07 04:14:23 +03:00
|
|
|
* attribute than the one it was initialized with the PS
|
|
|
|
* will then get intialized from prefs again.
|
|
|
|
*/
|
|
|
|
attribute boolean isInitializedFromPrefs;
|
|
|
|
|
2006-02-07 04:13:12 +03:00
|
|
|
/* C++ Helper Functions */
|
2009-01-15 06:27:09 +03:00
|
|
|
[noscript] void SetMarginInTwips(in nsNativeIntMarginRef aMargin);
|
|
|
|
[noscript] void SetEdgeInTwips(in nsNativeIntMarginRef aEdge);
|
2020-09-10 18:25:59 +03:00
|
|
|
[noscript, notxpcom, nostdcall] nsNativeIntMargin GetMarginInTwips();
|
|
|
|
[noscript, notxpcom, nostdcall] nsNativeIntMargin GetEdgeInTwips();
|
2008-01-21 06:47:25 +03: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 23:51:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets/Gets the "unwriteable margin" for the page format. This defines
|
2019-04-21 04:47:00 +03:00
|
|
|
* the boundary from which we'll measure the EdgeInTwips and MarginInTwips
|
2008-03-19 23:51:42 +03:00
|
|
|
* 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-15 06:27:09 +03:00
|
|
|
[noscript] void SetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
|
2020-09-10 18:25:59 +03:00
|
|
|
[noscript, notxpcom, nostdcall] nsNativeIntMargin GetUnwriteableMarginInTwips();
|
2019-04-21 04:47:00 +03:00
|
|
|
|
2011-12-07 08:45:06 +04:00
|
|
|
/**
|
2019-04-21 04:47:00 +03: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
|
2011-12-07 08:45:06 +04:00
|
|
|
* (startPageRange, endPageRange) scope.
|
|
|
|
*
|
|
|
|
* If there are no print ranges the aPages array is cleared.
|
|
|
|
*/
|
|
|
|
[noscript] void GetPageRanges(in IntegerArray aPages);
|
2006-02-07 04:11:45 +03:00
|
|
|
};
|
2020-08-20 09:11:08 +03:00
|
|
|
|
|
|
|
%{ C++
|
|
|
|
namespace mozilla {
|
|
|
|
struct PrintSettingsInitializer;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsIPrintSettings> CreatePlatformPrintSettings(const mozilla::PrintSettingsInitializer&);
|
|
|
|
%}
|