|
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/. */ |
|
5 |
|
6 /* Interface to the Service for gwetting the Global PrintSettings object |
|
7 or a unique PrintSettings object |
|
8 */ |
|
9 |
|
10 #include "nsISupports.idl" |
|
11 |
|
12 interface nsIPrintSettings; |
|
13 |
|
14 [scriptable, uuid(841387C8-72E6-484b-9296-BF6EEA80D58A)] |
|
15 interface nsIPrintSettingsService : nsISupports |
|
16 { |
|
17 /** |
|
18 * Returns a "global" PrintSettings object |
|
19 * Creates a new the first time, if one doesn't exist. |
|
20 * |
|
21 * Then returns the same object each time after that. |
|
22 * |
|
23 * Initializes the globalPrintSettings from the default printer |
|
24 */ |
|
25 readonly attribute nsIPrintSettings globalPrintSettings; |
|
26 |
|
27 /** |
|
28 * Returns a new, unique PrintSettings object each time. |
|
29 * |
|
30 * For example, if each browser was to have its own unique |
|
31 * PrintSettings, then each browser window would call this to |
|
32 * create its own unique PrintSettings object. |
|
33 * |
|
34 * If each browse window was to use the same PrintSettings object |
|
35 * then it should use "globalPrintSettings" |
|
36 * |
|
37 * Initializes the newPrintSettings from the default printer |
|
38 * |
|
39 */ |
|
40 readonly attribute nsIPrintSettings newPrintSettings; |
|
41 |
|
42 /** |
|
43 * The name of the last printer used, or else the system default printer. |
|
44 */ |
|
45 readonly attribute wstring defaultPrinterName; |
|
46 |
|
47 /** |
|
48 * Initializes certain settings from the native printer into the PrintSettings |
|
49 * if aPrinterName is null then it uses the default printer name if it can |
|
50 * These settings include, but are not limited to: |
|
51 * Page Orientation |
|
52 * Page Size |
|
53 * Number of Copies |
|
54 */ |
|
55 void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); |
|
56 |
|
57 /** |
|
58 * Reads PrintSettings values from Prefs, |
|
59 * the values to be read are indicated by the "flags" arg. |
|
60 * |
|
61 * aPrintSettings should be initialized with the name of a printer. First |
|
62 * it reads in the PrintSettings from the last print job. Then it uses the |
|
63 * PrinterName in the PrinterSettings to read any settings that were saved |
|
64 * just for that printer. |
|
65 * |
|
66 * aPS - PrintSettings to have its settings read |
|
67 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix |
|
68 * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the |
|
69 * const values. |
|
70 * |
|
71 * Items not read: |
|
72 * startPageRange, endPageRange, scaling, printRange, title |
|
73 * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage |
|
74 * printFrameType, printSilent, shrinkToFit, numCopies, |
|
75 * printerName |
|
76 * |
|
77 */ |
|
78 void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); |
|
79 |
|
80 /** |
|
81 * Writes PrintSettings values to Prefs, |
|
82 * the values to be written are indicated by the "flags" arg. |
|
83 * |
|
84 * If there is no PrinterName in the PrinterSettings |
|
85 * the values are saved as the "generic" values not associated with any printer. |
|
86 * If a PrinterName is there, then it saves the items qualified for that Printer |
|
87 * |
|
88 * aPS - PrintSettings to have its settings saved |
|
89 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix |
|
90 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values. |
|
91 * |
|
92 * Items not written: |
|
93 * startPageRange, endPageRange, scaling, printRange, title |
|
94 * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage |
|
95 * printFrameType, printSilent, shrinkToFit, numCopies |
|
96 * |
|
97 */ |
|
98 void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); |
|
99 |
|
100 }; |
|
101 |
|
102 %{C++ |
|
103 // {841387C8-72E6-484b-9296-BF6EEA80D58A} |
|
104 #define NS_PRINTSETTINGSSERVICE_IID \ |
|
105 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}} |
|
106 %} |