Update contrib.
2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef TCUSTOMWRAP_H_
22 #include <linebreak.h>
24 // ------------ TTestCustomWrap ---------
27 * A custom wrapping class that allows line breaks anywhere, but allows (Latin)
28 * commas, full-stops and closing brackets to "wrap-up" to the previous line.
30 class TTestCustomWrap : public MFormCustomWrap
32 // All characters are given the same class. It does not matter which it is
33 // as long as it is not ESpLineBreakClass. Spaces must not be treated
34 // differently from other characters.
35 TUint LineBreakClass(TUint /*aCode*/,TUint& aRangeStart,TUint& aRangeEnd) const
37 // All characters have the same class..
40 // ..this class is Ideographic
41 return MTmCustom::EIdLineBreakClass;
43 TBool LineBreakPossible(TUint /*aPrevClass*/,
44 TUint /*aNextClass*/, TBool /*aHaveSpaces*/) const
46 // Line breaking allowed between any class of characters.
47 // In practice they will all be EIdLineBreakClass, because we have
48 // fixed it so that they will be.
51 TBool IsHangingCharacter(TUint aChar) const
53 // Allow commas, full stops and closing brackets to hang over the
54 // margins. In practice, ideographic commas, full-stops and brackets
55 // should be allowed as well as many other types of closing punctuation.
56 if (aChar == ',' || aChar == '.' || aChar == ')')
63 * A custom wrapping class that allows line breaks between alphabetic and
66 class TTestCustomWrap2 : public MFormCustomWrap
69 TBool LineBreakPossible(TUint aPrevClass,
70 TUint aNextClass, TBool aHaveSpaces) const
73 breakAllowed = MFormCustomWrap::LineBreakPossible(aPrevClass,aNextClass,aHaveSpaces);
77 //Specifically allow breaking between alphabetic and break after
78 //classes (e.g. Tab character)
79 breakAllowed = ((aPrevClass == MLineBreaker::EAlLineBreakClass)
80 && (aNextClass == MLineBreaker::EBaLineBreakClass));
89 * A custom wrapping class that allows line breaks between alphabetic and
90 * break after classes, but allows (Latin) commas, full-stops,
91 * closing brackets and tabs to "wrap-up" to the previous line.
93 class TTestCustomWrap3 : public MFormCustomWrap
96 TBool LineBreakPossible(TUint aPrevClass,
97 TUint aNextClass, TBool aHaveSpaces) const
101 breakAllowed = MFormCustomWrap::LineBreakPossible(aPrevClass,aNextClass,aHaveSpaces);
105 //Specifically allow breaking between alphabetic and break after
106 //classes (e.g. Tab character)
107 breakAllowed = ((aPrevClass == MLineBreaker::EAlLineBreakClass)
108 && (aNextClass == MLineBreaker::EBaLineBreakClass));
114 TBool IsHangingCharacter(TUint aChar) const
116 // Allow commas, full stops, closing brackets and tabs to hang over the
117 // margins. In practice, ideographic commas, full-stops and brackets
118 // should be allowed as well as many other types of closing punctuation.
119 if (aChar == ',' || aChar == '.' || aChar == ')' || aChar == '\t')
126 * A custom wrapping class that sets tabs as space breaking characters
128 class TTestCustomWrap4 : public MFormCustomWrap
130 TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const
134 //Set tabs to be space breaking class
137 breakClass = MLineBreaker::ESpLineBreakClass;
141 breakClass = MFormCustomWrap::LineBreakClass(aCode,aRangeStart, aRangeEnd);