|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsIDOMWindow; |
|
10 interface nsIPrintSettings; |
|
11 interface nsIWebProgressListener; |
|
12 |
|
13 /** |
|
14 * nsIWebBrowserPrint corresponds to the main interface |
|
15 * for printing an embedded Gecko web browser window/document |
|
16 */ |
|
17 [scriptable, uuid(9A7CA4B0-FBBA-11d4-A869-00105A183419)] |
|
18 interface nsIWebBrowserPrint : nsISupports |
|
19 { |
|
20 /** |
|
21 * PrintPreview Navigation Constants |
|
22 */ |
|
23 const short PRINTPREVIEW_GOTO_PAGENUM = 0; |
|
24 const short PRINTPREVIEW_PREV_PAGE = 1; |
|
25 const short PRINTPREVIEW_NEXT_PAGE = 2; |
|
26 const short PRINTPREVIEW_HOME = 3; |
|
27 const short PRINTPREVIEW_END = 4; |
|
28 |
|
29 /** |
|
30 * Returns a "global" PrintSettings object |
|
31 * Creates a new the first time, if one doesn't exist. |
|
32 * |
|
33 * Then returns the same object each time after that. |
|
34 * |
|
35 * Initializes the globalPrintSettings from the default printer |
|
36 */ |
|
37 readonly attribute nsIPrintSettings globalPrintSettings; |
|
38 |
|
39 /** |
|
40 * Returns a pointer to the PrintSettings object that |
|
41 * that was passed into either "print" or "print preview" |
|
42 * |
|
43 * This enables any consumers of the interface to have access |
|
44 * to the "current" PrintSetting at later points in the execution |
|
45 */ |
|
46 readonly attribute nsIPrintSettings currentPrintSettings; |
|
47 |
|
48 /** |
|
49 * Returns a pointer to the current child DOMWindow |
|
50 * that is being print previewed. (FrameSet Frames) |
|
51 * |
|
52 * Returns null if parent document is not a frameset or the entire FrameSet |
|
53 * document is being print previewed |
|
54 * |
|
55 * This enables any consumers of the interface to have access |
|
56 * to the "current" child DOMWindow at later points in the execution |
|
57 */ |
|
58 readonly attribute nsIDOMWindow currentChildDOMWindow; |
|
59 |
|
60 /** |
|
61 * Returns whether it is in Print mode |
|
62 */ |
|
63 readonly attribute boolean doingPrint; |
|
64 |
|
65 /** |
|
66 * Returns whether it is in Print Preview mode |
|
67 */ |
|
68 readonly attribute boolean doingPrintPreview; |
|
69 |
|
70 /** |
|
71 * This returns whether the current document is a frameset document |
|
72 */ |
|
73 readonly attribute boolean isFramesetDocument; |
|
74 |
|
75 /** |
|
76 * This returns whether the current document is a frameset document |
|
77 */ |
|
78 readonly attribute boolean isFramesetFrameSelected; |
|
79 |
|
80 /** |
|
81 * This returns whether there is an IFrame selected |
|
82 */ |
|
83 readonly attribute boolean isIFrameSelected; |
|
84 |
|
85 /** |
|
86 * This returns whether there is a "range" selection |
|
87 */ |
|
88 readonly attribute boolean isRangeSelection; |
|
89 |
|
90 /** |
|
91 * This returns the total number of pages for the Print Preview |
|
92 */ |
|
93 readonly attribute long printPreviewNumPages; |
|
94 |
|
95 /** |
|
96 * Print the specified DOM window |
|
97 * |
|
98 * @param aThePrintSettings - Printer Settings for the print job, if aThePrintSettings is null |
|
99 * then the global PS will be used. |
|
100 * @param aWPListener - is updated during the print |
|
101 * @return void |
|
102 */ |
|
103 void print(in nsIPrintSettings aThePrintSettings, |
|
104 in nsIWebProgressListener aWPListener); |
|
105 |
|
106 /** |
|
107 * Print Preview the specified DOM window |
|
108 * |
|
109 * @param aThePrintSettings - Printer Settings for the print preview, if aThePrintSettings is null |
|
110 * then the global PS will be used. |
|
111 * @param aChildDOMWin - DOM Window to be print previewed. |
|
112 * @param aWPListener - is updated during the printpreview |
|
113 * @return void |
|
114 */ |
|
115 void printPreview(in nsIPrintSettings aThePrintSettings, |
|
116 in nsIDOMWindow aChildDOMWin, |
|
117 in nsIWebProgressListener aWPListener); |
|
118 |
|
119 /** |
|
120 * Print Preview - Navigates within the window |
|
121 * |
|
122 * @param aNavType - navigation enum |
|
123 * @param aPageNum - page num to navigate to when aNavType = ePrintPreviewGoToPageNum |
|
124 * @return void |
|
125 */ |
|
126 void printPreviewNavigate(in short aNavType, in long aPageNum); |
|
127 |
|
128 /** |
|
129 * Cancels the current print |
|
130 * @return void |
|
131 */ |
|
132 void cancel(); |
|
133 |
|
134 /** |
|
135 * Returns an array of the names of all documents names (Title or URL) |
|
136 * and sub-documents. This will return a single item if the attr "isFramesetDocument" is false |
|
137 * and may return any number of items is "isFramesetDocument" is true |
|
138 * |
|
139 * @param aCount - returns number of printers returned |
|
140 * @param aResult - returns array of names |
|
141 * @return void |
|
142 */ |
|
143 void enumerateDocumentNames(out uint32_t aCount,[retval, array, size_is(aCount)] out wstring aResult); |
|
144 |
|
145 /** |
|
146 * This exists PrintPreview mode and returns browser window to galley mode |
|
147 * @return void |
|
148 */ |
|
149 void exitPrintPreview(); |
|
150 |
|
151 }; |
|
152 |