1.1 --- a/epoc32/include/pdrstore.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/pdrstore.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,718 @@
1.4 -pdrstore.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef PDRSTORE_H
1.21 +#define PDRSTORE_H
1.22 +
1.23 +#include <s32mem.h>
1.24 +#include <gdi.h>
1.25 +#include <fbs.h>
1.26 +
1.27 +class CStreamStore;
1.28 +
1.29 +class CFontInfo;
1.30 +class TPdrResource;
1.31 +class CPdrTranslates;
1.32 +class CTypefaceFonts;
1.33 +class CBandedDevice;
1.34 +class CFbsBitGc;
1.35 +class CFbsFont;
1.36 +class CWsBitmap;
1.37 +
1.38 +/**
1.39 +Codes used by printer drivers.
1.40 +@publishedAll
1.41 +@released
1.42 +*/
1.43 +enum TFbsEncoding
1.44 + {
1.45 + /** No code. */
1.46 + EFbsNone = 0,
1.47 + /** Run length. */
1.48 + EFbsRunLength = 1,
1.49 + /** TIFF. */
1.50 + EFbsTIFF = 2,
1.51 + /** Delta row. */
1.52 + EFbsDeltaRow = 3,
1.53 + /** Reserved. */
1.54 + EFbsReserved = 4,
1.55 + /** Adaptive. */
1.56 + EFbsAdaptive = 5
1.57 + };
1.58 +
1.59 +/**
1.60 +Determines the raster mode used by printer drivers.
1.61 +@publishedAll
1.62 +@released
1.63 +*/
1.64 +enum TFbsRasterGraphicsMode
1.65 + {
1.66 + /** Logical page orientation. */
1.67 + EFbsLogicalPageOrientation = 0,
1.68 + /** Physcial page orientation. */
1.69 + EFbsPhysicalPageOrientation = 3
1.70 + };
1.71 +
1.72 +/**
1.73 +Enumerates resources used by printer drivers.
1.74 +@publishedAll
1.75 +@released
1.76 +*/
1.77 +enum TPdrResourceId // Corresponds to IdentResource in PDRREADR.H
1.78 + {
1.79 + /** Reset. */
1.80 + EPdrReset,
1.81 + /** Set page size. */
1.82 + EPdrSetPageSize,
1.83 + /** Preamble. */
1.84 + EPdrPreAmble,
1.85 + /** Postamble. */
1.86 + EPdrPostAmble,
1.87 + /** Set text colour. */
1.88 + EPdrSetTextColor,
1.89 + /** Bold text. */
1.90 + EPdrBoldOn,
1.91 + /** Normal text weighting. */
1.92 + EPdrBoldOff,
1.93 + /** Italic text. */
1.94 + EPdrItalicOn,
1.95 + /** Normal text slant. */
1.96 + EPdrItalicOff,
1.97 + /** Underline text. */
1.98 + EPdrUnderlineOn,
1.99 + /** No text underline. */
1.100 + EPdrUnderlineOff,
1.101 + /** Strike through text. */
1.102 + EPdrStrikethroughOn,
1.103 + /** No text strike through. */
1.104 + EPdrStrikethroughOff,
1.105 + /** New page. */
1.106 + EPdrNewPage,
1.107 + /** Portrait view. */
1.108 + EPdrPortrait,
1.109 + /** Landscape view. */
1.110 + EPdrLandscape,
1.111 + /** Set the x-position of the printer head. */
1.112 + EPdrSetXPos,
1.113 + /** Set the y-position of the printer head. */
1.114 + EPdrSetYPos,
1.115 + /** Increment the x-position. */
1.116 + EPdrIncrementXPos,
1.117 + /** Increment the y-position. */
1.118 + EPdrIncrementYPos,
1.119 + /** Carriage return. */
1.120 + EPdrCarriageReturn,
1.121 + /** Set the graphics colour. */
1.122 + EPdrSetGraphicsColor,
1.123 + /** Starting position of bitmap. */
1.124 + EPdrBitmapStart,
1.125 + /** End position of bitmap. */
1.126 + EPdrBitmapEnd,
1.127 + /** Scan line. */
1.128 + EPdrScanLine,
1.129 + /** End of scan line. */
1.130 + EPdrEndScanLine,
1.131 + /** Extra resource holder. */
1.132 + EPdrResource1,
1.133 + /** Extra resource holder. */
1.134 + EPdrResource2,
1.135 + /** Extra resource holder. */
1.136 + EPdrResource3,
1.137 + /** Extra resource holder. */
1.138 + EPdrResource4,
1.139 + /** Extra resource holder. */
1.140 + EPdrResource5,
1.141 + /** Extra resource holder. */
1.142 + EPdrResource6,
1.143 + /** Extra resource holder. */
1.144 + EPdrResource7,
1.145 + /** Extra resource holder. */
1.146 + EPdrResource8
1.147 + };
1.148 +
1.149 +/**
1.150 +Maximum length of a printer command string.
1.151 +@publishedAll
1.152 +@released
1.153 +*/
1.154 +const TInt KMaxCommandStringLength = 0x40;
1.155 +/**
1.156 +Defines a command string used by printer drivers.
1.157 +@publishedAll
1.158 +@released
1.159 +*/
1.160 +typedef TBuf8<KMaxCommandStringLength> TCommandString;
1.161 +
1.162 +
1.163 +class CPdrResources : public CBase
1.164 +/** @internalAll Internal to Symbian */
1.165 + {
1.166 +public:
1.167 + IMPORT_C CPdrResources();
1.168 + IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId aStreamId);
1.169 + IMPORT_C ~CPdrResources();
1.170 + IMPORT_C TPtrC8 ResourceString(TInt anId) const;
1.171 +private:
1.172 + TInt iNumResources;
1.173 +
1.174 + TPdrResource* iResourceList;
1.175 + };
1.176 +
1.177 +
1.178 +class CPdrDevice;
1.179 +class CInfoFont : public CFont
1.180 +/** @internalTechnology */
1.181 + {
1.182 + friend class CPdrTypefaceStore;
1.183 +public:
1.184 + // New functions
1.185 + IMPORT_C HBufC8* TranslateStringL(const TDesC& aString) const;
1.186 + IMPORT_C TPtrC8 CommandString() const;
1.187 + IMPORT_C TBool RepertoireContains(TChar aChar) const;
1.188 + IMPORT_C TBool AllCharsInFontRepertoire(const TDesC& aString, TInt& aFirstCharNotInRepertoire, TInt& aLength) const;
1.189 + inline CFontInfo* FontInfo() const {return iFontInfo;}
1.190 + CFont* RealFont() const;
1.191 +private:
1.192 + CInfoFont(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, CPdrDevice* aPdrDevice);
1.193 + ~CInfoFont();
1.194 + TInt Width(TInt aNum) const;
1.195 + TInt Height(TInt aNum) const;
1.196 + void CreateBandedFontIfRequired();
1.197 + // From CFont
1.198 + IMPORT_C virtual TUid DoTypeUid() const;
1.199 + IMPORT_C virtual TInt DoHeightInPixels() const;
1.200 + IMPORT_C virtual TInt DoAscentInPixels() const;
1.201 + IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const;
1.202 + IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC &aText) const;
1.203 + IMPORT_C virtual TInt DoBaselineOffsetInPixels() const;
1.204 + IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels) const;
1.205 + IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels, TInt &aExcessWidthInPixels) const;
1.206 + IMPORT_C virtual TInt DoMaxCharWidthInPixels() const;
1.207 + IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const;
1.208 + IMPORT_C virtual TFontSpec DoFontSpecInTwips() const;
1.209 +private:
1.210 + TCommandString iCommandString;
1.211 + TInt iBaselineOffsetInPixels;
1.212 + TFontSpec iFontSpecInTwips;
1.213 + TInt iFontInfoHeightInTwips;
1.214 + TInt iHeightInPixels;
1.215 + CFontInfo* iFontInfo;
1.216 + CPdrTranslates* iTranslates;
1.217 + CPdrDevice* iPdrDevice;
1.218 + CFont* iRealFont;
1.219 + };
1.220 +
1.221 +
1.222 +class TTypefaceFontsEntry
1.223 +/** @internalAll Internal to Symbian */
1.224 + {
1.225 +public:
1.226 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.227 +public:
1.228 +
1.229 + TStreamId iStreamId;
1.230 +
1.231 + TBool iNotInPortrait;
1.232 +
1.233 + TBool iNotInLandscape;
1.234 + };
1.235 +
1.236 +
1.237 +class CPdrModelInfo : public CBase
1.238 +/** @internalAll Internal to Symbian */
1.239 + {
1.240 +public:
1.241 + IMPORT_C CPdrModelInfo();
1.242 + IMPORT_C ~CPdrModelInfo();
1.243 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.244 +public:
1.245 +
1.246 + TInt iFlags;
1.247 +
1.248 + TInt iKPixelWidthInTwips;
1.249 +
1.250 + TInt iKPixelHeightInTwips;
1.251 +
1.252 + TPoint iPortraitOffsetInPixels;
1.253 +
1.254 + TPoint iLandscapeOffsetInPixels;
1.255 +
1.256 + TMargins iMinMarginsInPixels;
1.257 +
1.258 + TDisplayMode iDisplayMode;
1.259 +
1.260 + TInt iNumTypefaceFonts;
1.261 +
1.262 + TTypefaceFontsEntry* iTypefaceFontsEntryList;
1.263 +
1.264 + TStreamId iResourcesStreamId;
1.265 +
1.266 + TStreamId iSpareStreamId;
1.267 + };
1.268 +
1.269 +
1.270 +class CPdrTypefaceStore : public CTypefaceStore
1.271 +/** @internalTechnology */
1.272 + {
1.273 +public:
1.274 + IMPORT_C static CPdrTypefaceStore* NewL(CStreamStore& aStore, TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
1.275 + IMPORT_C ~CPdrTypefaceStore();
1.276 + // CTypefaceStore implementation
1.277 + IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.278 + IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.279 + IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
1.280 + IMPORT_C TInt NumTypefaces() const;
1.281 + IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
1.282 + IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
1.283 + IMPORT_C void SetPageOrientation(TPageSpec::TPageOrientation aPageOrientation);
1.284 +private:
1.285 + CPdrTypefaceStore(CStreamStore& aStore, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
1.286 + void ConstructL(TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation);
1.287 + CFontInfo* FontInfoL(TStreamId aStreamId) const;
1.288 + CPdrTranslates* TranslatesL(TStreamId aStreamId) const;
1.289 + TInt GetNearestFontHeightIndex(TInt aTypefaceIndex, TInt aHeightInTwips) const;
1.290 + TFontStyle GetNearestFontStyle(TInt aTypefaceIndex, TInt aHeightIndex, const TFontStyle& aFontStyle) const;
1.291 + TBool IsFontLoaded(CFont*& aFont, const TFontSpec& aFontSpecInTwips, TInt aHeightInPixels) const;
1.292 + CInfoFont* NewFontL(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, TStreamId aFontInfoStreamId);
1.293 + TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
1.294 +public:
1.295 + CPdrDevice* iPdrDevice;
1.296 +private:
1.297 + CStreamStore* iStore;
1.298 + TInt iKPixelHeightInTwips;
1.299 + CArrayPtr<CTypefaceFonts>* iTypefaceFontsList;
1.300 + CArrayPtr<CTypefaceFonts>* iPortraitTypefaceFontsList;
1.301 + CArrayPtr<CTypefaceFonts>* iLandscapeTypefaceFontsList;
1.302 + CArrayPtr<CTypefaceFonts>* iCurrentTypefaceFontsList;
1.303 + CArrayPtr<CPdrTranslates>* iTranslatesList;
1.304 + CArrayPtr<CFontInfo>* iFontInfoList;
1.305 + };
1.306 +
1.307 +
1.308 +/**
1.309 +@publishedAll
1.310 +@released
1.311 +*/
1.312 +class CPageBuffer : public CActive
1.313 + {
1.314 +public:
1.315 + IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort);
1.316 + IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort, TInt aGranularity);
1.317 + IMPORT_C void StartFlush(TRequestStatus& aRequestStatus);
1.318 + IMPORT_C void AddBytesL(const TDesC8& aDes);
1.319 + IMPORT_C RWriteStream& CreateWriteStreamL();
1.320 + IMPORT_C void CloseWriteStream();
1.321 + IMPORT_C ~CPageBuffer();
1.322 + void DoCancel();
1.323 + void RunL();
1.324 +private:
1.325 + void ConstructL();
1.326 + CPageBuffer(CPrinterPort* aPrinterPort, TInt aGranularity);
1.327 + void Queue();
1.328 +private:
1.329 +
1.330 + TRequestStatus* iRequestStatus;
1.331 +
1.332 + TInt iWritePos;
1.333 +
1.334 + TInt iGranularity;
1.335 +
1.336 + CBufSeg* iBuffer;
1.337 +
1.338 + TPtr8 iPtr;
1.339 +
1.340 + CPrinterPort* iPrinterPort;
1.341 +
1.342 + RBufWriteStream iWriteStream;
1.343 +
1.344 + CBufSeg* iWriteStreamBuffer;
1.345 + };
1.346 +
1.347 +
1.348 +class TTextFormat
1.349 +/** @internalAll Internal to Symbian */
1.350 + {
1.351 +public:
1.352 + IMPORT_C TTextFormat();
1.353 + IMPORT_C TTextFormat(const TFontUnderline anUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const TDesC8& aFontString, const TFontStyle& aFontStyle);
1.354 + IMPORT_C TBool operator == (const TTextFormat& aFormat) const;
1.355 +public:
1.356 +
1.357 + TFontUnderline iUnderlineStyle;
1.358 +
1.359 + TFontStrikethrough iStrikethroughStyle;
1.360 +
1.361 + TRgb iColor;
1.362 +
1.363 + TCommandString iFontString;
1.364 +
1.365 + TFontStyle iFontStyle;
1.366 + };
1.367 +
1.368 +
1.369 +class CPageTextEntry : public CBase
1.370 +/** @internalAll Internal to Symbian */
1.371 + {
1.372 +public:
1.373 + IMPORT_C CPageTextEntry(const TPoint& aDrawPos, TInt aHeightInPixels, TInt aTextWidthInPixels, HBufC8* aText, TTextFormat* aTextFormat);
1.374 + IMPORT_C ~CPageTextEntry();
1.375 + IMPORT_C TPoint TopTextPos();
1.376 +public:
1.377 +
1.378 + TPoint iDrawPos;
1.379 +
1.380 + TInt iHeightInPixels;
1.381 +
1.382 + TInt iTextWidthInPixels;
1.383 +
1.384 + HBufC8* iText;
1.385 +
1.386 + TTextFormat* iTextFormat;
1.387 + };
1.388 +
1.389 +
1.390 +class CPageText : public CBase
1.391 +/** @internalAll Internal to Symbian */
1.392 + {
1.393 +private:
1.394 + CPageText();
1.395 + void ConstructL();
1.396 +public:
1.397 + IMPORT_C static CPageText* NewL();
1.398 + IMPORT_C ~CPageText();
1.399 + IMPORT_C void Reset();
1.400 + IMPORT_C void AddEntryL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
1.401 + IMPORT_C TInt NumEntries();
1.402 + IMPORT_C CPageTextEntry* operator [] (TInt anIndex);
1.403 + /** This function is internal only, and is not intended for use. */
1.404 + inline TInt MaxFontHeightInPixels() const {return iMaxFontHeightInPixels;}
1.405 +private:
1.406 +
1.407 + TInt iMaxFontHeightInPixels;
1.408 +
1.409 + CArrayPtr<TTextFormat>* iTextFormatList;
1.410 +
1.411 + CArrayPtr<CPageTextEntry>* iPageTextEntryList;
1.412 + };
1.413 +
1.414 +class CPdrControl;
1.415 +
1.416 +
1.417 +/**
1.418 +@publishedAll
1.419 +@released
1.420 +@see CFbsDrvDevice
1.421 +*/
1.422 +class CPdrDevice : public CPrinterDevice
1.423 + {
1.424 +protected:
1.425 + IMPORT_C CPdrDevice();
1.426 +public:
1.427 + IMPORT_C virtual ~CPdrDevice();
1.428 + IMPORT_C void SelectPageSpecInTwips(const TPageSpec& aPageSpec);
1.429 + IMPORT_C TDisplayMode DisplayMode() const;
1.430 + IMPORT_C TSize SizeInPixels() const;
1.431 + IMPORT_C TSize SizeInTwips() const;
1.432 + IMPORT_C TRect PrintablePageInPixels() const;
1.433 + IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
1.434 + IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
1.435 + IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
1.436 + IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
1.437 + IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.438 + IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec);
1.439 + IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);
1.440 + IMPORT_C TInt NumTypefaces() const;
1.441 + IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const;
1.442 + IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
1.443 + IMPORT_C void PaletteAttributes(TBool& aModifiable, TInt& aNumEntries) const;
1.444 + IMPORT_C void SetPalette(CPalette* aPalette);
1.445 + IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
1.446 + IMPORT_C TPrinterModelEntry Model() const;
1.447 + IMPORT_C TInt Flags() const;
1.448 + IMPORT_C TInt SetModel(const TPrinterModelHeader& aModel, CStreamStore& aStore);
1.449 + IMPORT_C void ReleaseFont(CFont* aFont);
1.450 + IMPORT_C TPoint OffsetInPixels();
1.451 +
1.452 +protected:
1.453 + IMPORT_C virtual TSize KPixelSizeInTwips() const;
1.454 +private:
1.455 + void DoSetModelL();
1.456 +protected:
1.457 +
1.458 + CStreamStore* iStore;
1.459 +
1.460 + TPrinterModelHeader iModel;
1.461 +
1.462 + CPdrModelInfo* iModelInfo;
1.463 +
1.464 + CPdrTypefaceStore* iTypefaceStore;
1.465 + };
1.466 +
1.467 +
1.468 +/**
1.469 +@publishedAll
1.470 +@released
1.471 +*/
1.472 +class CPdrControl : public CPrinterControl
1.473 + {
1.474 +public:
1.475 + IMPORT_C ~CPdrControl();
1.476 + IMPORT_C TInt CreateContext(CGraphicsContext*& aGC);
1.477 + IMPORT_C TInt BandsPerPage();
1.478 + IMPORT_C TMoreOnPage QueueGetBand(TRequestStatus& aStatus, TBandAttributes& aBand); // returns affirmative if more to print on current page
1.479 + IMPORT_C void QueueEndPrint(TRequestStatus& aStatus); // Called at finish to flush buffer, tidy up printer etc.
1.480 + IMPORT_C void AbortPrint(); // tidy up synchronously in a short time
1.481 + IMPORT_C virtual void DrawTextL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
1.482 + IMPORT_C TBool IsGraphicsBand() const;
1.483 + inline CBandedDevice* BandedDevice() const {return iBandedDevice;}
1.484 +protected:
1.485 + IMPORT_C CPdrControl(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort);
1.486 + IMPORT_C virtual void DoQueueGetBandL();
1.487 + IMPORT_C virtual void DoQueueEndPrintL();
1.488 + IMPORT_C void ConstructL(CStreamStore& aStore, TStreamId aStreamId);
1.489 +
1.490 + virtual void OutputBandL() = 0;
1.491 +
1.492 + IMPORT_C virtual void MoveToL(const TPoint& aPoint);
1.493 + IMPORT_C virtual void MoveByL(const TPoint& aVector);
1.494 + IMPORT_C virtual void OutputTextL(const TPoint& aPoint, TInt aWidthInPixels, const TTextFormat& aTextFormat, const TDesC8& aString);
1.495 +
1.496 + IMPORT_C virtual void SetPageSizeL();
1.497 + IMPORT_C virtual void SetPageOrientationL();
1.498 + IMPORT_C virtual void SetFontPostureL(const TFontPosture aPosture);
1.499 + IMPORT_C virtual void SetFontStrokeWeightL(const TFontStrokeWeight aStrokeWeight);
1.500 + IMPORT_C virtual void SetTextColorL(const TRgb& aColor);
1.501 + IMPORT_C virtual void CommandL(const TInt anId);
1.502 +
1.503 + IMPORT_C TBool TransformBuffer(); // These two functions are not implemented anywhere
1.504 + IMPORT_C TBool CompressBuffer(); // for this class. Nor do I believe they are defined
1.505 + // for a reason. But since they are part of the
1.506 + // existing interface of a DLL in a ROM I need to
1.507 + // patch. They get to stay there for the moment. CJC
1.508 +
1.509 +protected:
1.510 +
1.511 + CPdrDevice* iPdrDevice;
1.512 +
1.513 + CPageBuffer* iPageBuffer;
1.514 +
1.515 + CPdrResources* iResources;
1.516 +
1.517 + CBandedDevice* iBandedDevice;
1.518 +
1.519 + CPageText* iPageText;
1.520 +
1.521 + TInt iBandIndex;
1.522 +
1.523 + TInt iEntryIndex;
1.524 +
1.525 + TPoint iPosition;
1.526 +
1.527 + TTextFormat iTextFormat;
1.528 + };
1.529 +
1.530 +
1.531 +class CPdrGc : public CGraphicsContext
1.532 +/** @internalAll Internal to Symbian */
1.533 + {
1.534 +private:
1.535 + CPdrGc(CPdrDevice* aDevice);
1.536 + void ConstructL();
1.537 +public:
1.538 + static CPdrGc* NewL(CPdrDevice* aDevice);
1.539 + IMPORT_C ~CPdrGc();
1.540 +
1.541 + IMPORT_C CGraphicsDevice* Device() const;
1.542 + IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
1.543 + IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
1.544 + IMPORT_C void SetClippingRect(const TRect& aRect);
1.545 + IMPORT_C void CancelClippingRect();
1.546 + IMPORT_C void Reset();
1.547 +
1.548 + IMPORT_C void UseFont(const CFont* aFont);
1.549 + IMPORT_C void DiscardFont();
1.550 +
1.551 + IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
1.552 + IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
1.553 + IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
1.554 + IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
1.555 +
1.556 + IMPORT_C void SetPenColor(const TRgb& aColor);
1.557 + IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
1.558 + IMPORT_C void SetPenSize(const TSize& aSize = TSize(1, 1));
1.559 +
1.560 + IMPORT_C void SetBrushColor(const TRgb& aColor);
1.561 + IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
1.562 + IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
1.563 + IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
1.564 + IMPORT_C void DiscardBrushPattern();
1.565 +
1.566 + IMPORT_C void MoveTo(const TPoint& aPoint);
1.567 + IMPORT_C void MoveBy(const TPoint& aVector);
1.568 + IMPORT_C void Plot(const TPoint& aPoint);
1.569 +
1.570 + IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
1.571 + IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
1.572 + IMPORT_C void DrawLineTo(const TPoint& aPoint);
1.573 + IMPORT_C void DrawLineBy(const TPoint& aVector);
1.574 + IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
1.575 + IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
1.576 +
1.577 + IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
1.578 + IMPORT_C void DrawEllipse(const TRect& aRect);
1.579 + IMPORT_C void DrawRect(const TRect& aRect);
1.580 + IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
1.581 + IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
1.582 + IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
1.583 +
1.584 + IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
1.585 + IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
1.586 + IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
1.587 + IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
1.588 + IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
1.589 +
1.590 + IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
1.591 + IMPORT_C void DrawTextL(const TDesC& aString, const TPoint& aPosition);
1.592 + IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
1.593 +
1.594 + IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
1.595 + IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
1.596 + IMPORT_C void CancelClippingRegion();
1.597 + IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
1.598 + IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
1.599 + IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
1.600 + IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
1.601 +
1.602 +private:
1.603 + inline CPdrControl* PdrControl() const {return ((CPdrControl*) iPdrDevice->iControl);}
1.604 +
1.605 +private:
1.606 +
1.607 + CPdrDevice* iPdrDevice;
1.608 +
1.609 + CFbsBitGc* iBandedGc;
1.610 +
1.611 + CFbsFont* iFbsFont;
1.612 +
1.613 + CFont* iBandedFont;
1.614 +
1.615 + CInfoFont* iFont;
1.616 +
1.617 + TPoint iOrigin;
1.618 +
1.619 + TPoint iPosition;
1.620 +
1.621 + TFontUnderline iUnderlineStyle;
1.622 +
1.623 + TFontStrikethrough iStrikethroughStyle;
1.624 +
1.625 + TRect iClippingRect; // Relative to absolute origin
1.626 +
1.627 + TInt iWordExcessWidthInPixels;
1.628 +
1.629 + TInt iNumGaps;
1.630 +
1.631 + TInt iCharExcessWidthInPixels;
1.632 +
1.633 + TInt iNumChars;
1.634 +
1.635 + TRgb iPenColor;
1.636 +
1.637 + TBool iPrintTextUsingBitmaps;
1.638 + };
1.639 +
1.640 +
1.641 +/**
1.642 +@publishedAll
1.643 +@released
1.644 +*/
1.645 +class CFbsDrvDevice : public CPdrDevice
1.646 + {
1.647 +public:
1.648 + IMPORT_C CFbsDrvDevice();
1.649 + IMPORT_C ~CFbsDrvDevice();
1.650 +
1.651 + IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
1.652 + IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec);
1.653 + IMPORT_C void ReleaseFont(CFont* aFont);
1.654 + IMPORT_C TInt NumTypefaces() const;
1.655 + IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const;
1.656 + IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
1.657 +
1.658 + IMPORT_C TInt CreateContext(CGraphicsContext*& aGc);
1.659 + IMPORT_C void CreateControlL(CPrinterPort* aPrinterPort);
1.660 + IMPORT_C TInt SetModel(const TPrinterModelHeader& aModel, CStreamStore& aStore);
1.661 + IMPORT_C void LoadTypeFaceList();
1.662 + IMPORT_C TSize KPixelSizeInTwips() const;
1.663 + IMPORT_C void LoadTypeFaceListL();
1.664 + IMPORT_C TInt SetModelL(const TPrinterModelHeader& aModel, CStreamStore& aStore);
1.665 +private:
1.666 +// reserved virtual function space
1.667 + IMPORT_C virtual void Reserved_1();
1.668 +
1.669 +protected:
1.670 +
1.671 + CFbsTypefaceStore* iFbsTypefaceStore;
1.672 +
1.673 + CArrayFixFlat<TInt>* iGenTypefaceFontsList;
1.674 +
1.675 + CArrayFixFlat<TInt>* iGenTypefaceFontsType;
1.676 +
1.677 + TInt iFbsTypefaceCount;
1.678 +
1.679 + TInt iPdrTypefaceCount;
1.680 +
1.681 +private:
1.682 +
1.683 + TAny* iReserved;
1.684 + };
1.685 +
1.686 +
1.687 +/**
1.688 +@publishedAll
1.689 +@released
1.690 +*/
1.691 +class CFbsDrvControl : public CPdrControl
1.692 + {
1.693 +public:
1.694 + IMPORT_C static CFbsDrvControl* NewL(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort, CStreamStore& aStore, TStreamId aResourcesStreamId);
1.695 + IMPORT_C ~CFbsDrvControl();
1.696 +
1.697 +protected:
1.698 + IMPORT_C virtual void OutputBandL();
1.699 +
1.700 + IMPORT_C CFbsDrvControl(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort);
1.701 + IMPORT_C void ConstructL(CStreamStore& aStore, TStreamId aResourcesStreamId);
1.702 + IMPORT_C void SetPageSizeL();
1.703 +
1.704 + IMPORT_C TBool TransformBuffer();
1.705 + IMPORT_C TBool CompressBuffer();
1.706 +
1.707 +private:
1.708 +// reserved virtual function space
1.709 + IMPORT_C virtual void Reserved_1();
1.710 +
1.711 +protected:
1.712 +
1.713 + HBufC8* iScanLine;
1.714 +
1.715 + HBufC8* iCompressedScanLine;
1.716 +
1.717 +private:
1.718 +
1.719 + TAny* iReserved;
1.720 + };
1.721 +
1.722 +#endif