Bug 1776444 [wpt PR 34582] - Revert "Add TimedHTMLParserBudget to fieldtrial_testing_...
[gecko.git] / widget / nsIPrintSettingsService.idl
blob34b8065bd76bca6140d36ede93ed7f90830c7db4
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
8 */
10 #include "nsISupports.idl"
12 interface nsIPrintSettings;
14 %{ C++
15 namespace mozilla {
16 namespace embedding {
17 class PrintData;
22 /**
23 * Native types
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
31 /**
32 * Returns the default print settings as used for printing.
34 [noscript] readonly attribute nsIPrintSettings defaultPrintSettingsForPrinting;
36 /**
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();
44 /**
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;
53 /**
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:
57 * Page Orientation
58 * Page Size
59 * Number of Copies
61 void initPrintSettingsFromPrinter(in AString aPrinterName,
62 in nsIPrintSettings aPrintSettings);
64 /**
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
76 * const values.
78 * Items not read:
79 * startPageRange, endPageRange, scaling, printRange, title
80 * docURL, isCancelled,
81 * printSilent, shrinkToFit, numCopies,
82 * printerName
85 void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
87 /**
88 * Writes PrintSettings values to Prefs,
89 * the values to be written are indicated by the "flags" arg.
91 * If there is no PrinterName in the PrinterSettings
92 * the values are saved as the "generic" values not associated with any printer.
93 * If a PrinterName is there, then it saves the items qualified for that Printer
95 * aPS - PrintSettings to have its settings saved
96 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
97 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
99 * Items not written:
100 * startPageRange, endPageRange, scaling, printRange, title
101 * docURL, isCancelled,
102 * printSilent, shrinkToFit, numCopies
105 void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
108 * Given some nsIPrintSettings,
109 * populates a PrintData representing them which can be sent over IPC. Values
110 * are only ever read from aSettings and aWBP.
112 * @param aSettings
113 * An nsIPrintSettings for a print job.
114 * @param data
115 * Pointer to a pre-existing PrintData to populate.
117 * @return nsresult
119 [noscript]
120 void SerializeToPrintData(in nsIPrintSettings aPrintSettings,
121 in PrintDataPtr data);
124 * This function is the opposite of SerializeToPrintData, in that it takes
125 * a PrintData, and populates a pre-existing nsIPrintSettings with the data
126 * from PrintData.
128 * @param PrintData
129 * Printing information sent through IPC.
130 * @param settings
131 * A pre-existing nsIPrintSettings to populate with the PrintData.
133 * @return nsresult
135 [noscript]
136 void DeserializeToPrintSettings(in PrintDataRef data,
137 in nsIPrintSettings aPrintSettings);
141 %{C++
142 // {841387C8-72E6-484b-9296-BF6EEA80D58A}
143 #define NS_PRINTSETTINGSSERVICE_IID \
144 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}}