summaryrefslogtreecommitdiffstats
path: root/toolkit/components/browser/nsIPrintingPromptService.idl
blob: afc22a4f53152206b43b69d22c1854260817f714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Doc interface here */

#include "nsISupports.idl"
#include "nsIWebBrowserPrint.idl"
#include "nsIWebProgressListener.idl"
#include "nsIPrintProgressParams.idl"
#include "nsIPrintSettings.idl"
#include "nsIObserver.idl"

[scriptable, uuid(72006d06-a2a5-4250-ae92-04b2f0e2ab8d)]
interface nsIPrintingPromptService : nsISupports
{
   /**
   *  This service enables embedders to implement their own Print and Progress Dialogs.
   *  Each platform has a "base" or "basckstop" implementation of the service. The
   *  service is automatically registered at start up.
   *
   *  Historically, platform toolkits with native dialogs have implemented them in the GFX layer
   *  Usually they were displayed when a new DeviceContextSpec specific to that platform
   *  was created.
   *
   *  Windows: The GFX layer no longers supports default toolkit behavior for displaying the
   *           native Print Dialog.
   *           If an embedder implemented service returns any error code (other than NS_ERROR_ABORT)
   *           printing will terminate.
   *
   *           Returning NS_OK assumes that the PrintSettings object was correctly filled in and
   *           if it does not have valid fields for printer name, etc. it may also terminate.
   *
   *           Defaults for platform service:
   *             showPrintDialog           - displays a native dialog
   *             showPrintProgressDialog   - displays a XUL dialog
   *             showPageSetupDialog       - displays a XUL dialog
   *
   *           Summary for Windows Embedders:
   *             Stated once again: There is no "fallback" native platform support in GFX for the
   *             displaying of the native print dialog. The current default implementation for Windows
   *             display a native print dialog but a XUL-based progress dialog.
   *             If you wish to have a native progress dialog on Windows you will have to create and
   *             register your own service.
   *
   *             Note: The Windows version Mozilla implements this service which is
   *                   automatically built and registered for you. You can use it as an example.
   *                   It is located at "widget/windows/nsPrintDialogService.cpp". That service
   *                   is capable of displaying a native print dialog and a XUL progress dialog.
   *
   *             To fly your own dialog you may:
   *
   *              1) Implement this service to display at least the Print Dialog and a Print Progress Dialog
   *                 or you may implement just one of the dialogs and pass back NS_ERROR_NOT_IMPLEMENTED
   *                 for any of the others.
   *
   *              2) For the Print Dialog:
   *                 You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED.
   *                 You can then fly you own dialog and then properly fill in the PrintSettings object
   *                 before calling nsIWebBrowserPrint's Print method. If you stub out this service
   *                 you MUST set "printSilent" to true, if you do not, Printing will terminate and an
   *                 error dialog will be displayed.
   *
   *  Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog.
   *       If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog"
   *       The toolkit will display the native print dialog.
   *
   *       Mac OSX: showPrintDialog           - displays a native dialog
   *                showPrintProgressDialog   - not implemented (provided by OS)
   *                showPageSetupDialog       - displays a native dialog
   *
   *  GTK: There are no native dialog for GTK.
   *
   *       Defaults for platform service:
   *         showPrintDialog           - displays a native dialog
   *         showPrintProgressDialog   - displays a XUL dialog
   *         showPageSetupDialog       - displays a native dialog
   *
   */



  /**
   *  Show the Print Dialog
   *
   *  @param parent - a DOM windows the dialog will be parented to (required)
   *  @param webBrowserPrint - represents the document to be printed (required)
   *  @param printSettings - PrintSettings for print "job" (required)
   *
   */
  void showPrintDialog(in mozIDOMWindowProxy parent,
                       in nsIPrintSettings printSettings);

  /**
   *  Shows the print progress dialog
   *
   *  @param parent - a DOM windows the dialog will be parented to
   *  @param printSettings - PrintSettings for print "job"
   *  @param openDialogObserver - an observer that will be notifed when the dialog is opened
   *  @param isForPrinting - true - for printing, false for print preview
   *  @param webProgressListener - additional listener can be registered for progress notifications
   *  @param printProgressParams - parameter object for passing progress state
   *  @param notifyOnOpen - this indicates that the observer will be notified when the progress
   *                        dialog has been opened. If false is returned it means the observer
   *                        (usually the caller) shouldn't wait
   *                        For Print Preview Progress there is intermediate progress
   */
  void showPrintProgressDialog(in mozIDOMWindowProxy parent,
                               in nsIPrintSettings printSettings,
                               in nsIObserver openDialogObserver,
                               in boolean isForPrinting,
                               out nsIWebProgressListener webProgressListener,
                               out nsIPrintProgressParams printProgressParams,
                               out boolean notifyOnOpen);

  /**
   *  Shows the print page setup dialog
   *
   *  @param parent - a DOM windows the dialog will be parented to (required)
   *  @param printSettings - PrintSettings for page setup (required)
   */
  void showPageSetupDialog(in mozIDOMWindowProxy parent,
                           in nsIPrintSettings printSettings);

};

%{C++
// {260FEDC5-524D-4aa6-9A41-E829F4C78B92}
#define NS_PRINTINGPROMPTSERVICE_IID \
 {0x260fedc5, 0x524d, 0x4aa6, { 0x9a, 0x41, 0xe8, 0x29, 0xf4, 0xc7, 0x8b, 0x92}}
%}