pjs/gfx/idl/nsIPrintOptions.idl

305 строки
9.2 KiB
Plaintext

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Don Cone <dcone@netscape.com>
* Jessica Blanco <jblanco@us.ibm.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
#include "nsIPrintSettings.idl"
%{ C++
#include "nsFont.h"
%}
interface nsISimpleEnumerator;
/**
* Native types
*/
[ref] native nsNativeFontRef(nsFont);
[ref] native nsNativeStringRef(nsString);
/**
* Simplified graphics interface for JS rendering.
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(CAE87E20-479E-11d4-A856-00105A183419)]
interface nsIPrintOptions : nsISupports
{
/* Print Option Flags for Bit Field*/
const long kOptPrintOddPages = 0x00000001;
const long kOptPrintEvenPages = 0x00000002;
const long kPrintOptionsEnableSelectionRB = 0x00000004;
/* Print Range Enums */
const long kRangeAllPages = 0;
const long kRangeSpecifiedPageRange = 1;
const long kRangeSelection = 2;
const long kRangeFocusFrame = 3;
/* Justification Enums */
const long kJustLeft = 0;
const long kJustCenter = 1;
const long kJustRight = 2;
/**
* Page Size Constants (NOTE: These have been deprecated!);
*/
const short kLetterPaperSize = 0;
const short kLegalPaperSize = 1;
const short kExecutivePaperSize = 2;
const short kA4PaperSize = 3;
const short kA3PaperSize = 4;
/**
* FrameSet Default Type Constants
*/
const short kUseInternalDefault = 0;
const short kUseSettingWhenPossible = 1;
/**
* Page Size Type Constants
*/
const short kPaperSizeNativeData = 0;
const short kPaperSizeDefined = 1;
/**
* Page Size Unit Constants
*/
const short kPaperSizeInches = 0;
const short kPaperSizeMillimeters = 1;
/**
* Orientation Constants
*/
const short kPortraitOrientation = 0;
const short kLandscapeOrientation = 1;
/**
* Print Frame Constants
*/
const short kNoFrames = 0;
const short kFramesAsIs = 1;
const short kSelectedFrame = 2;
const short kEachFrameSep = 3;
/**
* How to Enable Frame Set Printing Constants
*/
const short kFrameEnableNone = 0;
const short kFrameEnableAll = 1;
const short kFrameEnableAsIsAndEach = 2;
/**
* Show Native Print Options dialog, this may not be supported on all platforms
*/
void ShowNativeDialog();
/**
* Set PrintOptions
*/
void SetPrintOptions(in PRInt32 aType, in PRBool aTurnOnOff);
/**
* Get PrintOptions
*/
PRBool GetPrintOptions(in PRInt32 aType);
/**
* Set PrintOptions Bit field
*/
PRInt32 GetPrintOptionsBits();
/**
* Read Prefs
*/
void ReadPrefs();
/**
* Write Prefs
*/
void WritePrefs();
/**
* Creates a new PrintSettnigs Object
* and initializes it from prefs
*/
nsIPrintSettings CreatePrintSettings();
/**
* Initialize the values in the PrintSettings from Prefs
*/
void InitPrintSettingsFromPrefs(in nsIPrintSettings aPO);
/**
* Data Members
*/
attribute long startPageRange;
attribute long endPageRange;
attribute double marginTop; /* these are in inches */
attribute double marginLeft;
attribute double marginBottom;
attribute double marginRight;
attribute double scaling; /* values 0.0 - 1.0 */
attribute boolean printBGColors; /* Print Background Colors */
attribute boolean printBGImages; /* Print Background Images */
attribute short printRange;
attribute wstring title;
attribute wstring docURL;
attribute wstring headerStrLeft;
attribute wstring headerStrCenter;
attribute wstring headerStrRight;
attribute wstring footerStrLeft;
attribute wstring footerStrCenter;
attribute wstring footerStrRight;
attribute short howToEnableFrameUI;
attribute boolean isCancelled;
attribute short printFrameTypeUsage; /* indicates whether to use the interal value or not*/
attribute short printFrameType;
attribute boolean printSilent; /* print without putting up the dialog */
attribute nsIPrintSettings printSettingsValues; /* used copy the values to/from the settings obj*/
attribute nsIPrintSettings printSettings; /* used to set and get the current object */
/* Additional XP Related */
attribute short paperSizeType; /* use native data or is defined here */
attribute short paperData; /* native data value */
attribute double paperWidth; /* width of the paper in inches or mm */
attribute double paperHeight; /* height of the paper in inches or mm */
attribute short paperSizeUnit; /* paper is in inches or mm */
attribute long paperSize; /* This has been deprecated */
attribute boolean printReversed;
attribute boolean printInColor; /* a false means grayscale */
attribute long orientation; /* see orientation consts */
attribute wstring printCommand;
attribute long numCopies;
attribute wstring printerName;
attribute boolean printToFile;
attribute wstring toFileName;
attribute long printPageDelay; /* in milliseconds */
/* No Script Methods */
[noscript] void SetFontNamePointSize(in nsNativeStringRef aName, in PRInt32 aPointSize);
[noscript] void SetMarginInTwips(in nsNativeMarginRef aMargin);
/* Purposely made this an "in" arg */
[noscript] void GetMarginInTwips(in nsNativeMarginRef aMargin);
[noscript] void SetDefaultFont(in nsNativeFontRef aMargin);
/* Purposely made this an "in" arg */
[noscript] void GetDefaultFont(in nsNativeFontRef aMargin);
[noscript] void GetPageSizeInTwips(out long aWidth, out long aHeight);
/**
* available Printers
*/
nsISimpleEnumerator availablePrinters ();
/**
* Indicates whether the list of printers contains the extended
* information. i.e. That there are "pairs" of values returned. Where the second
* value is either "FILE", "PRINTER", "BOTH"
*
*/
readonly attribute boolean isExtended;
/**
* display Printer Job Properties dialog
*/
void displayJobProperties (in wstring aPrinter, in nsIPrintSettings aPrintSettings, out boolean aDisplayed);
/**
* Native data constants
*/
const short kNativeDataPrintRecord = 0;
[noscript] voidPtr GetNativeData(in short aDataType);
};
[scriptable, uuid(a6cf9128-15b3-11d2-932e-00805f8add32)]
interface nsIPrinterEnumerator : nsISupports
{
/**
* Returns an array of the names of all installed printers.
*
* @param aCount returns number of printers returned
* @param aResult returns array of names
* @return void
*/
void enumeratePrinters(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult);
/**
* Returns an array of "pairs" of strings
* The first string in the pair is the printer name
* the second string in the pair is can be "FILE", "PRINTER", or "BOTH"
* which indicates whether the printer driver associated with this printer
* ALWAYS "spools" to a file or to a printer.
*
* If this type of information is not available, it should return zero items
*
* Note: On some platforms any given driveris able to spool to either
*
* @param aCount returns number of printers AND info strings returned
* i.e If there are 5 printers define the
* "count" returned will be 10
* @param aResult returns array of names
* @return void
*/
void enumeratePrintersExtended(out PRUint32 aCount,[retval, array, size_is(aCount)] out wstring aResult);
/* takes printer selected and will display job properties dlg for that printer
* returns true if dialog displays
*/
void displayPropertiesDlg(in wstring aPrinter, in nsIPrintSettings aPrintSettings);
};