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: /** michael@0: * This is the printing prompt interface which can be used without knowlege of a michael@0: * parent window. The parentage is hidden by the GetInterface though michael@0: * which it is gotten. This interface is identical to nsIPintingPromptService michael@0: * but without the parent nsIDOMWindow parameter. See nsIPrintingPromptService michael@0: * for all documentation. michael@0: */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsIWebBrowserPrint.idl" michael@0: #include "nsIWebProgressListener.idl" michael@0: #include "nsIPrintSettings.idl" michael@0: #include "nsIPrintProgressParams.idl" michael@0: #include "nsIObserver.idl" michael@0: michael@0: [scriptable, uuid(44E314CA-75B1-4f3d-9553-9B3507912108)] michael@0: interface nsIPrintingPrompt : nsISupports michael@0: { michael@0: /** michael@0: * This service enables embedders to implement their own Print and Progress Dialogs. michael@0: * Each platform has a "base" or "basckstop" implementation of the service. The michael@0: * service is automatically registered at start up. michael@0: * michael@0: * Historically, platform toolkits with native dialogs have implemented them in the GFX layer michael@0: * Usually they were displayed when a new DeviceContextSpec specific to that platform michael@0: * was created. michael@0: * michael@0: * Windows: The GFX layer no longers supports default toolkit behavior for displaying the michael@0: * native Print Dialog. michael@0: * If an embedder implemented service returns any error code (other than NS_ERROR_ABORT) michael@0: * printing will terminate. michael@0: * michael@0: * Returning NS_OK assumes that the PrintSettings object was correctly filled in and michael@0: * if it does not have valid fields for printer name, etc. it may also terminate. michael@0: * michael@0: * Defaults for platform service: michael@0: * showPrintDialog - displays a native dialog michael@0: * showPageSetup - displays a XUL dialog michael@0: * showProgress - displays a XUL dialog michael@0: * showPrinterProperties - n/a michael@0: * michael@0: * Summary for Windows Embedders: michael@0: * Stated once again: There is no "fallback" native platform support in GFX for the michael@0: * displaying of the native print dialog. The current default implementation for Windows michael@0: * display a native print dialog but a XUL-based progress dialog. michael@0: * If you wish to have a native progress dialog on Windows you will have to create and michael@0: * register your own service. michael@0: * michael@0: * Note: The Windows version Mozilla implements this service which is michael@0: * automatically built and registered for you. You can use it as an example. michael@0: * It is located at "mozilla/embedding/components/printingui/src/win". That service michael@0: * is capable of displaying a native print dialog and a XUL progress dialog. michael@0: * michael@0: * To fly your own dialog you may: michael@0: * michael@0: * 1) Implement this service to display at least the Print Dialog and a Print Progress Dialog michael@0: * or you may implement just one of the dialogs and pass back NS_ERROR_NOT_IMPLEMENTED michael@0: * for any of the others. michael@0: * michael@0: * 2) For the Print Dialog: michael@0: * You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED. michael@0: * You can then fly you own dialog and then properly fill in the PrintSettings object michael@0: * before calling nsIWebBrowserPrint's Print method. If you stub out this service michael@0: * you MUST set "printSilent" to true, if you do not, Printing will terminate and an michael@0: * error dialog will be displayed. michael@0: * michael@0: * Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog. michael@0: * If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog" michael@0: * The toolkit will display the native print dialog. michael@0: * michael@0: * Defaults for platform service: michael@0: * Mac OS9: showPrintDialog - displays a native dialog michael@0: * showPageSetup - displays a native dialog michael@0: * showProgress - displays a XUL dialog michael@0: * showPrinterProperties - n/a michael@0: * michael@0: * Mac OSX: showPrintDialog - displays a native dialog michael@0: * showPageSetup - displays a native dialog michael@0: * showProgress - not implemented (provided by OS) michael@0: * showPrinterProperties - n/a michael@0: * michael@0: * GTK: There are no native dialog for GTK. michael@0: * michael@0: * Defaults for platform service: michael@0: * showPrintDialog - displays a XUL dialog michael@0: * showPageSetup - displays a XUL dialog michael@0: * showProgress - displays a XUL dialog michael@0: * showPrinterProperties - displays a XUL dialog michael@0: * michael@0: */ michael@0: michael@0: michael@0: /** michael@0: * Show the Print Dialog michael@0: * michael@0: * @param webBrowserPrint - represents the document to be printed michael@0: * @param printSettings - PrintSettings for print "job" michael@0: * michael@0: */ michael@0: void showPrintDialog(in nsIWebBrowserPrint webBrowserPrint, michael@0: in nsIPrintSettings printSettings); michael@0: michael@0: /** michael@0: * Shows the print progress dialog michael@0: * michael@0: * @param webBrowserPrint - represents the document to be printed michael@0: * @param printSettings - PrintSettings for print "job" michael@0: * @param openDialogObserver - an observer that will be notifed when the dialog is opened michael@0: * @param isForPrinting - true - for printing, false for print preview michael@0: * @param webProgressListener - additional listener can be registered for progress notifications michael@0: * @param printProgressParams - parameter object for passing progress state michael@0: * @param notifyOnOpen - this indicates that the observer will be notified when the progress michael@0: * dialog has been opened. If false is returned it means the observer michael@0: * (usually the caller) shouldn't wait michael@0: * For Print Preview Progress there is intermediate progress michael@0: */ michael@0: void showProgress(in nsIWebBrowserPrint webBrowserPrint, michael@0: in nsIPrintSettings printSettings, michael@0: in nsIObserver openDialogObserver, michael@0: in boolean isForPrinting, michael@0: out nsIWebProgressListener webProgressListener, michael@0: out nsIPrintProgressParams printProgressParams, michael@0: out boolean notifyOnOpen); michael@0: michael@0: /** michael@0: * Shows the print progress dialog michael@0: * michael@0: * @param printSettings - PrintSettings for page setup (required) michael@0: * @param aObs - An observer to know if the contents of the Print Settings michael@0: * object has changed while the dialog is being shown. michael@0: * For example, some platforms may implement an "Apply" button (not required) michael@0: */ michael@0: void showPageSetup(in nsIPrintSettings printSettings, in nsIObserver aObs); michael@0: michael@0: /** michael@0: * Sometimes platforms need to bring up a special properties dialog for showing michael@0: * print specific properties. Although the PrintSettings has a place to set the michael@0: * printer name, here is is an argument to be clear as to what printer is being michael@0: * asked to have the properties set for it. The Printer name in the PS is ignored. michael@0: * michael@0: * @param printerName - name of printer (required) michael@0: * @param printSettings - PrintSettings for page setup (required) michael@0: */ michael@0: void showPrinterProperties(in wstring printerName, michael@0: in nsIPrintSettings printSettings); michael@0: };