epoc32/include/tagma.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/tagma.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/tagma.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,1827 @@
     1.4 -tagma.h
     1.5 +// Copyright (c) 1999-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 +// The main header file for TAGMA, the low-level text formatting engine for EPOC.
    1.19 +// 'Tm' stands for 'TAGMA' and is the standard prefix for TAGMA classes, after
    1.20 +// the C, T, or whatever.
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +
    1.25 +
    1.26 +#ifndef __TAGMA_H__
    1.27 +#define __TAGMA_H__
    1.28 +
    1.29 +#include <e32base.h>
    1.30 +#include <openfont.h>
    1.31 +#include <txtfrmat.h>
    1.32 +#include <txtstyle.h>
    1.33 +#include <linebreak.h>
    1.34 +
    1.35 +// forward declarations
    1.36 +class TTmLineInfo;
    1.37 +class CTmTextImp;
    1.38 +class RWindow;
    1.39 +class RWsSession;
    1.40 +class RParagraphStyleInfo;
    1.41 +class CStyleList;
    1.42 +class TTmDocPosSpec;
    1.43 +class TTmDocPos;
    1.44 +class TCursorSelection;
    1.45 +class TTmHighlightExtensions;
    1.46 +class TBidirectionalContext;
    1.47 +
    1.48 +/** 
    1.49 +A bit mask for selecting one or more attributes of a TTmCharFormat object. 
    1.50 +@internalComponent
    1.51 +*/
    1.52 +class TTmCharFormatMask
    1.53 +
    1.54 +	{
    1.55 +public:
    1.56 +	/** Constants, that are also bit assignments, representing character format attributes */
    1.57 +	enum TAttrib
    1.58 +		{
    1.59 +		EFontName = 0x1,
    1.60 +		EFontCoverage = 0x2,
    1.61 +		EBold = 0x4,
    1.62 +		EItalic = 0x8,
    1.63 +		ESerif = 0x10,
    1.64 +		EMonoWidth = 0x20,
    1.65 +		EHeight = 0x40,
    1.66 +		EPrintPosition = 0x80,
    1.67 +		ETextColor = 0x100,
    1.68 +		EBackgroundColor = 0x200,
    1.69 +		EBackground = 0x400,
    1.70 +		EUnderline = 0x800,
    1.71 +		EStrikethrough = 0x1000,
    1.72 +		EShadow = 0x2000,
    1.73 +		EUserDefinedEffects = 0x4000,
    1.74 +		ELanguage = 0x8000,
    1.75 +		EPictureAlignment = 0x10000
    1.76 +		};
    1.77 +
    1.78 +	inline TTmCharFormatMask();
    1.79 +	IMPORT_C TTmCharFormatMask(const TCharFormatMask& aMask);
    1.80 +	IMPORT_C void GetTCharFormatMask(TCharFormatMask& aMask) const;
    1.81 +	inline void Clear(TAttrib aAttrib);
    1.82 +	inline void Set(TAttrib aAttrib);
    1.83 +	inline TBool IsSet(TAttrib aAttrib); 
    1.84 +
    1.85 +	TUint iFlags;
    1.86 +	};
    1.87 +
    1.88 +/** 
    1.89 +A character format; all dimensions are in twips. A character format object
    1.90 +stores all text style attributes that can differ from any one character to the
    1.91 +next. Attributes that affect an entire paragraph only are kept in RTmParFormat
    1.92 +objects. 
    1.93 +@internalComponent
    1.94 +*/
    1.95 +class TTmCharFormat
    1.96 +	{
    1.97 +public:
    1.98 +	/** Bit assignments for effects */
    1.99 +	enum
   1.100 +		{
   1.101 +		EBackground = 1,	///< Text background is drawn in the background colour
   1.102 +		ERounded = 2,		///< Text background (if any) has rounded corners
   1.103 +		EUnderline = 4,	///< Text is underlined
   1.104 +		EStrikethrough = 8,	///< Text is struck through with a horizontal line.
   1.105 +		EShadow = 16,	///< Text has a drop shadow.
   1.106 +		/** Bits 24-31 are reserved for styles defined by the custom drawer. */
   1.107 +		EUserDefinedMask = 0xFF000000,
   1.108 +		/** Shift TCharFormat highlight styles left by this to get the
   1.109 +		TTmCharFormat effects portion. */
   1.110 +		EUserDefinedShift = 24,
   1.111 +		/** For custom drawers: draw whatever is wanted for "no matches" in the FEP. */
   1.112 +		ENoMatchesIndicator = 0x4000000,
   1.113 +		/** Reset if the effect in bits 24-30 is defined defined by Symbian,
   1.114 +		set if it is defined externally. */
   1.115 +		ECustomDrawEffectIsExternallyDefined = 0x80000000
   1.116 +		};
   1.117 +
   1.118 +	/** Picture alignment */
   1.119 +	enum TPictureAlignment
   1.120 +		{
   1.121 +		EPictureAlignBaseline,
   1.122 +		EPictureAlignTop,
   1.123 +		EPictureAlignBottom,
   1.124 +		EPictureAlignCenter
   1.125 +		};
   1.126 +
   1.127 +	IMPORT_C TTmCharFormat();
   1.128 +	IMPORT_C TTmCharFormat(const TDesC& aFontName,TInt aFontHeight);
   1.129 +	IMPORT_C void operator=(const TCharFormat& aFormat);
   1.130 +	inline TTmCharFormat(const TCharFormat& aFormat);
   1.131 +	IMPORT_C void GetTCharFormat(TCharFormat& aFormat) const;
   1.132 +	IMPORT_C TBool operator==(const TTmCharFormat& aFormat) const;
   1.133 +	inline TBool operator!=(const TTmCharFormat& aFormat) const;
   1.134 +
   1.135 +	TOpenFontSpec iFontSpec;
   1.136 +	TLogicalRgb iTextColor;
   1.137 +	TLogicalRgb iBackgroundColor;		// used only when EBackground flag is set in iEffects
   1.138 +	TUint iEffects;						// bit flags as defined above;
   1.139 +										// note that effects NEVER change character metrics and so can
   1.140 +										// be ignored when measuring text
   1.141 +	TUint iLanguage;					// language used for proofing
   1.142 +	TPictureAlignment iPictureAlignment;// vertical alignment of embedded objects
   1.143 +	TUint iTag;							// tag for use by URL parsers, etc.; a way of marking a range of
   1.144 +										// text without using any typographic attributes
   1.145 +	};
   1.146 +
   1.147 +/** 
   1.148 +A tabulation position, measured from the start of the line, which will be
   1.149 +the left end for paragraphs with a left-to-right base direction, and vice
   1.150 +versa. 
   1.151 +@internalComponent
   1.152 +*/
   1.153 +class TTmTab
   1.154 +
   1.155 +	{
   1.156 +public:
   1.157 +	/** Tab type */
   1.158 +	enum TType
   1.159 +		{
   1.160 +		EStandardTab,	// text is placed after the tab, in the current paragraph direction
   1.161 +		ECenterTab,		// text is centred around the tab
   1.162 +		EReverseTab		// text is placed before the tab, in the current paragraph direction
   1.163 +		};
   1.164 +
   1.165 +	inline TTmTab();
   1.166 +	inline TTmTab(const TTabStop& aTab);
   1.167 +	IMPORT_C void operator=(const TTabStop& aTab);
   1.168 +	IMPORT_C void GetTTabStop(TTabStop& aTab) const;
   1.169 +	IMPORT_C TBool operator==(const TTmTab& aTab) const;
   1.170 +	inline TBool operator!=(const TTmTab& aTab) const;
   1.171 +
   1.172 +	TInt iPosition;
   1.173 +	TType iType;
   1.174 +	};
   1.175 +
   1.176 +/** 
   1.177 +A bullet or other label inserted automatically at the start of a paragraph.
   1.178 +As well as an actual bullet, it can be a number or a letter. 
   1.179 +@internalComponent
   1.180 +*/
   1.181 +class TTmBullet
   1.182 +
   1.183 +	{
   1.184 +public:
   1.185 +	/** Bullet style */
   1.186 +	enum TStyle
   1.187 +		{
   1.188 +		EBulletStyle,
   1.189 +		EArabicNumberStyle,
   1.190 +		ESmallRomanNumberStyle,
   1.191 +		ECapitalRomanNumberStyle,
   1.192 +		ESmallLetterStyle,
   1.193 +		ECapitalLetterStyle
   1.194 +		};
   1.195 +
   1.196 +	/** The alignment within the margin of bullets or other text used in TTmBullet objects */
   1.197 + 	enum TAlignment
   1.198 +		{
   1.199 +		/** Bullet forward aligned. */
   1.200 +		ELeftAlign,
   1.201 +		/** Bullet centre aligned. */
   1.202 +		ECenterAlign,
   1.203 +		/** Bullet reverse aligned. */
   1.204 +		ERightAlign
   1.205 +		};
   1.206 +
   1.207 +	IMPORT_C TTmBullet();
   1.208 +	IMPORT_C void operator=(const TBullet& aBullet);
   1.209 +	inline TTmBullet(const TBullet& aBullet);
   1.210 +	IMPORT_C void GetTBullet(TBullet& aBullet) const;
   1.211 +	IMPORT_C TBool operator==(const TTmBullet& aBullet) const;
   1.212 +	inline TBool operator!=(const TTmBullet& aBullet) const;
   1.213 +
   1.214 +	TChar iCharacterCode;		// the bullet or other symbol used if iStyle is EBulletStyle
   1.215 +	TOpenFontSpec iFontSpec;
   1.216 +	TBool iHangingIndent;
   1.217 +	TLogicalRgb iColor;
   1.218 +	TStyle iStyle;				// is this a bullet or a number or a letter?
   1.219 +	TInt iStartNumber;			// the number of the first paragraph in a run of paragraphs in this style
   1.220 +	TAlignment iAlignment;		// alignment of the bullet or number within the margin
   1.221 +	};
   1.222 +
   1.223 +/** 
   1.224 +A specification of a paragraph border rule: that is, a line or lines drawn
   1.225 +above, below, to the left, or to the right of a paragraph. 
   1.226 +@internalComponent
   1.227 +*/
   1.228 +class TTmParBorder
   1.229 +
   1.230 +	{
   1.231 +public:
   1.232 +	/** Paragraph border style */
   1.233 +	enum TStyle
   1.234 +		{
   1.235 +		ESolidStyle,
   1.236 +		EDoubleStyle,
   1.237 +		EDotStyle,
   1.238 +		EDashStyle,
   1.239 +		EDotDashStyle,
   1.240 +		EDotDotDashStyle
   1.241 +		};
   1.242 +
   1.243 +	IMPORT_C TTmParBorder();
   1.244 +	IMPORT_C void operator=(const TParaBorder& aBorder);
   1.245 +	inline TTmParBorder(const TParaBorder& aBorder);
   1.246 +	IMPORT_C void GetTParaBorder(TParaBorder& aBorder) const;
   1.247 +	IMPORT_C TBool operator==(const TTmParBorder& aBorder) const;
   1.248 +	inline TBool operator!=(const TTmParBorder& aBorder) const;
   1.249 +
   1.250 +	TStyle iStyle;
   1.251 +	TInt iWeight;
   1.252 +	TLogicalRgb iColor;
   1.253 +	TBool iAutoColor;
   1.254 +	};
   1.255 +
   1.256 +
   1.257 +/** 
   1.258 +A bit mask for selecting one or more attributes of an RTmParFormat. 
   1.259 +@internalComponent
   1.260 +*/	
   1.261 +class TTmParFormatMask
   1.262 +
   1.263 +	{
   1.264 +public:
   1.265 +	/** Constants, that are also bit assignments, representing paragraph format attributes */
   1.266 +	enum TAttrib
   1.267 +		{
   1.268 +		EAlignment = 0x1,
   1.269 +		EDirection = 0x2,
   1.270 +		EKeepTogether = 0x4,
   1.271 +		EKeepWithNext = 0x8,
   1.272 +		EStartNewPage = 0x10,
   1.273 +		EWidowOrphan = 0x20,
   1.274 +		ENoWrap = 0x40,
   1.275 +		EExactLineSpacing = 0x80,
   1.276 +		EPixelLineSpacing = 0x100,
   1.277 +		ELeadingMargin = 0x200,
   1.278 +		ETrailingMargin = 0x400,
   1.279 +		EFirstLineIndent = 0x800,
   1.280 +		ELineSpacing = 0x1000,
   1.281 +		ESpaceAbove = 0x2000,
   1.282 +		ESpaceBelow = 0x4000,
   1.283 +		ETabSize = 0x8000,
   1.284 +		EBorderMargin = 0x10000,
   1.285 +		ETabList = 0x20000,
   1.286 +		EBullet = 0x40000,
   1.287 +		EBorder = 0x80000
   1.288 +		};
   1.289 +
   1.290 +	inline TTmParFormatMask();
   1.291 +	IMPORT_C TTmParFormatMask(const TParaFormatMask& aMask);
   1.292 +	IMPORT_C void GetTParaFormatMask(TParaFormatMask& aMask) const;
   1.293 +	inline void Clear(TAttrib aAttrib);
   1.294 +	inline void Set(TAttrib aAttrib);
   1.295 +	inline TBool IsSet(TAttrib aAttrib);
   1.296 +
   1.297 +	TUint iFlags;
   1.298 +	};
   1.299 +
   1.300 +/** 
   1.301 +Paragraph format; all dimensions are in twips unless otherwise specified. 
   1.302 +@internalComponent
   1.303 +*/
   1.304 +class RTmParFormat
   1.305 +
   1.306 +	{
   1.307 +public:
   1.308 +	/** Index used to select one of the four borders of a paragraph */
   1.309 +	enum TBorderIndex
   1.310 +		{
   1.311 +		ETopBorder = 0,
   1.312 +		EBottomBorder = 1,
   1.313 +		ELeadingBorder = 2,
   1.314 +		ETrailingBorder = 3,
   1.315 +		};
   1.316 +
   1.317 +	/** Bit assignments for RTmParFormat::iFlags. */
   1.318 +	enum
   1.319 +		{
   1.320 +		/** Base direction of paragraph is right-to-left (as for Arabic) */
   1.321 +		ERightToLeft = 1,
   1.322 +		/** Do not allow paragraph to straddle page boundaries. */
   1.323 +		EKeepTogether = 2,
   1.324 +		/** Put this paragraph on the same page as the next. */
   1.325 +		EKeepWithNext = 4,
   1.326 +		/** Put this paragraph at the start of a new page. */
   1.327 +		EStartNewPage = 8,
   1.328 +		/** Suppress widows and orphans. */
   1.329 +		EWidowOrphan = 16,
   1.330 +		/** Suppresses line breaking. */
   1.331 +		ENoWrap = 32,
   1.332 +		/** Force line spacing distance to be respected even on lines that are
   1.333 +		 * taller than the specified height. */
   1.334 +		EExactLineSpacing = 64,
   1.335 +		/** Line spaceing is in pixels, not twips. */
   1.336 +		EPixelLineSpacing = 128,
   1.337 +		/** Work out paragraph directionality from the text. */
   1.338 +		EDirectionalityFromText = 256
   1.339 +		};
   1.340 +
   1.341 +	/** Paragraph alignment */
   1.342 +	enum TAlignment
   1.343 +		{
   1.344 +		EAlignNormalBidirectional,
   1.345 +		EAlignNormal = EAlignNormalBidirectional,		/** @deprecated in 7.0s */
   1.346 +		EAlignCenter,
   1.347 +		EAlignReverseBidirectional,
   1.348 +		EAlignReverse = EAlignReverseBidirectional,		/** @deprecated in 7.0s */
   1.349 +		EAlignJustify,
   1.350 +		EAlignAbsoluteLeft,
   1.351 +		EAlignAbsoluteRight
   1.352 +		};
   1.353 +
   1.354 +	IMPORT_C RTmParFormat();
   1.355 +	IMPORT_C void Close();
   1.356 +#ifdef _DEBUG
   1.357 +	inline ~RTmParFormat();
   1.358 +#endif
   1.359 +	IMPORT_C void CopyL(const RTmParFormat& aFormat);
   1.360 +	IMPORT_C void CopyL(const CParaFormat& aFormat);
   1.361 +	IMPORT_C void GetCParaFormatL(CParaFormat& aFormat) const;
   1.362 +	IMPORT_C TBool operator==(const RTmParFormat& aFormat) const;
   1.363 +	inline TBool operator!=(const RTmParFormat& aFormat) const;
   1.364 +	IMPORT_C TInt Tabs() const;
   1.365 +	inline const TTmTab& Tab(TInt aIndex) const;
   1.366 +	inline const TTmBullet* Bullet() const;
   1.367 +	inline const TTmParBorder* Border(TBorderIndex aIndex) const;
   1.368 +	IMPORT_C TBool HaveBorders() const;
   1.369 +	inline TBool RightToLeft() const;
   1.370 +
   1.371 +	TAlignment iAlignment;
   1.372 +	TUint iFlags;						// bit flags as defined above
   1.373 +	TInt iLeadingMargin;				// left margin, or right if right-to-left
   1.374 +	TInt iTrailingMargin;				// right margin, or left if right-to-left
   1.375 +	TInt iFirstLineIndent;				// added to first line leading margin
   1.376 +	TInt iLineSpacing;					// distance between baselines
   1.377 +	TInt iSpaceAbove;					// space above the paragraph
   1.378 +	TInt iSpaceBelow;					// space below the paragraph
   1.379 +	TInt iTabSize;						// default size of tabs
   1.380 +	TInt iBorderMargin;					// distance between the text and the border if any
   1.381 +	TLogicalRgb iBackgroundColor;		// paragraph background colour
   1.382 +
   1.383 +private:
   1.384 +	RTmParFormat(const RTmParFormat& aFormat);	// deliberately unimplemented
   1.385 +	void operator=(const RTmParFormat& aFormat);// deliberately unimplemented
   1.386 +
   1.387 +	RArray<TTmTab>* iTabList;			// custom tabs if any
   1.388 +	TTmBullet* iBullet;					// bullet if any
   1.389 +	TTmParBorder* iBorder[4];			// borders if any
   1.390 +	};
   1.391 +
   1.392 +/** 
   1.393 +The text customization interface. You can customize the colors, word
   1.394 +spacing, line breaking, line height calculation, background drawing, and text
   1.395 +appearance, of a text object by supplying an implementation of the MTmCustom
   1.396 +class, either directly (as in CTmText::CustomizeL, which takes a pointer to
   1.397 +MTmCustom) or indirectly, making use of the fact that MTmSource is derived from
   1.398 +MTmCustom (as in CTmTextLayout::SetTextL, which takes a reference to
   1.399 +MTmSource).
   1.400 +@publishedAll
   1.401 +@released
   1.402 +*/
   1.403 +class MTmCustom 
   1.404 +				: public MLineBreaker
   1.405 +	{
   1.406 +public:
   1.407 +	/**
   1.408 +    TLineHeightParam structure is used in MTmCustom::SetLineHeight() method to set 
   1.409 +    text line height related parameters such as max character height, max ascent and descent,
   1.410 +    height and depth of the tallest pictures (top-aligned, bottom-aligned or centered).
   1.411 +    @see MTmCustom::SetLineHeight()
   1.412 +	@publishedAll
   1.413 +	@released
   1.414 +	*/
   1.415 +	class TLineHeightParam
   1.416 +		{
   1.417 +	public:
   1.418 +		inline TLineHeightParam();
   1.419 +        /** Height of the highest character in the line. */
   1.420 +		TInt iMaxCharHeight;
   1.421 +        /** Depth of the deepest character in the line. */
   1.422 +		TInt iMaxCharDepth;
   1.423 +        /** Height plus depth of the tallest top-aligned picture. */
   1.424 +		TInt iMaxTopPictureHeight;
   1.425 +        /** Height plus depth of the tallest bottom-aligned picture. */
   1.426 +		TInt iMaxBottomPictureHeight;
   1.427 +        /** Height plus depth of the tallest centred picture. */
   1.428 +		TInt iMaxCenterPictureHeight;
   1.429 +        /** Height of the tallest character of any in the fonts in the line. */
   1.430 +		TInt iFontMaxCharHeight;
   1.431 +        /** Depth of the deepest character of any in the fonts in the line. */
   1.432 +		TInt iFontMaxCharDepth;
   1.433 +        /** Maximum ascent of the fonts in the line. */
   1.434 +		TInt iFontMaxAscent;
   1.435 +        /** Maximum descent of the fonts in the line. */
   1.436 +		TInt iFontMaxDescent;
   1.437 +        /** Desired precise or minimum line height. */
   1.438 +		TInt iDesiredLineHeight;
   1.439 +        /** True if the line height must be precise. */
   1.440 +		TBool iExactLineHeight;
   1.441 +		};
   1.442 +
   1.443 +	/**	The Unicode line breaking classes; see Unicode Technical Report 14.
   1.444 +	Not a named enumerated type, so that overriding applications can add new
   1.445 +	line breaking classes freely.
   1.446 +	The description of each constant gives the name of the line-breaking
   1.447 +	class, an example and a brief, imprecise description of the default
   1.448 +	behaviour of characters of that class.
   1.449 +	*/
   1.450 +	enum
   1.451 +		{
   1.452 +		/** Opening Punctuation (e.g. '['). Breaking after prohibited. */
   1.453 +		EOpLineBreakClass,
   1.454 +		/** Closing Punctuation (e.g. ']'). Breaking before prohibited. */
   1.455 +		EClLineBreakClass,
   1.456 +		/** Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited. */
   1.457 +		EQuLineBreakClass,
   1.458 +		/** Glue (e.g. Non-breaking space). Breaking before and after prohibited
   1.459 +		unless spaces are present. */
   1.460 +		EGlLineBreakClass,
   1.461 +		/** Non-Starter (e.g. small Japanese kana). Breaking before prohibited
   1.462 +		if no spaces present. */
   1.463 +		ENsLineBreakClass,
   1.464 +		/** Exclamation or Interrogation (e.g. '?'). Like closing punctuation
   1.465 +		except before Postfix or Non-starter. */
   1.466 +		EExLineBreakClass,
   1.467 +		/** Symbol (e.g. '/'. Like Alphabetic, but allows breaking before
   1.468 +		Alphabetic. */
   1.469 +		ESyLineBreakClass,
   1.470 +		/** Numeric Infix Separator (e.g. ','). Forbids breaking after any and before
   1.471 +		Numeric. */
   1.472 +		EIsLineBreakClass,
   1.473 +		/** Numeric Prefix (e.g. '$'). Forbids breaking before Numeric. */
   1.474 +		EPrLineBreakClass,
   1.475 +		/** Numeric Postfix (e.g. '%'). Forbids breaking after Numeric. */
   1.476 +		EPoLineBreakClass,
   1.477 +		/** Numeric (e.g. '1'). */
   1.478 +		ENuLineBreakClass,
   1.479 +		/** Alphabetic (e.g. 'a'). */
   1.480 +		EAlLineBreakClass,
   1.481 +		/** Ideographic (e.g. Japanese Kanji). Generally break before or after */
   1.482 +		EIdLineBreakClass,
   1.483 +		/** Inseparable (e.g. ellipsis). Forbid breaks between Inseparables. */
   1.484 +		EInLineBreakClass,
   1.485 +		/** Hyphen (e.g. '-'). Allows a break after except before Numeric. */
   1.486 +		EHyLineBreakClass,
   1.487 +		/** Break After. Generally allow a break after. Breaking between Break
   1.488 +		Afters not separated by spaces is prohibited. */
   1.489 +		EBaLineBreakClass,
   1.490 +		/** Break Before. Generally allow a break before. Breaking between Break
   1.491 +		Befores not separated by spaces is prohibited. */
   1.492 +		EBbLineBreakClass,
   1.493 +		/** Break Before and After. Generally allow a break before or after.
   1.494 +		Breaking between Break Before and Afters is prohibited, even if spaces
   1.495 +		are present. */
   1.496 +		EB2LineBreakClass,
   1.497 +		/** Zero-Width Space. Allow a break. */
   1.498 +		EZwLineBreakClass,
   1.499 +		/** Combining Mark. Takes on the class of its base class. */
   1.500 +		ECmLineBreakClass,
   1.501 +		/** Mandatory Break. */
   1.502 +		EBkLineBreakClass,
   1.503 +		/** Carriage Return. Break after unless part of a CRLF pair. */
   1.504 +		ECrLineBreakClass,
   1.505 +		/** Line Feed. Break after. */
   1.506 +		ELfLineBreakClass,
   1.507 +		/** Surrogate. Half of a surrogate pair. */
   1.508 +		ESgLineBreakClass,
   1.509 +		/** Contingent Break (e.g. embedded pictures). Uses external
   1.510 +		information */
   1.511 +		ECbLineBreakClass,
   1.512 +
   1.513 +		/** Space. Intervening characters of class Space are indicated by
   1.514 +		aHaveSpaces in LineBreakPossible. */
   1.515 +		ESpLineBreakClass, 
   1.516 +
   1.517 +		/** Complex Context (e.g. Thai). Runs of Complex Context are passed to
   1.518 +		GetLineBreakInContext. */
   1.519 +		ESaLineBreakClass,
   1.520 +
   1.521 +		/** Ambiguous. Characters of ambiguous East Asian width are treated
   1.522 +		as Alphabetic, unless they are resolved as being "Wide", in which case
   1.523 +		they are treated as Ideographic. */
   1.524 +		EAiLineBreakClass,
   1.525 +
   1.526 +		/** The Xx class is used when the class is unknown; e.g.; outside the provided context. */
   1.527 +		EXxLineBreakClass,
   1.528 +
   1.529 +		/** The number of Unicode line break classes. */
   1.530 +		ELineBreakClasses
   1.531 +		};
   1.532 +
   1.533 +	IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
   1.534 +	IMPORT_C virtual TInt Stretch(TUint aChar) const;
   1.535 +	IMPORT_C virtual TUint Map(TUint aChar) const;
   1.536 +	IMPORT_C virtual void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const;
   1.537 +	IMPORT_C virtual void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
   1.538 +										 const TLogicalRgb& aBackground,TRect& aRectDrawn) const;
   1.539 +	IMPORT_C virtual void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
   1.540 +										   const TTmLineInfo& aLineInfo) const;
   1.541 +	IMPORT_C virtual void DrawText(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aRect,
   1.542 +								   const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
   1.543 +								   const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
   1.544 +	IMPORT_C virtual void DrawPicture(CGraphicsContext& aGc,
   1.545 +		const TPoint& aTextLayoutTopLeft, const TRect& aRect,
   1.546 +		MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const;
   1.547 +	IMPORT_C virtual TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
   1.548 +	IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
   1.549 +	IMPORT_C virtual TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
   1.550 +												 TBool aForwards,TInt& aBreakPos) const;
   1.551 +	IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
   1.552 +
   1.553 +	// non-virtuals
   1.554 +	IMPORT_C void SetPenColor(CGraphicsContext& aGc,TLogicalRgb aColor) const;
   1.555 +	IMPORT_C void SetBrushColor(CGraphicsContext& aGc,TLogicalRgb aColor) const;
   1.556 +	IMPORT_C TRgb SystemColor(TLogicalRgb aColor) const;
   1.557 +	};
   1.558 +
   1.559 +/**
   1.560 +MTmTextDrawExt interface UID.
   1.561 +@internalComponent
   1.562 +*/
   1.563 +const TUid KTmTextDrawExtId = {0x10203665};
   1.564 +
   1.565 +/**
   1.566 +Text drawing - an extension interface. It offfers
   1.567 +DrawLine(), DrawText() and DrawRect() methods.
   1.568 +The idea is to move out from RTm<Name>Interpreter implementations all 
   1.569 +CGraphicsContext::Draw<Item> calls and replace them with the corresponding 
   1.570 +MTmTextDrawExt::Draw<Item> calls. The implementations of MTmTextDrawExt interface can customize
   1.571 +drawing methods implementations - for example - including opaque drawing support.
   1.572 +The MTmTextDrawExt interface UID is KTmTextDrawExtId. The interface implementation can be queried
   1.573 +through a MTmSource::GetExtendedInterface() call.
   1.574 +@internalComponent
   1.575 +*/
   1.576 +class MTmTextDrawExt
   1.577 +	{
   1.578 +public:
   1.579 +	virtual void DrawLine(CGraphicsContext& aGc, const TPoint& aPt1, const TPoint& aPt2) const = 0;
   1.580 +	virtual void DrawText(CGraphicsContext& aGc, const TDesC& aText, const TPoint& aPt) const = 0;
   1.581 +	virtual void DrawRect(CGraphicsContext& aGc, const TRect& aRc) const = 0;
   1.582 +	};
   1.583 +
   1.584 +/**
   1.585 +@internalComponent
   1.586 +*/
   1.587 +const TUid KFormLabelApiExtensionUid = { 0x101FD03C};
   1.588 +
   1.589 +/** 
   1.590 +MTmSource is an interface class that must be implemented by users of
   1.591 +CTmTextLayout to provide text content and attributes. MTmSource is derived from
   1.592 +MTmCustom, which contains the functions to customise the layout and display, so
   1.593 +that this can be done in CTmText without affecting the content.
   1.594 +@internalComponent
   1.595 +*/
   1.596 +class MTmSource: public MTmCustom
   1.597 +
   1.598 +	{
   1.599 +public:
   1.600 +	/** Label type used in LabelModeSelect */
   1.601 +	enum TLabelType
   1.602 +		{
   1.603 +		/** Not a label; used for TLabelTypes not yet assigned. */
   1.604 +		ENoLabel,
   1.605 +
   1.606 +		/** Paragraph label of the type supported by FORM. */
   1.607 +		EParLabel
   1.608 +		};
   1.609 +
   1.610 +	enum
   1.611 +		{
   1.612 +		/**
   1.613 +		The maximum number of characters supplied to GetLineBreak, after aMaxBreakPos,
   1.614 +		and after trailing whitespace, to provide context for line breaking decisions.
   1.615 +		*/
   1.616 +		ELineBreakContext = 32
   1.617 +		};
   1.618 +
   1.619 +	// pure virtuals
   1.620 +	
   1.621 +	/** Return the device used to format the text. */
   1.622 +	virtual MGraphicsDeviceMap& FormatDevice() const = 0;
   1.623 +
   1.624 +	/**
   1.625 +	Return the device used to draw the text and when converting between x-y coordinates and document positions.
   1.626 +	If the formatting and interpreting devices are different, text is scaled appropriately when it is drawn;
   1.627 +	this allows text to be formatted for printer fonts and displayed on the screen, giving a wysiwyg print preview.
   1.628 +	*/
   1.629 +	virtual MGraphicsDeviceMap& InterpretDevice() const = 0;
   1.630 +
   1.631 +	/** Return the length of the document in characters. */
   1.632 +	virtual TInt DocumentLength() const = 0;
   1.633 +
   1.634 +	/**
   1.635 +	Return at least one character of text, but preferably as many as possible, starting at aPos. Put its character
   1.636 +	format in aFormat. The text must be a run of characters sharing the same character format.
   1.637 +	*/
   1.638 +	virtual void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const = 0;
   1.639 +
   1.640 +	/**
   1.641 +	Return the paragraph format of the paragraph containing aPos. End-of-paragraph characters belong to the preceding
   1.642 +	paragraph.
   1.643 +	*/
   1.644 +	virtual void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const = 0;
   1.645 +
   1.646 +	/**
   1.647 +	Return the document position of the start of the paragraph containing aPos. End-of-paragraph characters belong to
   1.648 +	the preceding paragraph.
   1.649 +	*/
   1.650 +	virtual TInt ParagraphStart(TInt aPos) const = 0;
   1.651 +
   1.652 +	// ordinary virtuals
   1.653 +	IMPORT_C virtual CPicture* PictureL(TInt aPos) const;
   1.654 +	IMPORT_C virtual TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const;
   1.655 +	IMPORT_C virtual TAny* GetExtendedInterface(const TUid& aInterfaceId);
   1.656 +	IMPORT_C virtual void MTmSource_Reserved_1();
   1.657 +	IMPORT_C virtual void MTmSource_Reserved_2();
   1.658 +	IMPORT_C virtual TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const;
   1.659 +
   1.660 +	// non-virtuals
   1.661 +	IMPORT_C TInt ParagraphEnd(TInt aPos) const;
   1.662 +	IMPORT_C TBool GetLineBreakL(const TDesC& aText,TInt aDocPos,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,
   1.663 +								 TInt& aBreakPos,TInt& aHangingChars,TInt& aBreakPosAfterSpaces) const;
   1.664 +	IMPORT_C static void GetStandardLineBreak(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
   1.665 +											  TInt& aBreakPos,TInt& aNextLineStart);
   1.666 +	};
   1.667 +
   1.668 +/**
   1.669 +Class used to provide label functionality within Form
   1.670 +as an extended interface (via the GetExtendedInterface mechanism
   1.671 +supplied in MTmSource). This class is entirely internal to Form.
   1.672 +@internalComponent
   1.673 +@see MTmSource::GetExtendedInterface
   1.674 +@since Sirocco
   1.675 +*/
   1.676 +class MFormLabelApi
   1.677 +	{
   1.678 +public:
   1.679 +	IMPORT_C virtual TBool LabelModeSelect(MTmSource::TLabelType aType, TInt aPos);
   1.680 +	IMPORT_C virtual void LabelModeCancel();
   1.681 +	IMPORT_C virtual void LabelMetrics(MTmSource::TLabelType aType, TSize& aLabelSize, TInt& aMarginSize) const;
   1.682 +	};
   1.683 +
   1.684 +/**
   1.685 +@internalTechnology
   1.686 +*/
   1.687 +class CTmBufSeg: public CBufSeg
   1.688 +	{
   1.689 +public:
   1.690 +	inline CTmBufSeg(TInt aExpandSize);
   1.691 +	TInt MemoryUsed() const;
   1.692 +	};
   1.693 +
   1.694 +/** @internalTechnology */
   1.695 +class CTmCode: public CBase
   1.696 +	{
   1.697 +public:
   1.698 +	inline ~CTmCode();
   1.699 +	void InsertByteL(TUint8 aByte,TInt aPos);
   1.700 +	TInt InsertNumberL(TInt aNumber,TInt aPos);
   1.701 +	TInt InsertRectL(const TRect& aRect,TInt aPos);
   1.702 +	void AppendByteL(TUint8 aByte);
   1.703 +	TInt AppendNumberL(TInt aNumber);
   1.704 +	TInt AppendRectL(const TRect& aRect);
   1.705 +	void ChangeL(TInt aStart,TInt aEnd,CTmCode& aNewCode);
   1.706 +	TInt MemoryUsed() const;
   1.707 +	TInt Size() const;
   1.708 +	void Delete(TInt aPos,TInt aLength);
   1.709 +	void Reset();
   1.710 +	inline TPtr8 Ptr(TInt aPos);
   1.711 +	void CreateBufferL();
   1.712 +	inline CBufBase* Buffer();
   1.713 +	inline const CBufBase* Buffer() const;
   1.714 +
   1.715 +private:
   1.716 +	enum
   1.717 +		{
   1.718 +		EExpandSize = 512
   1.719 +		};
   1.720 +	TInt WriteNumber(TInt aNumber,TUint8* aBuffer);
   1.721 +
   1.722 +	CTmBufSeg* iBuffer;
   1.723 +	};
   1.724 +
   1.725 +/**
   1.726 +Formatting parameters used when formatting part of a layout object.
   1.727 +@internalComponent
   1.728 +*/
   1.729 +class TTmFormatParamBase
   1.730 +
   1.731 +	{
   1.732 +public:
   1.733 +	enum
   1.734 +		{
   1.735 +		EWrap = 1,							// wrap the text at iWrapWidth
   1.736 +		EAtLeastMaxHeight = 2,				// stop adding text only when iMaxHeight has been reached or exceeded
   1.737 +		ETruncateWithEllipsis = 4,			// truncate any text that sticks out; see iEllipsis below
   1.738 +		ELegalLineBreaksOnly = 8			// break only at allowed line breaks, even if that
   1.739 +											// results in the text not fitting the measure
   1.740 +		};
   1.741 +
   1.742 +	IMPORT_C TTmFormatParamBase();
   1.743 +	inline TBool IsWrapping() const;
   1.744 +	inline TBool IsTruncatingWithEllipsis() const;
   1.745 +	inline TBool LegalLineBreaksOnly() const;
   1.746 +
   1.747 +	TInt iWrapWidth;					// wrapping width of the text including margins and indents, if wrapping is on
   1.748 +	TInt iMaxHeight;					// maximum height of the text
   1.749 +	TInt iMaxLines;						// maximum number of lines to be formatted
   1.750 +	TInt iFlags;						// flags defined above
   1.751 +	TChar iEllipsis;					// if truncating and not 0xFFFF, insert this ellipsis char (defaults to '...').
   1.752 +				
   1.753 +	};
   1.754 +
   1.755 +/** 
   1.756 +Formatting parameters used when formatting an entire layout object or
   1.757 +creating a section of format code.
   1.758 +@internalComponent
   1.759 +*/
   1.760 +class TTmFormatParam: public TTmFormatParamBase
   1.761 +
   1.762 +	{
   1.763 +public:
   1.764 +	IMPORT_C TTmFormatParam();
   1.765 +	IMPORT_C TTmFormatParam(const TTmFormatParamBase& aBase);
   1.766 +
   1.767 +	TInt iStartChar;					// first character position to be formatted
   1.768 +	TInt iEndChar;						// last character position to be formatted
   1.769 +	TInt iLineInPar;					// starting line number in the paragraph
   1.770 +	};
   1.771 +
   1.772 +/** 
   1.773 +Additional parameters used when reformatting.
   1.774 +@internalComponent
   1.775 +*/
   1.776 +class TTmReformatParam
   1.777 +
   1.778 +	{
   1.779 +public:
   1.780 +	IMPORT_C TTmReformatParam();
   1.781 +
   1.782 +	TInt iStartChar;					// start of changed text
   1.783 +	TInt iOldLength;					// length of text before the change
   1.784 +	TInt iNewLength;					// length of text after the change
   1.785 +	TInt iMaxExtraLines;				// maximum lines in the partial paragraph after the end of the changed text
   1.786 +										// to format in one go; the remainder can be handled by background formatting
   1.787 +	TBool iParFormatChanged;			// TRUE if the paragraph format of the changed text has changed
   1.788 +	TBool iParInvalid;					// format to the end of the paragraph
   1.789 +	};
   1.790 +
   1.791 +/** 
   1.792 +Information returned when reformatting. 
   1.793 +@internalComponent
   1.794 +*/
   1.795 +class TTmReformatResult
   1.796 +
   1.797 +	{
   1.798 +public:
   1.799 +	IMPORT_C TTmReformatResult();
   1.800 +
   1.801 +	TRect iRedrawRect;					// rectangle to be redrawn
   1.802 +	TInt iHeightChange;					// change in height of the reformatted text
   1.803 +	TInt iUnchangedTop;					// y coordinate, before formatting, of the top of text needing no change,
   1.804 +										// including text in any section not yet formatted by this call
   1.805 +	TInt iUnformattedStart;				// start of any unformatted section; KMaxTInt if none
   1.806 +	};
   1.807 +
   1.808 +/** 
   1.809 +A structure for returning information about a line. One of these is
   1.810 +returned by all hit-detection functions. Typically, after finding the position
   1.811 +in the document that corresponds to given x-y coordinates, you will want some
   1.812 +more information like the line's bounding rectangle. When you call, for
   1.813 +example, CTmTextLayout::FindXyPos you will receive a TTmLineInfo object that
   1.814 +will tell you this, and much more. 
   1.815 +@publishedAll
   1.816 +@released
   1.817 +*/
   1.818 +class TTmLineInfo
   1.819 +
   1.820 +	{
   1.821 +public:
   1.822 +	// bit values for iFlags
   1.823 +	enum
   1.824 +		{
   1.825 +		EParStart = 1,
   1.826 +		EParEnd = 2,
   1.827 +		EParRightToLeft = 4,
   1.828 + 		ELineEndsInForcedLineBreak = 8,
   1.829 + 		EPictureButtsLowerEdge = 16,	/**< @deprecated - no effect, present for compatibility only */
   1.830 + 		EPictureButtsUpperEdge = 32	/**< @deprecated - no effect, present for compatibility only */
   1.831 +		};
   1.832 +
   1.833 +	inline TTmLineInfo();
   1.834 +	
   1.835 +	/** Outer enclosing rectangle including margins */
   1.836 +	TRect iOuterRect;	
   1.837 +	
   1.838 +	/** Inner enclosing rectangle: the text only */
   1.839 +	TRect iInnerRect;
   1.840 +	
   1.841 +	/** y coordinate of the baseline */
   1.842 +	TInt iBaseline;	
   1.843 +	
   1.844 +	/** Start document position */
   1.845 +	TInt iStart;
   1.846 +	
   1.847 +	/** End document position */
   1.848 +	TInt iEnd;			
   1.849 +	
   1.850 +	/** Line number */
   1.851 +	TInt iLineNumber;
   1.852 +	
   1.853 +	/** Paragraph number */
   1.854 +	TInt iParNumber;	
   1.855 +	
   1.856 +	/** Line number in the paragraph */
   1.857 +	TInt iLineInPar;
   1.858 +	
   1.859 +	/** y coordinate of the top of the paragraph */
   1.860 +	TInt iParTop;
   1.861 +
   1.862 +	/** Start of paragraph, end of paragraph, etc. */
   1.863 +	TUint iFlags;		
   1.864 +	};
   1.865 +
   1.866 +/**
   1.867 +A structure to hold a logical document position that can be converted to a raw
   1.868 +document position or an x-y position.
   1.869 +
   1.870 +A document position can specify a leading or trailing edge or a text
   1.871 +directionality so that bidirectional hit testing can use both these
   1.872 +distinctions.
   1.873 +
   1.874 +The leading edge at position N is the position before character N in logical
   1.875 +order, and the trailing edge is the position after character in logical order.
   1.876 +
   1.877 +Specification by directionality works differently. Character N in left-to-right
   1.878 +text is preceded by position N (left-to-right) and followed by position N+1
   1.879 +(left-to-right). Character N in right-to-left text is preceded (in display
   1.880 +order) by position N+1 (right-to-left) and followed by position N
   1.881 +(right-to-left).
   1.882 +@publishedAll
   1.883 +@released
   1.884 +*/
   1.885 +class TTmDocPosSpec
   1.886 +
   1.887 +	{
   1.888 +public:
   1.889 +	/**
   1.890 +	The cursor type.
   1.891 +	*/
   1.892 +	enum TType
   1.893 +		{
   1.894 +		/** trailing edge */
   1.895 +		ETrailing,
   1.896 +
   1.897 +		/** leading edge */
   1.898 +		ELeading,
   1.899 +
   1.900 +		/** left-to-right */
   1.901 +		ELeftToRight,
   1.902 +
   1.903 +		/** right-to-left */
   1.904 +		ERightToLeft
   1.905 +		};
   1.906 +
   1.907 +	inline TTmDocPosSpec();
   1.908 +	inline TTmDocPosSpec(TInt aPos,TType aType);
   1.909 +	inline TTmDocPosSpec(const TTmDocPos& aRawDocPos);
   1.910 +
   1.911 +	/** the edge position in the document; 0 ... document length */
   1.912 +	TInt iPos;
   1.913 +	/** the type as specified above */
   1.914 +	TType iType;	
   1.915 +	};
   1.916 +
   1.917 +/** 
   1.918 +A structure for holding a raw document position that can be converted to or
   1.919 +from an x-y position and compared ordinally, which cannot be done with the more
   1.920 +abstract TTmDocPosSpec class. Leading edges are distinguished from trailing
   1.921 +edges so that bidirectional hit testing and cursor positioning can distinguish
   1.922 +between 'after character N', and 'before character N + 1', which may be some
   1.923 +distance apart if N and N + 1 are in runs of opposite directionality. 
   1.924 +@publishedAll
   1.925 +@released
   1.926 +*/
   1.927 +class TTmDocPos
   1.928 +
   1.929 +	{
   1.930 +public:
   1.931 +	inline TTmDocPos();
   1.932 +	inline TTmDocPos(TInt aPos,TBool aLeadingEdge);
   1.933 +	IMPORT_C TBool operator==(const TTmDocPos& aPos) const;
   1.934 +	inline TBool operator!=(const TTmDocPos& aPos) const;
   1.935 +	IMPORT_C TBool operator>(const TTmDocPos& aPos) const;
   1.936 +	IMPORT_C TBool operator>=(const TTmDocPos& aPos) const;
   1.937 +	inline TBool operator<(const TTmDocPos& aPos) const;
   1.938 +	inline TBool operator<=(const TTmDocPos& aPos) const;
   1.939 +
   1.940 +	/** the edge position in the document; 0 ... document length */
   1.941 +	TInt iPos;
   1.942 +	/** true if the position is a leading edge */
   1.943 +	TBool iLeadingEdge;	
   1.944 +	};
   1.945 +
   1.946 +/** 
   1.947 +Holds information about a position in a document. 
   1.948 +@publishedAll
   1.949 +@released
   1.950 +*/	
   1.951 +class TTmPosInfo2
   1.952 +
   1.953 +	{
   1.954 +public:
   1.955 +	/** Document position. */
   1.956 +	TTmDocPos iDocPos;
   1.957 +	/** True if the position is attatched to text flowing right-to-left. */
   1.958 +	TBool iRightToLeft;
   1.959 +	/** Intersection of the character edge with the baseline. */
   1.960 +	TPoint iEdge;
   1.961 +	};
   1.962 +
   1.963 +/** 
   1.964 +A structure for returning information about a position in a line.
   1.965 +@deprecated 7.0s 
   1.966 +@internalComponent
   1.967 +*/
   1.968 +class TTmPosInfo
   1.969 +
   1.970 +	{
   1.971 +public:
   1.972 +	TTmPosInfo() {}
   1.973 +	TTmPosInfo(const TTmPosInfo2& a) : iDocPos(a.iDocPos), iEdge(a.iEdge) {}
   1.974 +	TTmDocPos iDocPos;	// the document position
   1.975 +	TPoint iEdge;			// intersection of the character edge at iDocPos with the baseline
   1.976 +	};
   1.977 +
   1.978 +/**
   1.979 +@internalComponent
   1.980 +*/
   1.981 +class TTmHighlightExtensions
   1.982 +
   1.983 +	{
   1.984 +public:
   1.985 +	inline TTmHighlightExtensions();
   1.986 +	inline void SetAll(TInt aExtension);
   1.987 +	inline void SetLeftExtension(TInt aExtension);
   1.988 +	inline void SetRightExtension(TInt aExtension);
   1.989 +	inline void SetTopExtension(TInt aExtension);
   1.990 +	inline void SetBottomExtension(TInt aExtension);
   1.991 +	inline TInt LeftExtension() const;
   1.992 +	inline TInt RightExtension() const;
   1.993 +	inline TInt TopExtension() const;
   1.994 +	inline TInt BottomExtension() const;
   1.995 +	inline TBool Extends() const;
   1.996 +	inline TBool Shrinks() const;
   1.997 +	inline void ExtendRect(TRect& aRect) const;
   1.998 +	inline void AdjustRect(TRect& aRect) const;
   1.999 +	inline TBool IsNull() const;
  1.1000 +	inline void AbsExtendRect(TRect& aRect) const;
  1.1001 +public:
  1.1002 +	TInt iLeftExtension;
  1.1003 +	TInt iRightExtension;
  1.1004 +	TInt iTopExtension;
  1.1005 +	TInt iBottomExtension;
  1.1006 +	};
  1.1007 +
  1.1008 +/** 
  1.1009 +Cursor placement. Used as an argument to CTextView::SetCursorPlacement().
  1.1010 +@see CTextView::SetCursorPlacement()
  1.1011 +@publishedAll
  1.1012 +*/
  1.1013 +enum TTmCursorPlacement
  1.1014 +	{
  1.1015 +	 /** The text cursor is a vertical line at the insertion position, with its height 
  1.1016 +	and depth based on the metrics of the previous character in the paragraph 
  1.1017 +	or if none, the next character. */
  1.1018 +	ECursorVertical,		
  1.1019 +	/** The text cursor is an underline below the character logically after the insertion 
  1.1020 +	position. */
  1.1021 +	ECursorUnderlineNext,
  1.1022 +	/** The text cursor is an underline below the character logically before the insertion 
  1.1023 +	position. */
  1.1024 +	ECursorUnderlinePrev
  1.1025 +	};
  1.1026 +
  1.1027 +/**
  1.1028 +The text layout for a single rectangular piece of text. The object does not own its text or format attributes but
  1.1029 +gets them from an interface class called MTmSource.
  1.1030 +
  1.1031 +There are functions for setting the text, drawing it, and converting between x-y coordinates and document positions.
  1.1032 +
  1.1033 +Ranges
  1.1034 +
  1.1035 +All ranges of character positions and pixels include the start but not the end. This means that if a line is described
  1.1036 +by a TTmLineInfo object as starting at document position 345 and ending at 389, character positions 345 to 388 are in
  1.1037 +the line; 389 is in the next line if any.
  1.1038 +
  1.1039 +Coordinates and units
  1.1040 +
  1.1041 +All coordinates used in TAGMA classes and function arguments are in pixels and are relative to the origin of the object,
  1.1042 +which is the top left corner of the ordinary text, not including paragraph labels. Vertical coordinates increase from
  1.1043 +top to bottom.
  1.1044 +
  1.1045 +Document format and positions
  1.1046 +
  1.1047 +A TAGMA document, as supplied by the MTmSource interface, has a length as returned by MTmSource::DocumentLength of
  1.1048 +zero or more characters. It consists of Unicode text split into paragraphs by standard Unicode paragraph delimiters
  1.1049 +(character value 0x2029), so the number of paragraphs in the entire document is one more than the number of
  1.1050 +paragraph delimiters. A document position is a value in the range 0 to one more than the document length.
  1.1051 +Lines contain all document positions from their start to one less than their end position. These conventions allow
  1.1052 +all lines to end in a delimiter; the last line contains an imaginary paragraph end, which need not be supplied by
  1.1053 +the MTmSource interface, at a position equal to the document length. A CTmTextLayout object formatted for an
  1.1054 +empty document will thus have a start position (returned by StartChar) of 0 and an end position
  1.1055 +(returned by EndChar) of 1.
  1.1056 +@internalComponent
  1.1057 +*/
  1.1058 +class CTmTextLayout: public CBase
  1.1059 +
  1.1060 +	{
  1.1061 +public:
  1.1062 +	
  1.1063 +	class TTmChunkDescription
  1.1064 +	/** 
  1.1065 +	Output from FindAdjacentChunks. Describes a chunk of text that is of a
  1.1066 +	constant format and directionality. 
  1.1067 +	@internalComponent
  1.1068 +	*/
  1.1069 +		{
  1.1070 +	public:
  1.1071 +		/** Position of the first character in the chunk. A negative number
  1.1072 +		indicates "no such chunk". */
  1.1073 +		TInt iStart;
  1.1074 +		/** One past the position of the last character in the chunk. */
  1.1075 +		TInt iEnd;
  1.1076 +		/** ETrue if the chunk is displayed right-to-left. */
  1.1077 +		TBool iRightToLeft;
  1.1078 +		};
  1.1079 +
  1.1080 +	IMPORT_C CTmTextLayout();
  1.1081 +	IMPORT_C ~CTmTextLayout();
  1.1082 +	IMPORT_C void SetTextL(MTmSource& aSource,const TTmFormatParam& aParam);
  1.1083 +	IMPORT_C void FormatL(const TTmFormatParamBase& aParam,const TTmReformatParam& aReformatParam,
  1.1084 +						  TTmReformatResult& TTmReformatResult);
  1.1085 +	IMPORT_C TBool AddParL(const TTmFormatParamBase& aParam,TBool aAtStart,TInt& aHeightIncrease,TInt& aParagraphsIncrease);
  1.1086 +	IMPORT_C TBool DeletePar(const TTmFormatParamBase& aParam,TBool aAtStart,TInt aMaxDeletedHeight,TInt& aHeightDecrease);
  1.1087 +	IMPORT_C void Clear();
  1.1088 +	IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1089 +							 const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const;
  1.1090 +	IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1091 +								 const TLogicalRgb& aBackground) const;
  1.1092 +	IMPORT_C void InvertLayout(CGraphicsContext& aGc, const TPoint& aTopLeft,
  1.1093 +		TInt aStartDocPos, TInt aEndDocPos) const;
  1.1094 +	IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
  1.1095 +		TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const;
  1.1096 +	IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
  1.1097 +		TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const;
  1.1098 +	IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
  1.1099 +		TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions,
  1.1100 +		TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
  1.1101 +	IMPORT_C void InvertLayout(CGraphicsContext& aGc,
  1.1102 +		const TPoint& aTopLeft, TInt aStartDocPos,TInt aEndDocPos, const TTmHighlightExtensions& aHighlightExtensions,
  1.1103 +		TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
  1.1104 +	IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
  1.1105 +		TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions,
  1.1106 +		TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
  1.1107 +	IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1108 +	IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1109 +	IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos,
  1.1110 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight,
  1.1111 +		TTmLineInfo& aLineInfo) const;
  1.1112 +	IMPORT_C TInt FindNextPos(TInt aStart) const;
  1.1113 +	IMPORT_C TInt FindPreviousPos(TInt aStart) const;
  1.1114 +	IMPORT_C TInt Lines() const;
  1.1115 +	IMPORT_C TInt Paragraphs() const;
  1.1116 +	IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const;
  1.1117 +	IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const;
  1.1118 +	IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const;
  1.1119 +	IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const;
  1.1120 +	IMPORT_C TBool GetDisplayedTextL(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
  1.1121 +	IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const;
  1.1122 +	IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const;
  1.1123 +	IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const;
  1.1124 +	IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight,
  1.1125 +		TInt aTopY = 0, TInt aBottomY = KMaxTInt) const;
  1.1126 +	IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const;
  1.1127 +	IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos,
  1.1128 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
  1.1129 +	IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos,
  1.1130 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
  1.1131 +	IMPORT_C TBool LineExtreme(const TTmDocPosSpec& aPos, TBool aToRight,
  1.1132 +		TTmDocPos& aExtreme) const;
  1.1133 +	IMPORT_C TBool FindAdjacentChunks(const TTmDocPosSpec& aPos,
  1.1134 +		TTmChunkDescription& aLeft, TTmChunkDescription& aRight) const;
  1.1135 +	IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement,
  1.1136 +							 TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
  1.1137 +	IMPORT_C TInt MemoryUsed() const;
  1.1138 +	inline TInt StartChar() const;
  1.1139 +	inline TInt EndChar() const;
  1.1140 +	inline TInt LayoutWidth() const;
  1.1141 +	inline TInt LayoutHeight() const;
  1.1142 +	inline MTmSource* Source();
  1.1143 +	inline const MTmSource* Source() const;
  1.1144 +	inline const CTmCode& Code() const;
  1.1145 + 	IMPORT_C void MakeVisible(TBool aVisible);
  1.1146 + 	TInt GetDrawingInterpFlags() const;
  1.1147 +	IMPORT_C void DeleteFormattingFromEndL(
  1.1148 +		const TTmFormatParamBase& aParam, TInt aMaxDeletedHeight, TInt& aHeightDecrease);
  1.1149 +	IMPORT_C void ExtendFormattingDownwardsL(TTmFormatParam& aParam);
  1.1150 +
  1.1151 +	// deprecated functions
  1.1152 +	// deprecated 7.0
  1.1153 +	IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
  1.1154 +	// deprecated 7.0s
  1.1155 +	IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1156 +	// deprecated 7.0s
  1.1157 +	IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1158 +	// deprecated 7.0s
  1.1159 +	IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const;
  1.1160 +	// deprecated 7.0s
  1.1161 +	IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const;
  1.1162 +	// deprecated 7.0s
  1.1163 +	IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos,
  1.1164 +		TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo,
  1.1165 +		TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const;
  1.1166 +
  1.1167 +	IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1168 +							 const TLogicalRgb* aDocBackground,TBool aDrawParBackground,
  1.1169 +							 const TCursorSelection* aHighlight,
  1.1170 +							 const TTmHighlightExtensions* aHighlightExtensions) const;
  1.1171 +	IMPORT_C void GetUpdateBoundingRect(TInt aStartDocPos, TInt aEndDocPos, const TPoint& aTopLeft,
  1.1172 +		TRect& aBoundingRect) const;
  1.1173 +
  1.1174 +	IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo, TInt& aSubscript) const;
  1.1175 +private:
  1.1176 +	TBool LastLine(TTmLineInfo& aLine);
  1.1177 +#ifdef _DEBUG
  1.1178 +	void Invariant() const;
  1.1179 +#else
  1.1180 +	void Invariant() const { }
  1.1181 +#endif
  1.1182 +	void AdjustWidth(const TTmFormatParamBase& aParam,TInt aWidthOfNewText);
  1.1183 +
  1.1184 +	MTmSource* iSource;				// source of text and text attributes; not owned
  1.1185 +	CTmCode iCode;					// the layout bytecode
  1.1186 +	TInt iWidth;					// width in pixels
  1.1187 +	TInt iHeight;					// height in pixels
  1.1188 +	TInt iStartChar;				// start character position in the document
  1.1189 +	TInt iEndChar;					// end character position in the document
  1.1190 +	TBidirectionalContext* iBdStateAtEnd; //bidirectional state at end of formatted range
  1.1191 +	TInt iDrawingInterpFlags;		// flags destined for the RTmDrawingInterpreter object
  1.1192 +	// please try to avoid removing or adding any new members to this class. although it
  1.1193 +	// is internal, it is included by value in CTextLayout which is published.  therefore
  1.1194 +	// a size change in this class would mean a size change in CTextLayout and a BC break.
  1.1195 +	// if adding or removing members is unavoidable, please remember to update the dummy
  1.1196 +	// member in CTextLayout accordingly.
  1.1197 +	};
  1.1198 +
  1.1199 +/**
  1.1200 +A mixin class to make it easy for higher-level classes that own a CTmTextLayout
  1.1201 +object to have enquiry functions without it being necessary to implement them
  1.1202 +all as forwarding functions. The owner class just implements TextLayout and
  1.1203 +overrides GetOrigin if necessary.
  1.1204 +
  1.1205 +Non-const CTmTextLayout functions like Clear are not included because allowing
  1.1206 +them to be called on owner classes would probably put the owner class into an
  1.1207 +inconsistent state.
  1.1208 +
  1.1209 +The word Layout is prefixed, suffixed or infixed to functions with names that
  1.1210 +would usually conflict with owner class names. For example, we have DrawLayout,
  1.1211 +not Draw, and GetMinimumLayoutSizeL, not GetMinimumSizeL.
  1.1212 +@internalComponent
  1.1213 +*/
  1.1214 +class MTmTextLayoutForwarder
  1.1215 +
  1.1216 +	{
  1.1217 +public:
  1.1218 +	IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1219 +							 const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const;
  1.1220 +	IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1221 +								 const TLogicalRgb& aBackground) const;
  1.1222 +	IMPORT_C void InvertLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,TInt aStartDocPos,TInt aEndDocPos);
  1.1223 +	IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1224 +	IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1225 +	IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos,
  1.1226 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight,
  1.1227 +		TTmLineInfo& aLineInfo) const;
  1.1228 +	IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const;
  1.1229 +	IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const;
  1.1230 +	IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const;
  1.1231 +	IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const;
  1.1232 +	IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const;
  1.1233 +	IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight,
  1.1234 +		TInt aTopY = 0, TInt aBottomY = KMaxTInt) const;
  1.1235 +	IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const;
  1.1236 +	IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos,
  1.1237 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
  1.1238 +	IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos,
  1.1239 +		TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
  1.1240 +	IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement,
  1.1241 +							 TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
  1.1242 +
  1.1243 +	IMPORT_C TInt Lines() const;
  1.1244 +	IMPORT_C TInt Paragraphs() const;
  1.1245 +	IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
  1.1246 +	IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const;
  1.1247 +	IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const;
  1.1248 +	IMPORT_C TInt StartChar() const;
  1.1249 +	IMPORT_C TInt EndChar() const;
  1.1250 +	IMPORT_C TInt LayoutWidth() const;
  1.1251 +	IMPORT_C TInt LayoutHeight() const;
  1.1252 +
  1.1253 +	// deprecated functions
  1.1254 +	// deprecated 7.0s
  1.1255 +	IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1256 +	// deprecated 7.0s
  1.1257 +	IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
  1.1258 +	// deprecated 7.0s
  1.1259 +	IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const;
  1.1260 +	// deprecated 7.0s
  1.1261 +	IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const;
  1.1262 +	// deprecated 7.0s
  1.1263 +	IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos,
  1.1264 +		TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo,
  1.1265 +		TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const;
  1.1266 +private:
  1.1267 +	/** Returns a reference to the CTmTextLayoutObject this
  1.1268 +	MTmTextLayoutForwarder forwards inquiries to. */
  1.1269 +	virtual const CTmTextLayout& TextLayout() const = 0;
  1.1270 +	
  1.1271 +	/** The origin is subtracted from coordinates passed in and added to those
  1.1272 +	passed out. */
  1.1273 +	IMPORT_C virtual void GetOrigin(TPoint& aPoint) const;
  1.1274 +
  1.1275 +	void FixUpLineInfo(TTmLineInfo& aInfo,const TPoint* aOrigin = NULL) const;
  1.1276 +	};
  1.1277 +
  1.1278 +/** 
  1.1279 +A character format layer. Unmasked attributes are transparent. 
  1.1280 +@internalComponent
  1.1281 +*/	
  1.1282 +class TTmCharFormatLayer
  1.1283 +
  1.1284 +	{
  1.1285 +public:
  1.1286 +	inline TTmCharFormatLayer();
  1.1287 +	IMPORT_C TTmCharFormatLayer(const CCharFormatLayer& aFormat);
  1.1288 +
  1.1289 +	TTmCharFormat iFormat;
  1.1290 +	TTmCharFormatMask iMask;
  1.1291 +	};
  1.1292 +
  1.1293 +/** 
  1.1294 +A paragraph format layer. Unmasked attributes are transparent. 
  1.1295 +@internalComponent
  1.1296 +*/
  1.1297 +class RTmParFormatLayer
  1.1298 +
  1.1299 +	{
  1.1300 +public:
  1.1301 +	inline void Close();
  1.1302 +	IMPORT_C void CopyL(const CParaFormatLayer& aFormat);
  1.1303 +
  1.1304 +	RTmParFormat iFormat;
  1.1305 +	TTmParFormatMask iMask;
  1.1306 +	};
  1.1307 +
  1.1308 +/**
  1.1309 + A style. 
  1.1310 +@internalComponent
  1.1311 +*/
  1.1312 +class RTmStyle
  1.1313 +
  1.1314 +	{
  1.1315 +public:
  1.1316 +	enum
  1.1317 +		{
  1.1318 +		EMaxName = KMaxParagraphStyleName
  1.1319 +		};
  1.1320 +
  1.1321 +	inline void Close();
  1.1322 +	IMPORT_C void CopyL(const RParagraphStyleInfo& aStyle);
  1.1323 +	IMPORT_C void GetRParagraphStyleInfoL(RParagraphStyleInfo& aStyle,
  1.1324 +		const CParaFormatLayer& aGlobalParaFormatLayer,const CCharFormatLayer& aGlobalCharFormatLayer,
  1.1325 +		const CStyleList& aList) const;
  1.1326 +
  1.1327 +	TBuf<KMaxName> iName;
  1.1328 +	TBuf<KMaxName> iNextStyleName;
  1.1329 +	TTmCharFormatLayer iCharFormat;
  1.1330 +	RTmParFormatLayer iParFormat;
  1.1331 +	TInt iOutlineLevel;
  1.1332 +	};
  1.1333 +
  1.1334 +/** 
  1.1335 +A self-contained text object. It owns both layout and content. It is
  1.1336 +intended for labels and the general display of small-to-medium-sized amounts of
  1.1337 +text. 
  1.1338 +@internalComponent
  1.1339 +*/
  1.1340 +class CTmText: public CBase, public MTmTextLayoutForwarder
  1.1341 +
  1.1342 +	{
  1.1343 +public:
  1.1344 +	IMPORT_C static CTmText* NewL(MGraphicsDeviceMap* aDevice = NULL,const TTmFormatParamBase* aFormatParam = NULL);
  1.1345 +	IMPORT_C static CTmText* NewL(MGraphicsDeviceMap& aDevice,const TTmFormatParamBase& aFormatParam);
  1.1346 +	IMPORT_C static CTmText* NewL(MGraphicsDeviceMap& aDevice,TInt aWrapWidth,TInt aFlags);
  1.1347 +	IMPORT_C ~CTmText();
  1.1348 +	IMPORT_C void InsertL(TInt aPos,const TDesC& aText,
  1.1349 +						  const TTmCharFormat* aCharFormat = NULL,const RTmParFormat* aParFormat = NULL,
  1.1350 +						  TRect* aRedrawRect = NULL,TInt* aScroll = NULL);
  1.1351 +	IMPORT_C void GetFormat(TTmFormatParamBase& aFormatParam) const;
  1.1352 +	IMPORT_C void SetWrapWidthL(TInt aWrapWidth);
  1.1353 +	IMPORT_C void ChangeFormatL(const TTmFormatParamBase& aFormatParam);
  1.1354 +	IMPORT_C void Clear();
  1.1355 +	IMPORT_C void CustomizeL(const MTmCustom* aCustom);
  1.1356 +	IMPORT_C TInt MemoryUsed() const;
  1.1357 +	inline void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1358 +					 const TLogicalRgb* aDocBackground,TBool aDrawParBackground);
  1.1359 +
  1.1360 +private:
  1.1361 +	CTmText();
  1.1362 +	IMPORT_C void Spare1();
  1.1363 +
  1.1364 +	// implementations of MTmTextLayoutForwarder virtual functions
  1.1365 +	const CTmTextLayout& TextLayout() const;
  1.1366 +
  1.1367 +	CTmTextImp* iImp;		// the implementation
  1.1368 +	};
  1.1369 +
  1.1370 +// inline functions
  1.1371 +/** Constructs a TTmCharFormatMask. Turns all the flags on. */
  1.1372 +TTmCharFormatMask::TTmCharFormatMask(): iFlags(0xFFFFFFFF)
  1.1373 +	{
  1.1374 +	}
  1.1375 +
  1.1376 +/** Clears the selected flag.*/
  1.1377 +void TTmCharFormatMask::Clear(TAttrib aAttrib)
  1.1378 +	{
  1.1379 +	iFlags &= ~aAttrib;
  1.1380 +	}
  1.1381 +
  1.1382 +/** Sets the selected flag. */
  1.1383 +void TTmCharFormatMask::Set(TAttrib aAttrib)
  1.1384 +	{
  1.1385 +	iFlags |= aAttrib;
  1.1386 +	}
  1.1387 +
  1.1388 +/** Returns true if the selected attribute is set. */
  1.1389 +TBool TTmCharFormatMask::IsSet(TAttrib aAttrib)
  1.1390 +	{
  1.1391 +	return iFlags & aAttrib;
  1.1392 +	}
  1.1393 +
  1.1394 +/** Constructs a TTmCharFormat by converting the information in a TCharFormat. */
  1.1395 +TTmCharFormat::TTmCharFormat(const TCharFormat& aFormat)
  1.1396 +	{
  1.1397 +	*this = aFormat;
  1.1398 +	}
  1.1399 +
  1.1400 +/** The inequality operator. Return TRUE if this object and aFormat differ in any way. */
  1.1401 +TBool TTmCharFormat::operator!=(const TTmCharFormat& aFormat) const
  1.1402 +	{
  1.1403 +	return !operator==(aFormat);
  1.1404 +	}
  1.1405 +
  1.1406 +/** Constructs a TTmTab and set it to a standard tab stop with a position of 0. */
  1.1407 +TTmTab::TTmTab():
  1.1408 +	iPosition(0),
  1.1409 +	iType(EStandardTab)
  1.1410 +	{
  1.1411 +	}
  1.1412 +
  1.1413 +/** Constructs a TTmTab by converting the information in a TTabStop. */
  1.1414 +TTmTab::TTmTab(const TTabStop& aTab)
  1.1415 +	{
  1.1416 +	*this = aTab;
  1.1417 +	}
  1.1418 +
  1.1419 +/** The inequality operator. Returns TRUE if this object and aTab differ in any
  1.1420 +way. */
  1.1421 +TBool TTmTab::operator!=(const TTmTab& aTab) const
  1.1422 +	{
  1.1423 +	return !operator==(aTab);
  1.1424 +	}
  1.1425 +
  1.1426 +/** Constructs a TTmBullet by converting the information in a TBullet. */
  1.1427 +TTmBullet::TTmBullet(const TBullet& aBullet)
  1.1428 +	{
  1.1429 +	*this = aBullet;
  1.1430 +	}
  1.1431 +
  1.1432 +/** The inequality operator. Returns true if this object and aBullet differ in
  1.1433 +any way. */
  1.1434 +TBool TTmBullet::operator!=(const TTmBullet& aBullet) const
  1.1435 +	{
  1.1436 +	return !operator==(aBullet);
  1.1437 +	}
  1.1438 +
  1.1439 +/** Constructs a TTmParBorder by converting the information in a TParaBorder. */
  1.1440 +TTmParBorder::TTmParBorder(const TParaBorder& aBorder)
  1.1441 +	{
  1.1442 +	*this = aBorder;
  1.1443 +	}
  1.1444 +
  1.1445 +/** The inequality operator. Returns TRUE if this object and aBorder differ in
  1.1446 +any way. */
  1.1447 +TBool TTmParBorder::operator!=(const TTmParBorder& aBorder) const
  1.1448 +	{
  1.1449 +	return !operator==(aBorder);
  1.1450 +	}
  1.1451 +
  1.1452 +/** Constructs a TTmParFormatMask with all the flags on. */
  1.1453 +TTmParFormatMask::TTmParFormatMask():
  1.1454 +	iFlags(0xFFFFFFFF)
  1.1455 +	{
  1.1456 +	}
  1.1457 +
  1.1458 +/** Clears the selected flag. */
  1.1459 +void TTmParFormatMask::Clear(TAttrib aAttrib)
  1.1460 +	{
  1.1461 +	iFlags &= ~aAttrib;
  1.1462 +	}
  1.1463 +
  1.1464 +/** Sets the selected flag. */
  1.1465 +void TTmParFormatMask::Set(TAttrib aAttrib)
  1.1466 +	{
  1.1467 +	iFlags |= aAttrib;
  1.1468 +	}
  1.1469 +
  1.1470 +/**
  1.1471 +Returns true if the selected flag is Set.
  1.1472 +*/
  1.1473 +TBool TTmParFormatMask::IsSet(TAttrib aAttrib)
  1.1474 +	{
  1.1475 +	return iFlags & aAttrib;
  1.1476 +	}
  1.1477 +
  1.1478 +#ifdef _DEBUG
  1.1479 +RTmParFormat::~RTmParFormat()
  1.1480 +	{
  1.1481 +	__ASSERT_DEBUG(!iTabList && !iBullet && !HaveBorders(), User::Invariant());
  1.1482 +	}
  1.1483 +#endif
  1.1484 +
  1.1485 +/** The inequality operator. Returns true if this object and aFormat differ in
  1.1486 +any way.
  1.1487 +*/
  1.1488 +TBool RTmParFormat::operator!=(const RTmParFormat& aFormat) const
  1.1489 +	{
  1.1490 +	return !operator==(aFormat);
  1.1491 +	}
  1.1492 +
  1.1493 +/** Returns a reference to the tab selected by aIndex. */
  1.1494 +const TTmTab& RTmParFormat::Tab(TInt aIndex) const
  1.1495 +	{
  1.1496 +	return (*iTabList)[aIndex];
  1.1497 +	}
  1.1498 +
  1.1499 +/** Returns a pointer to the TTmBullet object if any. Returns null if the
  1.1500 +RTmParFormat does not contain a TTmBullet. */
  1.1501 +const TTmBullet* RTmParFormat::Bullet() const
  1.1502 +	{
  1.1503 +	return iBullet;
  1.1504 +	}
  1.1505 +
  1.1506 +/** Returns a pointer to the border selected by aIndex. Returns null if the
  1.1507 +selected border is not present. */
  1.1508 +const TTmParBorder* RTmParFormat::Border(TBorderIndex aIndex) const
  1.1509 +	{
  1.1510 +	return iBorder[aIndex];
  1.1511 +	}
  1.1512 +
  1.1513 +/** Returns true if the paragraph's base direction is right-to-left. */
  1.1514 +TBool RTmParFormat::RightToLeft() const
  1.1515 +	{
  1.1516 +	return iFlags & ERightToLeft;
  1.1517 +	}
  1.1518 +
  1.1519 +/** Constructs a line height parameter structure, setting all the data members
  1.1520 +to zero. */
  1.1521 +MTmCustom::TLineHeightParam::TLineHeightParam()
  1.1522 +	{
  1.1523 +	Mem::FillZ(this,sizeof(*this));
  1.1524 +	}
  1.1525 +
  1.1526 +CTmBufSeg::CTmBufSeg(TInt aExpandSize):
  1.1527 +	CBufSeg(aExpandSize)
  1.1528 +	{
  1.1529 +	}
  1.1530 +
  1.1531 +CTmCode::~CTmCode()
  1.1532 +	{
  1.1533 +	delete iBuffer;
  1.1534 +	}
  1.1535 +
  1.1536 +TPtr8 CTmCode::Ptr(TInt aPos)
  1.1537 +	{
  1.1538 +	return iBuffer->Ptr(aPos);
  1.1539 +	}
  1.1540 +
  1.1541 +CBufBase* CTmCode::Buffer()
  1.1542 +	{
  1.1543 +	return iBuffer;
  1.1544 +	}
  1.1545 +
  1.1546 +const CBufBase* CTmCode::Buffer() const
  1.1547 +	{
  1.1548 +	return iBuffer;
  1.1549 +	}
  1.1550 +
  1.1551 +/** Returns true if wrapping is turned on. */
  1.1552 +TBool TTmFormatParamBase::IsWrapping() const
  1.1553 +	{
  1.1554 +	return iFlags & EWrap;
  1.1555 +	}
  1.1556 +
  1.1557 +/** Returns true if truncation with ellipsis is turned on. */
  1.1558 +TBool TTmFormatParamBase::IsTruncatingWithEllipsis() const
  1.1559 +	{
  1.1560 +	return iFlags & ETruncateWithEllipsis;
  1.1561 +	}
  1.1562 +
  1.1563 +/** Returns true if line breaking must only occur at legal line breaks, even if
  1.1564 +the line cannot legally be broken at the desired wrap width. */
  1.1565 +TBool TTmFormatParamBase::LegalLineBreaksOnly() const
  1.1566 +	{
  1.1567 +	return iFlags & ELegalLineBreaksOnly;
  1.1568 +	}
  1.1569 +
  1.1570 +/** Constructs a TTmLineInfo object, setting all data members to 0. */
  1.1571 +TTmLineInfo::TTmLineInfo()
  1.1572 +	{
  1.1573 +	Mem::FillZ(this,sizeof(*this));
  1.1574 +	}
  1.1575 +
  1.1576 +/** Constructs a TTmDocPos object, setting iPos to 0 and iLeadingEdge to false.
  1.1577 +This is the lowest legal value for a TTmDocPos object. A trailing edge comes
  1.1578 +before a leading edge because it is the trailing edge of the character before
  1.1579 +the position, while the leading edge is that of the character after the
  1.1580 +position. ('Leading' means the first to be encountered when traversing the
  1.1581 +document in logical order). */
  1.1582 +TTmDocPos::TTmDocPos():
  1.1583 +	iPos(0),
  1.1584 +	iLeadingEdge(FALSE)
  1.1585 +	{
  1.1586 +	}
  1.1587 +
  1.1588 +/** Constructs a TTmDocPos object, setting iPos to aPos and iLeadingEdge to
  1.1589 +aLeadingEdge.
  1.1590 +*/
  1.1591 +TTmDocPos::TTmDocPos(TInt aPos,TBool aLeadingEdge):
  1.1592 +	iPos(aPos),
  1.1593 +	iLeadingEdge(aLeadingEdge)
  1.1594 +	{
  1.1595 +	}
  1.1596 +
  1.1597 +/** Constructs a TTmDocPosSpec, setting the position to 0 and the type to
  1.1598 +trailing. */
  1.1599 +TTmDocPosSpec::TTmDocPosSpec():
  1.1600 +	iPos(0),
  1.1601 +	iType(ETrailing)
  1.1602 +	{
  1.1603 +	}
  1.1604 +	
  1.1605 +
  1.1606 +/**
  1.1607 +The not equal operator.
  1.1608 +@return True if both sides have different values.
  1.1609 +*/
  1.1610 +TBool TTmDocPos::operator!=(const TTmDocPos& aPos) const { return !((*this)==aPos); }
  1.1611 +
  1.1612 +/**
  1.1613 +Smaller than operator.
  1.1614 +@return
  1.1615 +	True if the right side of the operator is further on in the document than
  1.1616 +	the left hand side.
  1.1617 +*/
  1.1618 +TBool TTmDocPos::operator<(const TTmDocPos& aPos) const { return !((*this)>=aPos); }
  1.1619 +
  1.1620 +/**
  1.1621 +Smaller than or equal to operator.
  1.1622 +@return
  1.1623 +	True if the right side of the operator is further on in the document than
  1.1624 +	the left hand side or if both sides are identical.
  1.1625 +*/
  1.1626 +TBool TTmDocPos::operator<=(const TTmDocPos& aPos) const { return !((*this)>aPos); }
  1.1627 +
  1.1628 +/** Constructs a TTmDocPosSpec, setting the position to aPos and the type to
  1.1629 +aType.
  1.1630 +*/
  1.1631 +TTmDocPosSpec::TTmDocPosSpec(TInt aPos,TType aType):
  1.1632 +	iPos(aPos),
  1.1633 +	iType(aType)
  1.1634 +	{
  1.1635 +	}
  1.1636 +
  1.1637 +/** Constructs a TTmDocPosSpec from a TTmDocPos. */
  1.1638 +TTmDocPosSpec::TTmDocPosSpec(const TTmDocPos& aDocPos):
  1.1639 +	iPos(aDocPos.iPos),
  1.1640 +	iType(aDocPos.iLeadingEdge ? ELeading : ETrailing)
  1.1641 +	{
  1.1642 +	}
  1.1643 +
  1.1644 +/** Returns the first formatted character. */
  1.1645 +TInt CTmTextLayout::StartChar() const
  1.1646 +	{
  1.1647 +	return iStartChar;
  1.1648 +	}
  1.1649 +
  1.1650 +/** Returns the character after the last formatted character. */
  1.1651 +TInt CTmTextLayout::EndChar() const
  1.1652 +	{
  1.1653 +	return iEndChar;
  1.1654 +	}
  1.1655 +
  1.1656 +/** Return the width in pixels of the formatted text, not including paragraph
  1.1657 +labels if present. */
  1.1658 +TInt CTmTextLayout::LayoutWidth() const
  1.1659 +	{
  1.1660 +	return iWidth;
  1.1661 +	}
  1.1662 +
  1.1663 +/** Returns the height in pixels of the formatted text. */
  1.1664 +TInt CTmTextLayout::LayoutHeight() const
  1.1665 +	{
  1.1666 +	return iHeight;
  1.1667 +	}
  1.1668 +
  1.1669 +/** Returns a pointer to to the MTmSource object, if any, that provides text
  1.1670 +and formatting to this object. Returns null if no source object has been set. */
  1.1671 +MTmSource* CTmTextLayout::Source()
  1.1672 +	{
  1.1673 +	return iSource;
  1.1674 +	}
  1.1675 +
  1.1676 +const MTmSource* CTmTextLayout::Source() const
  1.1677 +	{
  1.1678 +	return iSource;
  1.1679 +	}
  1.1680 +
  1.1681 +/**
  1.1682 +Returns a reference to the CTmCode object containing the bytecode
  1.1683 +representing the text layout.
  1.1684 +@internalComponent
  1.1685 +*/
  1.1686 +const CTmCode& CTmTextLayout::Code() const
  1.1687 +	{
  1.1688 +	return iCode;
  1.1689 +	}
  1.1690 +
  1.1691 +/** Constructs a TTmCharFormatLayer object containing default TTmCharFormat and
  1.1692 +TTmCharFormatMask objects. */
  1.1693 +TTmCharFormatLayer::TTmCharFormatLayer()
  1.1694 +	{
  1.1695 +	}
  1.1696 +
  1.1697 +/** Closes an RTmParFormatLayer object by freeing any objects allocated on the
  1.1698 +heap. */
  1.1699 +void RTmParFormatLayer::Close()
  1.1700 +	{
  1.1701 +	iFormat.Close();
  1.1702 +	}
  1.1703 +
  1.1704 +/** Closes an RTmStyle object by freeing any objects allocated on the heap.
  1.1705 +*/
  1.1706 +void RTmStyle::Close()
  1.1707 +	{
  1.1708 +	iParFormat.Close();
  1.1709 +	}
  1.1710 +
  1.1711 +/** Draws the formatted text. This inline function just calls
  1.1712 +CTmText::DrawLayout and is identical to it. It is provided for coding
  1.1713 +convenience because of the expectation that a drawing function called Draw
  1.1714 +exists. */
  1.1715 +void CTmText::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
  1.1716 +				   const TLogicalRgb* aDocBackground,TBool aDrawParBackground)
  1.1717 +	{
  1.1718 +	DrawLayout(aGc,aTopLeft,aClipRect,aDocBackground,aDrawParBackground);
  1.1719 +	}
  1.1720 +
  1.1721 +/** Contains the extensions to character rectangle used when highlighting 
  1.1722 +the text in reverse video
  1.1723 +*/
  1.1724 +TTmHighlightExtensions::TTmHighlightExtensions()
  1.1725 +	{
  1.1726 +	}
  1.1727 +
  1.1728 +void TTmHighlightExtensions::SetAll(TInt aExtension)
  1.1729 +	{
  1.1730 +	iLeftExtension=iRightExtension=iTopExtension=iBottomExtension=aExtension;
  1.1731 +	}
  1.1732 +
  1.1733 +void TTmHighlightExtensions::SetLeftExtension(TInt aExtension)
  1.1734 +	{
  1.1735 +	iLeftExtension=aExtension;
  1.1736 +	}
  1.1737 +
  1.1738 +void TTmHighlightExtensions::SetRightExtension(TInt aExtension)
  1.1739 +	{
  1.1740 +	iRightExtension=aExtension;
  1.1741 +	}
  1.1742 +
  1.1743 +void TTmHighlightExtensions::SetTopExtension(TInt aExtension)
  1.1744 +	{
  1.1745 +	iTopExtension=aExtension;
  1.1746 +	}
  1.1747 +
  1.1748 +void TTmHighlightExtensions::SetBottomExtension(TInt aExtension)
  1.1749 +	{
  1.1750 +	iBottomExtension=aExtension;
  1.1751 +	}
  1.1752 +
  1.1753 +TInt TTmHighlightExtensions::LeftExtension() const
  1.1754 +	{
  1.1755 +	return iLeftExtension;
  1.1756 +	}
  1.1757 +
  1.1758 +TInt TTmHighlightExtensions::RightExtension() const
  1.1759 +	{
  1.1760 +	return iRightExtension;
  1.1761 +	}
  1.1762 +
  1.1763 +TInt TTmHighlightExtensions::TopExtension() const
  1.1764 +	{
  1.1765 +	return iTopExtension;
  1.1766 +	}
  1.1767 +
  1.1768 +TInt TTmHighlightExtensions::BottomExtension() const
  1.1769 +	{
  1.1770 +	return iBottomExtension;
  1.1771 +	}
  1.1772 +
  1.1773 +inline TBool TTmHighlightExtensions::Extends() const
  1.1774 +	{
  1.1775 +	return (iTopExtension > 0 || iBottomExtension > 0 || iLeftExtension > 0 || iRightExtension > 0);
  1.1776 +	}
  1.1777 +
  1.1778 +inline TBool TTmHighlightExtensions::Shrinks() const
  1.1779 +	{
  1.1780 +	return (iTopExtension < 0 || iBottomExtension < 0 || iLeftExtension < 0 || iRightExtension < 0);
  1.1781 +	}
  1.1782 +
  1.1783 +inline void TTmHighlightExtensions::ExtendRect(TRect& aRect) const
  1.1784 +	{
  1.1785 +	if (iLeftExtension>0)
  1.1786 +		aRect.iTl.iX-=iLeftExtension;
  1.1787 +	if (iRightExtension>0)
  1.1788 +		aRect.iBr.iX+=iRightExtension;
  1.1789 +	if (iTopExtension>0)
  1.1790 +		aRect.iTl.iY-=iTopExtension;
  1.1791 +	if (iBottomExtension>0)
  1.1792 +		aRect.iBr.iY+=iBottomExtension;
  1.1793 +	}
  1.1794 +
  1.1795 +inline void TTmHighlightExtensions::AdjustRect(TRect& aRect) const
  1.1796 +	{
  1.1797 +	aRect.iTl.iX-=iLeftExtension;
  1.1798 +	aRect.iTl.iY-=iTopExtension;
  1.1799 +	aRect.iBr.iX+=iRightExtension;
  1.1800 +	aRect.iBr.iY+=iBottomExtension;
  1.1801 +	}
  1.1802 +
  1.1803 +inline TBool TTmHighlightExtensions::IsNull() const
  1.1804 +	{
  1.1805 +	return 0 == iLeftExtension && 0 == iTopExtension && 0 == iRightExtension && 0 == iBottomExtension;
  1.1806 +	}
  1.1807 +
  1.1808 +inline void TTmHighlightExtensions::AbsExtendRect(TRect& aRect) const
  1.1809 +	{
  1.1810 +	if (iLeftExtension>0)
  1.1811 +		aRect.iTl.iX-=iLeftExtension;
  1.1812 +	else
  1.1813 +		aRect.iTl.iX+=iLeftExtension;
  1.1814 +
  1.1815 +	if (iRightExtension>0)
  1.1816 +		aRect.iBr.iX+=iRightExtension;
  1.1817 +	else
  1.1818 +		aRect.iBr.iX-=iRightExtension;
  1.1819 +
  1.1820 +	if (iTopExtension>0)
  1.1821 +		aRect.iTl.iY-=iTopExtension;
  1.1822 +	else
  1.1823 +		aRect.iTl.iY+=iTopExtension;
  1.1824 +
  1.1825 +	if (iBottomExtension>0)
  1.1826 +		aRect.iBr.iY+=iBottomExtension;
  1.1827 +	else
  1.1828 +		aRect.iBr.iY-=iBottomExtension;
  1.1829 +	}
  1.1830 +
  1.1831 +#endif // __TAGMA_H__