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
;
25 [ref] native PrintDataRef
(const mozilla
::embedding
::PrintData
);
26 [ptr] native PrintDataPtr
(mozilla
::embedding
::PrintData
);
28 [scriptable
, uuid(841387C8
-72E6
-484b
-9296-BF6EEA80D58A
)]
29 interface nsIPrintSettingsService
: nsISupports
32 * Returns the default print settings as used for printing.
34 [noscript
] readonly attribute nsIPrintSettings defaultPrintSettingsForPrinting
;
37 * Creates a new nsIPrintSettings object.
39 * Initializes the settings object from the unprefixed printer
40 * (Note: this may not happen if there is an OS specific implementation.)
42 nsIPrintSettings createNewPrintSettings
();
45 * The name of the last printer used. Note that this may not be set, or may
46 * no longer be a valid printer. The caller is responsible for checking and
47 * falling back to some other printer (such as the system default printer).
49 * XXX: make it [infallible] when AString supports that (bug 1491187).
51 readonly attribute AString lastUsedPrinterName
;
54 * Initializes certain settings from the native printer into the PrintSettings
55 * if aPrinterName is null then it uses the default printer name if it can
56 * These settings include, but are not limited to:
61 void initPrintSettingsFromPrinter
(in AString aPrinterName
,
62 in nsIPrintSettings aPrintSettings
);
65 * Reads PrintSettings values from Prefs,
66 * the values to be read are indicated by the "flags" arg.
68 * aPrintSettings should be initialized with the name of a printer. First
69 * it reads in the PrintSettings from the last print job. Then it uses the
70 * PrinterName in the PrinterSettings to read any settings that were saved
71 * just for that printer.
73 * aPS - PrintSettings to have its settings read
74 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
75 * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the
79 * startPageRange, endPageRange, scaling, printRange, title
80 * docURL, isCancelled,
81 * printSilent, shrinkToFit, numCopies,
85 void initPrintSettingsFromPrefs
(in nsIPrintSettings aPrintSettings
, in boolean aUsePrinterNamePrefix
, in unsigned long aFlags
);
88 * As long as the pref print.save_print_settings isn't set to false, this
89 * saves to prefs the settings from aPrintSettings that are indicated by
92 * If there is no PrinterName in the PrinterSettings
93 * the values are saved as the "generic" values not associated with any printer.
94 * If a PrinterName is there, then it saves the items qualified for that Printer
96 * aPS - PrintSettings to have its settings saved
97 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
100 * startPageRange, endPageRange, scaling, printRange, title
101 * docURL, isCancelled,
102 * printSilent, shrinkToFit, numCopies
105 void maybeSavePrintSettingsToPrefs
(in nsIPrintSettings aPrintSettings
, in unsigned long aFlags
);
108 * As long as the pref print.save_print_settings isn't set to false, this
109 * saves the given printer name as the last used printer name.
111 void maybeSaveLastUsedPrinterNameToPrefs
(in AString aPrinterName
);
114 * Given some nsIPrintSettings,
115 * populates a PrintData representing them which can be sent over IPC. Values
116 * are only ever read from aSettings and aWBP.
119 * An nsIPrintSettings for a print job.
121 * Pointer to a pre-existing PrintData to populate.
126 void SerializeToPrintData
(in nsIPrintSettings aPrintSettings
,
127 in PrintDataPtr data
);
130 * This function is the opposite of SerializeToPrintData, in that it takes
131 * a PrintData, and populates a pre-existing nsIPrintSettings with the data
135 * Printing information sent through IPC.
137 * A pre-existing nsIPrintSettings to populate with the PrintData.
142 void DeserializeToPrintSettings
(in PrintDataRef data
,
143 in nsIPrintSettings aPrintSettings
);
148 // {841387C8-72E6-484b-9296-BF6EEA80D58A}
149 #define NS_PRINTSETTINGSSERVICE_IID \
150 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}}