MFormCustomWrap Class Reference

class MFormCustomWrap

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.

All of these functions have a default implementation. To change the default behaviour, a pointer to an object that overrides any or all of the functions in the interface needs to be passed to the function CTextLayout::SetCustomWrap() .
Since
6.2
CTextLayout::SetCustomWrap()

Member Functions Documentation

GetLineBreakInContext(const TDesC &, TInt, TInt, TBool, TInt &)

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

const TDesC & aText A string containing characters of class ESaLineBreakClass.
TInt aMinBreakPos A position within aText at which to begin searching for a possible line break position.
TInt aMaxBreakPos A position within aText at which to stop searching for a possible line break position.
TBool 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).
TInt & 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.

IsHangingCharacter(TUint)

IMPORT_C TBool IsHangingCharacter ( TUint aChar ) const [virtual]

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

TUint aChar The Unicode character code of interest.

LineBreakClass(TUint, TUint &, TUint &)

IMPORT_C TUint LineBreakClass ( TUint aCode,
TUint & aRangeStart,
TUint & aRangeEnd
) const [virtual]

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

TUint aCode The Unicode character code of interest.
TUint & 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.
TUint & 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.

LineBreakPossible(TUint, TUint, TBool)

IMPORT_C TBool LineBreakPossible ( TUint aPrevClass,
TUint aNextClass,
TBool aHaveSpaces
) const [virtual]

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

TUint aPrevClass The line break class of the previous non-space character.
TUint aNextClass The line break class of the next non-space character.
TBool aHaveSpaces ETrue if there are one or more space characters (with a line break class of ESpLineBreakClass) between aPrevClass and aNextClass. EFalse if not.

MFormCustomWrap_Reserved_1()

IMPORT_C void MFormCustomWrap_Reserved_1 ( ) [private, virtual]

MFormCustomWrap_Reserved_2()

IMPORT_C void MFormCustomWrap_Reserved_2 ( ) [private, virtual]