michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* Interface to the Service for gwetting the Global PrintSettings object michael@0: or a unique PrintSettings object michael@0: */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIPrintSettings; michael@0: michael@0: [scriptable, uuid(841387C8-72E6-484b-9296-BF6EEA80D58A)] michael@0: interface nsIPrintSettingsService : nsISupports michael@0: { michael@0: /** michael@0: * Returns a "global" PrintSettings object michael@0: * Creates a new the first time, if one doesn't exist. michael@0: * michael@0: * Then returns the same object each time after that. michael@0: * michael@0: * Initializes the globalPrintSettings from the default printer michael@0: */ michael@0: readonly attribute nsIPrintSettings globalPrintSettings; michael@0: michael@0: /** michael@0: * Returns a new, unique PrintSettings object each time. michael@0: * michael@0: * For example, if each browser was to have its own unique michael@0: * PrintSettings, then each browser window would call this to michael@0: * create its own unique PrintSettings object. michael@0: * michael@0: * If each browse window was to use the same PrintSettings object michael@0: * then it should use "globalPrintSettings" michael@0: * michael@0: * Initializes the newPrintSettings from the default printer michael@0: * michael@0: */ michael@0: readonly attribute nsIPrintSettings newPrintSettings; michael@0: michael@0: /** michael@0: * The name of the last printer used, or else the system default printer. michael@0: */ michael@0: readonly attribute wstring defaultPrinterName; michael@0: michael@0: /** michael@0: * Initializes certain settings from the native printer into the PrintSettings michael@0: * if aPrinterName is null then it uses the default printer name if it can michael@0: * These settings include, but are not limited to: michael@0: * Page Orientation michael@0: * Page Size michael@0: * Number of Copies michael@0: */ michael@0: void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings); michael@0: michael@0: /** michael@0: * Reads PrintSettings values from Prefs, michael@0: * the values to be read are indicated by the "flags" arg. michael@0: * michael@0: * aPrintSettings should be initialized with the name of a printer. First michael@0: * it reads in the PrintSettings from the last print job. Then it uses the michael@0: * PrinterName in the PrinterSettings to read any settings that were saved michael@0: * just for that printer. michael@0: * michael@0: * aPS - PrintSettings to have its settings read michael@0: * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix michael@0: * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the michael@0: * const values. michael@0: * michael@0: * Items not read: michael@0: * startPageRange, endPageRange, scaling, printRange, title michael@0: * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage michael@0: * printFrameType, printSilent, shrinkToFit, numCopies, michael@0: * printerName michael@0: * michael@0: */ michael@0: void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); michael@0: michael@0: /** michael@0: * Writes PrintSettings values to Prefs, michael@0: * the values to be written are indicated by the "flags" arg. michael@0: * michael@0: * If there is no PrinterName in the PrinterSettings michael@0: * the values are saved as the "generic" values not associated with any printer. michael@0: * If a PrinterName is there, then it saves the items qualified for that Printer michael@0: * michael@0: * aPS - PrintSettings to have its settings saved michael@0: * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix michael@0: * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values. michael@0: * michael@0: * Items not written: michael@0: * startPageRange, endPageRange, scaling, printRange, title michael@0: * docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage michael@0: * printFrameType, printSilent, shrinkToFit, numCopies michael@0: * michael@0: */ michael@0: void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); michael@0: michael@0: }; michael@0: michael@0: %{C++ michael@0: // {841387C8-72E6-484b-9296-BF6EEA80D58A} michael@0: #define NS_PRINTSETTINGSSERVICE_IID \ michael@0: {0x841387c8, 0x72e6, 0x484b, { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a}} michael@0: %}