/* -*- 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>
 */

#include "nsISupports.idl"

interface nsIDOMWindow;
interface nsIPrintSettings;
interface nsIWebProgressListener;

/**
 * The nsIWebBrowserPrint
 */
[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 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);

  /**
   * Use this to Set and Get the current values of the last print invocation
   * of "print" or "printpreview". The print engine always sets the PrintSettings
   * from whoever is printing (or printpreview'ing) into the global settings.
   * 
   * It is the responsibilitity of those implementing page setup
   * to set their setting into the global settings if they want those new value
   * to available to other callers of "globalPrintSettingsValues"
   */
  attribute nsIPrintSettings globalPrintSettingsValues;

  /**
   * This returns whether the current document is a frameset document
   */
  readonly attribute boolean isFramesetDocument;

  /**
   * 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
   * @return void
   */
  void printPreview(in nsIPrintSettings aThePrintSettings);

  /**
   * 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();

};

