epoc32/include/txtfrmat.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/txtfrmat.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/txtfrmat.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,820 @@
     1.4 -txtfrmat.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __TXTFRMAT_H__
    1.21 +#define __TXTFRMAT_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +#include <e32base.h>
    1.25 +#include <gdi.h>
    1.26 +
    1.27 +
    1.28 +// Classes declared in this file:
    1.29 +class TTabStop;
    1.30 +class TParaBorder;
    1.31 +class TBullet;
    1.32 +class TParaBorderArray;
    1.33 +class CParaFormat;
    1.34 +class TParaFormatMask;
    1.35 +class TFontPresentation;
    1.36 +class TCharFormat;
    1.37 +class TCharFormatMask;
    1.38 +
    1.39 +/** 
    1.40 +Provides support for system colours, in addition to literal colours, in 
    1.41 +text formatting.
    1.42 +
    1.43 +The base class TRgb stores the 24-bit literal colour value using a TUint32. 
    1.44 +TLogicalRgb uses the MSB from iValue2 data member as an 8-bit index. The 
    1.45 +purpose of the  index is to allow applications to use logical colours. If the 
    1.46 +index is zero, the value is not a logical colour; it is treated as an ordinary 
    1.47 +TRgb value. If the index is non zero (1-255), the colour should be translated by the 
    1.48 +application into a system colour. Indices 254 and 255 are reserved for the 
    1.49 +system foreground and background colours, respectively and should be translated 
    1.50 +into them. Translation from index to RGB colour occurs in the implementation of 
    1.51 +MFormParam::SystemColor().
    1.52 +
    1.53 +All colours in the Text and Text Attributes API are stored using TLogicalRgb 
    1.54 +values and are initialised to either TLogicalRgb::ESystemForegroundColor or 
    1.55 +TLogicalRgb::ESystemBackgroundColor.
    1.56 +
    1.57 +This system allows an application to set its text colours once, perhaps using 
    1.58 +the system-wide colour scheme, rather than having to set the colours each 
    1.59 +time a text object is created. It is also compatible with legacy code which 
    1.60 +expects TRgb rather than TLogicalRgb values: for example, the logical 
    1.61 +foreground and background colours have their bottom three bytes filled with 
    1.62 +black and white respectively so that code which expects TRgb values can still 
    1.63 +use them. 
    1.64 +@publishedAll
    1.65 +@released
    1.66 +*/
    1.67 +class TLogicalRgb : public TRgb
    1.68 +	{
    1.69 +	public:
    1.70 + 
    1.71 +	/*
    1.72 +	Reserved colour indices for default foreground and background colours,
    1.73 +	and colours for the selection highlight. The top 128 indices (128-255)
    1.74 +	are reserved for future expansion, but the first 126 non-zero indices
    1.75 +	(1-127) can be used by the GUI as convenient.
    1.76 +	*/ 
    1.77 +	enum
    1.78 +		{
    1.79 +		ESystemSelectionForegroundIndex = 252,
    1.80 +		ESystemSelectionBackgroundIndex = 253,
    1.81 +		/** Index reserved for the system foreground colour (=254). */
    1.82 +		ESystemForegroundIndex = 254,
    1.83 +		/** Index reserved for the system background colour (=255). */
    1.84 +		ESystemBackgroundIndex = 255
    1.85 +		};
    1.86 +
    1.87 +	
    1.88 +	 
    1.89 +	/** Used to construct TLogicalRgb objects which should use either the 
    1.90 +	system foreground or background colour. */
    1.91 +	enum TSystemColor
    1.92 +		{
    1.93 +		ESystemSelectionForegroundColor = ESystemSelectionForegroundIndex << 24,
    1.94 +		ESystemSelectionBackgroundColor = ESystemSelectionBackgroundIndex << 24,
    1.95 +		/** The system foreground colour. */
    1.96 +		ESystemForegroundColor = ESystemForegroundIndex << 24,
    1.97 +		/** The system background colour. */
    1.98 +		ESystemBackgroundColor = (ESystemBackgroundIndex << 24) | 0xFFFFFF
    1.99 +		};
   1.100 +		 
   1.101 +	/** Constructs a new TLogicalRgb object. */
   1.102 +	TLogicalRgb() : 
   1.103 +		iValue2(0) 
   1.104 +		{ 
   1.105 +		}
   1.106 +	
   1.107 +	/** Constructs the object with a 32-bit integer. The index is stored in the 
   1.108 +	MSB of iValue2 data member. A TRgb value may be stored in the base TRgb class. 
   1.109 +	@param aValue Integer holding the logical colour index. */
   1.110 +	TLogicalRgb(TUint32 aValue): 
   1.111 +		iValue2(aValue & 0xFF000000)
   1.112 +		{ 
   1.113 +		SetInternal((TUint32)aValue | 0xFF000000);
   1.114 +		}
   1.115 +		
   1.116 +	/** Constructs the object with a TSystemColor value.
   1.117 +	@param aValue Identifies whether the colour is the system foreground or 
   1.118 +	system background colour. */
   1.119 +	TLogicalRgb(TSystemColor aValue) : 
   1.120 +		iValue2((TUint32)aValue & 0xFF000000)
   1.121 +		{ 
   1.122 +		SetInternal((TUint32)aValue | 0xFF000000);
   1.123 +		}
   1.124 +
   1.125 +	/** Constructs a new TLogicalRgb object from an existing one. */
   1.126 +	TLogicalRgb(const TRgb& aRgb) : 
   1.127 +		TRgb(aRgb),
   1.128 +		iValue2(0)
   1.129 +		{ 
   1.130 +		}
   1.131 +	 
   1.132 +	/** Returns the logical colour's index value. Zero indicates that the value 
   1.133 +	is not a logical colour; it is an ordinary TRgb value. 254 and 255 indicate 
   1.134 +	the system foreground and background colours, respectively.
   1.135 +	@return The index: between zero and 255 inclusive. */
   1.136 +	TUint SystemColorIndex() const 
   1.137 +		{ 
   1.138 +		return iValue2 >> 24; 
   1.139 +		}
   1.140 +		
   1.141 +	/** Sets the logical colour's index value.
   1.142 +	@param aIndex The new index value (between 1 and 253 inclusive). */
   1.143 +	void SetSystemColorIndex(TUint aIndex) 
   1.144 +		{ 
   1.145 +		iValue2 = aIndex << 24; 
   1.146 +		}
   1.147 +	
   1.148 +private:	
   1.149 +	TUint32 iValue2;
   1.150 +	
   1.151 +	};
   1.152 +
   1.153 +/** 
   1.154 +Indicates which format attributes are relevant when setting or sensing text 
   1.155 +formatting. 
   1.156 +@publishedAll
   1.157 +@released
   1.158 +*/
   1.159 +enum TTextFormatAttribute
   1.160 +	{
   1.161 +	// Paragraph format attributes.
   1.162 +	/** Language of the paragraph for proofing. */
   1.163 +	EAttParaLanguage,
   1.164 +	/** Background colour of the paragraph. */
   1.165 +	EAttFillColor,
   1.166 +	/** Leading text margin. */
   1.167 +	EAttLeftMargin,
   1.168 +	/** Trailing text margin. */
   1.169 +	EAttRightMargin,
   1.170 +	/** First line leading indent. */
   1.171 +	EAttIndent,
   1.172 +	/** Horizontal alignment of paragraph. */
   1.173 +	EAttAlignment,
   1.174 +	/** Vertical paragraph alignment. */
   1.175 +	EAttVerticalAlignment,
   1.176 +	/** Inter-line spacing. */
   1.177 +	EAttLineSpacing,
   1.178 +	/** Control for EAttLineSpacing. */
   1.179 +	EAttLineSpacingControl,
   1.180 +	/** Space above paragraph. */
   1.181 +	EAttSpaceBefore,
   1.182 +	/** Space below paragraph. */
   1.183 +	EAttSpaceAfter,
   1.184 +	/** Whether a page break can occur within the paragraph. */
   1.185 +	EAttKeepTogether,
   1.186 +	/** Whether a page break can occur between this and the next paragraph. */
   1.187 +	EAttKeepWithNext,
   1.188 +	/** Whether a page break should be inserted before this paragraph. */
   1.189 +	EAttStartNewPage,
   1.190 +	/** Whether the last line of a paragraph can appear by itself at the top of a new 
   1.191 +	page, (widow), or the first line of a paragraph can appear by itself at the 
   1.192 +	bottom of the page, (orphan). */
   1.193 +	EAttWidowOrphan,
   1.194 +	/** Whether the paragraph should line wrap at the right margin. */
   1.195 +	EAttWrap,
   1.196 +	/** Distance between paragraph border and enclosed text. */
   1.197 +	EAttBorderMargin,
   1.198 +	/** Top of paragraph border. */
   1.199 +	EAttTopBorder,
   1.200 +	/** Bottom of paragraph border. */
   1.201 +	EAttBottomBorder,
   1.202 +	/** Left-hand side of paragraph border. */
   1.203 +	EAttLeftBorder,
   1.204 +	/** Right-hand side of paragraph border. */
   1.205 +	EAttRightBorder,
   1.206 +	/** Bullet point associated with paragraph. */
   1.207 +	EAttBullet,
   1.208 +	/** Spacing between default tab stops. */
   1.209 +	EAttDefaultTabWidth,
   1.210 +	/** Tab stop. */
   1.211 +	EAttTabStop,
   1.212 +
   1.213 +	// Character format attributes.
   1.214 +	/** Language of individual characters within a paragraph for proofing. */
   1.215 +	EAttCharLanguage,
   1.216 +	/** Text colour. */
   1.217 +	EAttColor,
   1.218 +	/** Text highlight colour. */
   1.219 +	EAttFontHighlightColor,
   1.220 +	/** Text highlight style. */
   1.221 +	EAttFontHighlightStyle,
   1.222 +	/** Font height. */
   1.223 +	EAttFontHeight,
   1.224 +	/** Font posture (i.e. italics). */
   1.225 +	EAttFontPosture,
   1.226 +	/** Font stroke weight (i.e. bold). */
   1.227 +	EAttFontStrokeWeight,
   1.228 +	/** Subscript, superscript or normal print position. */
   1.229 +	EAttFontPrintPos,
   1.230 +	/** Underlining. */
   1.231 +	EAttFontUnderline,
   1.232 +	/** Strikethrough. */
   1.233 +	EAttFontStrikethrough,
   1.234 +	/** The typeface name. */
   1.235 +	EAttFontTypeface,
   1.236 +	/** Vertical picture alignment. */
   1.237 +	EAttFontPictureAlignment,
   1.238 +	/** Hidden text. */
   1.239 +	EAttFontHiddenText,
   1.240 +
   1.241 +	/** Used internally to indicate the count of all attributes. */
   1.242 +	ETextFormatAttributeCount
   1.243 +	};
   1.244 +/**
   1.245 +@internalComponent
   1.246 +*/
   1.247 +enum {EVariableLengthValue = 0};
   1.248 +
   1.249 +/**
   1.250 +@internalComponent
   1.251 +*/
   1.252 +const TInt KMaxStyleName = 0x20;
   1.253 +const TInt KMaxParaAttributes = EAttTabStop;
   1.254 +const TInt KMaxCharAttributes = EAttFontHiddenText - KMaxParaAttributes;
   1.255 +const TInt KTabNotFound = -1;
   1.256 +
   1.257 +/** 
   1.258 +A tab stop.
   1.259 +
   1.260 +This is a position on a page used to align columns of text. It has a twips 
   1.261 +position and an alignment. The twips position is the width in twips (1/1440th 
   1.262 +of an inch) of the tab stop, i.e. the number of twips from the start of the 
   1.263 +line at which text can be inserted. It uniquely identifies the tab stop. The 
   1.264 +alignment (left, right, or centre) indicates how text inserted at the tab 
   1.265 +stop should be aligned.
   1.266 +
   1.267 +Tab stops are paragraph format attributes. They are owned by the CParaFormat 
   1.268 +class, through which tab stops can be added and removed. 
   1.269 +@publishedAll
   1.270 +@released
   1.271 +*/
   1.272 +class TTabStop
   1.273 +	{
   1.274 +public:
   1.275 +	/** Text alignment at the tab stop. */
   1.276 +	enum TTabType
   1.277 +		{
   1.278 +		/** No tab. */
   1.279 +		ENullTab, 
   1.280 +		/** Text is aligned to the tab stop's leading edge (left for
   1.281 +		left-to-right paragraphs, right for right-to-left paragraphs). */
   1.282 +		ELeftTab, 
   1.283 +		/** Text is aligned to the tab stop's trailing edge (right for
   1.284 +		left-to-right paragraphs, left for right-to-left paragraphs). */
   1.285 +		ECenteredTab, 
   1.286 +		/** Text is right aligned at the tab stop. */
   1.287 +		ERightTab
   1.288 +		};
   1.289 +public:
   1.290 +	IMPORT_C TTabStop();
   1.291 +	IMPORT_C TTabStop(const TTabStop& aTabStop);
   1.292 +	IMPORT_C TTabStop& operator=(const TTabStop& aTabStop);
   1.293 +	IMPORT_C TBool operator==(const TTabStop& aTabStop) const;
   1.294 +	inline TBool operator!=(const TTabStop& aTabStop) const;
   1.295 +public:
   1.296 +	/** The twips position. This is the width in twips of the tab stop, i.e. 
   1.297 +	the number of twips from the start of the line at which text can be 
   1.298 +	inserted. */
   1.299 +	TUint32 iTwipsPosition;
   1.300 +	/** Text alignment at the tab stop. */
   1.301 +	TTabType iType;
   1.302 +	};
   1.303 +
   1.304 +/** 
   1.305 +Defines the characteristics of one of the four sides of a paragraph border. 
   1.306 +
   1.307 +These are the line style, thickness and colour. Paragraph borders are paragraph 
   1.308 +format attributes. They are owned by the CParaFormat class which allows 
   1.309 +paragraph borders to be added and removed. The CParaFormat::TParaBorderSide 
   1.310 +enumeration identifies which side of the paragraph the object applies to. 
   1.311 +@publishedAll
   1.312 +@released
   1.313 +*/
   1.314 +class TParaBorder
   1.315 +	{
   1.316 +public:
   1.317 +	
   1.318 +	/** Line styles. */
   1.319 +	enum TLineStyle 
   1.320 +		{
   1.321 +		/** No line style. */
   1.322 +		ENullLineStyle, 
   1.323 +		/** Solid line. */
   1.324 +		ESolid, 
   1.325 +		/** Double solid line. */
   1.326 +		EDouble,
   1.327 +		/** Dotted line. */
   1.328 +		EDotted, 
   1.329 +		/** Dashed line. */
   1.330 +		EDashed, 
   1.331 +		/** Alternating dots and dashes. */
   1.332 +		EDotDash, 
   1.333 +		/** Alternating sequence of two dots and a dash. */
   1.334 +		EDotDotDash
   1.335 +		};
   1.336 +	//
   1.337 +	IMPORT_C TParaBorder();
   1.338 +	IMPORT_C TBool operator==(const TParaBorder& aParaBorder) const;
   1.339 +	inline TBool operator!=(const TParaBorder& aParaBorder) const;
   1.340 +public:
   1.341 +	/** The line style. By default, ENullLineStyle. */
   1.342 +	TLineStyle iLineStyle;
   1.343 +	/** The line thickness in twips. By default, zero. */
   1.344 +	TInt iThickness;
   1.345 +	/** The line colour. By default, the system's default foreground colour. */
   1.346 +	TLogicalRgb iColor;
   1.347 +	/** ETrue indicates that the line colour is set to the default or current 
   1.348 +	text colour, overriding iColor. EFalse indicates that the iColor value is 
   1.349 +	used. By default, ETrue. */
   1.350 +	TBool iAutoColor;
   1.351 +	};
   1.352 +
   1.353 +/** 
   1.354 +Stores the four sides of a paragraph border.
   1.355 +
   1.356 +Paragraph borders sides are set individually using functions provided by class 
   1.357 +CParaFormat. 
   1.358 +@publishedAll
   1.359 +@released
   1.360 +*/
   1.361 +class TParaBorderArray
   1.362 +	{
   1.363 +public:
   1.364 +	TParaBorder iBorder[4];
   1.365 +	};
   1.366 +
   1.367 +/** 
   1.368 +A bullet point. 
   1.369 +
   1.370 +This is a paragraph format attribute, stored as the iBullet member of class 
   1.371 +CParaFormat.
   1.372 +
   1.373 +Bullet points have a typeface, height, colour and a character code (defines 
   1.374 +the symbol displayed). Single level bullets only are supported. Bullets may 
   1.375 +also have a hanging indent. If set, this means that the rest of the paragraph 
   1.376 +following the line containing the bullet point is indented. 
   1.377 +@publishedAll
   1.378 +@released
   1.379 +*/
   1.380 +class TBullet
   1.381 +	{
   1.382 +	public:
   1.383 +	IMPORT_C TBullet();
   1.384 +	IMPORT_C TBool operator ==(const TBullet& aBullet) const;
   1.385 +	inline TBool operator !=(const TBullet& aBullet) const;
   1.386 +
   1.387 +	/**
   1.388 +	Identifies the bullet style.
   1.389 +
   1.390 +	Note: Styles other than ENullStyle and EBulletStyle are not currently supported.
   1.391 +	They have the same effect as the EBulletStyle.
   1.392 +	*/
   1.393 +	enum TStyle
   1.394 +		{
   1.395 +		/**
   1.396 +		No bullet. Used for style layers that override a bullet with the absence of a bullet.
   1.397 +		*/
   1.398 +		ENullStyle,
   1.399 +		/**
   1.400 +		A bullet point. Character with code 0x2022 is used by default.
   1.401 +		*/
   1.402 +		EBulletStyle,
   1.403 +		EArabicNumberStyle,
   1.404 +		ESmallRomanNumberStyle,
   1.405 +		ECapitalRomanNumberStyle,
   1.406 +		ESmallLetterStyle,
   1.407 +		ECapitalLetterStyle
   1.408 +		};
   1.409 +
   1.410 +	/** Paragraph alignment */
   1.411 +	enum TAlignment
   1.412 +		{
   1.413 +		/** Paragraph left aligned. */
   1.414 +		ELeftAlign,
   1.415 +		/** Paragraph centre aligned. */
   1.416 +		ECenterAlign,
   1.417 +		/** Paragraph right aligned. */
   1.418 +		ERightAlign
   1.419 +		};
   1.420 +
   1.421 +	/** The Unicode character used to represent the bullet point. By default 
   1.422 +	0x2022. */
   1.423 +	TChar iCharacterCode;		// the bullet or other symbol used if iStyle is EBulletStyle
   1.424 +	/** The height in twips of the font used for the bullet point character. 
   1.425 +	By default, zero. */
   1.426 +	TUint iHeightInTwips;
   1.427 +	/** The typeface used for the bullet point character. */
   1.428 +	TTypeface iTypeface;
   1.429 +	/** ETrue to indent the rest of the paragraph from the bullet point. 
   1.430 +	EFalse to align the bullet point character with the rest of the paragraph. */
   1.431 +	TBool iHangingIndent;
   1.432 +	/** The colour of the bullet point character. By default, the system's 
   1.433 +	default foreground colour. */
   1.434 +	TLogicalRgb iColor;
   1.435 +	TStyle iStyle;				// is this a bullet or a number or a letter?
   1.436 +	TInt iStartNumber;			// the number of the first paragraph in a run of paragraphs in this style
   1.437 +	TAlignment iAlignment;		// alignment of the bullet or number within the margin
   1.438 +	};
   1.439 +
   1.440 +/** 
   1.441 +A transient container of paragraph format attributes, including tab stops, 
   1.442 +bullet points and paragraph borders. 
   1.443 +
   1.444 +Rich and global text objects store paragraph formatting using paragraph format 
   1.445 +layers (see class CParaFormatLayer). The CParaFormat class is used to store 
   1.446 +the relevant attribute values when setting or sensing a CParaFormatLayer. 
   1.447 +It is normally used in combination with a TParaFormatMask, to specify which 
   1.448 +attributes are relevant to the function concerned.
   1.449 +
   1.450 +On construction, all CParaFormat member data is initialised. The attributes 
   1.451 +which are not explicitly set are assigned default values. 
   1.452 +@publishedAll
   1.453 +@released
   1.454 +*/
   1.455 +class CParaFormat: public CBase
   1.456 +	{
   1.457 +public:
   1.458 +	/** Miscellaneous constants. */
   1.459 +	enum
   1.460 +		{
   1.461 +		/** The maximum number of paragraph borders (= 4). */
   1.462 +		EMaxParaBorder = 4
   1.463 +		};
   1.464 +
   1.465 +	/** Paragraph border sides */
   1.466 +	enum TParaBorderSide
   1.467 +		{
   1.468 +		/** The border at the top of the paragraph. */
   1.469 +		EParaBorderTop,
   1.470 +		/** The border at the bottom of the paragraph. */
   1.471 +		EParaBorderBottom,
   1.472 +		/** The border on the left hand side. */
   1.473 +		EParaBorderLeft,
   1.474 +		/** The border on the right hand side. */
   1.475 +		EParaBorderRight
   1.476 +		};
   1.477 +
   1.478 +	/** Line spacing control */
   1.479 +	enum TLineSpacingControl
   1.480 +		{
   1.481 +		/** Twips line spacing must be at least as wide as the 
   1.482 +		iLineSpacingInTwips value. */
   1.483 +		ELineSpacingAtLeastInTwips,
   1.484 +		/** Twips line spacing must be exactly the iLineSpacingInTwips value. */
   1.485 +		ELineSpacingExactlyInTwips,
   1.486 +		/** Pixels line spacing must be at least as wide as the line spacing 
   1.487 +		value in pixels. */
   1.488 +		ELineSpacingAtLeastInPixels,
   1.489 +		/** Pixels line spacing must be exactly the same as the line spacing 
   1.490 +		value in pixels. */
   1.491 +		ELineSpacingExactlyInPixels
   1.492 +		};
   1.493 +
   1.494 +	/** Paragraph alignment */
   1.495 +	enum TAlignment
   1.496 +		{
   1.497 +		/** Paragraph aligned to the leading margin (left for left-to-right
   1.498 +		paragraphs, right for right-to-left paragraphs). */
   1.499 +		ELeftAlign,
   1.500 +		/** Paragraph top aligned. */
   1.501 +		ETopAlign = ELeftAlign,
   1.502 +		/** Paragraph centre aligned. */
   1.503 +		ECenterAlign,
   1.504 +		/** Paragraph aligned to the trailing margin (right for left-to-right
   1.505 +		paragraphs, left for right-to-left paragraphs). */
   1.506 +		ERightAlign,
   1.507 +		/** Paragraph bottom aligned. */
   1.508 +		EBottomAlign = ERightAlign,
   1.509 +		/** Paragraph justified. */
   1.510 +		EJustifiedAlign,
   1.511 +		/** Used by the spreadsheet application. Unlike ETopAlign and 
   1.512 +		EBottomAlign, provides no default implementation. */
   1.513 +		EUnspecifiedAlign,
   1.514 +		/** User-defined paragraph alignment. */
   1.515 +		ECustomAlign,
   1.516 +		/** Absolute left alignment */
   1.517 +		EAbsoluteLeftAlign,
   1.518 +		/** Absolute right alignment */
   1.519 +		EAbsoluteRightAlign
   1.520 +		};
   1.521 +
   1.522 +	/** Attribute sense mode */
   1.523 +	enum TParaFormatGetMode
   1.524 +		{
   1.525 +		/** Indicates that all paragraph format attributes are written to the 
   1.526 +		result when sensing paragraph format attributes. */
   1.527 +		EAllAttributes,
   1.528 +		/** Indicates that tabs, bullets and borders are not sensed. */
   1.529 +		EFixedAttributes
   1.530 +		};
   1.531 +
   1.532 +	IMPORT_C static CParaFormat* NewL();
   1.533 +	IMPORT_C static CParaFormat* NewLC();
   1.534 +	IMPORT_C static CParaFormat* NewL(const CParaFormat& aFormat);
   1.535 +	IMPORT_C CParaFormat();
   1.536 +	IMPORT_C ~CParaFormat();
   1.537 +	IMPORT_C void ResetNonDestructive();  // preserves any allocated tabs, bullets or borders.
   1.538 +	IMPORT_C void Reset();  // full reset, deletes and nulls any allocated tabs, bullets or borders.
   1.539 +	IMPORT_C void CopyL(const CParaFormat& aFormat, const TParaFormatMask& aMask);
   1.540 +	IMPORT_C void CopyL(const CParaFormat& aFormat);
   1.541 +	IMPORT_C void Strip();  // Cleans up this paragraph format.
   1.542 +	IMPORT_C TBool IsEqual(const CParaFormat& aFormat, const TParaFormatMask& aMask) const;
   1.543 +	IMPORT_C TBool IsEqual(const CParaFormat& aFormat) const;
   1.544 +	IMPORT_C void StoreTabL(const TTabStop& aTabStop);
   1.545 +	IMPORT_C void RemoveTab(TInt aTabTwipsPosition);
   1.546 +	inline void RemoveAllTabs();
   1.547 +	IMPORT_C const TTabStop TabStop(TInt aTabIndex) const;
   1.548 +	inline TInt TabCount() const;
   1.549 +	IMPORT_C TInt LocateTab(TInt aTabTwipsPosition) const;
   1.550 +	IMPORT_C void SetParaBorderL(TParaBorderSide aSide, const TParaBorder& aBorder);  // Overwrites any existing border for that side
   1.551 +	IMPORT_C void RemoveAllBorders();
   1.552 +	IMPORT_C const TParaBorder ParaBorder(TParaBorderSide aSide) const;
   1.553 +
   1.554 +	/** Tests whether any paragraph borders have been set.
   1.555 +	
   1.556 +	@return ETrue if any paragraph borders have been set, EFalse if not. */
   1.557 +	inline TBool BordersPresent() const { return iParaBorderArray != NULL;}
   1.558 +	
   1.559 +    inline TParaBorder* ParaBorderPtr(TParaBorderSide aSide)
   1.560 +
   1.561 +	/** Gets a pointer to the paragraph border on the side specified. If no 
   1.562 +	paragraph border array has been allocated, returns NULL.
   1.563 +	
   1.564 +	@param aSide The side for the paragraph border. 
   1.565 +	@return Pointer to the paragraph border on the specified side. */
   1.566 +		{ return iParaBorderArray ? &iParaBorderArray->iBorder[aSide] : NULL; }
   1.567 +	IMPORT_C TBool AllBordersEqual(const CParaFormat& aFormat) const;
   1.568 +	IMPORT_C TBool IsBorderEqual(TParaBorderSide aSide, const CParaFormat& aFormat) const;
   1.569 +private:
   1.570 +	CParaFormat(const CParaFormat& aFormat);
   1.571 +	void CreateTabListL();
   1.572 +	enum
   1.573 +		{
   1.574 +		ETabStoreGranularity = 2
   1.575 +		};
   1.576 +
   1.577 +	CParaFormat& operator=(const CParaFormat& aParaFormat);	// intentionally unimplemented
   1.578 +private:
   1.579 +	CArrayFixFlat<TTabStop>* iTabList;			// ordered list of tab stops; null if none
   1.580 +	TParaBorderArray* iParaBorderArray;			// array of paragraph borders; null if none
   1.581 +public:
   1.582 +	/** The background colour of the paragraph. By default the default system 
   1.583 +	background colour. This colour applies to the area bounded by the paragraph 
   1.584 +	border, if one exists. */
   1.585 +	TLogicalRgb iFillColor;
   1.586 +	/** The language of the paragraph for proofing. By default 
   1.587 +	KParaDefaultLanguage. Used for example when spell checking a document 
   1.588 +	which contains text in more than one language, so that the program 
   1.589 +	recognises the text as being in another language. */
   1.590 +	TInt32 iLanguage;						
   1.591 +	/** The width in twips of the leading margin (left for left-to-right
   1.592 +	paragraphs, right for right-to-left paragraphs). By default
   1.593 +	KParaDefaultLeftMargin (zero). */
   1.594 +	TInt32 iLeftMarginInTwips;
   1.595 +	/** The width in twips of the trailing margin (right for left-to-right
   1.596 +	paragraphs, left for right-to-left paragraphs). By default
   1.597 +	KParaDefaultRightMargin (zero). */
   1.598 +	TInt32 iRightMarginInTwips;
   1.599 +	/** An indent for the first line in the paragraph, relative to the leading
   1.600 +	margin (left for left-to-right paragraphs, right for right-to-left
   1.601 +	paragraphs). By default KParaDefaultIndent (zero). */
   1.602 +	TInt32 iIndentInTwips;
   1.603 +	/** Horizontal alignment of paragraph. By default KParaDefaultHorizAlign 
   1.604 +	(left). */
   1.605 +	TAlignment iHorizontalAlignment;
   1.606 +	/** Vertical alignment of paragraph, (intended for use by spreadsheet 
   1.607 +	applications). 	By default KParaDefaultVertAlign (unspecified). */
   1.608 +	TAlignment iVerticalAlignment;
   1.609 +	/** Inter-line spacing within the paragraph, in twips. By default 
   1.610 +	KParaDefaultLineSpacing (200 twips). */
   1.611 +	TInt32 iLineSpacingInTwips;	// distance between successive baselines
   1.612 +	/** Control for the iLineSpacingInTwips value. By default, 
   1.613 +	KParaDefaultLineSpacingControl 	(ELineSpacingAtLeastInTwips). */
   1.614 +	TLineSpacingControl iLineSpacingControl;	// whether iLineSpacingInTwips means 'at least' or 'exactly'
   1.615 +	/** Space above paragraph. By default KParaDefaultSpaceBefore (zero). */
   1.616 +	TInt32 iSpaceBeforeInTwips;	
   1.617 +	/** Space below paragraph. By default KParaDefaultSpaceAfter (zero). */
   1.618 +	TInt32 iSpaceAfterInTwips;	
   1.619 +	/** Prevents a page break within paragraph if ETrue. By default 
   1.620 +	KParaDefaultKeepTogether (EFalse). */
   1.621 +	TBool iKeepTogether;	
   1.622 +	/** Prevents a page break between this paragraph and the following 
   1.623 +	paragraph if ETrue. By default, KParaDefaultKeepWithNext (EFalse). */
   1.624 +	TBool iKeepWithNext;	
   1.625 +	/** Inserts a page break immediately before this paragraph if ETrue. 
   1.626 +	By default, KParaDefaultStartNewPage (EFalse). */
   1.627 +	TBool iStartNewPage;		
   1.628 +	/** Prevents the printing of the last line of a paragraph at the top 
   1.629 +	of the page (referred to as a widow), or the first line of a paragraph 
   1.630 +	at the bottom of the page, (referred to as an orphan). By default, 
   1.631 +	KParaDefaultWidowOrphan (EFalse). */
   1.632 +	TBool iWidowOrphan;	
   1.633 +	/** Specifies whether the paragraph should line wrap at the right margin. 
   1.634 +	By default KParaDefaultWrap (ETrue). */
   1.635 +	TBool iWrap;
   1.636 +	/** Distance in twips between the paragraph border and the enclosed text. 
   1.637 +	By default KParaDefaultBorderMargin (zero). */
   1.638 +	TInt32 iBorderMarginInTwips;	
   1.639 +	/** The bullet point associated with the paragraph. A NULL value indicates 
   1.640 +	no bullet point. By default NULL. */
   1.641 +	TBullet* iBullet;		
   1.642 +	/** Specifies the default tab stop width. By default KParaDefaultTabWidth 
   1.643 +	(360 twips). */
   1.644 +	TUint32 iDefaultTabWidthInTwips;
   1.645 +	};
   1.646 +
   1.647 +/** 
   1.648 +Masks the paragraph format attributes which are involved when setting and 
   1.649 +sensing paragraph formatting. 
   1.650 +
   1.651 +Used in conjunction with an object of class CParaFormat. When setting formatting, 
   1.652 +only the attributes which are set in the mask will participate in the relevant 
   1.653 +function. When sensing formatting, on return, the mask indicates which attributes 
   1.654 +were sensed from the format layer, and were not taken from the default values. 
   1.655 +@publishedAll
   1.656 +@released
   1.657 +*/
   1.658 +class TParaFormatMask
   1.659 +	{
   1.660 +public:
   1.661 +	inline TParaFormatMask();
   1.662 +	inline void SetAttrib(TTextFormatAttribute aAttribute);
   1.663 +	inline void ClearAttrib(TTextFormatAttribute aAttribute);
   1.664 +	IMPORT_C void SetAll();
   1.665 +	IMPORT_C void ClearAll();
   1.666 +	inline TBool AttribIsSet(TTextFormatAttribute aAttribute) const;
   1.667 +	inline TBool IsNull() const;
   1.668 +	IMPORT_C TBool operator==(const TParaFormatMask& aMask) const;
   1.669 +	inline TBool operator!=(const TParaFormatMask& aMask) const;
   1.670 +
   1.671 +private:
   1.672 +	TUint32 iGuard;
   1.673 +	};
   1.674 +
   1.675 +/** 
   1.676 +Specifies the font-independent character format attributes, including bold, 
   1.677 +italics and underlining.
   1.678 +
   1.679 +An instance of this class is owned by the character formatting container (class 
   1.680 +TCharFormat). 
   1.681 +@publishedAll
   1.682 +@released
   1.683 +*/
   1.684 +class TFontPresentation
   1.685 +	{
   1.686 +public:
   1.687 +		
   1.688 +	/** Highlight style */
   1.689 +	enum TFontHighlightStyle
   1.690 +		{
   1.691 +		/** No highlighting used. */
   1.692 +		EFontHighlightNone,
   1.693 +		/** Normal (square cornered) highlighting used. */
   1.694 +		EFontHighlightNormal,
   1.695 +		/** Rounded corner highlighting used. */
   1.696 +		EFontHighlightRounded,
   1.697 +		/** Text is drawn offset towards the bottom-right in the highlight 
   1.698 +		colour, (iHighlightColor) before being drawn again in the text colour, 
   1.699 +		(iTextColor) creating a shadow effect. */
   1.700 +		EFontHighlightShadow,
   1.701 +		/** Placeholder for "unrecognised word" highlighting style for FEPs */
   1.702 +		EFontHighlightNoMatchesIndicator,
   1.703 +		/** First custom highlighting style is used.
   1.704 +		@see MFormCustomDraw::DrawText(). */
   1.705 +		EFontHighlightFirstCustomStyle = 128,
   1.706 +		/** Second custom highlighting style is used. 
   1.707 +		@see MFormCustomDraw::DrawText(). */
   1.708 +		EFontHighlightLastCustomStyle = 255
   1.709 +		};
   1.710 +	
   1.711 +	
   1.712 +	/** Vertical picture alignment */
   1.713 +	enum TAlignment
   1.714 +		{
   1.715 +		/** The top of the picture is aligned flush with the top of the font's 
   1.716 +		ascent, so that the picture may descend below the line. */
   1.717 +		EAlignTop,
   1.718 +		/** The bottom of the picture is aligned flush with the bottom of the 
   1.719 +		font's descent so that the picture may extend above the line. */
   1.720 +		EAlignBottom,
   1.721 +		/** The picture is aligned so that its centre is positioned at the 
   1.722 +		baseline of the line. */
   1.723 +		EAlignCentered,
   1.724 +		/** The bottom of the picture is aligned with the baseline of the font.
   1.725 +		This is the default. */
   1.726 +		EAlignBaseLine
   1.727 +		};
   1.728 +	//
   1.729 +	IMPORT_C TFontPresentation();
   1.730 +	//
   1.731 +	// Enquiry function
   1.732 +	IMPORT_C TBool IsEqual(const TFontPresentation& aFontPresentation, const TCharFormatMask& aMask) const;
   1.733 +public:
   1.734 +	/** The text colour. By default, the default system foreground colour. */
   1.735 +	TLogicalRgb iTextColor;
   1.736 +	/** The highlight colour for selected text. Only takes effect if 
   1.737 +	iHighlightStyle is not EFontHighlightNone. By default, the default system 
   1.738 +	foreground colour. */
   1.739 +	TLogicalRgb iHighlightColor;  // Background color
   1.740 +	/** Style for character highlighting. By default EFontHighlightNone. */
   1.741 +	TFontHighlightStyle iHighlightStyle;
   1.742 +	/** The value of the strikethrough attribute. By default EStrikethroughOff. */
   1.743 +	TFontStrikethrough iStrikethrough;
   1.744 +	/** The value of the underline attribute. By default EUnderlineOff. */
   1.745 +	TFontUnderline iUnderline;
   1.746 +	/** Specifies whether or not text is hidden. Note that hidden text is not 
   1.747 +	currently supported by the text layout engine. This attribute is provided 
   1.748 +	to preserve information when copying from and to devices which support 
   1.749 +	hidden text. By default EFalse. */
   1.750 +	TBool iHiddenText;
   1.751 +	/** The vertical alignment of a picture character. By default 
   1.752 +	EAlignBaseLine. */
   1.753 +	TAlignment iPictureAlignment;
   1.754 +	};
   1.755 +
   1.756 +/** 
   1.757 +A transient container of character format attributes, including 
   1.758 +font-dependent and font-independent attributes. 
   1.759 +
   1.760 +The font-independent attributes are stored in a TFontPresentation object. 
   1.761 +Rich and global text objects store character formatting using character format 
   1.762 +layers (see class CCharFormatLayer). The TCharFormat class is used to store 
   1.763 +the relevant attribute values when setting or sensing a CCharFormatLayer. 
   1.764 +It is normally used in combination with a TCharFormatMask, to specify which 
   1.765 +attributes are relevant to the function concerned. 
   1.766 +@publishedAll
   1.767 +@released
   1.768 +*/
   1.769 +class TCharFormat
   1.770 +	{
   1.771 +public:
   1.772 +	IMPORT_C TCharFormat();
   1.773 +	IMPORT_C TCharFormat(const TDesC &aTypefaceName, TInt aHeight);
   1.774 +	//
   1.775 +	// Enquiry functions
   1.776 +	IMPORT_C TBool IsEqual(const TCharFormat& aFormat, const TCharFormatMask& aMask) const;
   1.777 +	IMPORT_C TBool IsEqual(const TCharFormat& aFormat) const;
   1.778 +public:
   1.779 +	/** Specifies the language of individual characters for proofing. Used for 
   1.780 +	example when spell checking a document which contains text in more than one 
   1.781 +	language, so that the program recognises the text as being in another 
   1.782 +	language. Language is also a paragraph format attribute. If the language 
   1.783 +	setting of a character is different from the language setting of the 
   1.784 +	containing paragraph, the character's setting takes precedence. */
   1.785 +	TInt32 iLanguage;
   1.786 +	/** Font independent character format attributes. */
   1.787 +	TFontPresentation iFontPresentation; 
   1.788 +	/** Device independent font specification. */
   1.789 +	TFontSpec iFontSpec;  
   1.790 +	};
   1.791 +
   1.792 +/** 
   1.793 +Masks the character format attributes which are involved when setting and 
   1.794 +sensing character formatting.
   1.795 +
   1.796 +Used in conjunction with an object of class TCharFormat.
   1.797 +
   1.798 +When setting formatting, only the attributes which are set in the mask should 
   1.799 +participate in the relevant function. When sensing formatting, on return, 
   1.800 +the mask indicates which attributes were sensed from the format layer, and 
   1.801 +were not taken from the default values. 
   1.802 +@publishedAll
   1.803 +@released
   1.804 +*/
   1.805 +class TCharFormatMask
   1.806 +	{
   1.807 +public:
   1.808 +	inline TCharFormatMask();
   1.809 +	inline void SetAttrib(TTextFormatAttribute aAttribute);
   1.810 +	inline void ClearAttrib(TTextFormatAttribute aAttribute);
   1.811 +	inline TBool AttribIsSet(TTextFormatAttribute aAttribute) const;
   1.812 +	IMPORT_C void SetAll();
   1.813 +	IMPORT_C void ClearAll();
   1.814 +	inline TBool IsNull()const;
   1.815 +	IMPORT_C TBool operator==(const TCharFormatMask& aMask) const;
   1.816 +	inline TBool operator!=(const TCharFormatMask& aMask) const;
   1.817 +
   1.818 +private:
   1.819 +	TUint32 iGuard;
   1.820 +	};
   1.821 +
   1.822 +#include <txtfrmat.inl>
   1.823 +
   1.824 +#endif