epoc32/include/PDRRECRD.H
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/PDRRECRD.H	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,473 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Header PDRRECRD.H
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __PDRRECRD_H__
    1.22 +#define __PDRRECRD_H__
    1.23 +
    1.24 +#include "LEXICAL.H"
    1.25 +#include "RECORD.H"
    1.26 +#include "UID.H"
    1.27 +
    1.28 +/** 
    1.29 +Index of text styles used by printer description records. 
    1.30 +@publishedAll
    1.31 +@released
    1.32 +*/
    1.33 +enum StyleIndex
    1.34 +	{
    1.35 +	/** Normal text. */
    1.36 +	Normal,
    1.37 +	/** Bold text. */
    1.38 +	Bold,
    1.39 +	/** Italic text. */
    1.40 +	Italic,
    1.41 +	/** Bold italic text. */
    1.42 +	BoldItalic
    1.43 +	};
    1.44 +
    1.45 +class PdrResource
    1.46 +/** 
    1.47 +This class encapsulates a printer resource. 
    1.48 +@publishedAll
    1.49 +@released
    1.50 +*/
    1.51 +	{
    1.52 +public:
    1.53 +	IMPORT_C static PdrResource* New();
    1.54 +	IMPORT_C void Delete();
    1.55 +	void Externalize(ostream& out);
    1.56 +public:
    1.57 +	/** Resource identifier. */
    1.58 +	int32 iId;
    1.59 +	/** String containing the resource. */
    1.60 +	String iString;
    1.61 +	};
    1.62 +
    1.63 +class PdrResources : public Record
    1.64 +/** 
    1.65 +This class holds printer resources. 
    1.66 +@publishedAll
    1.67 +@released
    1.68 +*/
    1.69 +	{
    1.70 +public:
    1.71 +	IMPORT_C static PdrResources* New();
    1.72 +	IMPORT_C void Delete();
    1.73 +	void Externalize(ostream& out);
    1.74 +	IMPORT_C void AddResource(PdrResource* aResource);
    1.75 +private:
    1.76 +	~PdrResources();
    1.77 +private:
    1.78 +	ObjectList<PdrResource*> iPdrResourceList;
    1.79 +	};
    1.80 +
    1.81 +class PdrTranslation
    1.82 +/** 
    1.83 +This class holds a translation between printer descriptions. 
    1.84 +@publishedAll
    1.85 +@released
    1.86 +*/
    1.87 +	{
    1.88 +public:
    1.89 +	IMPORT_C static PdrTranslation* New();
    1.90 +	IMPORT_C void Delete();
    1.91 +	void Externalize(ostream& out);
    1.92 +public:
    1.93 +	/** Printer identifier to translate from. */
    1.94 +	uint16 iFrom;
    1.95 +	/** Printer identifier to translate to. */
    1.96 +	String iTo;	//  !! Think about Unicode version
    1.97 +	};
    1.98 +
    1.99 +class PdrTranslates : public Record
   1.100 +/** 
   1.101 +This class encapsulates a list of printer description translations. 
   1.102 +@publishedAll
   1.103 +@released
   1.104 +*/
   1.105 +	{
   1.106 +public:
   1.107 +	IMPORT_C static PdrTranslates* New();
   1.108 +	IMPORT_C void Delete();
   1.109 +	void Externalize(ostream& out);
   1.110 +	IMPORT_C void AddTranslation(PdrTranslation* aTranslation);
   1.111 +private:
   1.112 +	~PdrTranslates();
   1.113 +private:
   1.114 +	ObjectList<PdrTranslation*> iPdrTranslationList;
   1.115 +	};
   1.116 +
   1.117 +class Width
   1.118 +/** 
   1.119 +This class is used to hold font widths. It is used by printer descriptions. 
   1.120 +@publishedAll
   1.121 +@released
   1.122 +*/
   1.123 +	{
   1.124 +public:
   1.125 +	IMPORT_C static Width* New();
   1.126 +	IMPORT_C void Delete();
   1.127 +	void Externalize(ostream& out);
   1.128 +public:
   1.129 +	/** Font width in pixels. */
   1.130 +	uint16 iWidthInPixels;
   1.131 +	};
   1.132 +
   1.133 +class WidthsCodeSection
   1.134 +/** 
   1.135 +This class encapsulates a list of font widths used by printer descriptions. 
   1.136 +@publishedAll
   1.137 +@released
   1.138 +*/
   1.139 +	{
   1.140 +private:
   1.141 +	WidthsCodeSection();
   1.142 +public:
   1.143 +	IMPORT_C static WidthsCodeSection* New();
   1.144 +	IMPORT_C void Delete();
   1.145 +	void Externalize(ostream& out);
   1.146 +	IMPORT_C void AddWidth(Width* aWidth);
   1.147 +	IMPORT_C Width* WidthList(int i);
   1.148 +	IMPORT_C int NumWidths();
   1.149 +	~WidthsCodeSection();
   1.150 +public:
   1.151 +	/** Start of list. */
   1.152 +	uint16 iStart;
   1.153 +	/** End of list. */
   1.154 +	uint16 iEnd;
   1.155 +private:
   1.156 +	ObjectList<Width*> iWidthList;
   1.157 +	};	
   1.158 +
   1.159 +class FontInfo : public Record
   1.160 +/** 
   1.161 +This class contains information about fonts. It is used by a printer description. 
   1.162 +@publishedAll
   1.163 +@released
   1.164 +*/
   1.165 +	{
   1.166 +public:
   1.167 +	IMPORT_C static FontInfo* New();
   1.168 +	IMPORT_C void Delete();
   1.169 +	void Externalize(ostream& out);
   1.170 +	IMPORT_C void AddCodeSection(WidthsCodeSection* aCodeSection);
   1.171 +	IMPORT_C WidthsCodeSection* CodeSectionList(int i);
   1.172 +	IMPORT_C int NumCodeSections();
   1.173 +private:
   1.174 +	~FontInfo();
   1.175 +public:
   1.176 +	/** Font ascent in pixels. */
   1.177 +	uint16 iAscentInPixels;
   1.178 +	/** Maximum font character width in pixels. */
   1.179 +	uint16 iMaxCharWidthInPixels;
   1.180 +	/** Normal font character width in pixels. */
   1.181 +	uint16 iMaxNormalCharWidthInPixels;
   1.182 +private:
   1.183 +	ObjectList<WidthsCodeSection*> iCodeSectionList;
   1.184 +	};
   1.185 + 
   1.186 +class PdrStyle
   1.187 +/** 
   1.188 +This class contains information about a font style used in a printer descriptions. 
   1.189 +@publishedAll
   1.190 +@released
   1.191 +*/
   1.192 +	{
   1.193 +public:
   1.194 +	IMPORT_C static PdrStyle* New();
   1.195 +	IMPORT_C void Delete();
   1.196 +	void Externalize(ostream& out);
   1.197 +	PdrStyle();
   1.198 +public:
   1.199 +	/** Determines whether the font is available for use. */
   1.200 +	boolean iIsAvailable;
   1.201 +	/** Reference to a record containing information about the font. */
   1.202 +	Record *iFontInfo;
   1.203 +	};
   1.204 +
   1.205 +class PdrFontHeight
   1.206 +/** 
   1.207 +This class stores information for use in printer descriptions about font heights 
   1.208 +and relative scaling. 
   1.209 +@publishedAll
   1.210 +@released
   1.211 +*/
   1.212 +	{
   1.213 +public:
   1.214 +	IMPORT_C static PdrFontHeight* New();
   1.215 +	IMPORT_C void Delete();
   1.216 +	void Externalize(ostream& out);
   1.217 +	PdrFontHeight();
   1.218 +public:
   1.219 +	/** Command string associated with font height. */
   1.220 +	String iCommandString;
   1.221 +	/** Font height in twips. */
   1.222 +	int32 iHeightInTwips;
   1.223 +	/** Width scaling. */
   1.224 +	int32 iWidthScale;
   1.225 +	/** Array containing space for four styles. */
   1.226 +	PdrStyle iStyle[BoldItalic + 1];	// Array for four styles
   1.227 +	};
   1.228 +
   1.229 +class PdrScalableFontHeight
   1.230 +/** 
   1.231 +This class contains information on scalable fonts used by printer descriptions. 
   1.232 +@publishedAll
   1.233 +@released
   1.234 +*/
   1.235 +	{
   1.236 +public:
   1.237 +	PdrScalableFontHeight();
   1.238 +	void Externalize(ostream& out);
   1.239 +public:
   1.240 +	/** Contains a printer command string associated with this font. */
   1.241 +	String iCommandString;
   1.242 +	/** Minimum height in twips. */
   1.243 +	int32 iHeightMinInTwips;
   1.244 +	/** Maximum height in twips. */
   1.245 +	int32 iHeightMaxInTwips;
   1.246 +	/** Scale delta in twips. */
   1.247 +	int32 iHeightDeltaInTwips;
   1.248 +	/** Array for four styles. */
   1.249 +	PdrStyle iStyle[BoldItalic + 1];	// Array for four styles
   1.250 +	};
   1.251 +
   1.252 +class TypefaceFonts : public Record
   1.253 +/** 
   1.254 +This class encapsulates a list of font heights for printer descriptions. 
   1.255 +@publishedAll
   1.256 +@released
   1.257 +*/
   1.258 +	{
   1.259 +public:
   1.260 +	IMPORT_C static TypefaceFonts* New();
   1.261 +	IMPORT_C void Delete();
   1.262 +	void Externalize(ostream& out);
   1.263 +	IMPORT_C void AddFontHeight(PdrFontHeight* aFontHeight);
   1.264 +	IMPORT_C int NumFontHeights();
   1.265 +	PdrFontHeight* FontHeightList(int i);
   1.266 +private:
   1.267 +	TypefaceFonts();
   1.268 +	~TypefaceFonts();
   1.269 +public:
   1.270 +	Typeface iTypeface;
   1.271 +	/** Determines whether the font height is scalable. */
   1.272 +	boolean iIsScalable;
   1.273 +private:
   1.274 +	ObjectList<PdrFontHeight*> iFontHeightList;
   1.275 +public:
   1.276 +	/** Describes a scalable font height. */
   1.277 +	PdrScalableFontHeight iScalableFontHeight;
   1.278 +	Record *iTranslates;
   1.279 +	};
   1.280 +
   1.281 +class TypefaceFontsEntry
   1.282 +/** 
   1.283 +This class encapsulates information about a printer font. 
   1.284 +@publishedAll
   1.285 +@released
   1.286 +*/
   1.287 +	{
   1.288 +public:
   1.289 +	IMPORT_C static TypefaceFontsEntry* New(Record* aTypefaceFonts);
   1.290 +	IMPORT_C void Delete();
   1.291 +	void Externalize(ostream& out);
   1.292 +private:
   1.293 +	TypefaceFontsEntry(Record* aTypefaceFonts);
   1.294 +public:
   1.295 +	~TypefaceFontsEntry();
   1.296 +public:
   1.297 +	/** Contains the font record. */
   1.298 +	Record* iTypefaceFonts;
   1.299 +	/** Determines whether the font can be used in portrait view. */
   1.300 +	boolean iNotInPortrait;
   1.301 +	/** Determines whether the font can be used in landscape view. */
   1.302 +	boolean iNotInLandscape;
   1.303 +	};
   1.304 +
   1.305 +class Margins
   1.306 +/** 
   1.307 +This class contains the margins used by a printer description. 
   1.308 +@publishedAll
   1.309 +@released
   1.310 +*/
   1.311 +	{
   1.312 +public:
   1.313 +	void Externalize(ostream& out);
   1.314 +public:
   1.315 +	/** Left margin. */
   1.316 +	int32 iLeft;
   1.317 +	/** Right margin. */
   1.318 +	int32 iRight;
   1.319 +	/** Top margin. */
   1.320 +	int32 iTop;
   1.321 +	/** Bottom margin. */
   1.322 +	int32 iBottom;
   1.323 +	};
   1.324 +/*
   1.325 +class PdrExtraInfo : public Record
   1.326 +	{
   1.327 +public:
   1.328 +	~PdrExtraInfo();
   1.329 +	void Externalize(ostream& out);
   1.330 +public:
   1.331 +	ObjectList<String*> iInfo;
   1.332 +	};
   1.333 +*/
   1.334 +class PdrModelInfo
   1.335 +/** 
   1.336 +This class contains information about a printer model used by a printer description. 
   1.337 +@publishedAll
   1.338 +@released
   1.339 +*/
   1.340 +	{
   1.341 +public:
   1.342 +	void Externalize(ostream& out);
   1.343 +	IMPORT_C void AddTypefaceFontsEntry(TypefaceFontsEntry* aTypefaceFontsEntry);
   1.344 +	int NumTypefaceFontsEntries();
   1.345 +	TypefaceFontsEntry* TypefaceFontsEntryList(int i);
   1.346 +	PdrModelInfo();
   1.347 +	~PdrModelInfo();
   1.348 +public:
   1.349 +	streampos iStreamId;
   1.350 +	/** Flags associated with model. */
   1.351 +	int32 iFlags;
   1.352 +	/** Pixel width in twips. */
   1.353 +	int32 iKPixelWidthInTwips;
   1.354 +	/** Pixel height in twips. */
   1.355 +	int32 iKPixelHeightInTwips;
   1.356 +	/** Portrait printng offset in twips. */
   1.357 +	Point iPortraitOffsetInPixels;
   1.358 +	/** Landscape printing offset in twips. */
   1.359 +	Point iLandscapeOffsetInPixels;
   1.360 +	/** Minimum margin in pixels. */
   1.361 +	Margins iMinMarginsInPixels;
   1.362 +	/** Display mode. */
   1.363 +	int32 iDisplayMode;
   1.364 +private:
   1.365 +	ObjectList<TypefaceFontsEntry*> iTypefaceFontsEntryList;
   1.366 +public:
   1.367 +	Record *iResources;
   1.368 +	Record *iSpareRecord;
   1.369 +	};
   1.370 + 
   1.371 +class PrinterModelEntry
   1.372 +/** 
   1.373 +This class contains information on a printer model. 
   1.374 +@publishedAll
   1.375 +@released
   1.376 +*/
   1.377 +	{
   1.378 +public:
   1.379 +	PrinterModelEntry();
   1.380 +	void Externalize(ostream& out);
   1.381 +public:
   1.382 +	/** Printer name. */
   1.383 +	String iName;
   1.384 +	/** Whether a printer port is required. */
   1.385 +	boolean iRequiresPrinterPort;
   1.386 +	uid iUid;
   1.387 +	};
   1.388 +
   1.389 +class PrinterModelHeader : public Record
   1.390 +/** 
   1.391 +This class encapsulates information about a printer model. 
   1.392 +@publishedAll
   1.393 +@released
   1.394 +*/
   1.395 +	{
   1.396 +public:
   1.397 +	IMPORT_C static PrinterModelHeader* New();
   1.398 +	IMPORT_C void Delete();
   1.399 +	void Externalize(ostream& out);
   1.400 +	void ExternalizeData(ostream& out);
   1.401 +	boolean IsPdrModel();
   1.402 +public:
   1.403 +	/** Printer model entry. */
   1.404 +	PrinterModelEntry iEntry;
   1.405 +	/** Printer model information. */
   1.406 +	PdrModelInfo iInfo;
   1.407 +	};
   1.408 +
   1.409 +class PdrStoreFile : public Record
   1.410 +/** 
   1.411 +This class stores printer description files. 
   1.412 +@publishedAll
   1.413 +@released
   1.414 +*/
   1.415 +	{
   1.416 +public:
   1.417 +	IMPORT_C static PdrStoreFile* New();
   1.418 +	IMPORT_C void Delete();
   1.419 +	IMPORT_C void AddModel(PrinterModelHeader *aModel);
   1.420 +	void Externalize(ostream& out);
   1.421 +private:
   1.422 +	PdrStoreFile();
   1.423 +private:
   1.424 +	void AddTypefaceFonts(TypefaceFonts* aTypefaceFonts);
   1.425 +	void ExternalizeHeader(ostream& out);
   1.426 +	void ExternalizeComponents(ostream& out);
   1.427 +public:
   1.428 +	/** Printer descriptor. */
   1.429 +	String iPDLName;
   1.430 +	uid iPDLUid;
   1.431 +private:
   1.432 +	RecordList iModelList;
   1.433 +	RecordList iTypefaceFontsList;
   1.434 +	RecordList iFontInfoList;
   1.435 +	RecordList iResourcesList; 
   1.436 +	RecordList iTranslatesList;
   1.437 +//	RecordList iExtraInfoList;
   1.438 +	};
   1.439 +
   1.440 +class PdrModelStore
   1.441 +/** 
   1.442 +This class is used to store information about printer models, and externalize 
   1.443 +it to external files. 
   1.444 +@publishedAll
   1.445 +@released
   1.446 +*/
   1.447 +	{
   1.448 +public:
   1.449 +	IMPORT_C boolean Store(const String& aFilename);
   1.450 +	IMPORT_C void AddPdrStoreFile(PdrStoreFile* aPdrStoreFile);
   1.451 +	IMPORT_C void AddModel(PrinterModelHeader *aModel);
   1.452 +	IMPORT_C Record* FindModel(String& aLabel);
   1.453 +	IMPORT_C void AddTypefaceFonts(TypefaceFonts *aTypefaceFonts);
   1.454 +	IMPORT_C Record* FindTypefaceFonts(String& aLabel);
   1.455 +	IMPORT_C void AddFontInfo(FontInfo *aFontInfo);
   1.456 +	IMPORT_C Record* FindFontInfo(String& aLabel);
   1.457 +	IMPORT_C void AddResources(PdrResources *aResources);
   1.458 +	IMPORT_C Record* FindResources(String& aLabel);
   1.459 +	IMPORT_C void AddTranslates(PdrTranslates *aTranslates);
   1.460 +	IMPORT_C Record* FindTranslates(String& aLabel);
   1.461 +//	void AddExtraInfo(PdrExtraInfo *aInfo);
   1.462 +//	Record* FindExtraInfo(String& aLabel);
   1.463 +	PdrModelStore();
   1.464 +	~PdrModelStore();
   1.465 +private:
   1.466 +	/** This attribute is internal, and is not intended for use. */
   1.467 +	PdrStoreFile* iPdrStoreFile;
   1.468 +	RecordList iModelList;
   1.469 +	RecordList iTypefaceFontsList;
   1.470 +	RecordList iFontInfoList;
   1.471 +	RecordList iResourcesList;
   1.472 +	RecordList iTranslatesList;
   1.473 +//	RecordList iExtraInfoList;
   1.474 +	};
   1.475 +
   1.476 +#endif