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