1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef nsIDeviceContextSpec_h___
39 : #define nsIDeviceContextSpec_h___
40 :
41 : #include "nsISupports.h"
42 :
43 : class nsIWidget;
44 : class nsIPrintSettings;
45 : class gfxASurface;
46 :
47 : #define NS_IDEVICE_CONTEXT_SPEC_IID \
48 : { 0x205c614f, 0x39f8, 0x42e1, \
49 : { 0x92, 0x53, 0x04, 0x9b, 0x48, 0xc3, 0xcb, 0xd8 } }
50 :
51 : class nsIDeviceContextSpec : public nsISupports
52 0 : {
53 : public:
54 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDEVICE_CONTEXT_SPEC_IID)
55 :
56 : /**
57 : * Initialize the device context spec.
58 : * @param aWidget A widget a dialog can be hosted in
59 : * @param aPrintSettings Print settings for the print operation
60 : * @param aIsPrintPreview True if creating Spec for PrintPreview
61 : * @return NS_OK or a suitable error code.
62 : */
63 : NS_IMETHOD Init(nsIWidget *aWidget,
64 : nsIPrintSettings* aPrintSettings,
65 : bool aIsPrintPreview) = 0;
66 :
67 : NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface) = 0;
68 :
69 : NS_IMETHOD BeginDocument(PRUnichar* aTitle,
70 : PRUnichar* aPrintToFileName,
71 : PRInt32 aStartPage,
72 : PRInt32 aEndPage) = 0;
73 :
74 : NS_IMETHOD EndDocument() = 0;
75 : NS_IMETHOD BeginPage() = 0;
76 : NS_IMETHOD EndPage() = 0;
77 : };
78 :
79 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextSpec,
80 : NS_IDEVICE_CONTEXT_SPEC_IID)
81 :
82 : /* error codes for printer device contexts */
83 : #define NS_ERROR_GFX_PRINTER_BASE (1) /* adjustable :-) */
84 : /* Unix: print command (lp/lpr) not found */
85 : #define NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND \
86 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+1)
87 : /* Unix: print command returned an error */
88 : #define NS_ERROR_GFX_PRINTER_CMD_FAILURE \
89 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+2)
90 : /* no printer available (e.g. cannot find _any_ printer) */
91 : #define NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE \
92 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+3)
93 : /* _specified_ (by name) printer not found */
94 : #define NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND \
95 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+4)
96 : /* access to printer denied */
97 : #define NS_ERROR_GFX_PRINTER_ACCESS_DENIED \
98 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+5)
99 : /* invalid printer attribute (for example: unsupported paper size etc.) */
100 : #define NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE \
101 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+6)
102 : /* printer not "ready" (offline ?) */
103 : #define NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY \
104 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+8)
105 : /* printer out of paper */
106 : #define NS_ERROR_GFX_PRINTER_OUT_OF_PAPER \
107 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+9)
108 : /* generic printer I/O error */
109 : #define NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR \
110 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+10)
111 : /* print-to-file: could not open output file */
112 : #define NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE \
113 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+11)
114 : /* print-to-file: I/O error while printing to file */
115 : #define NS_ERROR_GFX_PRINTER_FILE_IO_ERROR \
116 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+12)
117 : /* print preview: needs at least one printer */
118 : #define NS_ERROR_GFX_PRINTER_PRINTPREVIEW \
119 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+13)
120 : /* print: starting document */
121 : #define NS_ERROR_GFX_PRINTER_STARTDOC \
122 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+14)
123 : /* print: ending document */
124 : #define NS_ERROR_GFX_PRINTER_ENDDOC \
125 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+15)
126 : /* print: starting page */
127 : #define NS_ERROR_GFX_PRINTER_STARTPAGE \
128 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+16)
129 : /* print: ending page */
130 : #define NS_ERROR_GFX_PRINTER_ENDPAGE \
131 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+17)
132 : /* print: print while in print preview */
133 : #define NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW \
134 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+18)
135 : /* requested page size not supported by printer */
136 : #define NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED \
137 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+19)
138 : /* requested page orientation not supported */
139 : #define NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED \
140 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+20)
141 : /* requested colorspace not supported (like printing "color" on a
142 : "grayscale"-only printer) */
143 : #define NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED \
144 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+21)
145 : /* too many copies requested */
146 : #define NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES \
147 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+22)
148 : /* driver configuration error */
149 : #define NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR \
150 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+23)
151 : /* The document is still being loaded, can't Print Preview */
152 : #define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP \
153 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24)
154 : /* The document was asked to be destroyed while we were preparing printing */
155 : #define NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED \
156 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+25)
157 : /* Cannot Print or Print Preview XUL Documents */
158 : #define NS_ERROR_GFX_PRINTER_NO_XUL \
159 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
160 : /* The toolkit no longer supports the Print Dialog (for embedders) */
161 : #define NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT \
162 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
163 : /* The was wasn't any Print Prompt service registered (this shouldn't happen) */
164 : #define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \
165 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28)
166 : /* requested plex mode not supported by printer */
167 : #define NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED \
168 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
169 : /* The document is still being loaded */
170 : #define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY \
171 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
172 : /* Printing is not implemented */
173 : #define NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED \
174 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+31)
175 : /* Cannot load the matching print module */
176 : #define NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE \
177 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+32)
178 : /* requested resolution/quality mode not supported by printer */
179 : #define NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED \
180 : NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+33)
181 :
182 : #endif
|