#include <frmtlay.h>
class MFormCustomWrap |
Public Member Functions | |
---|---|
virtual IMPORT_C TBool | GetLineBreakInContext(const TDesC &, TInt, TInt, TBool, TInt &) |
virtual IMPORT_C TBool | IsHangingCharacter(TUint) |
virtual IMPORT_C TUint | LineBreakClass(TUint, TUint &, TUint &) |
virtual IMPORT_C TBool | LineBreakPossible(TUint, TUint, TBool) |
An interface class that can be derived from to implement custom line breaking.
Custom line breaking allows the Text Views line wrapping algorithm to break lines in any way. For instance, it may be used to avoid the jagged white space at the right edge of text windows caused by normal line wrapping on a small screen.
See also: CTextLayout::SetCustomWrap()
IMPORT_C TBool | GetLineBreakInContext | ( | const TDesC & | aText, |
TInt | aMinBreakPos, | |||
TInt | aMaxBreakPos, | |||
TBool | aForwards, | |||
TInt & | aBreakPos | |||
) | const [virtual] |
Gets the position of the first or last possible line break position in a text string.
This function is called instead of LineBreakPossible() for runs of characters of class ESaLineBreakClass. It is used for South Asian languages like Thai, Lao and Khmer that have no spaces between words, so that line breaks must be calculated using dictionary lookup or a linguistic algorithm.
The default implementation of this function just returns false.
Parameters | |
---|---|
aText | A string containing characters of class ESaLineBreakClass. |
aMinBreakPos | A position within aText at which to begin searching for a possible line break position. |
aMaxBreakPos | A position within aText at which to stop searching for a possible line break position. |
aForwards | If ETrue, the function gets the first possible line break position (searches forwards from aMinBreakPos); if EFalse, gets the last one (searches backwards from aMaxBreakPos). |
aBreakPos | On return, the position of the first or last possible line break within aText. This must be greater than zero and less than aText.Length()1, and must also be in the range aMinBreakPos to aMaxBreakPos. |
Tests whether a character can overhang the right margin.
This function can be overridden to customise the line breaking behaviour for closing punctuation in Japanese. Any characters for which this function returns ETrue are allowed to overhang the right margin. The rest will be moved to the next line.
The default implementation of this function just returns false.
Parameters | |
---|---|
aChar | The Unicode character code of interest. |
Returns the line break class for a Unicode character.
For convenience, it also gets the range of consecutive characters (if any) according to the Unicode standard, including aCode, that share the same line break class.
The Unicode line break classes are enumerated in class MTmCustom.
Each character's line break class is obtained using LineBreakClass(). To find out whether a line break is allowed between two adjacent characters, call LineBreakPossible() with the line break classes of the two characters as arguments. For example, the line break class EClLineBreakClass (closing punctuation) applies to characters such as ")", "]" and ";". Line breaks are typically allowed after these characters, but not before, so a call to LineBreakPossible() with the arguments (EAlLineBreakClass, EClLineBreakClass) would return EFalse in the default implementation, but a call with (EClLineBreakClass, EAlLineBreakClass) would return ETrue.
Parameters | |
---|---|
aCode | The Unicode character code of interest. |
aRangeStart | On return, contains the Unicode character code at the start of the range including aCode that shares the same line break class as aCode. |
aRangeEnd | On return, contains the Unicode character code at the end of the range including aCode that shares the same line break class as aCode. |
Tests whether a line break is possible between two characters.
If aHaveSpaces is true, the characters are not adjacent one or more space characters (with a line break class of ESpLineBreakClass) occur between them.
The aPrevClass and aNextClass arguments never have the value ESpLineBreakClass. Instead, this function is called with the classes of the characters on either side of the space or run of spaces, (and if so, aHaveSpaces is true). This is so that line breaks can be prohibited between certain characters with intervening spaces, for instance an alphabetic character (EAlLineBreakClass, such as 'a') and a closing bracket, with a space inbetween.
Additionally, the arguments to this function never have a value of ESaLineBreakClass. For such characters, GetLineBreakInContext() is called instead.
Parameters | |
---|---|
aPrevClass | The line break class of the previous non-space character. |
aNextClass | The line break class of the next non-space character. |
aHaveSpaces | ETrue if there are one or more space characters (with a line break class of ESpLineBreakClass) between aPrevClass and aNextClass. EFalse if not. |