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()
Public Member Functions
IMPORT_C TBoolGetLineBreakInContext(const TDesC &, TInt, TInt, TBool, TInt &)
IMPORT_C TBoolIsHangingCharacter(TUint)
IMPORT_C TUintLineBreakClass(TUint, TUint &, TUint &)
IMPORT_C TBoolLineBreakPossible(TUint, TUint, TBool)
Private Member Functions
IMPORT_C voidMFormCustomWrap_Reserved_1()
IMPORT_C voidMFormCustomWrap_Reserved_2()

Member Functions Documentation

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

IMPORT_C TBoolGetLineBreakInContext(const TDesC &aText,
TIntaMinBreakPos,
TIntaMaxBreakPos,
TBoolaForwards,
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 & aTextA string containing characters of class ESaLineBreakClass.
TInt aMinBreakPosA position within aText at which to begin searching for a possible line break position.
TInt aMaxBreakPosA position within aText at which to stop searching for a possible line break position.
TBool aForwardsIf 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 & aBreakPosOn 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 TBoolIsHangingCharacter(TUintaChar)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 aCharThe Unicode character code of interest.

LineBreakClass(TUint, TUint &, TUint &)

IMPORT_C TUintLineBreakClass(TUintaCode,
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 aCodeThe Unicode character code of interest.
TUint & aRangeStartOn return, contains the Unicode character code at the start of the range including aCode that shares the same line break class as aCode.
TUint & aRangeEndOn 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 TBoolLineBreakPossible(TUintaPrevClass,
TUintaNextClass,
TBoolaHaveSpaces
)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 aPrevClassThe line break class of the previous non-space character.
TUint aNextClassThe line break class of the next non-space character.
TBool aHaveSpacesETrue 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 voidMFormCustomWrap_Reserved_1()[private, virtual]

MFormCustomWrap_Reserved_2()

IMPORT_C voidMFormCustomWrap_Reserved_2()[private, virtual]