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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_
#define COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_
#include <string>
#include "base/logging.h"
#include "components/cloud_devices/description_items.h"
// Defines printer options, CDD and CJT items.
// https://developers.google.com/cloud-print/docs/cdd
namespace cloud_devices {
namespace printer {
typedef std::string ContentType;
enum ColorType {
STANDARD_COLOR,
STANDARD_MONOCHROME,
CUSTOM_COLOR,
CUSTOM_MONOCHROME,
AUTO_COLOR,
};
struct Color {
Color();
explicit Color(ColorType type);
bool IsValid() const;
bool operator==(const Color& other) const;
bool operator!=(const Color& other) const {
return !(*this == other);
}
ColorType type;
std::string vendor_id;
std::string custom_display_name;
};
enum DuplexType {
NO_DUPLEX,
LONG_EDGE,
SHORT_EDGE,
};
enum OrientationType {
PORTRAIT,
LANDSCAPE,
AUTO_ORIENTATION,
};
enum MarginsType {
NO_MARGINS,
STANDARD_MARGINS,
CUSTOM_MARGINS,
};
struct Margins {
Margins();
Margins(MarginsType type,
int32 top_um,
int32 right_um,
int32 bottom_um,
int32 left_um);
bool operator==(const Margins& other) const;
bool operator!=(const Margins& other) const {
return !(*this == other);
}
MarginsType type;
int32 top_um;
int32 right_um;
int32 bottom_um;
int32 left_um;
};
struct Dpi {
Dpi();
Dpi(int32 horizontal, int32 vertical);
bool operator==(const Dpi& other) const;
bool operator!=(const Dpi& other) const {
return !(*this == other);
}
int32 horizontal;
int32 vertical;
};
enum FitToPageType {
NO_FITTING,
FIT_TO_PAGE,
GROW_TO_PAGE,
SHRINK_TO_PAGE,
FILL_PAGE,
};
enum MediaType {
CUSTOM_MEDIA,
// North American standard sheet media names.
NA_INDEX_3X5,
NA_PERSONAL,
NA_MONARCH,
NA_NUMBER_9,
NA_INDEX_4X6,
NA_NUMBER_10,
NA_A2,
NA_NUMBER_11,
NA_NUMBER_12,
NA_5X7,
NA_INDEX_5X8,
NA_NUMBER_14,
NA_INVOICE,
NA_INDEX_4X6_EXT,
NA_6X9,
NA_C5,
NA_7X9,
NA_EXECUTIVE,
NA_GOVT_LETTER,
NA_GOVT_LEGAL,
NA_QUARTO,
NA_LETTER,
NA_FANFOLD_EUR,
NA_LETTER_PLUS,
NA_FOOLSCAP,
NA_LEGAL,
NA_SUPER_A,
NA_9X11,
NA_ARCH_A,
NA_LETTER_EXTRA,
NA_LEGAL_EXTRA,
NA_10X11,
NA_10X13,
NA_10X14,
NA_10X15,
NA_11X12,
NA_EDP,
NA_FANFOLD_US,
NA_11X15,
NA_LEDGER,
NA_EUR_EDP,
NA_ARCH_B,
NA_12X19,
NA_B_PLUS,
NA_SUPER_B,
NA_C,
NA_ARCH_C,
NA_D,
NA_ARCH_D,
NA_ASME_F,
NA_WIDE_FORMAT,
NA_E,
NA_ARCH_E,
NA_F,
// Chinese standard sheet media size names.
ROC_16K,
ROC_8K,
PRC_32K,
PRC_1,
PRC_2,
PRC_4,
PRC_5,
PRC_8,
PRC_6,
PRC_3,
PRC_16K,
PRC_7,
OM_JUURO_KU_KAI,
OM_PA_KAI,
OM_DAI_PA_KAI,
PRC_10,
// ISO standard sheet media size names.
ISO_A10,
ISO_A9,
ISO_A8,
ISO_A7,
ISO_A6,
ISO_A5,
ISO_A5_EXTRA,
ISO_A4,
ISO_A4_TAB,
ISO_A4_EXTRA,
ISO_A3,
ISO_A4X3,
ISO_A4X4,
ISO_A4X5,
ISO_A4X6,
ISO_A4X7,
ISO_A4X8,
ISO_A4X9,
ISO_A3_EXTRA,
ISO_A2,
ISO_A3X3,
ISO_A3X4,
ISO_A3X5,
ISO_A3X6,
ISO_A3X7,
ISO_A1,
ISO_A2X3,
ISO_A2X4,
ISO_A2X5,
ISO_A0,
ISO_A1X3,
ISO_A1X4,
ISO_2A0,
ISO_A0X3,
ISO_B10,
ISO_B9,
ISO_B8,
ISO_B7,
ISO_B6,
ISO_B6C4,
ISO_B5,
ISO_B5_EXTRA,
ISO_B4,
ISO_B3,
ISO_B2,
ISO_B1,
ISO_B0,
ISO_C10,
ISO_C9,
ISO_C8,
ISO_C7,
ISO_C7C6,
ISO_C6,
ISO_C6C5,
ISO_C5,
ISO_C4,
ISO_C3,
ISO_C2,
ISO_C1,
ISO_C0,
ISO_DL,
ISO_RA2,
ISO_SRA2,
ISO_RA1,
ISO_SRA1,
ISO_RA0,
ISO_SRA0,
// Japanese standard sheet media size names.
JIS_B10,
JIS_B9,
JIS_B8,
JIS_B7,
JIS_B6,
JIS_B5,
JIS_B4,
JIS_B3,
JIS_B2,
JIS_B1,
JIS_B0,
JIS_EXEC,
JPN_CHOU4,
JPN_HAGAKI,
JPN_YOU4,
JPN_CHOU2,
JPN_CHOU3,
JPN_OUFUKU,
JPN_KAHU,
JPN_KAKU2,
// Other metric standard sheet media size names.
OM_SMALL_PHOTO,
OM_ITALIAN,
OM_POSTFIX,
OM_LARGE_PHOTO,
OM_FOLIO,
OM_FOLIO_SP,
OM_INVITE,
};
struct Media {
Media();
Media(MediaType type, int32 width_um, int32 height_um);
Media(const std::string& custom_display_name,
int32 width_um, int32 height_um);
bool MatchBySize();
bool IsValid() const;
bool operator==(const Media& other) const;
bool operator!=(const Media& other) const {
return !(*this == other);
}
MediaType type;
int32 width_um;
int32 height_um;
bool is_continuous_feed;
std::string custom_display_name;
};
struct Interval {
Interval();
Interval(int32 start, int32 end);
Interval(int32 start);
bool operator==(const Interval& other) const;
bool operator!=(const Interval& other) const {
return !(*this == other);
}
int32 start;
int32 end;
};
typedef std::vector<Interval> PageRange;
class ContentTypeTraits;
class ColorTraits;
class DuplexTraits;
class OrientationTraits;
class MarginsTraits;
class DpiTraits;
class FitToPageTraits;
class MediaTraits;
class CopiesTraits;
class PageRangeTraits;
class CollateTraits;
class ReverseTraits;
typedef ListCapability<ContentType, ContentTypeTraits> ContentTypesCapability;
typedef SelectionCapability<Color, ColorTraits> ColorCapability;
typedef SelectionCapability<DuplexType, DuplexTraits> DuplexCapability;
typedef SelectionCapability<OrientationType,
OrientationTraits> OrientationCapability;
typedef SelectionCapability<Margins, MarginsTraits> MarginsCapability;
typedef SelectionCapability<Dpi, DpiTraits> DpiCapability;
typedef SelectionCapability<FitToPageType, FitToPageTraits> FitToPageCapability;
typedef SelectionCapability<Media, MediaTraits> MediaCapability;
typedef EmptyCapability<class CopiesTraits> CopiesCapability;
typedef EmptyCapability<class PageRangeTraits> PageRangeCapability;
typedef BooleanCapability<class CollateTraits> CollateCapability;
typedef BooleanCapability<class ReverseTraits> ReverseCapability;
typedef TicketItem<Color, ColorTraits> ColorTicketItem;
typedef TicketItem<DuplexType, DuplexTraits> DuplexTicketItem;
typedef TicketItem<OrientationType, OrientationTraits> OrientationTicketItem;
typedef TicketItem<Margins, MarginsTraits> MarginsTicketItem;
typedef TicketItem<Dpi, DpiTraits> DpiTicketItem;
typedef TicketItem<FitToPageType, FitToPageTraits> FitToPageTicketItem;
typedef TicketItem<Media, MediaTraits> MediaTicketItem;
typedef TicketItem<int32, CopiesTraits> CopiesTicketItem;
typedef TicketItem<PageRange, PageRangeTraits> PageRangeTicketItem;
typedef TicketItem<bool, CollateTraits> CollateTicketItem;
typedef TicketItem<bool, ReverseTraits> ReverseTicketItem;
} // namespace printer
} // namespace cloud_devices
#endif // COMPONENTS_CLOUD_DEVICES_CLOUD_PRINTER_DESCRIPTION_H_
|