1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 /* Interface to the Service for gwetting the Global PrintSettings object
39 or a unique PrintSettings object
40 */
41
42 #include "nsISupports.idl"
43
44 interface nsIPrintSettings;
45
46 [scriptable, uuid(841387C8-72E6-484b-9296-BF6EEA80D58A)]
47 interface nsIPrintSettingsService : nsISupports
48 {
49 /**
50 * Returns a "global" PrintSettings object
51 * Creates a new the first time, if one doesn't exist.
52 *
53 * Then returns the same object each time after that.
54 *
55 * Initializes the globalPrintSettings from the default printer
56 */
57 readonly attribute nsIPrintSettings globalPrintSettings;
58
59 /**
60 * Returns a new, unique PrintSettings object each time.
61 *
62 * For example, if each browser was to have its own unique
63 * PrintSettings, then each browser window would call this to
64 * create its own unique PrintSettings object.
65 *
66 * If each browse window was to use the same PrintSettings object
67 * then it should use "globalPrintSettings"
68 *
69 * Initializes the newPrintSettings from the default printer
70 *
71 */
72 readonly attribute nsIPrintSettings newPrintSettings;
73
74 /**
75 * The name of the last printer used, or else the system default printer.
76 */
77 readonly attribute wstring defaultPrinterName;
78
79 /**
80 * Initializes certain settings from the native printer into the PrintSettings
81 * if aPrinterName is null then it uses the default printer name if it can
82 * These settings include, but are not limited to:
83 * Page Orientation
84 * Page Size
85 * Number of Copies
86 */
87 void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings);
88
89 /**
90 * Reads PrintSettings values from Prefs,
91 * the values to be read are indicated by the "flags" arg.
92 *
93 * aPrintSettings should be initialized with the name of a printer. First
94 * it reads in the PrintSettings from the last print job. Then it uses the
95 * PrinterName in the PrinterSettings to read any settings that were saved
96 * just for that printer.
97 *
98 * aPS - PrintSettings to have its settings read
99 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
100 * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the
101 * const values.
102 *
103 * Items not read:
104 * startPageRange, endPageRange, scaling, printRange, title
105 * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
106 * printFrameType, printSilent, shrinkToFit, numCopies,
107 * printerName
108 *
109 */
110 void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
111
112 /**
113 * Writes PrintSettings values to Prefs,
114 * the values to be written are indicated by the "flags" arg.
115 *
116 * If there is no PrinterName in the PrinterSettings
117 * the values are saved as the "generic" values not associated with any printer.
118 * If a PrinterName is there, then it saves the items qualified for that Printer
119 *
120 * aPS - PrintSettings to have its settings saved
121 * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
122 * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
123 *
124 * Items not written:
125 * startPageRange, endPageRange, scaling, printRange, title
126 * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
127 * printFrameType, printSilent, shrinkToFit, numCopies
128 *
129 */
130 void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
131
132 };
133
134 %{C++
135 // {841387C8-72E6-484b-9296-BF6EEA80D58A}
136 #define NS_PRINTSETTINGSSERVICE_IID \
137 {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}}
138 %}