|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef BIDICOMPACT_H_ |
|
17 #define BIDICOMPACT_H_ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <bidi.h> |
|
21 |
|
22 class TRunInfoCompact |
|
23 /** |
|
24 Stores information about a run and how to re-order it. |
|
25 @internalTechnology |
|
26 */ |
|
27 { |
|
28 public: |
|
29 /** Describes text to be re-ordered. |
|
30 @internalTechnology */ |
|
31 class TReorderingContext |
|
32 { |
|
33 public: |
|
34 /** Where the logical-order text starts. */ |
|
35 const TText* iSource; |
|
36 /** The start of the line. */ |
|
37 TInt iStart; |
|
38 /** One past the end of the line. */ |
|
39 TInt iEnd; |
|
40 /** |
|
41 * Truncation character, if there is to be one on this line. Otherwise, |
|
42 * 0xFFFF. |
|
43 */ |
|
44 TChar iTruncation; |
|
45 /** ETrue if the line must join at its beginning. */ |
|
46 TBool iJoinsAtStart; |
|
47 /** ETrue if the line must join at its end. */ |
|
48 TBool iJoinsAtEnd; |
|
49 }; |
|
50 |
|
51 /** How to re-order the run. |
|
52 @internalTechnology */ |
|
53 enum TTypeFlags |
|
54 { |
|
55 /** Reverse the run, but not surrogate pairs or combining characters. */ |
|
56 EFRightToLeft = 0x80000000, |
|
57 /** Simply reverse the run, do not check for surrogates or combiners. */ |
|
58 EFNoPairsNoCombiners = 0x40000000, |
|
59 /** No mirrored characters are present. */ |
|
60 EFNoMirroredCharacters = 0x20000000 |
|
61 }; |
|
62 |
|
63 /** Sets up an empty run. |
|
64 @internalTechnology */ |
|
65 TRunInfoCompact() : iStart(0), iLengthAndType(0) {} |
|
66 TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse, |
|
67 const TText* aText); |
|
68 TRunInfoCompact(TInt aStart, TInt aLength, TBool aReverse); |
|
69 TBool AddRun(const TRunInfoCompact& aToBeAdded); |
|
70 TText* Reorder(TText* aDestination, const TReorderingContext& aContext) const; |
|
71 |
|
72 /** @return The start of this run. |
|
73 @internalTechnology */ |
|
74 TInt Start() const { return iStart; } |
|
75 |
|
76 /**@return The length of this run. |
|
77 @internalTechnology */ |
|
78 TInt Length() const { return static_cast<TInt>(iLengthAndType & 0x0FFFFFFF); } |
|
79 |
|
80 /** @return The flags associated with this run. |
|
81 @internalTechnology */ |
|
82 TInt TypeFlags() const { return iLengthAndType & 0xF0000000; } |
|
83 |
|
84 static TInt Convert(TRunInfoCompact* aBuffer, const TDesC& aText, |
|
85 const TBidirectionalState::TRunInfo* aRunArray, TInt aArraySize); |
|
86 static TBool JoinBefore(const TText* aText, TInt aIndex); |
|
87 private: |
|
88 TInt iStart; |
|
89 TUint iLengthAndType; |
|
90 }; |
|
91 |
|
92 #endif |
|
93 |