epoc32/include/linebreak.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 2002-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@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.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 LINEBREAK_H_
williamr@2
    17
#define LINEBREAK_H_
williamr@2
    18
williamr@2
    19
#include <e32def.h>
williamr@2
    20
class MContingentLineBreaker;
williamr@2
    21
class MContingentLineBreakerL;
williamr@2
    22
class TDesC16;
williamr@2
    23
class TUid;
williamr@2
    24
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
 This enumeration holds the possible panic codes that may be raised
williamr@2
    28
 by the LineBreak API on detecting an unrecoverable error.
williamr@2
    29
@publishedAll
williamr@2
    30
@released
williamr@2
    31
*/
williamr@2
    32
enum TLineBreakPanic
williamr@2
    33
	{
williamr@2
    34
	/** Not used */
williamr@2
    35
	ELineBreakPanic_Unknown				= 0,
williamr@2
    36
	/** Internal error, error found in data table */
williamr@2
    37
	ELineBreakPanic_BadTable			= 1,
williamr@2
    38
	/** One or more of the input parameters to the interface were invalid */
williamr@2
    39
	ELineBreakPanic_InvalidInputParam	= 2,
williamr@2
    40
	/** Raised when an output parameter breaks an API condition */
williamr@2
    41
	ELineBreakPanic_InvalidOutputParam	= 3,
williamr@2
    42
	};
williamr@2
    43
williamr@2
    44
williamr@2
    45
williamr@2
    46
class MLineBreaker
williamr@2
    47
/**
williamr@2
    48
Customizes the Unicode line-breaking algorithm. 
williamr@2
    49
@publishedAll
williamr@2
    50
@released
williamr@2
    51
*/
williamr@2
    52
	{
williamr@2
    53
public:
williamr@2
    54
	/** The Unicode line breaking classes; see Unicode Technical Report 14.
williamr@2
    55
	Not a named enumerated type, so that overriding classes may add new
williamr@2
    56
	line breaking classes freely.
williamr@2
    57
	The description of each constant gives the name of the line-breaking
williamr@2
    58
	class, an example and a brief, imprecise description of the default
williamr@2
    59
	behaviour of characters of that class.	 */
williamr@2
    60
	enum
williamr@2
    61
		{
williamr@2
    62
		/** Opening Punctuation (e.g. '['). Breaking after prohibited. */
williamr@2
    63
		EOpLineBreakClass,
williamr@2
    64
		/** Closing Punctuation (e.g. ']'). Breaking before prohibited. */
williamr@2
    65
		EClLineBreakClass,
williamr@2
    66
		/** Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited. */
williamr@2
    67
		EQuLineBreakClass,
williamr@2
    68
		/** Glue (e.g. Non-breaking space). Breaking before and after prohibited
williamr@2
    69
		unless spaces are present. */
williamr@2
    70
		EGlLineBreakClass,
williamr@2
    71
		/** Non-Starter (e.g. small Japanese kana). Breaking before prohibited
williamr@2
    72
		if no spaces present. */
williamr@2
    73
		ENsLineBreakClass,
williamr@2
    74
		/** Exclamation or Interrogation (e.g. '?'). Like closing punctuation
williamr@2
    75
		except before Postfix or Non-starter. */
williamr@2
    76
		EExLineBreakClass,
williamr@2
    77
		/** Symbol (e.g. '/'. Like Alphabetic, but allows breaking before
williamr@2
    78
		Alphabetic. */
williamr@2
    79
		ESyLineBreakClass,
williamr@2
    80
		/** Numeric Infix Separator (e.g. ','). Forbids breaking after any and before
williamr@2
    81
		Numeric. */
williamr@2
    82
		EIsLineBreakClass,
williamr@2
    83
		/** Numeric Prefix (e.g. '$'). Forbids breaking before Numeric. */
williamr@2
    84
		EPrLineBreakClass,
williamr@2
    85
		/** Numeric Postfix (e.g. '%'). Forbids breaking after Numeric. */
williamr@2
    86
		EPoLineBreakClass,
williamr@2
    87
		/** Numeric (e.g. '1'). */
williamr@2
    88
		ENuLineBreakClass,
williamr@2
    89
		/** Alphabetic (e.g. 'a'). */
williamr@2
    90
		EAlLineBreakClass,
williamr@2
    91
		/** Ideographic (e.g. Japanese Kanji). Generally break before or after */
williamr@2
    92
		EIdLineBreakClass,
williamr@2
    93
		/** Inseparable (e.g. ellipsis). Forbid breaks between Inseparables. */
williamr@2
    94
		EInLineBreakClass,
williamr@2
    95
		/** Hyphen (e.g. '-'). Allows a break after except before Numeric. */
williamr@2
    96
		EHyLineBreakClass,
williamr@2
    97
		/** Break After. Generally allow a break after. Breaking between Break
williamr@2
    98
		Afters not separated by spaces is prohibited. */
williamr@2
    99
		EBaLineBreakClass,
williamr@2
   100
		/** Break Before. Generally allow a break before. Breaking between Break
williamr@2
   101
		Befores not separated by spaces is prohibited. */
williamr@2
   102
		EBbLineBreakClass,
williamr@2
   103
		/** Break Before and After. Generally allow a break before or after.
williamr@2
   104
		Breaking between Break Before and Afters is prohibited, even if spaces
williamr@2
   105
		are present. */
williamr@2
   106
		EB2LineBreakClass,
williamr@2
   107
		/** Zero-Width Space. Allow a break. */
williamr@2
   108
		EZwLineBreakClass,
williamr@2
   109
		/** Combining Mark. Takes on the class of its base class. */
williamr@2
   110
		ECmLineBreakClass,
williamr@2
   111
		/** Mandatory Break. */
williamr@2
   112
		EBkLineBreakClass,
williamr@2
   113
		/** Carriage Return. Break after unless part of a CRLF pair. */
williamr@2
   114
		ECrLineBreakClass,
williamr@2
   115
		/** Line Feed. Break after. */
williamr@2
   116
		ELfLineBreakClass,
williamr@2
   117
		/** Surrogate. Half of a surrogate pair. */
williamr@2
   118
		ESgLineBreakClass,
williamr@2
   119
		/** Contingent Break (e.g. embedded pictures). Uses external
williamr@2
   120
		information */
williamr@2
   121
		ECbLineBreakClass,
williamr@2
   122
williamr@2
   123
		/** Space. Intervening characters of class Space are indicated by
williamr@2
   124
		aHaveSpaces in LineBreakPossible. */
williamr@2
   125
		ESpLineBreakClass, 
williamr@2
   126
williamr@2
   127
		/** Complex Context (e.g. Thai). Runs of Complex Context are passed to
williamr@2
   128
		GetLineBreakInContext. */
williamr@2
   129
		ESaLineBreakClass,
williamr@2
   130
williamr@2
   131
		/** Ambiguous. Characters of ambiguous East Asian width are treated
williamr@2
   132
		as Alphabetic, unless they are resolved as being "Wide", in which case
williamr@2
   133
		they are treated as Ideographic. */
williamr@2
   134
		EAiLineBreakClass,
williamr@2
   135
williamr@2
   136
		/** The Xx class is used when the class is unknown; e.g.; outside the provided context. */
williamr@2
   137
		EXxLineBreakClass,
williamr@2
   138
williamr@2
   139
		/** The number of Unicode line break classes. */
williamr@2
   140
		ELineBreakClasses
williamr@2
   141
		};
williamr@2
   142
williamr@2
   143
	IMPORT_C virtual TUint LineBreakClass(TUint aCode,
williamr@2
   144
		TUint& aRangeStart, TUint& aRangeEnd) const;
williamr@2
   145
	IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass, TUint aNextClass,
williamr@2
   146
		TBool aHaveSpaces) const;
williamr@2
   147
	IMPORT_C virtual TBool GetLineBreakInContext(const TDesC16& aText,
williamr@2
   148
		TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
williamr@2
   149
		TInt& aBreakPos) const;
williamr@2
   150
	IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
williamr@2
   151
	IMPORT_C TBool GetLineBreak(const TDesC16& aText,
williamr@2
   152
		TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
williamr@2
   153
		MContingentLineBreaker* aCbDelegate,
williamr@2
   154
		TInt& aBreakPos, TInt& aBreakPosAfterSpaces) const;
williamr@2
   155
	IMPORT_C TBool GetLineBreakL(const TDesC16& aText,
williamr@2
   156
		TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
williamr@2
   157
		MContingentLineBreakerL* aCbDelegate,
williamr@2
   158
		TInt& aBreakPos, TInt& aBreakPosAfterSpaces) const;
williamr@2
   159
	IMPORT_C virtual void* ExtendedInterface(TUid& aUid) const;
williamr@2
   160
	};
williamr@2
   161
williamr@2
   162
williamr@2
   163
class MContingentLineBreaker
williamr@2
   164
/**
williamr@2
   165
Used to determine the line breaks around pictures and other characters with 
williamr@2
   166
the CB (contingent line break) class in situations where this operation cannot 
williamr@2
   167
leave. 
williamr@2
   168
@publishedAll
williamr@2
   169
@released
williamr@2
   170
*/
williamr@2
   171
	{
williamr@2
   172
public:
williamr@2
   173
	/** Determines if a break is legal before the picture at aTextPosition. 
williamr@2
   174
	
williamr@2
   175
	@param aTextPosition The position of a character of line breaking class ECbLineBreakClass 
williamr@2
   176
	in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to 
williamr@2
   177
	a picture.
williamr@2
   178
	@param aPrecedingClass The class of the character preceding aTextPosition.
williamr@2
   179
	@param aHasSpaces ETrue if spaces separate the preceding class from this.
williamr@2
   180
	@return ETrue if a line break is legal here. */
williamr@2
   181
	virtual TBool IsLegalBreakBefore(TInt aTextPosition, TInt aPrecedingClass,
williamr@2
   182
		TBool aHasSpaces) = 0;
williamr@2
   183
	/** Determines if a break is legal after the picture at aTextPosition. 
williamr@2
   184
	
williamr@2
   185
	@param aTextPosition The position of a character of line breaking class ECbLineBreakClass 
williamr@2
   186
	in the text as supplied to MLineBreaker::GetLineBreak, which may refer to 
williamr@2
   187
	a picture.
williamr@2
   188
	@param aFollowingClass The class of the character immediately following aTextPosition.
williamr@2
   189
	@param aHasSpaces ETrue if spaces separate the following class from this.
williamr@2
   190
	@return ETrue if a line break is legal here. */
williamr@2
   191
	virtual TBool IsLegalBreakAfter(TInt aTextPosition, TInt aFollowingClass,
williamr@2
   192
		TBool aHasSpaces) = 0;
williamr@2
   193
	};
williamr@2
   194
williamr@2
   195
williamr@2
   196
williamr@2
   197
class MContingentLineBreakerL
williamr@2
   198
/**
williamr@2
   199
Used to determine the line breaks around pictures and other characters with 
williamr@2
   200
the CB (contingent line break) class in situations where this operation may 
williamr@2
   201
leave. 
williamr@2
   202
@publishedAll
williamr@2
   203
@released
williamr@2
   204
*/
williamr@2
   205
	{
williamr@2
   206
public:
williamr@2
   207
	/** Determines if a break is legal before the picture at aTextPosition. 
williamr@2
   208
	
williamr@2
   209
	@param aTextPosition The position of a character of line breaking class ECbLineBreakClass 
williamr@2
   210
	in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to 
williamr@2
   211
	a picture.
williamr@2
   212
	@param aPrecedingClass The class of the character preceding aTextPosition.
williamr@2
   213
	@param aHasSpaces ETrue if spaces separate the preceding class from this.
williamr@2
   214
	@return ETrue if a line break is legal here. */
williamr@2
   215
	virtual TBool IsLegalBreakBeforeL(TInt aTextPosition, TInt aPrecedingClass,
williamr@2
   216
		TBool aHasSpaces) = 0;
williamr@2
   217
	/** Determines if a break is legal after the picture at aTextPosition. 
williamr@2
   218
	
williamr@2
   219
	@param aTextPosition The position of a character of line breaking class ECbLineBreakClass 
williamr@2
   220
	in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to 
williamr@2
   221
	a picture.
williamr@2
   222
	@param aFollowingClass The class of the character immediately following aTextPosition.
williamr@2
   223
	@param aHasSpaces ETrue if spaces separate the preceding class from this.
williamr@2
   224
	@return ETrue if a line break is legal here. */
williamr@2
   225
	virtual TBool IsLegalBreakAfterL(TInt aTextPosition, TInt aFollowingClass,
williamr@2
   226
		TBool aHasSpaces) = 0;
williamr@2
   227
	};
williamr@2
   228
williamr@2
   229
#endif