epoc32/include/pdrstore.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 pdrstore.h
     1 // Copyright (c) 1997-2009 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef PDRSTORE_H
       
    17 #define PDRSTORE_H
       
    18 
       
    19 #include <s32mem.h>
       
    20 #include <gdi.h>
       
    21 #include <fbs.h>
       
    22 
       
    23 class CStreamStore;
       
    24 
       
    25 class CFontInfo;
       
    26 class TPdrResource;
       
    27 class CPdrTranslates;
       
    28 class CTypefaceFonts;
       
    29 class CBandedDevice;
       
    30 class CFbsBitGc;
       
    31 class CFbsFont;
       
    32 class CWsBitmap;
       
    33 
       
    34 /** 
       
    35 Codes used by printer drivers. 
       
    36 @publishedAll
       
    37 @released
       
    38 */
       
    39 enum TFbsEncoding
       
    40 	{
       
    41 	/** No code. */
       
    42 	EFbsNone = 0,
       
    43 	/** Run length. */
       
    44 	EFbsRunLength = 1,
       
    45 	/** TIFF. */
       
    46 	EFbsTIFF = 2,
       
    47 	/** Delta row. */
       
    48 	EFbsDeltaRow = 3,
       
    49 	/** Reserved. */
       
    50 	EFbsReserved = 4,
       
    51 	/** Adaptive. */
       
    52 	EFbsAdaptive = 5
       
    53 	};
       
    54 
       
    55 /**
       
    56 Determines the raster mode used by printer drivers. 
       
    57 @publishedAll
       
    58 @released
       
    59 */
       
    60 enum TFbsRasterGraphicsMode
       
    61 	{
       
    62 	/** Logical page orientation. */
       
    63 	EFbsLogicalPageOrientation = 0,
       
    64 	/** Physcial page orientation. */
       
    65 	EFbsPhysicalPageOrientation = 3
       
    66 	};
       
    67 
       
    68 /**
       
    69 Enumerates resources used by printer drivers. 
       
    70 @publishedAll
       
    71 @released
       
    72 */
       
    73 enum TPdrResourceId  // Corresponds to IdentResource in PDRREADR.H
       
    74 	{
       
    75 	/** Reset. */
       
    76 	EPdrReset,
       
    77 	/** Set page size. */
       
    78 	EPdrSetPageSize,
       
    79 	/** Preamble. */
       
    80 	EPdrPreAmble,
       
    81 	/** Postamble. */
       
    82 	EPdrPostAmble,
       
    83 	/** Set text colour. */
       
    84 	EPdrSetTextColor,
       
    85 	/** Bold text. */
       
    86 	EPdrBoldOn,
       
    87 	/** Normal text weighting. */
       
    88 	EPdrBoldOff,
       
    89 	/** Italic text. */
       
    90 	EPdrItalicOn,
       
    91 	/** Normal text slant. */
       
    92 	EPdrItalicOff,
       
    93 	/** Underline text. */
       
    94 	EPdrUnderlineOn,
       
    95 	/** No text underline. */
       
    96 	EPdrUnderlineOff,
       
    97 	/** Strike through text. */
       
    98 	EPdrStrikethroughOn,
       
    99 	/** No text strike through. */
       
   100 	EPdrStrikethroughOff,
       
   101 	/** New page. */
       
   102 	EPdrNewPage,
       
   103 	/** Portrait view. */
       
   104 	EPdrPortrait,
       
   105 	/** Landscape view. */
       
   106 	EPdrLandscape,
       
   107 	/** Set the x-position of the printer head. */
       
   108 	EPdrSetXPos,
       
   109 	/** Set the y-position of the printer head. */
       
   110 	EPdrSetYPos,
       
   111 	/** Increment the x-position. */
       
   112 	EPdrIncrementXPos,
       
   113 	/** Increment the y-position. */
       
   114 	EPdrIncrementYPos,
       
   115 	/** Carriage return. */
       
   116 	EPdrCarriageReturn,
       
   117 	/** Set the graphics colour. */
       
   118 	EPdrSetGraphicsColor,
       
   119 	/** Starting position of bitmap. */
       
   120 	EPdrBitmapStart,
       
   121 	/** End position of bitmap. */
       
   122 	EPdrBitmapEnd,
       
   123 	/** Scan line. */
       
   124 	EPdrScanLine,
       
   125 	/** End of scan line. */
       
   126 	EPdrEndScanLine, 
       
   127 	/** Extra resource holder. */
       
   128 	EPdrResource1,
       
   129 	/** Extra resource holder. */
       
   130 	EPdrResource2,
       
   131 	/** Extra resource holder. */
       
   132 	EPdrResource3,
       
   133 	/** Extra resource holder. */
       
   134 	EPdrResource4,
       
   135 	/** Extra resource holder. */
       
   136 	EPdrResource5,
       
   137 	/** Extra resource holder. */
       
   138 	EPdrResource6,
       
   139 	/** Extra resource holder. */
       
   140 	EPdrResource7,
       
   141 	/** Extra resource holder. */
       
   142 	EPdrResource8
       
   143 	};
       
   144 
       
   145 /**
       
   146 Maximum length of a printer command string. 
       
   147 @publishedAll
       
   148 @released
       
   149 */
       
   150 const TInt KMaxCommandStringLength = 0x40;
       
   151 /**
       
   152 Defines a command string used by printer drivers. 
       
   153 @publishedAll
       
   154 @released
       
   155 */
       
   156 typedef TBuf8<KMaxCommandStringLength> TCommandString;
       
   157 
       
   158 
       
   159 class CPdrResources : public CBase
       
   160 /** @internalAll Internal to Symbian */
       
   161 	{
       
   162 public:
       
   163 	IMPORT_C CPdrResources();
       
   164 	IMPORT_C void RestoreL(CStreamStore& aStore, TStreamId aStreamId);
       
   165 	IMPORT_C ~CPdrResources();
       
   166 	IMPORT_C TPtrC8 ResourceString(TInt anId) const;
       
   167 private:
       
   168 	TInt iNumResources;
       
   169 	
       
   170 	TPdrResource* iResourceList;
       
   171 	};
       
   172 
       
   173 
       
   174 class CPdrDevice;
       
   175 class CInfoFont : public CFont
       
   176 /** @internalTechnology */	
       
   177 	{
       
   178 	friend class CPdrTypefaceStore;
       
   179 public:
       
   180 	// New functions
       
   181 	IMPORT_C HBufC8* TranslateStringL(const TDesC& aString) const;
       
   182 	IMPORT_C TPtrC8 CommandString() const;
       
   183 	IMPORT_C TBool RepertoireContains(TChar aChar) const;
       
   184 	IMPORT_C TBool AllCharsInFontRepertoire(const TDesC& aString, TInt& aFirstCharNotInRepertoire, TInt& aLength) const;
       
   185 	inline CFontInfo* FontInfo() const {return iFontInfo;}
       
   186 	CFont* RealFont() const;
       
   187 private:
       
   188 	CInfoFont(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, CPdrDevice* aPdrDevice);
       
   189 	~CInfoFont();
       
   190 	TInt Width(TInt aNum) const;
       
   191 	TInt Height(TInt aNum) const;
       
   192 	void CreateBandedFontIfRequired();
       
   193 	// From CFont
       
   194 	IMPORT_C virtual TUid DoTypeUid() const;
       
   195 	IMPORT_C virtual TInt DoHeightInPixels() const;
       
   196 	IMPORT_C virtual TInt DoAscentInPixels() const;
       
   197 	IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const;
       
   198 	IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC &aText) const;
       
   199 	IMPORT_C virtual TInt DoBaselineOffsetInPixels() const;
       
   200 	IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels) const;
       
   201 	IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels, TInt &aExcessWidthInPixels) const;
       
   202 	IMPORT_C virtual TInt DoMaxCharWidthInPixels() const;
       
   203 	IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const;
       
   204 	IMPORT_C virtual TFontSpec DoFontSpecInTwips() const;
       
   205 private:
       
   206     TCommandString iCommandString;
       
   207 	TInt iBaselineOffsetInPixels;
       
   208 	TFontSpec iFontSpecInTwips;
       
   209 	TInt iFontInfoHeightInTwips;
       
   210 	TInt iHeightInPixels;
       
   211 	CFontInfo* iFontInfo;
       
   212 	CPdrTranslates* iTranslates;
       
   213 	CPdrDevice* iPdrDevice;
       
   214 	CFont* iRealFont;
       
   215 	};
       
   216 
       
   217 
       
   218 class TTypefaceFontsEntry
       
   219 /** @internalAll Internal to Symbian */	
       
   220 	{
       
   221 public:
       
   222 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   223 public:
       
   224 	
       
   225 	TStreamId iStreamId;
       
   226 	
       
   227 	TBool iNotInPortrait;
       
   228 	
       
   229 	TBool iNotInLandscape;
       
   230 	};
       
   231 
       
   232 
       
   233 class CPdrModelInfo : public CBase
       
   234 /** @internalAll Internal to Symbian */	
       
   235 	{
       
   236 public:
       
   237 	IMPORT_C CPdrModelInfo();
       
   238 	IMPORT_C ~CPdrModelInfo();
       
   239 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   240 public:
       
   241 	
       
   242 	TInt iFlags;
       
   243 	
       
   244 	TInt iKPixelWidthInTwips;
       
   245 	
       
   246 	TInt iKPixelHeightInTwips;
       
   247 	
       
   248 	TPoint iPortraitOffsetInPixels;
       
   249 	
       
   250 	TPoint iLandscapeOffsetInPixels;
       
   251 	
       
   252 	TMargins iMinMarginsInPixels;
       
   253 	
       
   254 	TDisplayMode iDisplayMode;
       
   255 	
       
   256 	TInt iNumTypefaceFonts;
       
   257 	
       
   258 	TTypefaceFontsEntry* iTypefaceFontsEntryList;
       
   259 	
       
   260 	TStreamId iResourcesStreamId;
       
   261 	
       
   262 	TStreamId iSpareStreamId; 
       
   263 	};
       
   264 
       
   265 
       
   266 class CPdrTypefaceStore : public CTypefaceStore
       
   267 /** @internalTechnology */
       
   268 	{
       
   269 public:
       
   270 	IMPORT_C static CPdrTypefaceStore* NewL(CStreamStore& aStore, TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
       
   271 	IMPORT_C ~CPdrTypefaceStore();
       
   272 	// CTypefaceStore implementation
       
   273 	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
   274 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
   275 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
       
   276 	IMPORT_C TInt NumTypefaces() const;
       
   277 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
       
   278 	IMPORT_C void TypefaceSupport(TTypefaceSupport &aTypefaceSupport, TInt aTypefaceIndex) const;
       
   279 	IMPORT_C void SetPageOrientation(TPageSpec::TPageOrientation aPageOrientation);
       
   280 private:
       
   281 	CPdrTypefaceStore(CStreamStore& aStore, TInt aKPixelHeightInTwips, CPdrDevice* aPdrDevice);
       
   282 	void ConstructL(TInt aNumTypefacesFonts, TTypefaceFontsEntry* aTypefaceFontsEntryList, TPageSpec::TPageOrientation aPageOrientation);
       
   283 	CFontInfo* FontInfoL(TStreamId aStreamId) const;
       
   284 	CPdrTranslates* TranslatesL(TStreamId aStreamId) const;
       
   285 	TInt GetNearestFontHeightIndex(TInt aTypefaceIndex, TInt aHeightInTwips) const;
       
   286 	TFontStyle GetNearestFontStyle(TInt aTypefaceIndex, TInt aHeightIndex, const TFontStyle& aFontStyle) const;
       
   287 	TBool IsFontLoaded(CFont*& aFont, const TFontSpec& aFontSpecInTwips, TInt aHeightInPixels) const;
       
   288 	CInfoFont* NewFontL(TInt aBaselineOffsetInPixels, const TFontSpec& aFontSpecInTwips, TInt aFontInfoHeightInTwips, TInt aHeightInPixels, CPdrTranslates* aTranslates, const TDesC8& aCommandString, TStreamId aFontInfoStreamId);
       
   289 	TInt VerticalTwipsToPixels(TInt aTwipsHeight) const;
       
   290 public:
       
   291 	CPdrDevice* iPdrDevice;
       
   292 private:
       
   293 	CStreamStore* iStore;
       
   294 	TInt iKPixelHeightInTwips;
       
   295 	CArrayPtr<CTypefaceFonts>* iTypefaceFontsList;
       
   296 	CArrayPtr<CTypefaceFonts>* iPortraitTypefaceFontsList;
       
   297 	CArrayPtr<CTypefaceFonts>* iLandscapeTypefaceFontsList;
       
   298 	CArrayPtr<CTypefaceFonts>* iCurrentTypefaceFontsList;
       
   299 	CArrayPtr<CPdrTranslates>* iTranslatesList;
       
   300 	CArrayPtr<CFontInfo>* iFontInfoList;
       
   301 	};
       
   302 
       
   303 
       
   304 /**
       
   305 @publishedAll
       
   306 @released 
       
   307 */
       
   308 class CPageBuffer : public CActive
       
   309 	{
       
   310 public:
       
   311 	IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort);
       
   312 	IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort, TInt aGranularity);
       
   313 	IMPORT_C void StartFlush(TRequestStatus& aRequestStatus);
       
   314 	IMPORT_C void AddBytesL(const TDesC8& aDes);
       
   315 	IMPORT_C RWriteStream& CreateWriteStreamL();
       
   316 	IMPORT_C void CloseWriteStream();
       
   317 	IMPORT_C ~CPageBuffer();
       
   318 	void DoCancel();
       
   319 	void RunL();
       
   320 private:
       
   321 	void ConstructL();
       
   322 	CPageBuffer(CPrinterPort* aPrinterPort, TInt aGranularity);
       
   323 	void Queue();
       
   324 private:
       
   325 	
       
   326 	TRequestStatus* iRequestStatus;
       
   327 	
       
   328 	TInt iWritePos;
       
   329 	
       
   330 	TInt iGranularity;
       
   331 	
       
   332 	CBufSeg* iBuffer;
       
   333 	
       
   334 	TPtr8 iPtr;
       
   335 	
       
   336 	CPrinterPort* iPrinterPort;
       
   337 	
       
   338 	RBufWriteStream iWriteStream;
       
   339 	
       
   340 	CBufSeg* iWriteStreamBuffer;
       
   341 	};
       
   342 
       
   343 
       
   344 class TTextFormat
       
   345 /** @internalAll Internal to Symbian */	
       
   346 	{
       
   347 public:
       
   348 	IMPORT_C TTextFormat();
       
   349 	IMPORT_C TTextFormat(const TFontUnderline anUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const TDesC8& aFontString, const TFontStyle& aFontStyle);
       
   350 	IMPORT_C TBool operator == (const TTextFormat& aFormat) const;
       
   351 public:
       
   352 	
       
   353 	TFontUnderline iUnderlineStyle;
       
   354 	
       
   355 	TFontStrikethrough iStrikethroughStyle;
       
   356 	
       
   357 	TRgb iColor;
       
   358 	
       
   359 	TCommandString iFontString;
       
   360 	
       
   361 	TFontStyle iFontStyle;
       
   362 	};
       
   363 
       
   364 
       
   365 class CPageTextEntry : public CBase
       
   366 /** @internalAll Internal to Symbian */	
       
   367 	{
       
   368 public:
       
   369 	IMPORT_C CPageTextEntry(const TPoint& aDrawPos, TInt aHeightInPixels, TInt aTextWidthInPixels, HBufC8* aText, TTextFormat* aTextFormat);
       
   370 	IMPORT_C ~CPageTextEntry();
       
   371 	IMPORT_C TPoint TopTextPos();
       
   372 public:
       
   373 	
       
   374 	TPoint iDrawPos;
       
   375 	
       
   376 	TInt iHeightInPixels;
       
   377 	
       
   378 	TInt iTextWidthInPixels;
       
   379 	
       
   380 	HBufC8* iText;
       
   381 	
       
   382 	TTextFormat* iTextFormat;
       
   383 	};
       
   384 
       
   385 
       
   386 class CPageText : public CBase
       
   387 /** @internalAll Internal to Symbian */	
       
   388 	{
       
   389 private:
       
   390 	CPageText();
       
   391 	void ConstructL();
       
   392 public:
       
   393 	IMPORT_C static CPageText* NewL();
       
   394 	IMPORT_C ~CPageText();
       
   395 	IMPORT_C void Reset();
       
   396 	IMPORT_C void AddEntryL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString);
       
   397 	IMPORT_C TInt NumEntries();
       
   398 	IMPORT_C CPageTextEntry* operator [] (TInt anIndex);
       
   399 	/** This function is internal only, and is not intended for use. */
       
   400 	inline TInt MaxFontHeightInPixels() const {return iMaxFontHeightInPixels;}
       
   401 private:
       
   402 	
       
   403 	TInt iMaxFontHeightInPixels;
       
   404 	
       
   405 	CArrayPtr<TTextFormat>* iTextFormatList;
       
   406 	
       
   407 	CArrayPtr<CPageTextEntry>* iPageTextEntryList;
       
   408 	};
       
   409 
       
   410 class CPdrControl;
       
   411 
       
   412 
       
   413 /**
       
   414 @publishedAll
       
   415 @released
       
   416 @see CFbsDrvDevice
       
   417 */
       
   418 class CPdrDevice : public CPrinterDevice
       
   419 	{
       
   420 protected:
       
   421 	IMPORT_C CPdrDevice();
       
   422 public:
       
   423 	IMPORT_C virtual ~CPdrDevice();
       
   424 	IMPORT_C void SelectPageSpecInTwips(const TPageSpec& aPageSpec);
       
   425 	IMPORT_C TDisplayMode DisplayMode() const;
       
   426 	IMPORT_C TSize SizeInPixels() const;
       
   427 	IMPORT_C TSize SizeInTwips() const;
       
   428 	IMPORT_C TRect PrintablePageInPixels() const;
       
   429 	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
       
   430 	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
       
   431 	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
       
   432 	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
       
   433 	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
   434 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec);
       
   435 	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);
       
   436 	IMPORT_C TInt NumTypefaces() const;
       
   437 	IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const;
       
   438 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
       
   439 	IMPORT_C void PaletteAttributes(TBool& aModifiable, TInt& aNumEntries) const;
       
   440 	IMPORT_C void SetPalette(CPalette* aPalette);
       
   441 	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
       
   442 	IMPORT_C TPrinterModelEntry Model() const;
       
   443 	IMPORT_C TInt Flags() const;
       
   444 	IMPORT_C TInt SetModel(const TPrinterModelHeader& aModel, CStreamStore& aStore);
       
   445 	IMPORT_C void ReleaseFont(CFont* aFont);
       
   446 	IMPORT_C TPoint OffsetInPixels();
       
   447 
       
   448 protected:
       
   449 	IMPORT_C virtual TSize KPixelSizeInTwips() const;
       
   450 private:
       
   451 	void DoSetModelL();
       
   452 protected:
       
   453 	
       
   454 	CStreamStore* iStore;
       
   455 	
       
   456 	TPrinterModelHeader iModel;
       
   457 	
       
   458 	CPdrModelInfo* iModelInfo;
       
   459 	
       
   460 	CPdrTypefaceStore* iTypefaceStore;
       
   461 	}; 
       
   462 
       
   463 
       
   464 /**
       
   465 @publishedAll
       
   466 @released 
       
   467 */
       
   468 class CPdrControl : public CPrinterControl
       
   469 	{
       
   470 public:
       
   471 	IMPORT_C ~CPdrControl();
       
   472 	IMPORT_C TInt CreateContext(CGraphicsContext*& aGC);
       
   473 	IMPORT_C TInt BandsPerPage();
       
   474 	IMPORT_C TMoreOnPage QueueGetBand(TRequestStatus& aStatus, TBandAttributes& aBand); // returns affirmative if more to print on current page
       
   475 	IMPORT_C void QueueEndPrint(TRequestStatus& aStatus); // Called at finish to flush buffer, tidy up printer etc.
       
   476 	IMPORT_C void AbortPrint(); // tidy up synchronously in a short time
       
   477 	IMPORT_C virtual void DrawTextL(const TPoint& aPoint, const TFontUnderline aUnderlineStyle, const TFontStrikethrough aStrikethroughStyle, const TRgb& aColor, const CInfoFont* aFont, const TDesC& aString); 
       
   478 	IMPORT_C TBool IsGraphicsBand() const;
       
   479 	inline CBandedDevice* BandedDevice() const {return iBandedDevice;}
       
   480 protected:
       
   481 	IMPORT_C CPdrControl(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort);
       
   482 	IMPORT_C virtual void DoQueueGetBandL();
       
   483 	IMPORT_C virtual void DoQueueEndPrintL();
       
   484 	IMPORT_C void ConstructL(CStreamStore& aStore, TStreamId aStreamId);
       
   485 
       
   486 	virtual void OutputBandL() = 0;
       
   487 
       
   488 	IMPORT_C virtual void MoveToL(const TPoint& aPoint); 
       
   489 	IMPORT_C virtual void MoveByL(const TPoint& aVector); 
       
   490 	IMPORT_C virtual void OutputTextL(const TPoint& aPoint, TInt aWidthInPixels, const TTextFormat& aTextFormat, const TDesC8& aString); 
       
   491 
       
   492 	IMPORT_C virtual void SetPageSizeL(); 
       
   493 	IMPORT_C virtual void SetPageOrientationL();
       
   494 	IMPORT_C virtual void SetFontPostureL(const TFontPosture aPosture);
       
   495 	IMPORT_C virtual void SetFontStrokeWeightL(const TFontStrokeWeight aStrokeWeight);
       
   496 	IMPORT_C virtual void SetTextColorL(const TRgb& aColor);
       
   497 	IMPORT_C virtual void CommandL(const TInt anId);
       
   498 
       
   499 	IMPORT_C TBool TransformBuffer(); // These two functions are not implemented anywhere
       
   500 	IMPORT_C TBool CompressBuffer();  // for this class. Nor do I believe they are defined
       
   501 									  // for a reason. But since they are part of the 
       
   502 									  // existing interface of a DLL in a ROM I need to
       
   503 									  // patch. They get to stay there for the moment. CJC
       
   504 
       
   505 protected:
       
   506 	
       
   507 	CPdrDevice* iPdrDevice;
       
   508 	
       
   509 	CPageBuffer* iPageBuffer;
       
   510 	
       
   511 	CPdrResources* iResources;
       
   512 	
       
   513 	CBandedDevice* iBandedDevice;
       
   514 	
       
   515 	CPageText* iPageText;
       
   516 	
       
   517 	TInt iBandIndex;
       
   518 	
       
   519 	TInt iEntryIndex;
       
   520 	
       
   521 	TPoint iPosition;
       
   522 	
       
   523 	TTextFormat iTextFormat;
       
   524 	};
       
   525 
       
   526 
       
   527 class CPdrGc : public CGraphicsContext
       
   528 /** @internalAll Internal to Symbian */	
       
   529 	{
       
   530 private:
       
   531 	CPdrGc(CPdrDevice* aDevice);
       
   532 	void ConstructL();
       
   533 public:
       
   534 	static CPdrGc* NewL(CPdrDevice* aDevice);
       
   535 	IMPORT_C ~CPdrGc();
       
   536 
       
   537 	IMPORT_C CGraphicsDevice* Device() const;
       
   538 	IMPORT_C void SetOrigin(const TPoint& aPos = TPoint(0, 0));
       
   539 	IMPORT_C void SetDrawMode(TDrawMode aDrawingMode);
       
   540 	IMPORT_C void SetClippingRect(const TRect& aRect);
       
   541 	IMPORT_C void CancelClippingRect();
       
   542 	IMPORT_C void Reset();
       
   543 
       
   544 	IMPORT_C void UseFont(const CFont* aFont);
       
   545 	IMPORT_C void DiscardFont();
       
   546 
       
   547 	IMPORT_C void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
       
   548 	IMPORT_C void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
       
   549 	IMPORT_C void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
       
   550 	IMPORT_C void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
       
   551 
       
   552 	IMPORT_C void SetPenColor(const TRgb& aColor);
       
   553 	IMPORT_C void SetPenStyle(TPenStyle aPenStyle);
       
   554 	IMPORT_C void SetPenSize(const TSize& aSize = TSize(1, 1));
       
   555 
       
   556 	IMPORT_C void SetBrushColor(const TRgb& aColor);
       
   557 	IMPORT_C void SetBrushStyle(TBrushStyle aBrushStyle);
       
   558 	IMPORT_C void SetBrushOrigin(const TPoint& aOrigin);
       
   559 	IMPORT_C void UseBrushPattern(const CFbsBitmap* aBitmap);
       
   560 	IMPORT_C void DiscardBrushPattern();
       
   561 
       
   562 	IMPORT_C void MoveTo(const TPoint& aPoint);
       
   563 	IMPORT_C void MoveBy(const TPoint& aVector);
       
   564 	IMPORT_C void Plot(const TPoint& aPoint);
       
   565 
       
   566 	IMPORT_C void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
       
   567 	IMPORT_C void DrawLine(const TPoint& aPoint1, const TPoint& aPoint2);
       
   568 	IMPORT_C void DrawLineTo(const TPoint& aPoint);
       
   569 	IMPORT_C void DrawLineBy(const TPoint& aVector);
       
   570 	IMPORT_C void DrawPolyLine(const CArrayFix<TPoint>* aPointList);
       
   571 	IMPORT_C void DrawPolyLine(const TPoint* aPointList, TInt aNumPoints);
       
   572 
       
   573 	IMPORT_C void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
       
   574 	IMPORT_C void DrawEllipse(const TRect& aRect);
       
   575 	IMPORT_C void DrawRect(const TRect& aRect);
       
   576 	IMPORT_C void DrawRoundRect(const TRect& aRect, const TSize& aCornerSize);
       
   577 	IMPORT_C TInt DrawPolygon(const CArrayFix<TPoint>* aPointList, TFillRule aFillRule = EAlternate);
       
   578 	IMPORT_C TInt DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule = EAlternate);
       
   579 
       
   580 	IMPORT_C void DrawBitmap(const TPoint& aTopLeft, const CFbsBitmap* aSource);
       
   581 	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource);
       
   582 	IMPORT_C void DrawBitmap(const TRect& aDestRect, const CFbsBitmap* aSource, const TRect& aSourceRect);
       
   583 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
       
   584 	IMPORT_C void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask);
       
   585 
       
   586 	IMPORT_C void DrawText(const TDesC& aString, const TPoint& aPosition);
       
   587 	IMPORT_C void DrawTextL(const TDesC& aString, const TPoint& aPosition);
       
   588 	IMPORT_C void DrawText(const TDesC& aString, const TRect& aBox, TInt aBaselineOffset, TTextAlign aHoriz = ELeft, TInt aLeftMrg = 0);
       
   589 									
       
   590 	IMPORT_C void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards);
       
   591 	IMPORT_C TInt SetClippingRegion(const TRegion &aRegion);
       
   592 	IMPORT_C void CancelClippingRegion();
       
   593 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
       
   594 	IMPORT_C void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);								
       
   595 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
       
   596 	IMPORT_C TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,  const TRect& aSrcRect, const CWsBitmap*  aAlphaBmp, const TPoint& aAlphaPt);
       
   597 	
       
   598 private:
       
   599 	inline CPdrControl* PdrControl() const {return ((CPdrControl*) iPdrDevice->iControl);}
       
   600 
       
   601 private:
       
   602 	
       
   603 	CPdrDevice* iPdrDevice;
       
   604 	
       
   605 	CFbsBitGc* iBandedGc;
       
   606 	
       
   607 	CFbsFont* iFbsFont;
       
   608 	
       
   609 	CFont* iBandedFont;
       
   610 	
       
   611 	CInfoFont* iFont;
       
   612 	
       
   613 	TPoint iOrigin;
       
   614 	
       
   615 	TPoint iPosition;
       
   616 	
       
   617 	TFontUnderline iUnderlineStyle;
       
   618 	
       
   619 	TFontStrikethrough iStrikethroughStyle;
       
   620 	
       
   621 	TRect iClippingRect;  // Relative to absolute origin
       
   622 	
       
   623 	TInt iWordExcessWidthInPixels;
       
   624 	
       
   625 	TInt iNumGaps;
       
   626 	
       
   627 	TInt iCharExcessWidthInPixels;
       
   628 	
       
   629 	TInt iNumChars;
       
   630 	
       
   631 	TRgb iPenColor;
       
   632 	
       
   633 	TBool iPrintTextUsingBitmaps;
       
   634 	};
       
   635 
       
   636 
       
   637 /**
       
   638 @publishedAll
       
   639 @released 
       
   640 */
       
   641 class CFbsDrvDevice : public CPdrDevice
       
   642 	{
       
   643 public:
       
   644 	IMPORT_C CFbsDrvDevice();
       
   645 	IMPORT_C ~CFbsDrvDevice();
       
   646 
       
   647 	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
       
   648 	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec);
       
   649 	IMPORT_C void ReleaseFont(CFont* aFont);
       
   650 	IMPORT_C TInt NumTypefaces() const;
       
   651 	IMPORT_C void TypefaceSupport(TTypefaceSupport& aTypefaceSupport, TInt aTypefaceIndex) const;
       
   652 	IMPORT_C TInt FontHeightInTwips(TInt aTypefaceIndex, TInt aHeightIndex) const;
       
   653 
       
   654 	IMPORT_C TInt CreateContext(CGraphicsContext*& aGc);
       
   655 	IMPORT_C void CreateControlL(CPrinterPort* aPrinterPort);
       
   656 	IMPORT_C TInt SetModel(const TPrinterModelHeader& aModel, CStreamStore& aStore);
       
   657 	IMPORT_C void LoadTypeFaceList();
       
   658 	IMPORT_C TSize KPixelSizeInTwips() const;
       
   659 	IMPORT_C void LoadTypeFaceListL();
       
   660 	IMPORT_C TInt SetModelL(const TPrinterModelHeader& aModel, CStreamStore& aStore);
       
   661 private:
       
   662 // reserved virtual function space
       
   663 	IMPORT_C virtual void Reserved_1();
       
   664 
       
   665 protected:
       
   666 	
       
   667 	CFbsTypefaceStore* iFbsTypefaceStore;
       
   668 	
       
   669 	CArrayFixFlat<TInt>* iGenTypefaceFontsList;
       
   670 	
       
   671 	CArrayFixFlat<TInt>* iGenTypefaceFontsType;
       
   672 	
       
   673 	TInt iFbsTypefaceCount;
       
   674 	
       
   675 	TInt iPdrTypefaceCount;
       
   676 
       
   677 private:
       
   678 	
       
   679 	TAny* iReserved;
       
   680 	};
       
   681 
       
   682 
       
   683 /**
       
   684 @publishedAll
       
   685 @released 
       
   686 */
       
   687 class CFbsDrvControl : public CPdrControl
       
   688 	{
       
   689 public:
       
   690 	IMPORT_C static CFbsDrvControl* NewL(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort, CStreamStore& aStore, TStreamId aResourcesStreamId);
       
   691 	IMPORT_C ~CFbsDrvControl();
       
   692 
       
   693 protected:
       
   694 	IMPORT_C virtual void OutputBandL();
       
   695 
       
   696 	IMPORT_C CFbsDrvControl(CPdrDevice* aPdrDevice, CPrinterPort* aPrinterPort);
       
   697 	IMPORT_C void ConstructL(CStreamStore& aStore, TStreamId aResourcesStreamId);
       
   698 	IMPORT_C void SetPageSizeL();
       
   699 
       
   700 	IMPORT_C TBool TransformBuffer();
       
   701 	IMPORT_C TBool CompressBuffer();
       
   702 
       
   703 private:
       
   704 // reserved virtual function space
       
   705 	IMPORT_C virtual void Reserved_1();
       
   706 		
       
   707 protected:
       
   708 	
       
   709 	HBufC8* iScanLine;
       
   710 	
       
   711 	HBufC8* iCompressedScanLine;
       
   712 
       
   713 private:
       
   714 	
       
   715 	TAny* iReserved;
       
   716 	};
       
   717 
       
   718 #endif