|
1 /* |
|
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Header PDRRECRD.H |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __PDRRECRD_H__ |
|
21 #define __PDRRECRD_H__ |
|
22 |
|
23 #include "LEXICAL.H" |
|
24 #include "RECORD.H" |
|
25 #include "UID.H" |
|
26 |
|
27 /** |
|
28 Index of text styles used by printer description records. |
|
29 @publishedAll |
|
30 @released |
|
31 */ |
|
32 enum StyleIndex |
|
33 { |
|
34 /** Normal text. */ |
|
35 Normal, |
|
36 /** Bold text. */ |
|
37 Bold, |
|
38 /** Italic text. */ |
|
39 Italic, |
|
40 /** Bold italic text. */ |
|
41 BoldItalic |
|
42 }; |
|
43 |
|
44 class PdrResource |
|
45 /** |
|
46 This class encapsulates a printer resource. |
|
47 @publishedAll |
|
48 @released |
|
49 */ |
|
50 { |
|
51 public: |
|
52 IMPORT_C static PdrResource* New(); |
|
53 IMPORT_C void Delete(); |
|
54 void Externalize(ostream& out); |
|
55 public: |
|
56 /** Resource identifier. */ |
|
57 int32 iId; |
|
58 /** String containing the resource. */ |
|
59 String iString; |
|
60 }; |
|
61 |
|
62 class PdrResources : public Record |
|
63 /** |
|
64 This class holds printer resources. |
|
65 @publishedAll |
|
66 @released |
|
67 */ |
|
68 { |
|
69 public: |
|
70 IMPORT_C static PdrResources* New(); |
|
71 IMPORT_C void Delete(); |
|
72 void Externalize(ostream& out); |
|
73 IMPORT_C void AddResource(PdrResource* aResource); |
|
74 private: |
|
75 ~PdrResources(); |
|
76 private: |
|
77 ObjectList<PdrResource*> iPdrResourceList; |
|
78 }; |
|
79 |
|
80 class PdrTranslation |
|
81 /** |
|
82 This class holds a translation between printer descriptions. |
|
83 @publishedAll |
|
84 @released |
|
85 */ |
|
86 { |
|
87 public: |
|
88 IMPORT_C static PdrTranslation* New(); |
|
89 IMPORT_C void Delete(); |
|
90 void Externalize(ostream& out); |
|
91 public: |
|
92 /** Printer identifier to translate from. */ |
|
93 uint16 iFrom; |
|
94 /** Printer identifier to translate to. */ |
|
95 String iTo; // !! Think about Unicode version |
|
96 }; |
|
97 |
|
98 class PdrTranslates : public Record |
|
99 /** |
|
100 This class encapsulates a list of printer description translations. |
|
101 @publishedAll |
|
102 @released |
|
103 */ |
|
104 { |
|
105 public: |
|
106 IMPORT_C static PdrTranslates* New(); |
|
107 IMPORT_C void Delete(); |
|
108 void Externalize(ostream& out); |
|
109 IMPORT_C void AddTranslation(PdrTranslation* aTranslation); |
|
110 private: |
|
111 ~PdrTranslates(); |
|
112 private: |
|
113 ObjectList<PdrTranslation*> iPdrTranslationList; |
|
114 }; |
|
115 |
|
116 class Width |
|
117 /** |
|
118 This class is used to hold font widths. It is used by printer descriptions. |
|
119 @publishedAll |
|
120 @released |
|
121 */ |
|
122 { |
|
123 public: |
|
124 IMPORT_C static Width* New(); |
|
125 IMPORT_C void Delete(); |
|
126 void Externalize(ostream& out); |
|
127 public: |
|
128 /** Font width in pixels. */ |
|
129 uint16 iWidthInPixels; |
|
130 }; |
|
131 |
|
132 class WidthsCodeSection |
|
133 /** |
|
134 This class encapsulates a list of font widths used by printer descriptions. |
|
135 @publishedAll |
|
136 @released |
|
137 */ |
|
138 { |
|
139 private: |
|
140 WidthsCodeSection(); |
|
141 public: |
|
142 IMPORT_C static WidthsCodeSection* New(); |
|
143 IMPORT_C void Delete(); |
|
144 void Externalize(ostream& out); |
|
145 IMPORT_C void AddWidth(Width* aWidth); |
|
146 IMPORT_C Width* WidthList(int i); |
|
147 IMPORT_C int NumWidths(); |
|
148 ~WidthsCodeSection(); |
|
149 public: |
|
150 /** Start of list. */ |
|
151 uint16 iStart; |
|
152 /** End of list. */ |
|
153 uint16 iEnd; |
|
154 private: |
|
155 ObjectList<Width*> iWidthList; |
|
156 }; |
|
157 |
|
158 class FontInfo : public Record |
|
159 /** |
|
160 This class contains information about fonts. It is used by a printer description. |
|
161 @publishedAll |
|
162 @released |
|
163 */ |
|
164 { |
|
165 public: |
|
166 IMPORT_C static FontInfo* New(); |
|
167 IMPORT_C void Delete(); |
|
168 void Externalize(ostream& out); |
|
169 IMPORT_C void AddCodeSection(WidthsCodeSection* aCodeSection); |
|
170 IMPORT_C WidthsCodeSection* CodeSectionList(int i); |
|
171 IMPORT_C int NumCodeSections(); |
|
172 private: |
|
173 ~FontInfo(); |
|
174 public: |
|
175 /** Font ascent in pixels. */ |
|
176 uint16 iAscentInPixels; |
|
177 /** Maximum font character width in pixels. */ |
|
178 uint16 iMaxCharWidthInPixels; |
|
179 /** Normal font character width in pixels. */ |
|
180 uint16 iMaxNormalCharWidthInPixels; |
|
181 private: |
|
182 ObjectList<WidthsCodeSection*> iCodeSectionList; |
|
183 }; |
|
184 |
|
185 class PdrStyle |
|
186 /** |
|
187 This class contains information about a font style used in a printer descriptions. |
|
188 @publishedAll |
|
189 @released |
|
190 */ |
|
191 { |
|
192 public: |
|
193 IMPORT_C static PdrStyle* New(); |
|
194 IMPORT_C void Delete(); |
|
195 void Externalize(ostream& out); |
|
196 PdrStyle(); |
|
197 public: |
|
198 /** Determines whether the font is available for use. */ |
|
199 boolean iIsAvailable; |
|
200 /** Reference to a record containing information about the font. */ |
|
201 Record *iFontInfo; |
|
202 }; |
|
203 |
|
204 class PdrFontHeight |
|
205 /** |
|
206 This class stores information for use in printer descriptions about font heights |
|
207 and relative scaling. |
|
208 @publishedAll |
|
209 @released |
|
210 */ |
|
211 { |
|
212 public: |
|
213 IMPORT_C static PdrFontHeight* New(); |
|
214 IMPORT_C void Delete(); |
|
215 void Externalize(ostream& out); |
|
216 PdrFontHeight(); |
|
217 public: |
|
218 /** Command string associated with font height. */ |
|
219 String iCommandString; |
|
220 /** Font height in twips. */ |
|
221 int32 iHeightInTwips; |
|
222 /** Width scaling. */ |
|
223 int32 iWidthScale; |
|
224 /** Array containing space for four styles. */ |
|
225 PdrStyle iStyle[BoldItalic + 1]; // Array for four styles |
|
226 }; |
|
227 |
|
228 class PdrScalableFontHeight |
|
229 /** |
|
230 This class contains information on scalable fonts used by printer descriptions. |
|
231 @publishedAll |
|
232 @released |
|
233 */ |
|
234 { |
|
235 public: |
|
236 PdrScalableFontHeight(); |
|
237 void Externalize(ostream& out); |
|
238 public: |
|
239 /** Contains a printer command string associated with this font. */ |
|
240 String iCommandString; |
|
241 /** Minimum height in twips. */ |
|
242 int32 iHeightMinInTwips; |
|
243 /** Maximum height in twips. */ |
|
244 int32 iHeightMaxInTwips; |
|
245 /** Scale delta in twips. */ |
|
246 int32 iHeightDeltaInTwips; |
|
247 /** Array for four styles. */ |
|
248 PdrStyle iStyle[BoldItalic + 1]; // Array for four styles |
|
249 }; |
|
250 |
|
251 class TypefaceFonts : public Record |
|
252 /** |
|
253 This class encapsulates a list of font heights for printer descriptions. |
|
254 @publishedAll |
|
255 @released |
|
256 */ |
|
257 { |
|
258 public: |
|
259 IMPORT_C static TypefaceFonts* New(); |
|
260 IMPORT_C void Delete(); |
|
261 void Externalize(ostream& out); |
|
262 IMPORT_C void AddFontHeight(PdrFontHeight* aFontHeight); |
|
263 IMPORT_C int NumFontHeights(); |
|
264 PdrFontHeight* FontHeightList(int i); |
|
265 private: |
|
266 TypefaceFonts(); |
|
267 ~TypefaceFonts(); |
|
268 public: |
|
269 Typeface iTypeface; |
|
270 /** Determines whether the font height is scalable. */ |
|
271 boolean iIsScalable; |
|
272 private: |
|
273 ObjectList<PdrFontHeight*> iFontHeightList; |
|
274 public: |
|
275 /** Describes a scalable font height. */ |
|
276 PdrScalableFontHeight iScalableFontHeight; |
|
277 Record *iTranslates; |
|
278 }; |
|
279 |
|
280 class TypefaceFontsEntry |
|
281 /** |
|
282 This class encapsulates information about a printer font. |
|
283 @publishedAll |
|
284 @released |
|
285 */ |
|
286 { |
|
287 public: |
|
288 IMPORT_C static TypefaceFontsEntry* New(Record* aTypefaceFonts); |
|
289 IMPORT_C void Delete(); |
|
290 void Externalize(ostream& out); |
|
291 private: |
|
292 TypefaceFontsEntry(Record* aTypefaceFonts); |
|
293 public: |
|
294 ~TypefaceFontsEntry(); |
|
295 public: |
|
296 /** Contains the font record. */ |
|
297 Record* iTypefaceFonts; |
|
298 /** Determines whether the font can be used in portrait view. */ |
|
299 boolean iNotInPortrait; |
|
300 /** Determines whether the font can be used in landscape view. */ |
|
301 boolean iNotInLandscape; |
|
302 }; |
|
303 |
|
304 class Margins |
|
305 /** |
|
306 This class contains the margins used by a printer description. |
|
307 @publishedAll |
|
308 @released |
|
309 */ |
|
310 { |
|
311 public: |
|
312 void Externalize(ostream& out); |
|
313 public: |
|
314 /** Left margin. */ |
|
315 int32 iLeft; |
|
316 /** Right margin. */ |
|
317 int32 iRight; |
|
318 /** Top margin. */ |
|
319 int32 iTop; |
|
320 /** Bottom margin. */ |
|
321 int32 iBottom; |
|
322 }; |
|
323 /* |
|
324 class PdrExtraInfo : public Record |
|
325 { |
|
326 public: |
|
327 ~PdrExtraInfo(); |
|
328 void Externalize(ostream& out); |
|
329 public: |
|
330 ObjectList<String*> iInfo; |
|
331 }; |
|
332 */ |
|
333 class PdrModelInfo |
|
334 /** |
|
335 This class contains information about a printer model used by a printer description. |
|
336 @publishedAll |
|
337 @released |
|
338 */ |
|
339 { |
|
340 public: |
|
341 void Externalize(ostream& out); |
|
342 IMPORT_C void AddTypefaceFontsEntry(TypefaceFontsEntry* aTypefaceFontsEntry); |
|
343 int NumTypefaceFontsEntries(); |
|
344 TypefaceFontsEntry* TypefaceFontsEntryList(int i); |
|
345 PdrModelInfo(); |
|
346 ~PdrModelInfo(); |
|
347 public: |
|
348 streampos iStreamId; |
|
349 /** Flags associated with model. */ |
|
350 int32 iFlags; |
|
351 /** Pixel width in twips. */ |
|
352 int32 iKPixelWidthInTwips; |
|
353 /** Pixel height in twips. */ |
|
354 int32 iKPixelHeightInTwips; |
|
355 /** Portrait printng offset in twips. */ |
|
356 Point iPortraitOffsetInPixels; |
|
357 /** Landscape printing offset in twips. */ |
|
358 Point iLandscapeOffsetInPixels; |
|
359 /** Minimum margin in pixels. */ |
|
360 Margins iMinMarginsInPixels; |
|
361 /** Display mode. */ |
|
362 int32 iDisplayMode; |
|
363 private: |
|
364 ObjectList<TypefaceFontsEntry*> iTypefaceFontsEntryList; |
|
365 public: |
|
366 Record *iResources; |
|
367 Record *iSpareRecord; |
|
368 }; |
|
369 |
|
370 class PrinterModelEntry |
|
371 /** |
|
372 This class contains information on a printer model. |
|
373 @publishedAll |
|
374 @released |
|
375 */ |
|
376 { |
|
377 public: |
|
378 PrinterModelEntry(); |
|
379 void Externalize(ostream& out); |
|
380 public: |
|
381 /** Printer name. */ |
|
382 String iName; |
|
383 /** Whether a printer port is required. */ |
|
384 boolean iRequiresPrinterPort; |
|
385 uid iUid; |
|
386 }; |
|
387 |
|
388 class PrinterModelHeader : public Record |
|
389 /** |
|
390 This class encapsulates information about a printer model. |
|
391 @publishedAll |
|
392 @released |
|
393 */ |
|
394 { |
|
395 public: |
|
396 IMPORT_C static PrinterModelHeader* New(); |
|
397 IMPORT_C void Delete(); |
|
398 void Externalize(ostream& out); |
|
399 void ExternalizeData(ostream& out); |
|
400 boolean IsPdrModel(); |
|
401 public: |
|
402 /** Printer model entry. */ |
|
403 PrinterModelEntry iEntry; |
|
404 /** Printer model information. */ |
|
405 PdrModelInfo iInfo; |
|
406 }; |
|
407 |
|
408 class PdrStoreFile : public Record |
|
409 /** |
|
410 This class stores printer description files. |
|
411 @publishedAll |
|
412 @released |
|
413 */ |
|
414 { |
|
415 public: |
|
416 IMPORT_C static PdrStoreFile* New(); |
|
417 IMPORT_C void Delete(); |
|
418 IMPORT_C void AddModel(PrinterModelHeader *aModel); |
|
419 void Externalize(ostream& out); |
|
420 private: |
|
421 PdrStoreFile(); |
|
422 private: |
|
423 void AddTypefaceFonts(TypefaceFonts* aTypefaceFonts); |
|
424 void ExternalizeHeader(ostream& out); |
|
425 void ExternalizeComponents(ostream& out); |
|
426 public: |
|
427 /** Printer descriptor. */ |
|
428 String iPDLName; |
|
429 uid iPDLUid; |
|
430 private: |
|
431 RecordList iModelList; |
|
432 RecordList iTypefaceFontsList; |
|
433 RecordList iFontInfoList; |
|
434 RecordList iResourcesList; |
|
435 RecordList iTranslatesList; |
|
436 // RecordList iExtraInfoList; |
|
437 }; |
|
438 |
|
439 class PdrModelStore |
|
440 /** |
|
441 This class is used to store information about printer models, and externalize |
|
442 it to external files. |
|
443 @publishedAll |
|
444 @released |
|
445 */ |
|
446 { |
|
447 public: |
|
448 IMPORT_C boolean Store(const String& aFilename); |
|
449 IMPORT_C void AddPdrStoreFile(PdrStoreFile* aPdrStoreFile); |
|
450 IMPORT_C void AddModel(PrinterModelHeader *aModel); |
|
451 IMPORT_C Record* FindModel(String& aLabel); |
|
452 IMPORT_C void AddTypefaceFonts(TypefaceFonts *aTypefaceFonts); |
|
453 IMPORT_C Record* FindTypefaceFonts(String& aLabel); |
|
454 IMPORT_C void AddFontInfo(FontInfo *aFontInfo); |
|
455 IMPORT_C Record* FindFontInfo(String& aLabel); |
|
456 IMPORT_C void AddResources(PdrResources *aResources); |
|
457 IMPORT_C Record* FindResources(String& aLabel); |
|
458 IMPORT_C void AddTranslates(PdrTranslates *aTranslates); |
|
459 IMPORT_C Record* FindTranslates(String& aLabel); |
|
460 // void AddExtraInfo(PdrExtraInfo *aInfo); |
|
461 // Record* FindExtraInfo(String& aLabel); |
|
462 PdrModelStore(); |
|
463 ~PdrModelStore(); |
|
464 private: |
|
465 /** This attribute is internal, and is not intended for use. */ |
|
466 PdrStoreFile* iPdrStoreFile; |
|
467 RecordList iModelList; |
|
468 RecordList iTypefaceFontsList; |
|
469 RecordList iFontInfoList; |
|
470 RecordList iResourcesList; |
|
471 RecordList iTranslatesList; |
|
472 // RecordList iExtraInfoList; |
|
473 }; |
|
474 |
|
475 #endif |