epoc32/include/txtfrmat.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __TXTFRMAT_H__
williamr@2
    17
#define __TXTFRMAT_H__
williamr@2
    18
williamr@2
    19
#include <e32std.h>
williamr@2
    20
#include <e32base.h>
williamr@2
    21
#include <gdi.h>
williamr@2
    22
williamr@2
    23
williamr@2
    24
// Classes declared in this file:
williamr@2
    25
class TTabStop;
williamr@2
    26
class TParaBorder;
williamr@2
    27
class TBullet;
williamr@2
    28
class TParaBorderArray;
williamr@2
    29
class CParaFormat;
williamr@2
    30
class TParaFormatMask;
williamr@2
    31
class TFontPresentation;
williamr@2
    32
class TCharFormat;
williamr@2
    33
class TCharFormatMask;
williamr@2
    34
williamr@2
    35
/** 
williamr@2
    36
Provides support for system colours, in addition to literal colours, in 
williamr@2
    37
text formatting.
williamr@2
    38
williamr@2
    39
The base class TRgb stores the 24-bit literal colour value using a TUint32. 
williamr@2
    40
TLogicalRgb uses the MSB from iValue2 data member as an 8-bit index. The 
williamr@2
    41
purpose of the  index is to allow applications to use logical colours. If the 
williamr@2
    42
index is zero, the value is not a logical colour; it is treated as an ordinary 
williamr@2
    43
TRgb value. If the index is non zero (1-255), the colour should be translated by the 
williamr@2
    44
application into a system colour. Indices 254 and 255 are reserved for the 
williamr@2
    45
system foreground and background colours, respectively and should be translated 
williamr@2
    46
into them. Translation from index to RGB colour occurs in the implementation of 
williamr@2
    47
MFormParam::SystemColor().
williamr@2
    48
williamr@2
    49
All colours in the Text and Text Attributes API are stored using TLogicalRgb 
williamr@2
    50
values and are initialised to either TLogicalRgb::ESystemForegroundColor or 
williamr@2
    51
TLogicalRgb::ESystemBackgroundColor.
williamr@2
    52
williamr@2
    53
This system allows an application to set its text colours once, perhaps using 
williamr@2
    54
the system-wide colour scheme, rather than having to set the colours each 
williamr@2
    55
time a text object is created. It is also compatible with legacy code which 
williamr@2
    56
expects TRgb rather than TLogicalRgb values: for example, the logical 
williamr@2
    57
foreground and background colours have their bottom three bytes filled with 
williamr@2
    58
black and white respectively so that code which expects TRgb values can still 
williamr@2
    59
use them. 
williamr@2
    60
@publishedAll
williamr@2
    61
@released
williamr@2
    62
*/
williamr@2
    63
class TLogicalRgb : public TRgb
williamr@2
    64
	{
williamr@2
    65
	public:
williamr@2
    66
 
williamr@2
    67
	/*
williamr@2
    68
	Reserved colour indices for default foreground and background colours,
williamr@2
    69
	and colours for the selection highlight. The top 128 indices (128-255)
williamr@2
    70
	are reserved for future expansion, but the first 126 non-zero indices
williamr@2
    71
	(1-127) can be used by the GUI as convenient.
williamr@2
    72
	*/ 
williamr@2
    73
	enum
williamr@2
    74
		{
williamr@2
    75
		ESystemSelectionForegroundIndex = 252,
williamr@2
    76
		ESystemSelectionBackgroundIndex = 253,
williamr@2
    77
		/** Index reserved for the system foreground colour (=254). */
williamr@2
    78
		ESystemForegroundIndex = 254,
williamr@2
    79
		/** Index reserved for the system background colour (=255). */
williamr@2
    80
		ESystemBackgroundIndex = 255
williamr@2
    81
		};
williamr@2
    82
williamr@2
    83
	
williamr@2
    84
	 
williamr@2
    85
	/** Used to construct TLogicalRgb objects which should use either the 
williamr@2
    86
	system foreground or background colour. */
williamr@2
    87
	enum TSystemColor
williamr@2
    88
		{
williamr@2
    89
		ESystemSelectionForegroundColor = ESystemSelectionForegroundIndex << 24,
williamr@2
    90
		ESystemSelectionBackgroundColor = ESystemSelectionBackgroundIndex << 24,
williamr@2
    91
		/** The system foreground colour. */
williamr@2
    92
		ESystemForegroundColor = ESystemForegroundIndex << 24,
williamr@2
    93
		/** The system background colour. */
williamr@2
    94
		ESystemBackgroundColor = (ESystemBackgroundIndex << 24) | 0xFFFFFF
williamr@2
    95
		};
williamr@2
    96
		 
williamr@2
    97
	/** Constructs a new TLogicalRgb object. */
williamr@2
    98
	TLogicalRgb() : 
williamr@2
    99
		iValue2(0) 
williamr@2
   100
		{ 
williamr@2
   101
		}
williamr@2
   102
	
williamr@2
   103
	/** Constructs the object with a 32-bit integer. The index is stored in the 
williamr@2
   104
	MSB of iValue2 data member. A TRgb value may be stored in the base TRgb class. 
williamr@2
   105
	@param aValue Integer holding the logical colour index. */
williamr@2
   106
	TLogicalRgb(TUint32 aValue): 
williamr@2
   107
		iValue2(aValue & 0xFF000000)
williamr@2
   108
		{ 
williamr@2
   109
		SetInternal((TUint32)aValue | 0xFF000000);
williamr@2
   110
		}
williamr@2
   111
		
williamr@2
   112
	/** Constructs the object with a TSystemColor value.
williamr@2
   113
	@param aValue Identifies whether the colour is the system foreground or 
williamr@2
   114
	system background colour. */
williamr@2
   115
	TLogicalRgb(TSystemColor aValue) : 
williamr@2
   116
		iValue2((TUint32)aValue & 0xFF000000)
williamr@2
   117
		{ 
williamr@2
   118
		SetInternal((TUint32)aValue | 0xFF000000);
williamr@2
   119
		}
williamr@2
   120
williamr@2
   121
	/** Constructs a new TLogicalRgb object from an existing one. */
williamr@2
   122
	TLogicalRgb(const TRgb& aRgb) : 
williamr@2
   123
		TRgb(aRgb),
williamr@2
   124
		iValue2(0)
williamr@2
   125
		{ 
williamr@2
   126
		}
williamr@2
   127
	 
williamr@2
   128
	/** Returns the logical colour's index value. Zero indicates that the value 
williamr@2
   129
	is not a logical colour; it is an ordinary TRgb value. 254 and 255 indicate 
williamr@2
   130
	the system foreground and background colours, respectively.
williamr@2
   131
	@return The index: between zero and 255 inclusive. */
williamr@2
   132
	TUint SystemColorIndex() const 
williamr@2
   133
		{ 
williamr@2
   134
		return iValue2 >> 24; 
williamr@2
   135
		}
williamr@2
   136
		
williamr@2
   137
	/** Sets the logical colour's index value.
williamr@2
   138
	@param aIndex The new index value (between 1 and 253 inclusive). */
williamr@2
   139
	void SetSystemColorIndex(TUint aIndex) 
williamr@2
   140
		{ 
williamr@2
   141
		iValue2 = aIndex << 24; 
williamr@2
   142
		}
williamr@2
   143
	
williamr@2
   144
private:	
williamr@2
   145
	TUint32 iValue2;
williamr@2
   146
	
williamr@2
   147
	};
williamr@2
   148
williamr@2
   149
/** 
williamr@2
   150
Indicates which format attributes are relevant when setting or sensing text 
williamr@2
   151
formatting. 
williamr@2
   152
@publishedAll
williamr@2
   153
@released
williamr@2
   154
*/
williamr@2
   155
enum TTextFormatAttribute
williamr@2
   156
	{
williamr@2
   157
	// Paragraph format attributes.
williamr@2
   158
	/** Language of the paragraph for proofing. */
williamr@2
   159
	EAttParaLanguage,
williamr@2
   160
	/** Background colour of the paragraph. */
williamr@2
   161
	EAttFillColor,
williamr@2
   162
	/** Leading text margin. */
williamr@2
   163
	EAttLeftMargin,
williamr@2
   164
	/** Trailing text margin. */
williamr@2
   165
	EAttRightMargin,
williamr@2
   166
	/** First line leading indent. */
williamr@2
   167
	EAttIndent,
williamr@2
   168
	/** Horizontal alignment of paragraph. */
williamr@2
   169
	EAttAlignment,
williamr@2
   170
	/** Vertical paragraph alignment. */
williamr@2
   171
	EAttVerticalAlignment,
williamr@2
   172
	/** Inter-line spacing. */
williamr@2
   173
	EAttLineSpacing,
williamr@2
   174
	/** Control for EAttLineSpacing. */
williamr@2
   175
	EAttLineSpacingControl,
williamr@2
   176
	/** Space above paragraph. */
williamr@2
   177
	EAttSpaceBefore,
williamr@2
   178
	/** Space below paragraph. */
williamr@2
   179
	EAttSpaceAfter,
williamr@2
   180
	/** Whether a page break can occur within the paragraph. */
williamr@2
   181
	EAttKeepTogether,
williamr@2
   182
	/** Whether a page break can occur between this and the next paragraph. */
williamr@2
   183
	EAttKeepWithNext,
williamr@2
   184
	/** Whether a page break should be inserted before this paragraph. */
williamr@2
   185
	EAttStartNewPage,
williamr@2
   186
	/** Whether the last line of a paragraph can appear by itself at the top of a new 
williamr@2
   187
	page, (widow), or the first line of a paragraph can appear by itself at the 
williamr@2
   188
	bottom of the page, (orphan). */
williamr@2
   189
	EAttWidowOrphan,
williamr@2
   190
	/** Whether the paragraph should line wrap at the right margin. */
williamr@2
   191
	EAttWrap,
williamr@2
   192
	/** Distance between paragraph border and enclosed text. */
williamr@2
   193
	EAttBorderMargin,
williamr@2
   194
	/** Top of paragraph border. */
williamr@2
   195
	EAttTopBorder,
williamr@2
   196
	/** Bottom of paragraph border. */
williamr@2
   197
	EAttBottomBorder,
williamr@2
   198
	/** Left-hand side of paragraph border. */
williamr@2
   199
	EAttLeftBorder,
williamr@2
   200
	/** Right-hand side of paragraph border. */
williamr@2
   201
	EAttRightBorder,
williamr@2
   202
	/** Bullet point associated with paragraph. */
williamr@2
   203
	EAttBullet,
williamr@2
   204
	/** Spacing between default tab stops. */
williamr@2
   205
	EAttDefaultTabWidth,
williamr@2
   206
	/** Tab stop. */
williamr@2
   207
	EAttTabStop,
williamr@2
   208
williamr@2
   209
	// Character format attributes.
williamr@2
   210
	/** Language of individual characters within a paragraph for proofing. */
williamr@2
   211
	EAttCharLanguage,
williamr@2
   212
	/** Text colour. */
williamr@2
   213
	EAttColor,
williamr@2
   214
	/** Text highlight colour. */
williamr@2
   215
	EAttFontHighlightColor,
williamr@2
   216
	/** Text highlight style. */
williamr@2
   217
	EAttFontHighlightStyle,
williamr@2
   218
	/** Font height. */
williamr@2
   219
	EAttFontHeight,
williamr@2
   220
	/** Font posture (i.e. italics). */
williamr@2
   221
	EAttFontPosture,
williamr@2
   222
	/** Font stroke weight (i.e. bold). */
williamr@2
   223
	EAttFontStrokeWeight,
williamr@2
   224
	/** Subscript, superscript or normal print position. */
williamr@2
   225
	EAttFontPrintPos,
williamr@2
   226
	/** Underlining. */
williamr@2
   227
	EAttFontUnderline,
williamr@2
   228
	/** Strikethrough. */
williamr@2
   229
	EAttFontStrikethrough,
williamr@2
   230
	/** The typeface name. */
williamr@2
   231
	EAttFontTypeface,
williamr@2
   232
	/** Vertical picture alignment. */
williamr@2
   233
	EAttFontPictureAlignment,
williamr@2
   234
	/** Hidden text. */
williamr@2
   235
	EAttFontHiddenText,
williamr@2
   236
williamr@2
   237
	/** Used internally to indicate the count of all attributes. */
williamr@2
   238
	ETextFormatAttributeCount
williamr@2
   239
	};
williamr@2
   240
/**
williamr@2
   241
@internalComponent
williamr@2
   242
*/
williamr@2
   243
enum {EVariableLengthValue = 0};
williamr@2
   244
williamr@2
   245
/**
williamr@2
   246
@internalComponent
williamr@2
   247
*/
williamr@2
   248
const TInt KMaxStyleName = 0x20;
williamr@2
   249
const TInt KMaxParaAttributes = EAttTabStop;
williamr@2
   250
const TInt KMaxCharAttributes = EAttFontHiddenText - KMaxParaAttributes;
williamr@2
   251
const TInt KTabNotFound = -1;
williamr@2
   252
williamr@2
   253
/** 
williamr@2
   254
A tab stop.
williamr@2
   255
williamr@2
   256
This is a position on a page used to align columns of text. It has a twips 
williamr@2
   257
position and an alignment. The twips position is the width in twips (1/1440th 
williamr@2
   258
of an inch) of the tab stop, i.e. the number of twips from the start of the 
williamr@2
   259
line at which text can be inserted. It uniquely identifies the tab stop. The 
williamr@2
   260
alignment (left, right, or centre) indicates how text inserted at the tab 
williamr@2
   261
stop should be aligned.
williamr@2
   262
williamr@2
   263
Tab stops are paragraph format attributes. They are owned by the CParaFormat 
williamr@2
   264
class, through which tab stops can be added and removed. 
williamr@2
   265
@publishedAll
williamr@2
   266
@released
williamr@2
   267
*/
williamr@2
   268
class TTabStop
williamr@2
   269
	{
williamr@2
   270
public:
williamr@2
   271
	/** Text alignment at the tab stop. */
williamr@2
   272
	enum TTabType
williamr@2
   273
		{
williamr@2
   274
		/** No tab. */
williamr@2
   275
		ENullTab, 
williamr@2
   276
		/** Text is aligned to the tab stop's leading edge (left for
williamr@2
   277
		left-to-right paragraphs, right for right-to-left paragraphs). */
williamr@2
   278
		ELeftTab, 
williamr@2
   279
		/** Text is aligned to the tab stop's trailing edge (right for
williamr@2
   280
		left-to-right paragraphs, left for right-to-left paragraphs). */
williamr@2
   281
		ECenteredTab, 
williamr@2
   282
		/** Text is right aligned at the tab stop. */
williamr@2
   283
		ERightTab
williamr@2
   284
		};
williamr@2
   285
public:
williamr@2
   286
	IMPORT_C TTabStop();
williamr@2
   287
	IMPORT_C TTabStop(const TTabStop& aTabStop);
williamr@2
   288
	IMPORT_C TTabStop& operator=(const TTabStop& aTabStop);
williamr@2
   289
	IMPORT_C TBool operator==(const TTabStop& aTabStop) const;
williamr@2
   290
	inline TBool operator!=(const TTabStop& aTabStop) const;
williamr@2
   291
public:
williamr@2
   292
	/** The twips position. This is the width in twips of the tab stop, i.e. 
williamr@2
   293
	the number of twips from the start of the line at which text can be 
williamr@2
   294
	inserted. */
williamr@2
   295
	TUint32 iTwipsPosition;
williamr@2
   296
	/** Text alignment at the tab stop. */
williamr@2
   297
	TTabType iType;
williamr@2
   298
	};
williamr@2
   299
williamr@2
   300
/** 
williamr@2
   301
Defines the characteristics of one of the four sides of a paragraph border. 
williamr@2
   302
williamr@2
   303
These are the line style, thickness and colour. Paragraph borders are paragraph 
williamr@2
   304
format attributes. They are owned by the CParaFormat class which allows 
williamr@2
   305
paragraph borders to be added and removed. The CParaFormat::TParaBorderSide 
williamr@2
   306
enumeration identifies which side of the paragraph the object applies to. 
williamr@2
   307
@publishedAll
williamr@2
   308
@released
williamr@2
   309
*/
williamr@2
   310
class TParaBorder
williamr@2
   311
	{
williamr@2
   312
public:
williamr@2
   313
	
williamr@2
   314
	/** Line styles. */
williamr@2
   315
	enum TLineStyle 
williamr@2
   316
		{
williamr@2
   317
		/** No line style. */
williamr@2
   318
		ENullLineStyle, 
williamr@2
   319
		/** Solid line. */
williamr@2
   320
		ESolid, 
williamr@2
   321
		/** Double solid line. */
williamr@2
   322
		EDouble,
williamr@2
   323
		/** Dotted line. */
williamr@2
   324
		EDotted, 
williamr@2
   325
		/** Dashed line. */
williamr@2
   326
		EDashed, 
williamr@2
   327
		/** Alternating dots and dashes. */
williamr@2
   328
		EDotDash, 
williamr@2
   329
		/** Alternating sequence of two dots and a dash. */
williamr@2
   330
		EDotDotDash
williamr@2
   331
		};
williamr@2
   332
	//
williamr@2
   333
	IMPORT_C TParaBorder();
williamr@2
   334
	IMPORT_C TBool operator==(const TParaBorder& aParaBorder) const;
williamr@2
   335
	inline TBool operator!=(const TParaBorder& aParaBorder) const;
williamr@2
   336
public:
williamr@2
   337
	/** The line style. By default, ENullLineStyle. */
williamr@2
   338
	TLineStyle iLineStyle;
williamr@2
   339
	/** The line thickness in twips. By default, zero. */
williamr@2
   340
	TInt iThickness;
williamr@2
   341
	/** The line colour. By default, the system's default foreground colour. */
williamr@2
   342
	TLogicalRgb iColor;
williamr@2
   343
	/** ETrue indicates that the line colour is set to the default or current 
williamr@2
   344
	text colour, overriding iColor. EFalse indicates that the iColor value is 
williamr@2
   345
	used. By default, ETrue. */
williamr@2
   346
	TBool iAutoColor;
williamr@2
   347
	};
williamr@2
   348
williamr@2
   349
/** 
williamr@2
   350
Stores the four sides of a paragraph border.
williamr@2
   351
williamr@2
   352
Paragraph borders sides are set individually using functions provided by class 
williamr@2
   353
CParaFormat. 
williamr@2
   354
@publishedAll
williamr@2
   355
@released
williamr@2
   356
*/
williamr@2
   357
class TParaBorderArray
williamr@2
   358
	{
williamr@2
   359
public:
williamr@2
   360
	TParaBorder iBorder[4];
williamr@2
   361
	};
williamr@2
   362
williamr@2
   363
/** 
williamr@2
   364
A bullet point. 
williamr@2
   365
williamr@2
   366
This is a paragraph format attribute, stored as the iBullet member of class 
williamr@2
   367
CParaFormat.
williamr@2
   368
williamr@2
   369
Bullet points have a typeface, height, colour and a character code (defines 
williamr@2
   370
the symbol displayed). Single level bullets only are supported. Bullets may 
williamr@2
   371
also have a hanging indent. If set, this means that the rest of the paragraph 
williamr@2
   372
following the line containing the bullet point is indented. 
williamr@2
   373
@publishedAll
williamr@2
   374
@released
williamr@2
   375
*/
williamr@2
   376
class TBullet
williamr@2
   377
	{
williamr@2
   378
	public:
williamr@2
   379
	IMPORT_C TBullet();
williamr@2
   380
	IMPORT_C TBool operator ==(const TBullet& aBullet) const;
williamr@2
   381
	inline TBool operator !=(const TBullet& aBullet) const;
williamr@2
   382
williamr@2
   383
	/**
williamr@2
   384
	Identifies the bullet style.
williamr@2
   385
williamr@2
   386
	Note: Styles other than ENullStyle and EBulletStyle are not currently supported.
williamr@2
   387
	They have the same effect as the EBulletStyle.
williamr@2
   388
	*/
williamr@2
   389
	enum TStyle
williamr@2
   390
		{
williamr@2
   391
		/**
williamr@2
   392
		No bullet. Used for style layers that override a bullet with the absence of a bullet.
williamr@2
   393
		*/
williamr@2
   394
		ENullStyle,
williamr@2
   395
		/**
williamr@2
   396
		A bullet point. Character with code 0x2022 is used by default.
williamr@2
   397
		*/
williamr@2
   398
		EBulletStyle,
williamr@2
   399
		EArabicNumberStyle,
williamr@2
   400
		ESmallRomanNumberStyle,
williamr@2
   401
		ECapitalRomanNumberStyle,
williamr@2
   402
		ESmallLetterStyle,
williamr@2
   403
		ECapitalLetterStyle
williamr@2
   404
		};
williamr@2
   405
williamr@2
   406
	/** Paragraph alignment */
williamr@2
   407
	enum TAlignment
williamr@2
   408
		{
williamr@2
   409
		/** Paragraph left aligned. */
williamr@2
   410
		ELeftAlign,
williamr@2
   411
		/** Paragraph centre aligned. */
williamr@2
   412
		ECenterAlign,
williamr@2
   413
		/** Paragraph right aligned. */
williamr@2
   414
		ERightAlign
williamr@2
   415
		};
williamr@2
   416
williamr@2
   417
	/** The Unicode character used to represent the bullet point. By default 
williamr@2
   418
	0x2022. */
williamr@2
   419
	TChar iCharacterCode;		// the bullet or other symbol used if iStyle is EBulletStyle
williamr@2
   420
	/** The height in twips of the font used for the bullet point character. 
williamr@2
   421
	By default, zero. */
williamr@2
   422
	TUint iHeightInTwips;
williamr@2
   423
	/** The typeface used for the bullet point character. */
williamr@2
   424
	TTypeface iTypeface;
williamr@2
   425
	/** ETrue to indent the rest of the paragraph from the bullet point. 
williamr@2
   426
	EFalse to align the bullet point character with the rest of the paragraph. */
williamr@2
   427
	TBool iHangingIndent;
williamr@2
   428
	/** The colour of the bullet point character. By default, the system's 
williamr@2
   429
	default foreground colour. */
williamr@2
   430
	TLogicalRgb iColor;
williamr@2
   431
	TStyle iStyle;				// is this a bullet or a number or a letter?
williamr@2
   432
	TInt iStartNumber;			// the number of the first paragraph in a run of paragraphs in this style
williamr@2
   433
	TAlignment iAlignment;		// alignment of the bullet or number within the margin
williamr@2
   434
	};
williamr@2
   435
williamr@2
   436
/** 
williamr@2
   437
A transient container of paragraph format attributes, including tab stops, 
williamr@2
   438
bullet points and paragraph borders. 
williamr@2
   439
williamr@2
   440
Rich and global text objects store paragraph formatting using paragraph format 
williamr@2
   441
layers (see class CParaFormatLayer). The CParaFormat class is used to store 
williamr@2
   442
the relevant attribute values when setting or sensing a CParaFormatLayer. 
williamr@2
   443
It is normally used in combination with a TParaFormatMask, to specify which 
williamr@2
   444
attributes are relevant to the function concerned.
williamr@2
   445
williamr@2
   446
On construction, all CParaFormat member data is initialised. The attributes 
williamr@2
   447
which are not explicitly set are assigned default values. 
williamr@2
   448
@publishedAll
williamr@2
   449
@released
williamr@2
   450
*/
williamr@2
   451
class CParaFormat: public CBase
williamr@2
   452
	{
williamr@2
   453
public:
williamr@2
   454
	/** Miscellaneous constants. */
williamr@2
   455
	enum
williamr@2
   456
		{
williamr@2
   457
		/** The maximum number of paragraph borders (= 4). */
williamr@2
   458
		EMaxParaBorder = 4
williamr@2
   459
		};
williamr@2
   460
williamr@2
   461
	/** Paragraph border sides */
williamr@2
   462
	enum TParaBorderSide
williamr@2
   463
		{
williamr@2
   464
		/** The border at the top of the paragraph. */
williamr@2
   465
		EParaBorderTop,
williamr@2
   466
		/** The border at the bottom of the paragraph. */
williamr@2
   467
		EParaBorderBottom,
williamr@2
   468
		/** The border on the left hand side. */
williamr@2
   469
		EParaBorderLeft,
williamr@2
   470
		/** The border on the right hand side. */
williamr@2
   471
		EParaBorderRight
williamr@2
   472
		};
williamr@2
   473
williamr@2
   474
	/** Line spacing control */
williamr@2
   475
	enum TLineSpacingControl
williamr@2
   476
		{
williamr@2
   477
		/** Twips line spacing must be at least as wide as the 
williamr@2
   478
		iLineSpacingInTwips value. */
williamr@2
   479
		ELineSpacingAtLeastInTwips,
williamr@2
   480
		/** Twips line spacing must be exactly the iLineSpacingInTwips value. */
williamr@2
   481
		ELineSpacingExactlyInTwips,
williamr@2
   482
		/** Pixels line spacing must be at least as wide as the line spacing 
williamr@2
   483
		value in pixels. */
williamr@2
   484
		ELineSpacingAtLeastInPixels,
williamr@2
   485
		/** Pixels line spacing must be exactly the same as the line spacing 
williamr@2
   486
		value in pixels. */
williamr@2
   487
		ELineSpacingExactlyInPixels
williamr@2
   488
		};
williamr@2
   489
williamr@2
   490
	/** Paragraph alignment */
williamr@2
   491
	enum TAlignment
williamr@2
   492
		{
williamr@2
   493
		/** Paragraph aligned to the leading margin (left for left-to-right
williamr@2
   494
		paragraphs, right for right-to-left paragraphs). */
williamr@2
   495
		ELeftAlign,
williamr@2
   496
		/** Paragraph top aligned. */
williamr@2
   497
		ETopAlign = ELeftAlign,
williamr@2
   498
		/** Paragraph centre aligned. */
williamr@2
   499
		ECenterAlign,
williamr@2
   500
		/** Paragraph aligned to the trailing margin (right for left-to-right
williamr@2
   501
		paragraphs, left for right-to-left paragraphs). */
williamr@2
   502
		ERightAlign,
williamr@2
   503
		/** Paragraph bottom aligned. */
williamr@2
   504
		EBottomAlign = ERightAlign,
williamr@2
   505
		/** Paragraph justified. */
williamr@2
   506
		EJustifiedAlign,
williamr@2
   507
		/** Used by the spreadsheet application. Unlike ETopAlign and 
williamr@2
   508
		EBottomAlign, provides no default implementation. */
williamr@2
   509
		EUnspecifiedAlign,
williamr@2
   510
		/** User-defined paragraph alignment. */
williamr@2
   511
		ECustomAlign,
williamr@2
   512
		/** Absolute left alignment */
williamr@2
   513
		EAbsoluteLeftAlign,
williamr@2
   514
		/** Absolute right alignment */
williamr@2
   515
		EAbsoluteRightAlign
williamr@2
   516
		};
williamr@2
   517
williamr@2
   518
	/** Attribute sense mode */
williamr@2
   519
	enum TParaFormatGetMode
williamr@2
   520
		{
williamr@2
   521
		/** Indicates that all paragraph format attributes are written to the 
williamr@2
   522
		result when sensing paragraph format attributes. */
williamr@2
   523
		EAllAttributes,
williamr@2
   524
		/** Indicates that tabs, bullets and borders are not sensed. */
williamr@2
   525
		EFixedAttributes
williamr@2
   526
		};
williamr@2
   527
williamr@2
   528
	IMPORT_C static CParaFormat* NewL();
williamr@2
   529
	IMPORT_C static CParaFormat* NewLC();
williamr@2
   530
	IMPORT_C static CParaFormat* NewL(const CParaFormat& aFormat);
williamr@2
   531
	IMPORT_C CParaFormat();
williamr@2
   532
	IMPORT_C ~CParaFormat();
williamr@2
   533
	IMPORT_C void ResetNonDestructive();  // preserves any allocated tabs, bullets or borders.
williamr@2
   534
	IMPORT_C void Reset();  // full reset, deletes and nulls any allocated tabs, bullets or borders.
williamr@2
   535
	IMPORT_C void CopyL(const CParaFormat& aFormat, const TParaFormatMask& aMask);
williamr@2
   536
	IMPORT_C void CopyL(const CParaFormat& aFormat);
williamr@2
   537
	IMPORT_C void Strip();  // Cleans up this paragraph format.
williamr@2
   538
	IMPORT_C TBool IsEqual(const CParaFormat& aFormat, const TParaFormatMask& aMask) const;
williamr@2
   539
	IMPORT_C TBool IsEqual(const CParaFormat& aFormat) const;
williamr@2
   540
	IMPORT_C void StoreTabL(const TTabStop& aTabStop);
williamr@2
   541
	IMPORT_C void RemoveTab(TInt aTabTwipsPosition);
williamr@2
   542
	inline void RemoveAllTabs();
williamr@2
   543
	IMPORT_C const TTabStop TabStop(TInt aTabIndex) const;
williamr@2
   544
	inline TInt TabCount() const;
williamr@2
   545
	IMPORT_C TInt LocateTab(TInt aTabTwipsPosition) const;
williamr@2
   546
	IMPORT_C void SetParaBorderL(TParaBorderSide aSide, const TParaBorder& aBorder);  // Overwrites any existing border for that side
williamr@2
   547
	IMPORT_C void RemoveAllBorders();
williamr@2
   548
	IMPORT_C const TParaBorder ParaBorder(TParaBorderSide aSide) const;
williamr@2
   549
williamr@2
   550
	/** Tests whether any paragraph borders have been set.
williamr@2
   551
	
williamr@2
   552
	@return ETrue if any paragraph borders have been set, EFalse if not. */
williamr@2
   553
	inline TBool BordersPresent() const { return iParaBorderArray != NULL;}
williamr@2
   554
	
williamr@2
   555
    inline TParaBorder* ParaBorderPtr(TParaBorderSide aSide)
williamr@2
   556
williamr@2
   557
	/** Gets a pointer to the paragraph border on the side specified. If no 
williamr@2
   558
	paragraph border array has been allocated, returns NULL.
williamr@2
   559
	
williamr@2
   560
	@param aSide The side for the paragraph border. 
williamr@2
   561
	@return Pointer to the paragraph border on the specified side. */
williamr@2
   562
		{ return iParaBorderArray ? &iParaBorderArray->iBorder[aSide] : NULL; }
williamr@2
   563
	IMPORT_C TBool AllBordersEqual(const CParaFormat& aFormat) const;
williamr@2
   564
	IMPORT_C TBool IsBorderEqual(TParaBorderSide aSide, const CParaFormat& aFormat) const;
williamr@2
   565
private:
williamr@2
   566
	CParaFormat(const CParaFormat& aFormat);
williamr@2
   567
	void CreateTabListL();
williamr@2
   568
	enum
williamr@2
   569
		{
williamr@2
   570
		ETabStoreGranularity = 2
williamr@2
   571
		};
williamr@2
   572
williamr@2
   573
	CParaFormat& operator=(const CParaFormat& aParaFormat);	// intentionally unimplemented
williamr@2
   574
private:
williamr@2
   575
	CArrayFixFlat<TTabStop>* iTabList;			// ordered list of tab stops; null if none
williamr@2
   576
	TParaBorderArray* iParaBorderArray;			// array of paragraph borders; null if none
williamr@2
   577
public:
williamr@2
   578
	/** The background colour of the paragraph. By default the default system 
williamr@2
   579
	background colour. This colour applies to the area bounded by the paragraph 
williamr@2
   580
	border, if one exists. */
williamr@2
   581
	TLogicalRgb iFillColor;
williamr@2
   582
	/** The language of the paragraph for proofing. By default 
williamr@2
   583
	KParaDefaultLanguage. Used for example when spell checking a document 
williamr@2
   584
	which contains text in more than one language, so that the program 
williamr@2
   585
	recognises the text as being in another language. */
williamr@2
   586
	TInt32 iLanguage;						
williamr@2
   587
	/** The width in twips of the leading margin (left for left-to-right
williamr@2
   588
	paragraphs, right for right-to-left paragraphs). By default
williamr@2
   589
	KParaDefaultLeftMargin (zero). */
williamr@2
   590
	TInt32 iLeftMarginInTwips;
williamr@2
   591
	/** The width in twips of the trailing margin (right for left-to-right
williamr@2
   592
	paragraphs, left for right-to-left paragraphs). By default
williamr@2
   593
	KParaDefaultRightMargin (zero). */
williamr@2
   594
	TInt32 iRightMarginInTwips;
williamr@2
   595
	/** An indent for the first line in the paragraph, relative to the leading
williamr@2
   596
	margin (left for left-to-right paragraphs, right for right-to-left
williamr@2
   597
	paragraphs). By default KParaDefaultIndent (zero). */
williamr@2
   598
	TInt32 iIndentInTwips;
williamr@2
   599
	/** Horizontal alignment of paragraph. By default KParaDefaultHorizAlign 
williamr@2
   600
	(left). */
williamr@2
   601
	TAlignment iHorizontalAlignment;
williamr@2
   602
	/** Vertical alignment of paragraph, (intended for use by spreadsheet 
williamr@2
   603
	applications). 	By default KParaDefaultVertAlign (unspecified). */
williamr@2
   604
	TAlignment iVerticalAlignment;
williamr@2
   605
	/** Inter-line spacing within the paragraph, in twips. By default 
williamr@2
   606
	KParaDefaultLineSpacing (200 twips). */
williamr@2
   607
	TInt32 iLineSpacingInTwips;	// distance between successive baselines
williamr@2
   608
	/** Control for the iLineSpacingInTwips value. By default, 
williamr@2
   609
	KParaDefaultLineSpacingControl 	(ELineSpacingAtLeastInTwips). */
williamr@2
   610
	TLineSpacingControl iLineSpacingControl;	// whether iLineSpacingInTwips means 'at least' or 'exactly'
williamr@2
   611
	/** Space above paragraph. By default KParaDefaultSpaceBefore (zero). */
williamr@2
   612
	TInt32 iSpaceBeforeInTwips;	
williamr@2
   613
	/** Space below paragraph. By default KParaDefaultSpaceAfter (zero). */
williamr@2
   614
	TInt32 iSpaceAfterInTwips;	
williamr@2
   615
	/** Prevents a page break within paragraph if ETrue. By default 
williamr@2
   616
	KParaDefaultKeepTogether (EFalse). */
williamr@2
   617
	TBool iKeepTogether;	
williamr@2
   618
	/** Prevents a page break between this paragraph and the following 
williamr@2
   619
	paragraph if ETrue. By default, KParaDefaultKeepWithNext (EFalse). */
williamr@2
   620
	TBool iKeepWithNext;	
williamr@2
   621
	/** Inserts a page break immediately before this paragraph if ETrue. 
williamr@2
   622
	By default, KParaDefaultStartNewPage (EFalse). */
williamr@2
   623
	TBool iStartNewPage;		
williamr@2
   624
	/** Prevents the printing of the last line of a paragraph at the top 
williamr@2
   625
	of the page (referred to as a widow), or the first line of a paragraph 
williamr@2
   626
	at the bottom of the page, (referred to as an orphan). By default, 
williamr@2
   627
	KParaDefaultWidowOrphan (EFalse). */
williamr@2
   628
	TBool iWidowOrphan;	
williamr@2
   629
	/** Specifies whether the paragraph should line wrap at the right margin. 
williamr@2
   630
	By default KParaDefaultWrap (ETrue). */
williamr@2
   631
	TBool iWrap;
williamr@2
   632
	/** Distance in twips between the paragraph border and the enclosed text. 
williamr@2
   633
	By default KParaDefaultBorderMargin (zero). */
williamr@2
   634
	TInt32 iBorderMarginInTwips;	
williamr@2
   635
	/** The bullet point associated with the paragraph. A NULL value indicates 
williamr@2
   636
	no bullet point. By default NULL. */
williamr@2
   637
	TBullet* iBullet;		
williamr@2
   638
	/** Specifies the default tab stop width. By default KParaDefaultTabWidth 
williamr@2
   639
	(360 twips). */
williamr@2
   640
	TUint32 iDefaultTabWidthInTwips;
williamr@2
   641
	};
williamr@2
   642
williamr@2
   643
/** 
williamr@2
   644
Masks the paragraph format attributes which are involved when setting and 
williamr@2
   645
sensing paragraph formatting. 
williamr@2
   646
williamr@2
   647
Used in conjunction with an object of class CParaFormat. When setting formatting, 
williamr@2
   648
only the attributes which are set in the mask will participate in the relevant 
williamr@2
   649
function. When sensing formatting, on return, the mask indicates which attributes 
williamr@2
   650
were sensed from the format layer, and were not taken from the default values. 
williamr@2
   651
@publishedAll
williamr@2
   652
@released
williamr@2
   653
*/
williamr@2
   654
class TParaFormatMask
williamr@2
   655
	{
williamr@2
   656
public:
williamr@2
   657
	inline TParaFormatMask();
williamr@2
   658
	inline void SetAttrib(TTextFormatAttribute aAttribute);
williamr@2
   659
	inline void ClearAttrib(TTextFormatAttribute aAttribute);
williamr@2
   660
	IMPORT_C void SetAll();
williamr@2
   661
	IMPORT_C void ClearAll();
williamr@2
   662
	inline TBool AttribIsSet(TTextFormatAttribute aAttribute) const;
williamr@2
   663
	inline TBool IsNull() const;
williamr@2
   664
	IMPORT_C TBool operator==(const TParaFormatMask& aMask) const;
williamr@2
   665
	inline TBool operator!=(const TParaFormatMask& aMask) const;
williamr@2
   666
williamr@2
   667
private:
williamr@2
   668
	TUint32 iGuard;
williamr@2
   669
	};
williamr@2
   670
williamr@2
   671
/** 
williamr@2
   672
Specifies the font-independent character format attributes, including bold, 
williamr@2
   673
italics and underlining.
williamr@2
   674
williamr@2
   675
An instance of this class is owned by the character formatting container (class 
williamr@2
   676
TCharFormat). 
williamr@2
   677
@publishedAll
williamr@2
   678
@released
williamr@2
   679
*/
williamr@2
   680
class TFontPresentation
williamr@2
   681
	{
williamr@2
   682
public:
williamr@2
   683
		
williamr@2
   684
	/** Highlight style */
williamr@2
   685
	enum TFontHighlightStyle
williamr@2
   686
		{
williamr@2
   687
		/** No highlighting used. */
williamr@2
   688
		EFontHighlightNone,
williamr@2
   689
		/** Normal (square cornered) highlighting used. */
williamr@2
   690
		EFontHighlightNormal,
williamr@2
   691
		/** Rounded corner highlighting used. */
williamr@2
   692
		EFontHighlightRounded,
williamr@2
   693
		/** Text is drawn offset towards the bottom-right in the highlight 
williamr@2
   694
		colour, (iHighlightColor) before being drawn again in the text colour, 
williamr@2
   695
		(iTextColor) creating a shadow effect. */
williamr@2
   696
		EFontHighlightShadow,
williamr@2
   697
		/** Placeholder for "unrecognised word" highlighting style for FEPs */
williamr@2
   698
		EFontHighlightNoMatchesIndicator,
williamr@2
   699
		/** First custom highlighting style is used.
williamr@2
   700
		@see MFormCustomDraw::DrawText(). */
williamr@2
   701
		EFontHighlightFirstCustomStyle = 128,
williamr@2
   702
		/** Second custom highlighting style is used. 
williamr@2
   703
		@see MFormCustomDraw::DrawText(). */
williamr@2
   704
		EFontHighlightLastCustomStyle = 255
williamr@2
   705
		};
williamr@2
   706
	
williamr@2
   707
	
williamr@2
   708
	/** Vertical picture alignment */
williamr@2
   709
	enum TAlignment
williamr@2
   710
		{
williamr@2
   711
		/** The top of the picture is aligned flush with the top of the font's 
williamr@2
   712
		ascent, so that the picture may descend below the line. */
williamr@2
   713
		EAlignTop,
williamr@2
   714
		/** The bottom of the picture is aligned flush with the bottom of the 
williamr@2
   715
		font's descent so that the picture may extend above the line. */
williamr@2
   716
		EAlignBottom,
williamr@2
   717
		/** The picture is aligned so that its centre is positioned at the 
williamr@2
   718
		baseline of the line. */
williamr@2
   719
		EAlignCentered,
williamr@2
   720
		/** The bottom of the picture is aligned with the baseline of the font.
williamr@2
   721
		This is the default. */
williamr@2
   722
		EAlignBaseLine
williamr@2
   723
		};
williamr@2
   724
	//
williamr@2
   725
	IMPORT_C TFontPresentation();
williamr@2
   726
	//
williamr@2
   727
	// Enquiry function
williamr@2
   728
	IMPORT_C TBool IsEqual(const TFontPresentation& aFontPresentation, const TCharFormatMask& aMask) const;
williamr@2
   729
public:
williamr@2
   730
	/** The text colour. By default, the default system foreground colour. */
williamr@2
   731
	TLogicalRgb iTextColor;
williamr@2
   732
	/** The highlight colour for selected text. Only takes effect if 
williamr@2
   733
	iHighlightStyle is not EFontHighlightNone. By default, the default system 
williamr@2
   734
	foreground colour. */
williamr@2
   735
	TLogicalRgb iHighlightColor;  // Background color
williamr@2
   736
	/** Style for character highlighting. By default EFontHighlightNone. */
williamr@2
   737
	TFontHighlightStyle iHighlightStyle;
williamr@2
   738
	/** The value of the strikethrough attribute. By default EStrikethroughOff. */
williamr@2
   739
	TFontStrikethrough iStrikethrough;
williamr@2
   740
	/** The value of the underline attribute. By default EUnderlineOff. */
williamr@2
   741
	TFontUnderline iUnderline;
williamr@2
   742
	/** Specifies whether or not text is hidden. Note that hidden text is not 
williamr@2
   743
	currently supported by the text layout engine. This attribute is provided 
williamr@2
   744
	to preserve information when copying from and to devices which support 
williamr@2
   745
	hidden text. By default EFalse. */
williamr@2
   746
	TBool iHiddenText;
williamr@2
   747
	/** The vertical alignment of a picture character. By default 
williamr@2
   748
	EAlignBaseLine. */
williamr@2
   749
	TAlignment iPictureAlignment;
williamr@2
   750
	};
williamr@2
   751
williamr@2
   752
/** 
williamr@2
   753
A transient container of character format attributes, including 
williamr@2
   754
font-dependent and font-independent attributes. 
williamr@2
   755
williamr@2
   756
The font-independent attributes are stored in a TFontPresentation object. 
williamr@2
   757
Rich and global text objects store character formatting using character format 
williamr@2
   758
layers (see class CCharFormatLayer). The TCharFormat class is used to store 
williamr@2
   759
the relevant attribute values when setting or sensing a CCharFormatLayer. 
williamr@2
   760
It is normally used in combination with a TCharFormatMask, to specify which 
williamr@2
   761
attributes are relevant to the function concerned. 
williamr@2
   762
@publishedAll
williamr@2
   763
@released
williamr@2
   764
*/
williamr@2
   765
class TCharFormat
williamr@2
   766
	{
williamr@2
   767
public:
williamr@2
   768
	IMPORT_C TCharFormat();
williamr@2
   769
	IMPORT_C TCharFormat(const TDesC &aTypefaceName, TInt aHeight);
williamr@2
   770
	//
williamr@2
   771
	// Enquiry functions
williamr@2
   772
	IMPORT_C TBool IsEqual(const TCharFormat& aFormat, const TCharFormatMask& aMask) const;
williamr@2
   773
	IMPORT_C TBool IsEqual(const TCharFormat& aFormat) const;
williamr@2
   774
public:
williamr@2
   775
	/** Specifies the language of individual characters for proofing. Used for 
williamr@2
   776
	example when spell checking a document which contains text in more than one 
williamr@2
   777
	language, so that the program recognises the text as being in another 
williamr@2
   778
	language. Language is also a paragraph format attribute. If the language 
williamr@2
   779
	setting of a character is different from the language setting of the 
williamr@2
   780
	containing paragraph, the character's setting takes precedence. */
williamr@2
   781
	TInt32 iLanguage;
williamr@2
   782
	/** Font independent character format attributes. */
williamr@2
   783
	TFontPresentation iFontPresentation; 
williamr@2
   784
	/** Device independent font specification. */
williamr@2
   785
	TFontSpec iFontSpec;  
williamr@2
   786
	};
williamr@2
   787
williamr@2
   788
/** 
williamr@2
   789
Masks the character format attributes which are involved when setting and 
williamr@2
   790
sensing character formatting.
williamr@2
   791
williamr@2
   792
Used in conjunction with an object of class TCharFormat.
williamr@2
   793
williamr@2
   794
When setting formatting, only the attributes which are set in the mask should 
williamr@2
   795
participate in the relevant function. When sensing formatting, on return, 
williamr@2
   796
the mask indicates which attributes were sensed from the format layer, and 
williamr@2
   797
were not taken from the default values. 
williamr@2
   798
@publishedAll
williamr@2
   799
@released
williamr@2
   800
*/
williamr@2
   801
class TCharFormatMask
williamr@2
   802
	{
williamr@2
   803
public:
williamr@2
   804
	inline TCharFormatMask();
williamr@2
   805
	inline void SetAttrib(TTextFormatAttribute aAttribute);
williamr@2
   806
	inline void ClearAttrib(TTextFormatAttribute aAttribute);
williamr@2
   807
	inline TBool AttribIsSet(TTextFormatAttribute aAttribute) const;
williamr@2
   808
	IMPORT_C void SetAll();
williamr@2
   809
	IMPORT_C void ClearAll();
williamr@2
   810
	inline TBool IsNull()const;
williamr@2
   811
	IMPORT_C TBool operator==(const TCharFormatMask& aMask) const;
williamr@2
   812
	inline TBool operator!=(const TCharFormatMask& aMask) const;
williamr@2
   813
williamr@2
   814
private:
williamr@2
   815
	TUint32 iGuard;
williamr@2
   816
	};
williamr@2
   817
williamr@2
   818
#include <txtfrmat.inl>
williamr@2
   819
williamr@2
   820
#endif