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