xref: /haiku/headers/libs/print/libprint/JobData.h (revision f412257ccbb73bb17f039a1be364b73d9e6df481)
1 /*
2  * JobData.h
3  * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
4  */
5 
6 #ifndef __JOBDATA_H
7 #define __JOBDATA_H
8 
9 #include <SupportDefs.h>
10 #include <GraphicsDefs.h>
11 #include <Rect.h>
12 
13 #include "Halftone.h"
14 #include "MarginView.h" // for MarginUnit
15 
16 class BMessage;
17 class PrinterCap;
18 
19 class JobData {
20 public:
21 	enum Orientation {
22 		kPortrait,
23 		kLandscape
24 	};
25 
26 	enum Paper {
27 		kLetter = 1,            //   1  Letter 8 1/2 x 11 in
28 		kLetterSmall,           //   2  Letter Small 8 1/2 x 11 in
29 		kTabloid,               //   3  Tabloid 11 x 17 in
30 		kLedger,                //   4  Ledger 17 x 11 in
31 		kLegal,                 //   5  Legal 8 1/2 x 14 in
32 		kStatement,             //   6  Statement 5 1/2 x 8 1/2 in
33 		kExecutive,             //   7  Executive 7 1/4 x 10 1/2 in
34 		kA3,                    //   8  A3 297 x 420 mm
35 		kA4,                    //   9  A4 210 x 297 mm
36 		kA4Small,               //  10  A4 Small 210 x 297 mm
37 		kA5,                    //  11  A5 148 x 210 mm
38 		kB4,                    //  12  B4 (JIS) 250 x 354
39 		kB5,                    //  13  B5 (JIS) 182 x 257 mm
40 		kFolio,                 //  14  Folio 8 1/2 x 13 in
41 		kQuarto,                //  15  Quarto 215 x 275 mm
42 		k10X14,                 //  16  10x14 in
43 		k11X17,                 //  17  11x17 in
44 		kNote,                  //  18  Note 8 1/2 x 11 in
45 		kEnv9,                  //  19  Envelope #9 3 7/8 x 8 7/8
46 		kEnv10,                 //  20  Envelope #10 4 1/8 x 9 1/2
47 		kEnv11,                 //  21  Envelope #11 4 1/2 x 10 3/8
48 		kEnv12,                 //  22  Envelope #12 4 \276 x 11
49 		kEnv14,                 //  23  Envelope #14 5 x 11 1/2
50 		kCSheet,                //  24  C size sheet
51 		kDSheet,                //  25  D size sheet
52 		kESheet,                //  26  E size sheet
53 		kEnvDL,                 //  27  Envelope DL 110 x 220mm
54 		kEnvC5,                 //  28  Envelope C5 162 x 229 mm
55 		kEnvC3,                 //  29  Envelope C3  324 x 458 mm
56 		kEnvC4,                 //  30  Envelope C4  229 x 324 mm
57 		kEnvC6,                 //  31  Envelope C6  114 x 162 mm
58 		kEnvC65,                //  32  Envelope C65 114 x 229 mm
59 		kEnvB4,                 //  33  Envelope B4  250 x 353 mm
60 		kEnvB5,                 //  34  Envelope B5  176 x 250 mm
61 		kEnvB6,                 //  35  Envelope B6  176 x 125 mm
62 		kEnvItaly,              //  36  Envelope 110 x 230 mm
63 		kEnvMonarch,            //  37  Envelope Monarch 3.875 x 7.5 in
64 		kEnvPersonal,           //  38  6 3/4 Envelope 3 5/8 x 6 1/2 in
65 		kFanFoldUS,             //  39  US Std Fanfold 14 7/8 x 11 in
66 		kFanFoldStdGerman,      //  40  German Std Fanfold 8 1/2 x 12 in
67 		kFanFoldLglGerman,      //  41  German Legal Fanfold 8 1/2 x 13 in
68 		kIsoB4,                 //  42  B4 (ISO) 250 x 353 mm
69 		kJapanesePostcard,      //  43  Japanese Postcard 100 x 148 mm
70 		k9X11,                  //  44  9 x 11 in
71 		k10X11,                 //  45  10 x 11 in
72 		k15X11,                 //  46  15 x 11 in
73 		kEnvInvite,             //  47  Envelope Invite 220 x 220 mm
74 		kReserved48,            //  48  RESERVED--DO NOT USE
75 		kReserved49,            //  49  RESERVED--DO NOT USE
76 		kLetterExtra,	        //  50  Letter Extra 9 \275 x 12 in
77 		kLegalExtra, 	        //  51  Legal Extra 9 \275 x 15 in
78 		kTabloidExtra,	        //  52  Tabloid Extra 11.69 x 18 in
79 		kA4Extra,     	        //  53  A4 Extra 9.27 x 12.69 in
80 		kLetterTransverse,      //  54  Letter Transverse 8 \275 x 11 in
81 		kA4Transverse,          //  55  A4 Transverse 210 x 297 mm
82 		kLetterExtraTransverse, //  56  Letter Extra Transverse 9\275 x 12 in
83 		kAPlus,                 //  57  SuperA/SuperA/A4 227 x 356 mm
84 		kBPlus,                 //  58  SuperB/SuperB/A3 305 x 487 mm
85 		kLetterPlus,            //  59  Letter Plus 8.5 x 12.69 in
86 		kA4Plus,                //  60  A4 Plus 210 x 330 mm
87 		kA5Transverse,          //  61  A5 Transverse 148 x 210 mm
88 		kB5Transverse,          //  62  B5 (JIS) Transverse 182 x 257 mm
89 		kA3Extra,               //  63  A3 Extra 322 x 445 mm
90 		kA5Extra,               //  64  A5 Extra 174 x 235 mm
91 		kB5Extra,               //  65  B5 (ISO) Extra 201 x 276 mm
92 		kA2,                    //  66  A2 420 x 594 mm
93 		kA3Transverse,          //  67  A3 Transverse 297 x 420 mm
94 		kA3ExtraTransverse,     //  68  A3 Extra Transverse 322 x 445 mm
95 		kDBLJapanesePostcard,   //  69  Japanese Double Postcard 200 x 148 mm
96 		kA6,                    //  70  A6 105 x 148 mm
97 		kJEnvKaku2,             //  71  Japanese Envelope Kaku #2
98 		kJEnvKaku3,             //  72  Japanese Envelope Kaku #3
99 		kJEnvChou3,             //  73  Japanese Envelope Chou #3
100 		kJEnvChou4,             //  74  Japanese Envelope Chou #4
101 		kLetterRotated,         //  75  Letter Rotated 11 x 8 1/2 11 in
102 		kA3Rotated,             //  76  A3 Rotated 420 x 297 mm
103 		kA4Rotated,             //  77  A4 Rotated 297 x 210 mm
104 		kA5Rotated,             //  78  A5 Rotated 210 x 148 mm
105 		kB4JISRotated,          //  79  B4 (JIS) Rotated 364 x 257 mm
106 		kB5JISRotated,          //  80  B5 (JIS) Rotated 257 x 182 mm
107 		kJapanesePostcardRotated, //  81 Japanese Postcard Rotated 148 x 100 mm
108 		kDBLJapanesePostcardRotated, // 82 Double Japanese Postcard Rotated 148 x 200 mm
109 		kA6Rotated,             //  83  A6 Rotated 148 x 105 mm
110 		kJEnvKaku2Rotated,      //  84  Japanese Envelope Kaku #2 Rotated
111 		kJEnvKaku3Rotated,      //  85  Japanese Envelope Kaku #3 Rotated
112 		kJEnvChou3Rotated,      //  86  Japanese Envelope Chou #3 Rotated
113 		kJEnvChou4Rotated,      //  87  Japanese Envelope Chou #4 Rotated
114 		kB6JIS,                 //  88  B6 (JIS) 128 x 182 mm
115 		kB6JISRotated,          //  89  B6 (JIS) Rotated 182 x 128 mm
116 		k12X11,                 //  90  12 x 11 in
117 		kJEnvYou4,              //  91  Japanese Envelope You #4
118 		kJEnvYou4Rotated,       //  92  Japanese Envelope You #4 Rotated
119 		kP16K,                  //  93  PRC 16K 146 x 215 mm
120 		kP32K,                  //  94  PRC 32K 97 x 151 mm
121 		kP32KBig,               //  95  PRC 32K(Big) 97 x 151 mm
122 		kPEnv1,                 //  96  PRC Envelope #1 102 x 165 mm
123 		kPEnv2,                 //  97  PRC Envelope #2 102 x 176 mm
124 		kPEnv3,                 //  98  PRC Envelope #3 125 x 176 mm
125 		kPEnv4,                 //  99  PRC Envelope #4 110 x 208 mm
126 		kPEnv5,                 // 100  PRC Envelope #5 110 x 220 mm
127 		kPEnv6,                 // 101  PRC Envelope #6 120 x 230 mm
128 		kPEnv7,                 // 102  PRC Envelope #7 160 x 230 mm
129 		kPEnv8,                 // 103  PRC Envelope #8 120 x 309 mm
130 		kPEnv9,                 // 104  PRC Envelope #9 229 x 324 mm
131 		kPEnv10,                // 105  PRC Envelope #10 324 x 458 mm
132 		kP16KRotated,           // 106  PRC 16K Rotated
133 		kP32KRotated,           // 107  PRC 32K Rotated
134 		kP32KBIGRotated,        // 108  PRC 32K(Big) Rotated
135 		kPEnv1Rotated,          // 109  PRC Envelope #1 Rotated 165 x 102 mm
136 		kPEnv2Rotated,          // 110  PRC Envelope #2 Rotated 176 x 102 mm
137 		kPEnv3Rotated,          // 111  PRC Envelope #3 Rotated 176 x 125 mm
138 		kPEnv4Rotated,          // 112  PRC Envelope #4 Rotated 208 x 110 mm
139 		kPEnv5Rotated,          // 113  PRC Envelope #5 Rotated 220 x 110 mm
140 		kPEnv6Rotated,          // 114  PRC Envelope #6 Rotated 230 x 120 mm
141 		kPEnv7Rotated,          // 115  PRC Envelope #7 Rotated 230 x 160 mm
142 		kPEnv8Rotated,          // 116  PRC Envelope #8 Rotated 309 x 120 mm
143 		kPEnv9Rotated,          // 117  PRC Envelope #9 Rotated 324 x 229 mm
144 		kPEnv10Rotated,         // 118  PRC Envelope #10 Rotated 458 x 324 mm
145 		kUserDefined = 256
146 	};
147 
148 	enum PaperSource {
149 		kAuto,          // 7	o
150 		kManual,        // 4	o
151 		kUpper,         // 1	o
152 		kMiddle,        // 3	o
153 		kLower,         // 2	o
154 //		kOnlyOne,       // 1	x
155 //		kEnvelope,      // 5	o
156 //		kEnvManual,     // 6	x
157 //		kTractor,       // 8	x
158 //		kSmallFmt,      // 9	x
159 //		kLargeFmt,      // 10	x
160 //		kLargeCapacity, // 11	x
161 //		kCassette,      // 14	x
162 //		kFormSource,    // 15	x
163 		kCassette1 = 21,
164 		kCassette2,
165 		kCassette3,
166 		kCassette4,
167 		kCassette5,
168 		kCassette6,
169 		kCassette7,
170 		kCassette8,
171 		kCassette9,
172 		kUser = 256     // device specific bins start here
173 	};
174 
175 	enum PrintStyle {
176 		kSimplex,
177 		kDuplex,
178 		kBooklet
179 	};
180 
181 	enum BindingLocation {
182 		kLongEdgeLeft,
183 		kLongEdgeRight,
184 		kShortEdgeTop,
185 		kShortEdgeBottom,
186 		kLongEdge  = kLongEdgeLeft,
187 		kShortEdge = kShortEdgeTop
188 	};
189 
190 	enum PageOrder {
191 		kAcrossFromLeft,
192 		kDownFromLeft,
193 		kAcrossFromRight,
194 		kDownFromRight,
195 		kLeftToRight = kAcrossFromLeft,
196 		kRightToLeft = kAcrossFromRight
197 	};
198 
199 /*
200 	enum Quality {
201 		kDraft  = -1,
202 		kLow    = -2,
203 		kMedium = -3,
204 		kHigh   = -4
205 	};
206 */
207 	enum Color {
208 		kMonochrome = 1,
209 		kColor,
210 		// Some PCL6 printers do not support compressed data
211 		// in color mode.
212 		kColorCompressionDisabled
213 	};
214 
215 	enum Settings {
216 		kPageSettings,
217 		kJobSettings
218 	};
219 
220 	enum PageSelection {
221 		kAllPages,
222 		kOddNumberedPages,
223 		kEvenNumberedPages
224 	};
225 
226 private:
227 	bool        fShowPreview;
228 	Paper       fPaper;
229 	int32       fResolutionID;
230 	int32       fXRes;
231 	int32       fYRes;
232 	Orientation fOrientation;
233 	float       fScaling;
234 	BRect       fPaperRect;
235 	BRect       fScaledPaperRect;
236 	BRect       fPrintableRect;
237 	BRect       fScaledPrintableRect;
238 	BRect       fPhysicalRect;
239 	BRect       fScaledPhysicalRect;
240 	int32       fNup;
241 	int32       fFirstPage;
242 	int32       fLastPage;
243 	float       fGamma;      // 1 identiy, < 1 brigther, > 1 darker
244 	float       fInkDensity; // [0, 255] lower means higher density
245 	PaperSource fPaperSource;
246 	int32       fCopies;
247 	bool        fCollate;
248 	bool        fReverse;
249 	PrintStyle  fPrintStyle;
250 	BindingLocation fBindingLocation;
251 	PageOrder   fPageOrder;
252 	Settings    fSettings;
253 	BMessage    *fMsg;
254 	Color       fColor;
255 	Halftone::DitherType fDitherType;
256 	PageSelection        fPageSelection;
257 	MarginUnit  fMarginUnit;
258 
259 public:
260 	JobData(BMessage *msg, const PrinterCap *cap, Settings settings);
261 	~JobData();
262 
263 	JobData(const JobData &job_data);
264 	JobData &operator = (const JobData &job_data);
265 
266 	void load(BMessage *msg, const PrinterCap *cap, Settings settings);
267 	void save(BMessage *msg = NULL);
268 
269 	bool getShowPreview() const { return fShowPreview; }
270 	void setShowPreview(bool showPreview) { fShowPreview = showPreview; }
271 
272 	Paper getPaper() const { return fPaper; }
273 	void  setPaper(Paper paper) { fPaper = paper; }
274 
275 	int32 getResolutionID() const { return fResolutionID; }
276 	void setResolutionID(int32 resolution) { fResolutionID = resolution; }
277 
278 	int32 getXres() const { return fXRes; }
279 	void  setXres(int32 xres) { fXRes = xres; }
280 
281 	int32 getYres() const { return fYRes; }
282 	void  setYres(int32 yres) { fYRes = yres; };
283 
284 	Orientation getOrientation() const { return fOrientation; }
285 	void  setOrientation(Orientation orientation) { fOrientation = orientation; }
286 
287 	float getScaling() const { return fScaling; }
288 	void  setScaling(float scaling) { fScaling = scaling; }
289 
290 	const BRect &getPaperRect() const { return fPaperRect; }
291 	void  setPaperRect(const BRect &paper_rect) { fPaperRect = paper_rect; }
292 
293 	const BRect &getScaledPaperRect() const { return fScaledPaperRect; }
294 	void  setScaledPaperRect(const BRect &paper_rect) { fScaledPaperRect = paper_rect; }
295 
296 	const BRect &getPrintableRect() const { return fPrintableRect; }
297 	void  setPrintableRect(const BRect &printable_rect) { fPrintableRect = printable_rect; }
298 
299 	const BRect &getScaledPrintableRect() const { return fScaledPrintableRect; }
300 	void  setScaledPrintableRect(const BRect &printable_rect) { fScaledPrintableRect = printable_rect; }
301 
302 	const BRect &getPhysicalRect() const { return fPhysicalRect; }
303 	void  setPhysicalRect(const BRect &Physical_rect) { fPhysicalRect = Physical_rect; }
304 
305 	const BRect &getScaledPhysicalRect() const { return fScaledPhysicalRect; }
306 	void  setScaledPhysicalRect(const BRect &Physical_rect) { fScaledPhysicalRect = Physical_rect; }
307 
308 	int32 getNup() const { return fNup; }
309 	void  setNup(int32 nup) { fNup = nup; }
310 
311 	bool getReverse() const { return fReverse; }
312 	void  setReverse(bool reverse) { fReverse = reverse; }
313 
314 	int32 getFirstPage() const { return fFirstPage; }
315 	void  setFirstPage(int32 first_page) { fFirstPage = first_page; }
316 
317 	int32 getLastPage() const { return fLastPage; }
318 	void  setLastPage(int32 last_page) { fLastPage = last_page; }
319 
320 	// libprint supports only B_RGB32
321 	color_space getSurfaceType() const { return B_RGB32; }
322 
323 	float getGamma() const { return fGamma; }
324 	void setGamma(float gamma) { fGamma = gamma; }
325 
326 	float getInkDensity() const { return fInkDensity; }
327 	void setInkDensity(float inkDensity) { fInkDensity = inkDensity; }
328 
329 	PaperSource getPaperSource() const { return fPaperSource; }
330 	void setPaperSource(PaperSource paper_source) { fPaperSource = paper_source; };
331 
332 	int32 getCopies() const { return fCopies; }
333 	void  setCopies(int32 copies) { fCopies = copies; }
334 
335 	bool getCollate() const { return fCollate; }
336 	void setCollate(bool collate) { fCollate = collate; }
337 
338 	PrintStyle getPrintStyle() const { return fPrintStyle; }
339 	void setPrintStyle(PrintStyle print_style) { fPrintStyle = print_style; }
340 
341 	BindingLocation getBindingLocation() const { return fBindingLocation; }
342 	void setBindingLocation(BindingLocation binding_location) { fBindingLocation = binding_location; }
343 
344 	PageOrder getPageOrder() const { return fPageOrder; }
345 	void setPageOrder(PageOrder page_order) { fPageOrder = page_order; }
346 
347 	Color getColor() const { return fColor; }
348 	void setColor(Color color) { fColor = color; }
349 
350 	Halftone::DitherType getDitherType() const { return fDitherType; }
351 	void setDitherType(Halftone::DitherType dither_type) { fDitherType = dither_type; }
352 
353 	PageSelection getPageSelection() const { return fPageSelection; }
354 	void setPageSelection(PageSelection pageSelection) { fPageSelection = pageSelection; }
355 
356 	MarginUnit getMarginUnit() const { return fMarginUnit; }
357 	void setMarginUnit(MarginUnit marginUnit) { fMarginUnit = marginUnit; }
358 };
359 
360 #endif	/* __JOBDATA_H */
361