1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* Interface to the Service for gwetting the Global PrintSettings object
7 or a unique PrintSettings object
10 #include
"nsISupports.idl"
12 interface nsIPrintSettings
;
13 interface nsIWebBrowserPrint
;
26 [ref] native PrintDataRef
(const mozilla
::embedding
::PrintData
);
27 [ptr] native PrintDataPtr
(mozilla
::embedding
::PrintData
);
29 [scriptable
, uuid(841387C8
-72E6
-484b
-9296-BF6EEA80D58A
)]
30 interface nsIPrintSettingsService
: nsISupports
33 * Returns the default print settings as used for printing.
35 [noscript
] readonly attribute nsIPrintSettings defaultPrintSettingsForPrinting
;
38 * Returns a new, unique PrintSettings object each time.
40 * Initializes the newPrintSettings from the unprefixed printer
41 * (Note: this may not happen if there is an OS specific implementation.)
43 * XXX This should really be a function called `createPrintSettings()`.
45 readonly attribute nsIPrintSettings newPrintSettings
;
48 * The name of the last printer used. Note that this may not be set, or may
49 * no longer be a valid printer. The caller is responsible for checking and
50 * falling back to some other printer (such as the system default printer).
52 * XXX: make it [infallible] when AString supports that (bug 1491187).
54 readonly attribute AString lastUsedPrinterName
;
57 * Initializes certain settings from the native printer into the PrintSettings
58 * if aPrinterName is null then it uses the default printer name if it can
59 * These settings include, but are not limited to:
64 void initPrintSettingsFromPrinter
(in AString aPrinterName
,
65 in nsIPrintSettings aPrintSettings
);
68 * Reads PrintSettings values from Prefs,
69 * the values to be read are indicated by the "flags" arg.
71 * aPrintSettings should be initialized with the name of a printer. First
72 * it reads in the PrintSettings from the last print job. Then it uses the
73 * PrinterName in the PrinterSettings to read any settings that were saved
74 * just for that printer.
76 * aPS - PrintSettings to have its settings read
77 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
78 * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the
82 * startPageRange, endPageRange, scaling, printRange, title
83 * docURL, isCancelled,
84 * printSilent, shrinkToFit, numCopies,
88 void initPrintSettingsFromPrefs
(in nsIPrintSettings aPrintSettings
, in boolean aUsePrinterNamePrefix
, in unsigned long aFlags
);
91 * Writes PrintSettings values to Prefs,
92 * the values to be written are indicated by the "flags" arg.
94 * If there is no PrinterName in the PrinterSettings
95 * the values are saved as the "generic" values not associated with any printer.
96 * If a PrinterName is there, then it saves the items qualified for that Printer
98 * aPS - PrintSettings to have its settings saved
99 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
100 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
103 * startPageRange, endPageRange, scaling, printRange, title
104 * docURL, isCancelled,
105 * printSilent, shrinkToFit, numCopies
108 void savePrintSettingsToPrefs
(in nsIPrintSettings aPrintSettings
, in boolean aUsePrinterNamePrefix
, in unsigned long aFlags
);
111 * Given some nsIPrintSettings,
112 * populates a PrintData representing them which can be sent over IPC. Values
113 * are only ever read from aSettings and aWBP.
116 * An nsIPrintSettings for a print job.
118 * Pointer to a pre-existing PrintData to populate.
123 void SerializeToPrintData
(in nsIPrintSettings aPrintSettings
,
124 in PrintDataPtr data
);
127 * This function is the opposite of SerializeToPrintData, in that it takes
128 * a PrintData, and populates a pre-existing nsIPrintSettings with the data
132 * Printing information sent through IPC.
134 * A pre-existing nsIPrintSettings to populate with the PrintData.
139 void DeserializeToPrintSettings
(in PrintDataRef data
,
140 in nsIPrintSettings aPrintSettings
);
145 // {841387C8-72E6-484b-9296-BF6EEA80D58A}
146 #define NS_PRINTSETTINGSSERVICE_IID \
147 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}}