gecko-dev/embedding/browser/webBrowser/nsIWebBrowserPrint.idl
rods%netscape.com 1d956bc3a5 making a few adjustments to the APIs before the freeze
Bug 143248 r=conrad sr=attinasi
2002-05-09 22:02:44 +00:00

226 lines
7.2 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Don Cone <dcone@netscape.com>
* Rod Spears <rods@netscape.com>
*/
#include "nsISupports.idl"
interface nsIDOMWindow;
interface nsIPrintSettings;
interface nsIWebProgressListener;
/**
* nsIWebBrowserPrint corresponds to the main interface
* for printing an embedded Gecko web browser window/document
*
*/
[scriptable, uuid(9A7CA4B0-FBBA-11d4-A869-00105A183419)]
interface nsIWebBrowserPrint : nsISupports
{
/**
* PrintPreview Navigation Constants
*/
const short PRINTPREVIEW_GOTO_PAGENUM = 0;
const short PRINTPREVIEW_PREV_PAGE = 1;
const short PRINTPREVIEW_NEXT_PAGE = 2;
const short PRINTPREVIEW_HOME = 3;
const short PRINTPREVIEW_END = 4;
/**
* Returns a new, unique PrintSettings object each time.
*
* For example, if each browser was to have its own unique
* PrintSettings, then each browser window would call this to
* create its own unique PrintSettings object.
*
* If each browse window was to use the same PrintSettings object
* then it should use "globalPrintSettings"
*
* Initializes the newPrintSettings from the default printer
*
*/
readonly attribute nsIPrintSettings newPrintSettings;
/**
* Returns a "global" PrintSettings object
* Creates a new the first time, if one doesn't exist.
*
* Then returns the same object each time after that.
*
* Initializes the globalPrintSettings from the default printer
*/
readonly attribute nsIPrintSettings globalPrintSettings;
/**
* Returns a pointer to the PrintSettings object that
* that was passed into either "print" or "print preview"
*
* This enables any consumers of the interface to have access
* to the "current" PrintSetting at later points in the execution
*/
readonly attribute nsIPrintSettings currentPrintSettings;
/**
* Returns whether it is in Print mode
*/
readonly attribute boolean doingPrint;
/**
* Returns whether it is in Print Preview mode
*/
readonly attribute boolean doingPrintPreview;
/**
* The name of the default printer
*/
readonly attribute wstring defaultPrinterName;
/**
* Initializes certain settings from the native printer into the PrintSettings
* if aPrinterName is null then it uses the default printer name if it can
* These settings include, but are not limited to:
* Page Orientation
* Page Size
* Number of Copies
*/
void initPrintSettingsFromPrinter(in wstring aPrinterName, in nsIPrintSettings aPrintSettings);
/**
* Reads PrintSettings values from Prefs,
* the values to be read are indicated by the "flags" arg.
*
* First it reads in the "generic" set of PrintSetings not associated with any printer
* then it uses the PrinterName in the PrinterSettings to read any settings that were saved
* just for that printer.
*
* aPS - PrintSettings to have its settings read
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
* aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the const values.
*
* Items not read:
* startPageRange, endPageRange, scaling, printRange, title
* docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
* printFrameType, printSilent, shrinkToFit, numCopies
*
*/
void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
/**
* Writes PrintSettings values to Prefs,
* the values to be written are indicated by the "flags" arg.
*
* If there is no PrinterName in the PrinterSettings
* the values are saved as the "generic" values not associated with any printer.
* If a PrinterName is there, then it saves the items qualified for that Printer
*
* aPS - PrintSettings to have its settings saved
* aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
* aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
*
* Items not written:
* startPageRange, endPageRange, scaling, printRange, title
* docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
* printFrameType, printSilent, shrinkToFit, numCopies
*
*/
void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
/**
* This returns whether the current document is a frameset document
*/
readonly attribute boolean isFramesetDocument;
/**
* This returns whether the current document is a frameset document
*/
readonly attribute boolean isFramesetFrameSelected;
/**
* This returns whether there is an IFrame selected
*/
readonly attribute boolean isIFrameSelected;
/**
* This returns whether there is a "range" selection
*/
readonly attribute boolean isRangeSelection;
/**
* This returns the total number of pages for the Print Preview
*/
readonly attribute long printPreviewNumPages;
/**
* Print the specified DOM window
*
* aThePrintOptions - Printer Settings for the print job
* nsIWebProgressListener - is updated during the print
* @return void
*/
void print(in nsIPrintSettings aThePrintSettings,
in nsIWebProgressListener aWPListener);
/**
* Print Preview the specified DOM window
*
* aThePrintOptions - Printer Settings for the print preview
* nsIWebProgressListener - is updated during the printpreview
* @return void
*/
void printPreview(in nsIPrintSettings aThePrintSettings,
in nsIWebProgressListener aWPListener);
/**
* Print Preview - Navigates within the window
*
* aNavType - navigation enum
* aPageNum - page num to navigate to when aNavType = ePrintPreviewGoToPageNum
* @return void
*/
void printPreviewNavigate(in short aNavType, in long aPageNum);
/**
* Cancel - Cancels the current print
* @return void
*/
void cancel();
/**
* Returns an array of the names of all documents names (Title or URL)
* and sub-documents. This will return a single item if the attr "isFramesetDocument" is false
* and may return any number of items is "isFramesetDocument" is true
*
* @param aCount - returns number of printers returned
* @param aResult - returns array of names
* @return void
*/
void enumerateDocumentNames(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult);
/**
* This exists PrintPreview mode and returns browser window to galley mode
* @return void
*/
void exitPrintPreview();
};