|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: smiely engine class |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "smileymanager.h" |
|
19 #include "smileycustomwrap.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 // --------------------------------------------------------------------------- |
|
23 // CSmileyCustomWrap::CSmileyCustomWrap |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 CSmileyCustomWrap::CSmileyCustomWrap() |
|
27 { |
|
28 } |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // CSmileyCustomWrap::CSmileyCustomWrap |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CSmileyCustomWrap::~CSmileyCustomWrap() |
|
35 { |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // CSmileyCustomWrap::LineBreakClass |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 TUint CSmileyCustomWrap::LineBreakClass( TUint aCode, TUint& aRangeStart, |
|
43 TUint& aRangeEnd) const |
|
44 { |
|
45 TUint breakClass( iAvkonCustomWrap.LineBreakClass( aCode, aRangeStart, |
|
46 aRangeEnd ) ); |
|
47 CSmileyCustomWrap* customWrap( const_cast<CSmileyCustomWrap*>( this ) ); |
|
48 if ( CSmileyManager::IsSmileyCode( aCode ) ) |
|
49 { |
|
50 breakClass = MTmCustom::EOpLineBreakClass; |
|
51 customWrap->iPrevCodeIsSmiley = !iPlaceHolder; |
|
52 customWrap->iPlaceHolder = EFalse; |
|
53 } |
|
54 else if ( ( iPrevCodeIsSmiley || iPlaceHolder ) && aCode == CSmileyManager::KCompensateChar ) |
|
55 { |
|
56 breakClass = MTmCustom::EClLineBreakClass; |
|
57 customWrap->iPrevCodeIsSmiley = EFalse; |
|
58 } |
|
59 else if ( aCode == CSmileyManager::KPlaceHolder ) |
|
60 { |
|
61 breakClass = MTmCustom::EB2LineBreakClass; |
|
62 customWrap->iPlaceHolder = ETrue; |
|
63 } |
|
64 return breakClass; |
|
65 } |
|
66 |
|
67 TBool CSmileyCustomWrap::LineBreakPossible( TUint aPrevClass, TUint aNextClass, |
|
68 TBool aHaveSpaces ) const |
|
69 { |
|
70 return iAvkonCustomWrap.LineBreakPossible( aPrevClass, aNextClass, aHaveSpaces ); |
|
71 } |