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