Bug 1643246 - Don't use attribute selectors for determining if a select is a drop...
[gecko.git] / widget / nsIPrintSettingsService.idl
blob84053e05bd256220a74105c056309194cdbb9a57
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;
13 interface nsIWebBrowserPrint;
15 %{ C++
16 namespace mozilla {
17 namespace embedding {
18 class PrintData;
23 /**
24 * Native types
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
32 /**
33 * Returns a "global" PrintSettings object
34 * Creates a new the first time, if one doesn't exist.
36 * Then returns the same object each time after that.
38 * Initializes the globalPrintSettings from the default printer
40 readonly attribute nsIPrintSettings globalPrintSettings;
42 /**
43 * Returns a new, unique PrintSettings object each time.
45 * For example, if each browser was to have its own unique
46 * PrintSettings, then each browser window would call this to
47 * create its own unique PrintSettings object.
49 * If each browse window was to use the same PrintSettings object
50 * then it should use "globalPrintSettings"
52 * Initializes the newPrintSettings from the unprefixed printer
53 * (Note: this may not happen if there is an OS specific implementation.)
56 readonly attribute nsIPrintSettings newPrintSettings;
58 /**
59 * The name of the last printer used, or else the system default printer.
61 readonly attribute AString lastUsedPrinterName;
63 /**
64 * Initializes certain settings from the native printer into the PrintSettings
65 * if aPrinterName is null then it uses the default printer name if it can
66 * These settings include, but are not limited to:
67 * Page Orientation
68 * Page Size
69 * Number of Copies
71 void initPrintSettingsFromPrinter(in AString aPrinterName,
72 in nsIPrintSettings aPrintSettings);
74 /**
75 * Reads PrintSettings values from Prefs,
76 * the values to be read are indicated by the "flags" arg.
78 * aPrintSettings should be initialized with the name of a printer. First
79 * it reads in the PrintSettings from the last print job. Then it uses the
80 * PrinterName in the PrinterSettings to read any settings that were saved
81 * just for that printer.
83 * aPS - PrintSettings to have its settings read
84 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
85 * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the
86 * const values.
88 * Items not read:
89 * startPageRange, endPageRange, scaling, printRange, title
90 * docURL, isCancelled,
91 * printSilent, shrinkToFit, numCopies,
92 * printerName
95 void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
97 /**
98 * Writes PrintSettings values to Prefs,
99 * the values to be written are indicated by the "flags" arg.
101 * If there is no PrinterName in the PrinterSettings
102 * the values are saved as the "generic" values not associated with any printer.
103 * If a PrinterName is there, then it saves the items qualified for that Printer
105 * aPS - PrintSettings to have its settings saved
106 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
107 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
109 * Items not written:
110 * startPageRange, endPageRange, scaling, printRange, title
111 * docURL, isCancelled,
112 * printSilent, shrinkToFit, numCopies
115 void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
118 * Given some nsIPrintSettings,
119 * populates a PrintData representing them which can be sent over IPC. Values
120 * are only ever read from aSettings and aWBP.
122 * @param aSettings
123 * An nsIPrintSettings for a print job.
124 * @param data
125 * Pointer to a pre-existing PrintData to populate.
127 * @return nsresult
129 [noscript]
130 void SerializeToPrintData(in nsIPrintSettings aPrintSettings,
131 in PrintDataPtr data);
134 * This function is the opposite of SerializeToPrintData, in that it takes
135 * a PrintData, and populates a pre-existing nsIPrintSettings with the data
136 * from PrintData.
138 * @param PrintData
139 * Printing information sent through IPC.
140 * @param settings
141 * A pre-existing nsIPrintSettings to populate with the PrintData.
143 * @return nsresult
145 [noscript]
146 void DeserializeToPrintSettings(in PrintDataRef data,
147 in nsIPrintSettings aPrintSettings);
151 %{C++
152 // {841387C8-72E6-484b-9296-BF6EEA80D58A}
153 #define NS_PRINTSETTINGSSERVICE_IID \
154 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}}