textrendering/textformatting/inc/FRMTLAY_INTERNAL.H
changeset 32 8b9155204a54
parent 0 1fb32624e06b
equal deleted inserted replaced
31:b9ad20498fb4 32:8b9155204a54
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __FRMTLAY_INTERNAL_H__
       
    19 #define __FRMTLAY_INTERNAL_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <e32base.h>
       
    23 #include <gdi.h>
       
    24 #include <tagma.h>
       
    25 
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <tagma_internal.h>
       
    28 #endif
       
    29 
       
    30 class MLayDoc;
       
    31 class MFormCustomInterfaceProvider; 
       
    32 class MFormCustomInvisibleCharacterRemapper;
       
    33 class MFormCustomWrap;
       
    34 class MFormCustomDraw;
       
    35 
       
    36 /**
       
    37 @internalTechnology
       
    38 Internal to Symbian
       
    39 */
       
    40 NONSHARABLE_CLASS(TLayDocTextSource) : public MTmSource, public MFormLabelApi, public MTmTextDrawExt, public MTmCustomExtension
       
    41 	{
       
    42 	public:
       
    43 
       
    44 	enum
       
    45 		{
       
    46 		EDefaultFontHeightIncreaseFactor = 7,
       
    47 		EDefaultMinimumLineDescent = 3
       
    48 		};
       
    49 
       
    50 	TLayDocTextSource();
       
    51 
       
    52 	// overrides for MTmSource pure virtual functions
       
    53 	MGraphicsDeviceMap& FormatDevice() const;
       
    54 	MGraphicsDeviceMap& InterpretDevice() const;
       
    55 	TInt DocumentLength() const;
       
    56 	void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const;
       
    57 	void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const;
       
    58 	TInt ParagraphStart(TInt aPos) const;
       
    59 
       
    60 	// overrides for other MTmSource virtual functions
       
    61 	TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
       
    62 	CPicture* PictureL(TInt aPos) const;
       
    63 	TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const;
       
    64 	TBool LabelModeSelect(TLabelType aType, TInt aPos);
       
    65 	void LabelModeCancel();
       
    66 	void LabelMetrics(TLabelType aType, TSize& aLabelSize, TInt& aMarginSize) const;
       
    67 	TUint Map(TUint aChar) const;
       
    68 	void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const;
       
    69 	TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const;
       
    70 	void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
       
    71 						const TLogicalRgb& aBackground,TRect& aRectDrawn) const;
       
    72 	void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
       
    73 						  const TTmLineInfo& aLineInfo) const;
       
    74 	void DrawText(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
       
    75 				  const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
       
    76 				  const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
       
    77 	virtual void DrawPicture(CGraphicsContext& aGc,
       
    78 							 const TPoint& aTextLayoutTopLeft, const TRect& aRect,
       
    79 							 MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const;
       
    80 	void DrawText(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
       
    81 				  const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
       
    82 				  const TDesC& aText, const TInt aStart, const TInt aEnd, const TPoint& aTextOrigin,TInt aExtraPixels) const;
       
    83 	
       
    84 	// overrides for the MTmSource virtual functions which implements the MFormCustomWrap
       
    85 	// if iCustomWrap is set. 
       
    86 	TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
       
    87 	TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
       
    88 	TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
       
    89 												 TBool aForwards,TInt& aBreakPos) const;
       
    90 	TBool IsHangingCharacter(TUint aChar) const;
       
    91 	
       
    92 	// other functions
       
    93 	TBool CanMap() const;
       
    94 
       
    95 	TAny* GetExtendedInterface(const TUid& aInterfaceId);
       
    96 
       
    97 	//MTmTextDrawExt implementations
       
    98 	virtual void DrawLine(CGraphicsContext& aGc, const TPoint& aPt1, const TPoint& aPt2) const;
       
    99 	virtual void DrawText(CGraphicsContext& aGc, const TDesC& aText, const TPoint& aPt) const;
       
   100 	virtual void DrawRect(CGraphicsContext& aGc, const TRect& aRc) const;
       
   101 
       
   102 	//Set/reset opaque flag of aGc graphics context
       
   103 	void SetOpaque(CGraphicsContext& aGc) const;
       
   104 	void ResetOpaque(CGraphicsContext& aGc) const;
       
   105 
       
   106 	// flags
       
   107 	enum
       
   108 		{
       
   109 		EWrap = 1,
       
   110 		ETruncateWithEllipsis = 2,
       
   111 		EUseLabelsDevice = 4
       
   112 		};
       
   113 
       
   114 	MLayDoc* iLayDoc;
       
   115 	TUint iFlags;								// wrap, truncate, etc.
       
   116 	TInt iWidth;								// wrapping width
       
   117 	TChar iEllipsis;							// ellipsis character (or none if 0xFFFF) used if truncating
       
   118 	TInt iLabelsWidth;
       
   119 	TInt iLabelsGutter;
       
   120 	CLayoutData::TFormatMode iFormatMode;
       
   121 	MGraphicsDeviceMap* iImageDevice;			// device map used for drawing text
       
   122 	MGraphicsDeviceMap* iLabelsDevice;			// device map used for labels
       
   123 	MGraphicsDeviceMap* iFormatDevice;			// device map used for formatting
       
   124 	TInt iFontHeightIncreaseFactor;				// percentage automatically added to font heights
       
   125 	TInt iMinimumLineDescent;					// minimum line descent in pixels
       
   126 	TNonPrintingCharVisibility iNonPrintingCharVisibility;
       
   127 	const MFormParam* iFormParam;				// if non-null, points to the object that supplies system colours
       
   128 	const MFormCustomDraw* iCustomDraw;			// if non-null, points to custom drawing routines
       
   129 	const MFormCustomWrap* iCustomWrap;			// if non-null, points to custom wrapping routines 
       
   130     /** Optional object able to provide a concrete customisation object for use 
       
   131 	    internally by Form. */
       
   132 	MFormCustomInterfaceProvider* iInterfaceProvider;
       
   133 	TBool iDrawOpaque;						// Opaque drawing active if the flag is ETrue
       
   134 	TInt iExcessHeightRequired;				// delta required to position the baseline so there is enough
       
   135 											// space for the highset glyph in pixels.  
       
   136 	MFormCustomInvisibleCharacterRemapper* iInvisibleCharacterRemapper;	// Used to customize the remapping of 
       
   137 																		// invisible characters to visible characters
       
   138 	};
       
   139 
       
   140 #endif