Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 class MContingentLineBreaker;
21 class MContingentLineBreakerL;
27 This enumeration holds the possible panic codes that may be raised
28 by the LineBreak API on detecting an unrecoverable error.
35 ELineBreakPanic_Unknown = 0,
36 /** Internal error, error found in data table */
37 ELineBreakPanic_BadTable = 1,
38 /** One or more of the input parameters to the interface were invalid */
39 ELineBreakPanic_InvalidInputParam = 2,
40 /** Raised when an output parameter breaks an API condition */
41 ELineBreakPanic_InvalidOutputParam = 3,
48 Customizes the Unicode line-breaking algorithm.
54 /** The Unicode line breaking classes; see Unicode Technical Report 14.
55 Not a named enumerated type, so that overriding classes may add new
56 line breaking classes freely.
57 The description of each constant gives the name of the line-breaking
58 class, an example and a brief, imprecise description of the default
59 behaviour of characters of that class. */
62 /** Opening Punctuation (e.g. '['). Breaking after prohibited. */
64 /** Closing Punctuation (e.g. ']'). Breaking before prohibited. */
66 /** Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited. */
68 /** Glue (e.g. Non-breaking space). Breaking before and after prohibited
69 unless spaces are present. */
71 /** Non-Starter (e.g. small Japanese kana). Breaking before prohibited
72 if no spaces present. */
74 /** Exclamation or Interrogation (e.g. '?'). Like closing punctuation
75 except before Postfix or Non-starter. */
77 /** Symbol (e.g. '/'. Like Alphabetic, but allows breaking before
80 /** Numeric Infix Separator (e.g. ','). Forbids breaking after any and before
83 /** Numeric Prefix (e.g. '$'). Forbids breaking before Numeric. */
85 /** Numeric Postfix (e.g. '%'). Forbids breaking after Numeric. */
87 /** Numeric (e.g. '1'). */
89 /** Alphabetic (e.g. 'a'). */
91 /** Ideographic (e.g. Japanese Kanji). Generally break before or after */
93 /** Inseparable (e.g. ellipsis). Forbid breaks between Inseparables. */
95 /** Hyphen (e.g. '-'). Allows a break after except before Numeric. */
97 /** Break After. Generally allow a break after. Breaking between Break
98 Afters not separated by spaces is prohibited. */
100 /** Break Before. Generally allow a break before. Breaking between Break
101 Befores not separated by spaces is prohibited. */
103 /** Break Before and After. Generally allow a break before or after.
104 Breaking between Break Before and Afters is prohibited, even if spaces
107 /** Zero-Width Space. Allow a break. */
109 /** Combining Mark. Takes on the class of its base class. */
111 /** Mandatory Break. */
113 /** Carriage Return. Break after unless part of a CRLF pair. */
115 /** Line Feed. Break after. */
117 /** Surrogate. Half of a surrogate pair. */
119 /** Contingent Break (e.g. embedded pictures). Uses external
123 /** Space. Intervening characters of class Space are indicated by
124 aHaveSpaces in LineBreakPossible. */
127 /** Complex Context (e.g. Thai). Runs of Complex Context are passed to
128 GetLineBreakInContext. */
131 /** Ambiguous. Characters of ambiguous East Asian width are treated
132 as Alphabetic, unless they are resolved as being "Wide", in which case
133 they are treated as Ideographic. */
136 /** The Xx class is used when the class is unknown; e.g.; outside the provided context. */
139 /** The number of Unicode line break classes. */
143 IMPORT_C virtual TUint LineBreakClass(TUint aCode,
144 TUint& aRangeStart, TUint& aRangeEnd) const;
145 IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass, TUint aNextClass,
146 TBool aHaveSpaces) const;
147 IMPORT_C virtual TBool GetLineBreakInContext(const TDesC16& aText,
148 TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
149 TInt& aBreakPos) const;
150 IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
151 IMPORT_C TBool GetLineBreak(const TDesC16& aText,
152 TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
153 MContingentLineBreaker* aCbDelegate,
154 TInt& aBreakPos, TInt& aBreakPosAfterSpaces) const;
155 IMPORT_C TBool GetLineBreakL(const TDesC16& aText,
156 TInt aMinBreakPos, TInt aMaxBreakPos, TBool aForwards,
157 MContingentLineBreakerL* aCbDelegate,
158 TInt& aBreakPos, TInt& aBreakPosAfterSpaces) const;
159 IMPORT_C virtual void* ExtendedInterface(TUid& aUid) const;
163 class MContingentLineBreaker
165 Used to determine the line breaks around pictures and other characters with
166 the CB (contingent line break) class in situations where this operation cannot
173 /** Determines if a break is legal before the picture at aTextPosition.
175 @param aTextPosition The position of a character of line breaking class ECbLineBreakClass
176 in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to
178 @param aPrecedingClass The class of the character preceding aTextPosition.
179 @param aHasSpaces ETrue if spaces separate the preceding class from this.
180 @return ETrue if a line break is legal here. */
181 virtual TBool IsLegalBreakBefore(TInt aTextPosition, TInt aPrecedingClass,
182 TBool aHasSpaces) = 0;
183 /** Determines if a break is legal after the picture at aTextPosition.
185 @param aTextPosition The position of a character of line breaking class ECbLineBreakClass
186 in the text as supplied to MLineBreaker::GetLineBreak, which may refer to
188 @param aFollowingClass The class of the character immediately following aTextPosition.
189 @param aHasSpaces ETrue if spaces separate the following class from this.
190 @return ETrue if a line break is legal here. */
191 virtual TBool IsLegalBreakAfter(TInt aTextPosition, TInt aFollowingClass,
192 TBool aHasSpaces) = 0;
197 class MContingentLineBreakerL
199 Used to determine the line breaks around pictures and other characters with
200 the CB (contingent line break) class in situations where this operation may
207 /** Determines if a break is legal before the picture at aTextPosition.
209 @param aTextPosition The position of a character of line breaking class ECbLineBreakClass
210 in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to
212 @param aPrecedingClass The class of the character preceding aTextPosition.
213 @param aHasSpaces ETrue if spaces separate the preceding class from this.
214 @return ETrue if a line break is legal here. */
215 virtual TBool IsLegalBreakBeforeL(TInt aTextPosition, TInt aPrecedingClass,
216 TBool aHasSpaces) = 0;
217 /** Determines if a break is legal after the picture at aTextPosition.
219 @param aTextPosition The position of a character of line breaking class ECbLineBreakClass
220 in the text as supplied to MLineBreaker::GetLineBreak(), which may refer to
222 @param aFollowingClass The class of the character immediately following aTextPosition.
223 @param aHasSpaces ETrue if spaces separate the preceding class from this.
224 @return ETrue if a line break is legal here. */
225 virtual TBool IsLegalBreakAfterL(TInt aTextPosition, TInt aFollowingClass,
226 TBool aHasSpaces) = 0;