sl@0
|
1 |
// Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Font and text classes used by printer drivers.
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef PDRSTOREFONT_H
|
sl@0
|
17 |
#define PDRSTOREFONT_H
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@internalAll - Internal to Symbian
|
sl@0
|
22 |
@released
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <s32mem.h>
|
sl@0
|
26 |
#include <gdi.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
class CFbsBitGc;
|
sl@0
|
30 |
class TPdrResource;
|
sl@0
|
31 |
class CPdrDevice;
|
sl@0
|
32 |
class CFontInfo;
|
sl@0
|
33 |
class CPdrTranslates;
|
sl@0
|
34 |
class CInfoFont;
|
sl@0
|
35 |
class CTypefaceFonts;
|
sl@0
|
36 |
class TTextFormat;
|
sl@0
|
37 |
class CPdrControl;
|
sl@0
|
38 |
class CFbsFont;
|
sl@0
|
39 |
|
sl@0
|
40 |
|
sl@0
|
41 |
class CPdrResources : public CBase
|
sl@0
|
42 |
{
|
sl@0
|
43 |
public:
|
sl@0
|
44 |
IMPORT_C CPdrResources();
|
sl@0
|
45 |
IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId aStreamId);
|
sl@0
|
46 |
IMPORT_C ~CPdrResources();
|
sl@0
|
47 |
IMPORT_C TPtrC8 ResourceString(TInt anId) const;
|
sl@0
|
48 |
private:
|
sl@0
|
49 |
TInt iNumResources;
|
sl@0
|
50 |
|
sl@0
|
51 |
TPdrResource* iResourceList;
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
class TTypefaceFontsEntry
|
sl@0
|
56 |
{
|
sl@0
|
57 |
public:
|
sl@0
|
58 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
sl@0
|
59 |
public:
|
sl@0
|
60 |
|
sl@0
|
61 |
TStreamId iStreamId;
|
sl@0
|
62 |
|
sl@0
|
63 |
TBool iNotInPortrait;
|
sl@0
|
64 |
|
sl@0
|
65 |
TBool iNotInLandscape;
|
sl@0
|
66 |
};
|
sl@0
|
67 |
|
sl@0
|
68 |
|
sl@0
|
69 |
class CPdrModelInfo : public CBase
|
sl@0
|
70 |
{
|
sl@0
|
71 |
public:
|
sl@0
|
72 |
IMPORT_C CPdrModelInfo();
|
sl@0
|
73 |
IMPORT_C ~CPdrModelInfo();
|
sl@0
|
74 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
sl@0
|
75 |
public:
|
sl@0
|
76 |
|
sl@0
|
77 |
TInt iFlags;
|
sl@0
|
78 |
|
sl@0
|
79 |
TInt iKPixelWidthInTwips;
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt iKPixelHeightInTwips;
|
sl@0
|
82 |
|
sl@0
|
83 |
TPoint iPortraitOffsetInPixels;
|
sl@0
|
84 |
|
sl@0
|
85 |
TPoint iLandscapeOffsetInPixels;
|
sl@0
|
86 |
|
sl@0
|
87 |
TMargins iMinMarginsInPixels;
|
sl@0
|
88 |
|
sl@0
|
89 |
TDisplayMode iDisplayMode;
|
sl@0
|
90 |
|
sl@0
|
91 |
TInt iNumTypefaceFonts;
|
sl@0
|
92 |
|
sl@0
|
93 |
TTypefaceFontsEntry* iTypefaceFontsEntryList;
|
sl@0
|
94 |
|
sl@0
|
95 |
TStreamId iResourcesStreamId;
|
sl@0
|
96 |
|
sl@0
|
97 |
TStreamId iSpareStreamId;
|
sl@0
|
98 |
};
|
sl@0
|
99 |
|
sl@0
|
100 |
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
@internalTechnology
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
class CPdrTypefaceStore : public CTypefaceStore
|
sl@0
|
105 |
{
|
sl@0
|
106 |
public:
|
sl@0
|
107 |
IMPORT_C static CPdrTypefaceStore* NewL(CStreamStore& aStore, TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
|
sl@0
|
108 |
IMPORT_C ~CPdrTypefaceStore();
|
sl@0
|
109 |
// CTypefaceStore implementation
|
sl@0
|
110 |
IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
|
sl@0
|
111 |
IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
|
sl@0
|
112 |
IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
|
sl@0
|
113 |
IMPORT_C TInt NumTypefaces() const;
|
sl@0
|
114 |
IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
|
sl@0
|
115 |
IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
|
sl@0
|
116 |
IMPORT_C void SetPageOrientation(TPageSpec::TPageOrientation aPageOrientation);
|
sl@0
|
117 |
private:
|
sl@0
|
118 |
CPdrTypefaceStore(CStreamStore& aStore, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
|
sl@0
|
119 |
void ConstructL(TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation);
|
sl@0
|
120 |
CFontInfo* FontInfoL(TStreamId aStreamId) const;
|
sl@0
|
121 |
CPdrTranslates* TranslatesL(TStreamId aStreamId) const;
|
sl@0
|
122 |
TInt GetNearestFontHeightIndex(TInt aTypefaceIndex, TInt aHeightInTwips) const;
|
sl@0
|
123 |
TFontStyle GetNearestFontStyle(TInt aTypefaceIndex, TInt aHeightIndex, const TFontStyle& aFontStyle) const;
|
sl@0
|
124 |
TBool IsFontLoaded(CFont*& aFont, const TFontSpec& aFontSpecInTwips, TInt aHeightInPixels) const;
|
sl@0
|
125 |
CInfoFont* NewFontL(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, TStreamId aFontInfoStreamId);
|
sl@0
|
126 |
TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
|
sl@0
|
127 |
public:
|
sl@0
|
128 |
CPdrDevice* iPdrDevice;
|
sl@0
|
129 |
private:
|
sl@0
|
130 |
CStreamStore* iStore;
|
sl@0
|
131 |
TInt iKPixelHeightInTwips;
|
sl@0
|
132 |
CArrayPtr<CTypefaceFonts>* iTypefaceFontsList;
|
sl@0
|
133 |
CArrayPtr<CTypefaceFonts>* iPortraitTypefaceFontsList;
|
sl@0
|
134 |
CArrayPtr<CTypefaceFonts>* iLandscapeTypefaceFontsList;
|
sl@0
|
135 |
CArrayPtr<CTypefaceFonts>* iCurrentTypefaceFontsList;
|
sl@0
|
136 |
CArrayPtr<CPdrTranslates>* iTranslatesList;
|
sl@0
|
137 |
CArrayPtr<CFontInfo>* iFontInfoList;
|
sl@0
|
138 |
};
|
sl@0
|
139 |
|
sl@0
|
140 |
class CPageTextEntry : public CBase
|
sl@0
|
141 |
{
|
sl@0
|
142 |
public:
|
sl@0
|
143 |
IMPORT_C CPageTextEntry(const TPoint& aDrawPos, TInt aHeightInPixels, TInt aTextWidthInPixels, HBufC8* aText, TTextFormat* aTextFormat);
|
sl@0
|
144 |
IMPORT_C ~CPageTextEntry();
|
sl@0
|
145 |
IMPORT_C TPoint TopTextPos();
|
sl@0
|
146 |
public:
|
sl@0
|
147 |
|
sl@0
|
148 |
TPoint iDrawPos;
|
sl@0
|
149 |
|
sl@0
|
150 |
TInt iHeightInPixels;
|
sl@0
|
151 |
|
sl@0
|
152 |
TInt iTextWidthInPixels;
|
sl@0
|
153 |
|
sl@0
|
154 |
HBufC8* iText;
|
sl@0
|
155 |
|
sl@0
|
156 |
TTextFormat* iTextFormat;
|
sl@0
|
157 |
};
|
sl@0
|
158 |
|
sl@0
|
159 |
|
sl@0
|
160 |
class CPageText : public CBase
|
sl@0
|
161 |
{
|
sl@0
|
162 |
private:
|
sl@0
|
163 |
CPageText();
|
sl@0
|
164 |
void ConstructL();
|
sl@0
|
165 |
public:
|
sl@0
|
166 |
IMPORT_C static CPageText* NewL();
|
sl@0
|
167 |
IMPORT_C ~CPageText();
|
sl@0
|
168 |
IMPORT_C void Reset();
|
sl@0
|
169 |
IMPORT_C void AddEntryL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
|
sl@0
|
170 |
IMPORT_C TInt NumEntries();
|
sl@0
|
171 |
IMPORT_C CPageTextEntry* operator [] (TInt anIndex);
|
sl@0
|
172 |
/** This function is internal only, and is not intended for use. */
|
sl@0
|
173 |
inline TInt MaxFontHeightInPixels() const {return iMaxFontHeightInPixels;}
|
sl@0
|
174 |
private:
|
sl@0
|
175 |
|
sl@0
|
176 |
TInt iMaxFontHeightInPixels;
|
sl@0
|
177 |
|
sl@0
|
178 |
CArrayPtr<TTextFormat>* iTextFormatList;
|
sl@0
|
179 |
|
sl@0
|
180 |
CArrayPtr<CPageTextEntry>* iPageTextEntryList;
|
sl@0
|
181 |
};
|
sl@0
|
182 |
|
sl@0
|
183 |
|
sl@0
|
184 |
class CPdrGc : public CGraphicsContext
|
sl@0
|
185 |
{
|
sl@0
|
186 |
private:
|
sl@0
|
187 |
CPdrGc(CPdrDevice* aDevice);
|
sl@0
|
188 |
void ConstructL();
|
sl@0
|
189 |
public:
|
sl@0
|
190 |
static CPdrGc* NewL(CPdrDevice* aDevice);
|
sl@0
|
191 |
IMPORT_C ~CPdrGc();
|
sl@0
|
192 |
|
sl@0
|
193 |
IMPORT_C CGraphicsDevice* Device() const;
|
sl@0
|
194 |
IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
|
sl@0
|
195 |
IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
|
sl@0
|
196 |
IMPORT_C void SetClippingRect(const TRect& aRect);
|
sl@0
|
197 |
IMPORT_C void CancelClippingRect();
|
sl@0
|
198 |
IMPORT_C void Reset();
|
sl@0
|
199 |
|
sl@0
|
200 |
IMPORT_C void UseFont(const CFont* aFont);
|
sl@0
|
201 |
IMPORT_C void DiscardFont();
|
sl@0
|
202 |
|
sl@0
|
203 |
IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
|
sl@0
|
204 |
IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
|
sl@0
|
205 |
IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
|
sl@0
|
206 |
IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
|
sl@0
|
207 |
|
sl@0
|
208 |
IMPORT_C void SetPenColor(const TRgb& aColor);
|
sl@0
|
209 |
IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
|
sl@0
|
210 |
IMPORT_C void SetPenSize(const TSize& aSize = TSize(1, 1));
|
sl@0
|
211 |
|
sl@0
|
212 |
IMPORT_C void SetBrushColor(const TRgb& aColor);
|
sl@0
|
213 |
IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
|
sl@0
|
214 |
IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
|
sl@0
|
215 |
IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
|
sl@0
|
216 |
IMPORT_C void DiscardBrushPattern();
|
sl@0
|
217 |
|
sl@0
|
218 |
IMPORT_C void MoveTo(const TPoint& aPoint);
|
sl@0
|
219 |
IMPORT_C void MoveBy(const TPoint& aVector);
|
sl@0
|
220 |
IMPORT_C void Plot(const TPoint& aPoint);
|
sl@0
|
221 |
|
sl@0
|
222 |
IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
|
sl@0
|
223 |
IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
|
sl@0
|
224 |
IMPORT_C void DrawLineTo(const TPoint& aPoint);
|
sl@0
|
225 |
IMPORT_C void DrawLineBy(const TPoint& aVector);
|
sl@0
|
226 |
IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
|
sl@0
|
227 |
IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
|
sl@0
|
228 |
|
sl@0
|
229 |
IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
|
sl@0
|
230 |
IMPORT_C void DrawEllipse(const TRect& aRect);
|
sl@0
|
231 |
IMPORT_C void DrawRect(const TRect& aRect);
|
sl@0
|
232 |
IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
|
sl@0
|
233 |
IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
|
sl@0
|
234 |
IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
|
sl@0
|
235 |
|
sl@0
|
236 |
IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
|
sl@0
|
237 |
IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
|
sl@0
|
238 |
IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
|
sl@0
|
239 |
IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
|
sl@0
|
240 |
IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
|
sl@0
|
241 |
|
sl@0
|
242 |
IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
|
sl@0
|
243 |
IMPORT_C void DrawTextL(const TDesC& aString, const TPoint& aPosition);
|
sl@0
|
244 |
IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
|
sl@0
|
245 |
|
sl@0
|
246 |
IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
|
sl@0
|
247 |
IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
|
sl@0
|
248 |
IMPORT_C void CancelClippingRegion();
|
sl@0
|
249 |
IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
|
sl@0
|
250 |
IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
|
sl@0
|
251 |
IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
|
sl@0
|
252 |
IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
|
sl@0
|
253 |
|
sl@0
|
254 |
private:
|
sl@0
|
255 |
CPdrControl* PdrControl() const;
|
sl@0
|
256 |
|
sl@0
|
257 |
private:
|
sl@0
|
258 |
|
sl@0
|
259 |
CPdrDevice* iPdrDevice;
|
sl@0
|
260 |
|
sl@0
|
261 |
CFbsBitGc* iBandedGc;
|
sl@0
|
262 |
|
sl@0
|
263 |
CFbsFont* iFbsFont;
|
sl@0
|
264 |
|
sl@0
|
265 |
CFont* iBandedFont;
|
sl@0
|
266 |
|
sl@0
|
267 |
CInfoFont* iFont;
|
sl@0
|
268 |
|
sl@0
|
269 |
TPoint iOrigin;
|
sl@0
|
270 |
|
sl@0
|
271 |
TPoint iPosition;
|
sl@0
|
272 |
|
sl@0
|
273 |
TFontUnderline iUnderlineStyle;
|
sl@0
|
274 |
|
sl@0
|
275 |
TFontStrikethrough iStrikethroughStyle;
|
sl@0
|
276 |
|
sl@0
|
277 |
TRect iClippingRect; // Relative to absolute origin
|
sl@0
|
278 |
|
sl@0
|
279 |
TInt iWordExcessWidthInPixels;
|
sl@0
|
280 |
|
sl@0
|
281 |
TInt iNumGaps;
|
sl@0
|
282 |
|
sl@0
|
283 |
TInt iCharExcessWidthInPixels;
|
sl@0
|
284 |
|
sl@0
|
285 |
TInt iNumChars;
|
sl@0
|
286 |
|
sl@0
|
287 |
TRgb iPenColor;
|
sl@0
|
288 |
|
sl@0
|
289 |
TBool iPrintTextUsingBitmaps;
|
sl@0
|
290 |
};
|
sl@0
|
291 |
|
sl@0
|
292 |
|
sl@0
|
293 |
|
sl@0
|
294 |
#endif // PDRSTOREFONT_H
|