Disable partial flat closures pending scope chain reconstruction on trace (554572...
[mozilla-central.git] / widget / public / nsIPrintSettings.idl
blobda351bb6cc6b02fe64635f07cd1b241892869515
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Don Cone <dcone@netscape.com>
24 * Rod Spears <rods@netscape.com>
25 * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
26 * Julien Lafon <julien.lafon@gmail.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #include "nsISupports.idl"
45 %{ C++
46 #include "nsMargin.h"
49 /**
50 * Native types
52 [ref] native nsNativeIntMarginRef(nsIntMargin);
54 interface nsIPrintSession;
56 /**
57 * Simplified graphics interface for JS rendering.
59 * @status UNDER_REVIEW
61 [scriptable, uuid(343700dd-078b-42b6-a809-b9c1d7e951d0)]
63 interface nsIPrintSettings : nsISupports
65 /**
66 * PrintSettings to be Saved Navigation Constants
68 const unsigned long kInitSaveOddEvenPages = 0x00000001;
69 const unsigned long kInitSaveHeaderLeft = 0x00000002;
70 const unsigned long kInitSaveHeaderCenter = 0x00000004;
71 const unsigned long kInitSaveHeaderRight = 0x00000008;
72 const unsigned long kInitSaveFooterLeft = 0x00000010;
73 const unsigned long kInitSaveFooterCenter = 0x00000020;
74 const unsigned long kInitSaveFooterRight = 0x00000040;
75 const unsigned long kInitSaveBGColors = 0x00000080;
76 const unsigned long kInitSaveBGImages = 0x00000100;
77 const unsigned long kInitSavePaperSize = 0x00000200;
78 /* Flag 0x00000400 is unused */
79 /* Flag 0x00000800 is unused */
80 /* Flag 0x00001000 is unused */
81 const unsigned long kInitSavePaperData = 0x00002000;
82 const unsigned long kInitSaveUnwriteableMargins = 0x00004000;
83 const unsigned long kInitSaveEdges = 0x00008000;
85 const unsigned long kInitSaveReversed = 0x00010000;
86 const unsigned long kInitSaveInColor = 0x00020000;
87 const unsigned long kInitSaveOrientation = 0x00040000;
88 const unsigned long kInitSavePrintCommand = 0x00080000;
89 const unsigned long kInitSavePrinterName = 0x00100000;
90 const unsigned long kInitSavePrintToFile = 0x00200000;
91 const unsigned long kInitSaveToFileName = 0x00400000;
92 const unsigned long kInitSavePageDelay = 0x00800000;
93 const unsigned long kInitSaveMargins = 0x01000000;
94 const unsigned long kInitSaveNativeData = 0x02000000;
95 const unsigned long kInitSavePlexName = 0x04000000;
96 const unsigned long kInitSaveShrinkToFit = 0x08000000;
97 const unsigned long kInitSaveScaling = 0x10000000;
98 const unsigned long kInitSaveColorspace = 0x20000000;
99 const unsigned long kInitSaveResolutionName = 0x40000000;
100 const unsigned long kInitSaveDownloadFonts = 0x80000000;
101 const unsigned long kInitSaveAll = 0xFFFFFFFF;
103 /* Print Option Flags for Bit Field*/
104 const long kPrintOddPages = 0x00000001;
105 const long kPrintEvenPages = 0x00000002;
106 const long kEnableSelectionRB = 0x00000004;
108 /* Print Range Enums */
109 const long kRangeAllPages = 0;
110 const long kRangeSpecifiedPageRange = 1;
111 const long kRangeSelection = 2;
112 const long kRangeFocusFrame = 3;
114 /* Justification Enums */
115 const long kJustLeft = 0;
116 const long kJustCenter = 1;
117 const long kJustRight = 2;
120 * FrameSet Default Type Constants
122 const short kUseInternalDefault = 0;
123 const short kUseSettingWhenPossible = 1;
126 * Page Size Type Constants
128 const short kPaperSizeNativeData = 0;
129 const short kPaperSizeDefined = 1;
132 * Page Size Unit Constants
134 const short kPaperSizeInches = 0;
135 const short kPaperSizeMillimeters = 1;
138 * Orientation Constants
140 const short kPortraitOrientation = 0;
141 const short kLandscapeOrientation = 1;
144 * Print Frame Constants
146 const short kNoFrames = 0;
147 const short kFramesAsIs = 1;
148 const short kSelectedFrame = 2;
149 const short kEachFrameSep = 3;
152 * How to Enable Frame Set Printing Constants
154 const short kFrameEnableNone = 0;
155 const short kFrameEnableAll = 1;
156 const short kFrameEnableAsIsAndEach = 2;
159 * Output file format
161 const short kOutputFormatNative = 0;
162 const short kOutputFormatPS = 1;
163 const short kOutputFormatPDF = 2;
166 * Set PrintOptions
168 void SetPrintOptions(in PRInt32 aType, in PRBool aTurnOnOff);
171 * Get PrintOptions
173 PRBool GetPrintOptions(in PRInt32 aType);
176 * Set PrintOptions Bit field
178 PRInt32 GetPrintOptionsBits();
181 * Get the page size in twips, considering the
182 * orientation (portrait or landscape).
184 void GetEffectivePageSize(out double aWidth, out double aHeight);
187 * Makes a new copy
189 nsIPrintSettings clone();
192 * Assigns the internal values from the "in" arg to the current object
194 void assign(in nsIPrintSettings aPS);
197 * Data Members
199 [noscript] attribute nsIPrintSession printSession; /* We hold a weak reference */
201 attribute long startPageRange;
202 attribute long endPageRange;
205 * The edge measurements define the positioning of the headers
206 * and footers on the page. They're measured as an offset from
207 * the "unwriteable margin" (described below).
209 attribute double edgeTop; /* these are in inches */
210 attribute double edgeLeft;
211 attribute double edgeBottom;
212 attribute double edgeRight;
215 * The margins define the positioning of the content on the page.
216 * They're treated as an offset from the "unwriteable margin"
217 * (described below).
219 attribute double marginTop; /* these are in inches */
220 attribute double marginLeft;
221 attribute double marginBottom;
222 attribute double marginRight;
224 * The unwriteable margin defines the printable region of the paper, creating
225 * an invisible border from which the edge and margin attributes are measured.
227 attribute double unwriteableMarginTop; /* these are in inches */
228 attribute double unwriteableMarginLeft;
229 attribute double unwriteableMarginBottom;
230 attribute double unwriteableMarginRight;
232 attribute double scaling; /* values 0.0 - 1.0 */
233 attribute boolean printBGColors; /* Print Background Colors */
234 attribute boolean printBGImages; /* Print Background Images */
236 attribute short printRange;
238 attribute wstring title;
239 attribute wstring docURL;
241 attribute wstring headerStrLeft;
242 attribute wstring headerStrCenter;
243 attribute wstring headerStrRight;
245 attribute wstring footerStrLeft;
246 attribute wstring footerStrCenter;
247 attribute wstring footerStrRight;
249 attribute short howToEnableFrameUI; /* indicates how to enable the frameset UI */
250 attribute boolean isCancelled; /* indicates whether the print job has been cancelled */
251 attribute short printFrameTypeUsage; /* indicates whether to use the interal value or not */
252 attribute short printFrameType;
253 attribute boolean printSilent; /* print without putting up the dialog */
254 attribute boolean shrinkToFit; /* shrinks content to fit on page */
255 attribute boolean showPrintProgress; /* indicates whether the progress dialog should be shown */
257 /* Additional XP Related */
258 attribute wstring paperName; /* name of paper */
259 attribute short paperSizeType; /* use native data or is defined here */
260 attribute short paperData; /* native data value */
261 attribute double paperWidth; /* width of the paper in inches or mm */
262 attribute double paperHeight; /* height of the paper in inches or mm */
263 attribute short paperSizeUnit; /* paper is in inches or mm */
265 attribute wstring plexName; /* name of plex mode (like "simplex", "duplex",
266 * "tumble" and various custom values) */
268 attribute wstring colorspace; /* device-specific name of colorspace, overrides |printInColor| */
269 attribute wstring resolutionName;/* device-specific identifer of resolution or quality
270 * (like "600", "600x300", "600x300x12", "high-res",
271 * "med-res". "low-res", etc.) */
272 attribute boolean downloadFonts; /* enable font download to printer? */
274 attribute boolean printReversed;
275 attribute boolean printInColor; /* a false means grayscale */
276 attribute long orientation; /* see orientation consts */
277 attribute wstring printCommand;
278 attribute long numCopies;
280 attribute wstring printerName; /* name of destination printer */
282 attribute boolean printToFile;
283 attribute wstring toFileName;
284 attribute short outputFormat;
286 attribute long printPageDelay; /* in milliseconds */
288 /* initialize helpers */
290 * This attribute tracks whether the PS has been initialized
291 * from a printer specified by the "printerName" attr.
292 * If a different name is set into the "printerName"
293 * attribute than the one it was initialized with the PS
294 * will then get intialized from that printer.
296 attribute boolean isInitializedFromPrinter;
299 * This attribute tracks whether the PS has been initialized
300 * from prefs. If a different name is set into the "printerName"
301 * attribute than the one it was initialized with the PS
302 * will then get intialized from prefs again.
304 attribute boolean isInitializedFromPrefs;
306 /* C++ Helper Functions */
307 [noscript] void SetMarginInTwips(in nsNativeIntMarginRef aMargin);
308 [noscript] void SetEdgeInTwips(in nsNativeIntMarginRef aEdge);
309 /* Purposely made this an "in" arg */
310 [noscript] void GetMarginInTwips(in nsNativeIntMarginRef aMargin);
311 [noscript] void GetEdgeInTwips(in nsNativeIntMarginRef aEdge);
314 * We call this function so that anything that requires a run of the event loop
315 * can do so safely. The print dialog runs the event loop but in silent printing
316 * that doesn't happen.
318 * Either this or ShowPrintDialog (but not both) MUST be called by the print engine
319 * before printing, otherwise printing can fail on some platforms.
321 [noscript] void SetupSilentPrinting();
324 * Sets/Gets the "unwriteable margin" for the page format. This defines
325 * the boundary from which we'll measure the EdgeInTwips and MarginInTwips
326 * attributes, to place the headers and content, respectively.
328 * Note: Implementations of SetUnwriteableMarginInTwips should handle
329 * negative margin values by falling back on the system default for
330 * that margin.
332 [noscript] void SetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
333 [noscript] void GetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);