os/graphics/printingservices/printerdriversupport/src/PDRBODY.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1997-2010 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 "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef PDRBODY_H
    17 #define PDRBODY_H
    18 
    19 #include <e32std.h>
    20 #include <s32file.h>
    21 #include <pdrstore.h>
    22 
    23 /**
    24 @internalComponent
    25 */
    26 const TInt KCInfoFontUidVal = 268435524;
    27 
    28 /**
    29 pdr store files are backwardly compatible to this value
    30 @internalComponent
    31 */
    32 const TInt KPdrtranVersion = 22;  
    33 
    34 /**
    35 50 points
    36 @internalComponent
    37 */
    38 const TInt KScalableWidthTableHeightInTwips = 1000;
    39 
    40 /**
    41 @internalComponent
    42 */
    43 const TInt KMaxCommandStringMaxLength=0x100;
    44 
    45 /**
    46 @internalComponent
    47 */
    48 enum TStyleIndex
    49 	{
    50 	EStyleNormal,
    51 	EStyleBold,
    52 	EStyleItalic,
    53 	EStyleBoldItalic
    54 	};
    55 
    56 class TPdrResource
    57 /**
    58 @internalComponent
    59 */
    60 	{
    61 public:
    62 	TPdrResource();
    63 	void InternalizeL(RReadStream& aStream);
    64 public:
    65 	TInt iId;
    66 	TCommandString iString;
    67 	};
    68 
    69 NONSHARABLE_CLASS(CPdrTranslation) : public CBase
    70 /**
    71 @internalComponent
    72 */
    73 	{
    74 public:
    75 	CPdrTranslation();
    76 	~CPdrTranslation();
    77 	void InternalizeL(RReadStream& aStream);
    78 public:
    79 	TInt iFrom;
    80 	HBufC8* iTo;
    81 	};
    82 
    83 NONSHARABLE_CLASS(CPdrTranslates) : public CBase
    84 /**
    85 @internalComponent
    86 */
    87 	{
    88 public:
    89 	CPdrTranslates();
    90 	void InternalizeL(RReadStream& aStream);
    91 	~CPdrTranslates();
    92 	HBufC8* TranslateStringL(const TDesC& aString) const;
    93 public:
    94 	TStreamId iStreamId;
    95 	TInt iNumTranslations;
    96 	CPdrTranslation** iTranslationList;
    97 	};
    98 
    99 NONSHARABLE_CLASS(CWidthsCodeSection) : public CBase
   100 /**
   101 @internalComponent
   102 */
   103 	{
   104 public:
   105 	CWidthsCodeSection();
   106 	void InternalizeL(RReadStream& aStream);
   107 	~CWidthsCodeSection();
   108 public:
   109 	TCodeSection iCodeSection;
   110 	TInt iNumWidths;
   111 	TUint16* iWidthList;
   112 	};
   113 
   114 NONSHARABLE_CLASS(CFontInfo)	: public CBase
   115 /**
   116 @internalComponent
   117 */
   118 	{
   119 public:
   120 	CFontInfo(TStreamId aStreamId);
   121 	void InternalizeL(RReadStream &aStream);
   122 	~CFontInfo();
   123 	TInt CharWidthInPixels(TChar aChar) const;
   124 	TInt NumCodeSections() const;
   125 	TCodeSection CodeSection(TInt anIndex) const;
   126 public:
   127 	TStreamId iStreamId;
   128 	TUint16 iAscentInPixels;
   129 	TUint16 iMaxCharWidthInPixels;
   130 	TUint16 iMaxNormalCharWidthInPixels;
   131 	TInt iNumCodeSections;
   132 	CWidthsCodeSection** iCodeSectionList;
   133 	};
   134 
   135 class TPdrStyle
   136 /**
   137 @internalComponent
   138 */
   139 	{
   140 public:
   141 	TPdrStyle();
   142 	void InternalizeL(RReadStream &aStream);
   143 public:
   144 	TBool iIsAvailable;
   145 	TStreamId iFontInfoStreamId;
   146 	};
   147 
   148 class TPdrFontHeight
   149 /**
   150 @internalComponent
   151 */
   152 	{
   153 public:
   154 	 TPdrFontHeight();
   155 	 void InternalizeL(RReadStream& aStream);
   156 public:
   157 	TCommandString iCommandString;
   158 	TInt iHeightInTwips;
   159 	TInt iWidthScale;
   160 	TPdrStyle iStyle[EStyleBoldItalic + 1];  // N.B. Don't use enums TFontPosture and TFontStrokeWeight as indices
   161 	};
   162 
   163 class TPdrScalableFontHeight
   164 /**
   165 @internalComponent
   166 */
   167 	{
   168 public:
   169 	TPdrScalableFontHeight();
   170 	void InternalizeL(RReadStream& aStream);
   171 public:
   172 	TCommandString iCommandString;
   173 	TInt iHeightMinInTwips;
   174 	TInt iHeightMaxInTwips;
   175 	TInt iHeightDeltaInTwips;
   176 	TPdrStyle iStyle[EStyleBoldItalic + 1];  // N.B. Don't use enums TFontPosture and TFontStrokeWeight as indices
   177 	};
   178 
   179 NONSHARABLE_CLASS(CTypefaceFonts) : public CBase
   180 /**
   181 @internalComponent
   182 */
   183 	{
   184 public:
   185 	CTypefaceFonts();
   186 	void InternalizeL(RReadStream& aStream);
   187 	~CTypefaceFonts();
   188 	TInt IsScalable() const;
   189 	TInt NumFontHeights() const;
   190 	TInt FontHeightInTwips(TInt aHeightIndex) const;
   191 	TInt FontInfoHeightInTwips(TInt aHeightIndex) const;
   192 	void CommandString(TDes8& aDes, TInt aHeightIndex) const;
   193 	TPdrStyle* Style(TInt aHeightIndex, TFontStyle& aFontStyle) const;
   194 	TTypeface Typeface();
   195 private:
   196 	TStyleIndex StyleIndex(TFontStyle& aFontStyle) const;
   197 private:
   198 	TTypeface iTypeface;
   199 	TInt iNumFontHeights;  // Also used as flag	for !iIsScalable
   200 	TPdrFontHeight* iFontHeightList;
   201 	TPdrScalableFontHeight* iScalableFontHeight;
   202 public:
   203 	TSwizzle<CPdrTranslates> iTranslates;
   204 	};
   205 
   206 #endif