os/graphics/printingservices/printerdriversupport/inc/pdrtext.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/printingservices/printerdriversupport/inc/pdrtext.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,294 @@
     1.4 +// Copyright (c) 1997-2010 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 "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.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 +// Font and text classes used by printer drivers.
    1.18 +
    1.19 +#ifndef PDRSTOREFONT_H
    1.20 +#define PDRSTOREFONT_H
    1.21 +
    1.22 +/**
    1.23 +@file
    1.24 +@internalAll - Internal to Symbian
    1.25 +@released
    1.26 + */
    1.27 +
    1.28 +#include <s32mem.h>
    1.29 +#include <gdi.h>
    1.30 +
    1.31 +
    1.32 +class CFbsBitGc;
    1.33 +class TPdrResource;
    1.34 +class CPdrDevice;
    1.35 +class CFontInfo;
    1.36 +class CPdrTranslates;
    1.37 +class CInfoFont;
    1.38 +class CTypefaceFonts;
    1.39 +class TTextFormat;
    1.40 +class CPdrControl;
    1.41 +class CFbsFont;
    1.42 +
    1.43 +
    1.44 +class CPdrResources : public CBase
    1.45 +	{
    1.46 +public:
    1.47 +	IMPORT_C CPdrResources();
    1.48 +	IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId aStreamId);
    1.49 +	IMPORT_C ~CPdrResources();
    1.50 +	IMPORT_C TPtrC8 ResourceString(TInt anId) const;
    1.51 +private:
    1.52 +	TInt iNumResources;
    1.53 +	
    1.54 +	TPdrResource* iResourceList;
    1.55 +	};
    1.56 +
    1.57 +
    1.58 +class TTypefaceFontsEntry	
    1.59 +	{
    1.60 +public:
    1.61 +	IMPORT_C void InternalizeL(RReadStream& aStream);
    1.62 +public:
    1.63 +	
    1.64 +	TStreamId iStreamId;
    1.65 +	
    1.66 +	TBool iNotInPortrait;
    1.67 +	
    1.68 +	TBool iNotInLandscape;
    1.69 +	};
    1.70 +
    1.71 +
    1.72 +class CPdrModelInfo : public CBase	
    1.73 +	{
    1.74 +public:
    1.75 +	IMPORT_C CPdrModelInfo();
    1.76 +	IMPORT_C ~CPdrModelInfo();
    1.77 +	IMPORT_C void InternalizeL(RReadStream& aStream);
    1.78 +public:
    1.79 +	
    1.80 +	TInt iFlags;
    1.81 +	
    1.82 +	TInt iKPixelWidthInTwips;
    1.83 +	
    1.84 +	TInt iKPixelHeightInTwips;
    1.85 +	
    1.86 +	TPoint iPortraitOffsetInPixels;
    1.87 +	
    1.88 +	TPoint iLandscapeOffsetInPixels;
    1.89 +	
    1.90 +	TMargins iMinMarginsInPixels;
    1.91 +	
    1.92 +	TDisplayMode iDisplayMode;
    1.93 +	
    1.94 +	TInt iNumTypefaceFonts;
    1.95 +	
    1.96 +	TTypefaceFontsEntry* iTypefaceFontsEntryList;
    1.97 +	
    1.98 +	TStreamId iResourcesStreamId;
    1.99 +	
   1.100 +	TStreamId iSpareStreamId; 
   1.101 +	};
   1.102 +
   1.103 +
   1.104 +/** 
   1.105 +@internalTechnology
   1.106 + */
   1.107 +class CPdrTypefaceStore : public CTypefaceStore
   1.108 +	{
   1.109 +public:
   1.110 +	IMPORT_C static CPdrTypefaceStore* NewL(CStreamStore& aStore, TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
   1.111 +	IMPORT_C ~CPdrTypefaceStore();
   1.112 +	// CTypefaceStore implementation
   1.113 +	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
   1.114 +	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
   1.115 +	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
   1.116 +	IMPORT_C TInt NumTypefaces() const;
   1.117 +	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
   1.118 +	IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
   1.119 +	IMPORT_C void SetPageOrientation(TPageSpec::TPageOrientation aPageOrientation);
   1.120 +private:
   1.121 +	CPdrTypefaceStore(CStreamStore& aStore, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
   1.122 +	void ConstructL(TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation);
   1.123 +	CFontInfo* FontInfoL(TStreamId aStreamId) const;
   1.124 +	CPdrTranslates* TranslatesL(TStreamId aStreamId) const;
   1.125 +	TInt GetNearestFontHeightIndex(TInt aTypefaceIndex, TInt aHeightInTwips) const;
   1.126 +	TFontStyle GetNearestFontStyle(TInt aTypefaceIndex, TInt aHeightIndex, const TFontStyle& aFontStyle) const;
   1.127 +	TBool IsFontLoaded(CFont*& aFont, const TFontSpec& aFontSpecInTwips, TInt aHeightInPixels) const;
   1.128 +	CInfoFont* NewFontL(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, TStreamId aFontInfoStreamId);
   1.129 +	TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
   1.130 +public:
   1.131 +	CPdrDevice* iPdrDevice;
   1.132 +private:
   1.133 +	CStreamStore* iStore;
   1.134 +	TInt iKPixelHeightInTwips;
   1.135 +	CArrayPtr<CTypefaceFonts>* iTypefaceFontsList;
   1.136 +	CArrayPtr<CTypefaceFonts>* iPortraitTypefaceFontsList;
   1.137 +	CArrayPtr<CTypefaceFonts>* iLandscapeTypefaceFontsList;
   1.138 +	CArrayPtr<CTypefaceFonts>* iCurrentTypefaceFontsList;
   1.139 +	CArrayPtr<CPdrTranslates>* iTranslatesList;
   1.140 +	CArrayPtr<CFontInfo>* iFontInfoList;
   1.141 +	};
   1.142 +
   1.143 +class CPageTextEntry : public CBase
   1.144 +	{
   1.145 +public:
   1.146 +	IMPORT_C CPageTextEntry(const TPoint& aDrawPos, TInt aHeightInPixels, TInt aTextWidthInPixels, HBufC8* aText, TTextFormat* aTextFormat);
   1.147 +	IMPORT_C ~CPageTextEntry();
   1.148 +	IMPORT_C TPoint TopTextPos();
   1.149 +public:
   1.150 +	
   1.151 +	TPoint iDrawPos;
   1.152 +	
   1.153 +	TInt iHeightInPixels;
   1.154 +	
   1.155 +	TInt iTextWidthInPixels;
   1.156 +	
   1.157 +	HBufC8* iText;
   1.158 +	
   1.159 +	TTextFormat* iTextFormat;
   1.160 +	};
   1.161 +
   1.162 +
   1.163 +class CPageText : public CBase
   1.164 +	{
   1.165 +private:
   1.166 +	CPageText();
   1.167 +	void ConstructL();
   1.168 +public:
   1.169 +	IMPORT_C static CPageText* NewL();
   1.170 +	IMPORT_C ~CPageText();
   1.171 +	IMPORT_C void Reset();
   1.172 +	IMPORT_C void AddEntryL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
   1.173 +	IMPORT_C TInt NumEntries();
   1.174 +	IMPORT_C CPageTextEntry* operator [] (TInt anIndex);
   1.175 +	/** This function is internal only, and is not intended for use. */
   1.176 +	inline TInt MaxFontHeightInPixels() const {return iMaxFontHeightInPixels;}
   1.177 +private:
   1.178 +	
   1.179 +	TInt iMaxFontHeightInPixels;
   1.180 +	
   1.181 +	CArrayPtr<TTextFormat>* iTextFormatList;
   1.182 +	
   1.183 +	CArrayPtr<CPageTextEntry>* iPageTextEntryList;
   1.184 +	};
   1.185 +
   1.186 +
   1.187 +class CPdrGc : public CGraphicsContext	
   1.188 +	{
   1.189 +private:
   1.190 +	CPdrGc(CPdrDevice* aDevice);
   1.191 +	void ConstructL();
   1.192 +public:
   1.193 +	static CPdrGc* NewL(CPdrDevice* aDevice);
   1.194 +	IMPORT_C ~CPdrGc();
   1.195 +
   1.196 +	IMPORT_C CGraphicsDevice* Device() const;
   1.197 +	IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
   1.198 +	IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
   1.199 +	IMPORT_C void SetClippingRect(const TRect& aRect);
   1.200 +	IMPORT_C void CancelClippingRect();
   1.201 +	IMPORT_C void Reset();
   1.202 +
   1.203 +	IMPORT_C void UseFont(const CFont* aFont);
   1.204 +	IMPORT_C void DiscardFont();
   1.205 +
   1.206 +	IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
   1.207 +	IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
   1.208 +	IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
   1.209 +	IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
   1.210 +
   1.211 +	IMPORT_C void SetPenColor(const TRgb& aColor);
   1.212 +	IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
   1.213 +	IMPORT_C void SetPenSize(const TSize& aSize = TSize(1, 1));
   1.214 +
   1.215 +	IMPORT_C void SetBrushColor(const TRgb& aColor);
   1.216 +	IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
   1.217 +	IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
   1.218 +	IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
   1.219 +	IMPORT_C void DiscardBrushPattern();
   1.220 +
   1.221 +	IMPORT_C void MoveTo(const TPoint& aPoint);
   1.222 +	IMPORT_C void MoveBy(const TPoint& aVector);
   1.223 +	IMPORT_C void Plot(const TPoint& aPoint);
   1.224 +
   1.225 +	IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
   1.226 +	IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
   1.227 +	IMPORT_C void DrawLineTo(const TPoint& aPoint);
   1.228 +	IMPORT_C void DrawLineBy(const TPoint& aVector);
   1.229 +	IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
   1.230 +	IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
   1.231 +
   1.232 +	IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
   1.233 +	IMPORT_C void DrawEllipse(const TRect& aRect);
   1.234 +	IMPORT_C void DrawRect(const TRect& aRect);
   1.235 +	IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
   1.236 +	IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
   1.237 +	IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
   1.238 +
   1.239 +	IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
   1.240 +	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
   1.241 +	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
   1.242 +	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
   1.243 +	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
   1.244 +
   1.245 +	IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
   1.246 +	IMPORT_C void DrawTextL(const TDesC& aString, const TPoint& aPosition);
   1.247 +	IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
   1.248 +									
   1.249 +	IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
   1.250 +	IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
   1.251 +	IMPORT_C void CancelClippingRegion();
   1.252 +	IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
   1.253 +	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);								
   1.254 +	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
   1.255 +	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,  const TRect& aSrcRect, const CWsBitmap*  aAlphaBmp, const TPoint& aAlphaPt);
   1.256 +	
   1.257 +private:
   1.258 +	CPdrControl* PdrControl() const;
   1.259 +
   1.260 +private:
   1.261 +	
   1.262 +	CPdrDevice* iPdrDevice;
   1.263 +	
   1.264 +	CFbsBitGc* iBandedGc;
   1.265 +	
   1.266 +	CFbsFont* iFbsFont;
   1.267 +	
   1.268 +	CFont* iBandedFont;
   1.269 +	
   1.270 +	CInfoFont* iFont;
   1.271 +	
   1.272 +	TPoint iOrigin;
   1.273 +	
   1.274 +	TPoint iPosition;
   1.275 +	
   1.276 +	TFontUnderline iUnderlineStyle;
   1.277 +	
   1.278 +	TFontStrikethrough iStrikethroughStyle;
   1.279 +	
   1.280 +	TRect iClippingRect;  // Relative to absolute origin
   1.281 +	
   1.282 +	TInt iWordExcessWidthInPixels;
   1.283 +	
   1.284 +	TInt iNumGaps;
   1.285 +	
   1.286 +	TInt iCharExcessWidthInPixels;
   1.287 +	
   1.288 +	TInt iNumChars;
   1.289 +	
   1.290 +	TRgb iPenColor;
   1.291 +	
   1.292 +	TBool iPrintTextUsingBitmaps;
   1.293 +	};
   1.294 +
   1.295 +
   1.296 +
   1.297 +#endif // PDRSTOREFONT_H