142 EPdrResource8 |
135 EPdrResource8 |
143 }; |
136 }; |
144 |
137 |
145 /** |
138 /** |
146 Maximum length of a printer command string. |
139 Maximum length of a printer command string. |
147 @publishedAll |
|
148 @released |
|
149 */ |
140 */ |
150 const TInt KMaxCommandStringLength = 0x40; |
141 const TInt KMaxCommandStringLength = 0x40; |
151 /** |
142 /** |
152 Defines a command string used by printer drivers. |
143 Defines a command string used by printer drivers. |
153 @publishedAll |
|
154 @released |
|
155 */ |
144 */ |
156 typedef TBuf8<KMaxCommandStringLength> TCommandString; |
145 typedef TBuf8<KMaxCommandStringLength> TCommandString; |
157 |
146 |
158 |
147 // Forward declarations |
159 class CPdrResources : public CBase |
148 class CFontInfo; |
160 /** @internalAll Internal to Symbian */ |
149 class CPdrTranslates; |
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; |
150 class CPdrDevice; |
|
151 |
|
152 /** WARNING: Class for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
153 */ |
175 class CInfoFont : public CFont |
154 class CInfoFont : public CFont |
176 /** @internalTechnology */ |
|
177 { |
155 { |
178 friend class CPdrTypefaceStore; |
156 friend class CPdrTypefaceStore; |
179 public: |
157 public: |
180 // New functions |
158 // New functions |
181 IMPORT_C HBufC8* TranslateStringL(const TDesC& aString) const; |
159 IMPORT_C HBufC8* TranslateStringL(const TDesC& aString) const; |
213 CPdrDevice* iPdrDevice; |
191 CPdrDevice* iPdrDevice; |
214 CFont* iRealFont; |
192 CFont* iRealFont; |
215 }; |
193 }; |
216 |
194 |
217 |
195 |
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 |
196 class CPageBuffer : public CActive |
309 { |
197 { |
310 public: |
198 public: |
311 IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort); |
199 IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort); |
312 IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort, TInt aGranularity); |
200 IMPORT_C static CPageBuffer* NewL(CPrinterPort* aPrinterPort, TInt aGranularity); |
360 |
249 |
361 TFontStyle iFontStyle; |
250 TFontStyle iFontStyle; |
362 }; |
251 }; |
363 |
252 |
364 |
253 |
365 class CPageTextEntry : public CBase |
254 // Forward declarations |
366 /** @internalAll Internal to Symbian */ |
255 class CPdrModelInfo; |
367 { |
256 class CPdrTypefaceStore; |
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 |
257 |
413 /** |
258 /** |
414 @publishedAll |
|
415 @released |
|
416 @see CFbsDrvDevice |
259 @see CFbsDrvDevice |
417 */ |
260 */ |
418 class CPdrDevice : public CPrinterDevice |
261 class CPdrDevice : public CPrinterDevice |
419 { |
262 { |
420 protected: |
263 protected: |
522 |
365 |
523 TTextFormat iTextFormat; |
366 TTextFormat iTextFormat; |
524 }; |
367 }; |
525 |
368 |
526 |
369 |
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 |
370 class CFbsDrvDevice : public CPdrDevice |
642 { |
371 { |
643 public: |
372 public: |
644 IMPORT_C CFbsDrvDevice(); |
373 IMPORT_C CFbsDrvDevice(); |
645 IMPORT_C ~CFbsDrvDevice(); |
374 IMPORT_C ~CFbsDrvDevice(); |