|
1 /* |
|
2 * Copyright (c) 2002-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TMCHUNKINTERP_H_ |
|
20 #define TMCHUNKINTERP_H_ |
|
21 |
|
22 #include "TMINTERP.H" |
|
23 |
|
24 /** |
|
25 * Interpreter for finding text chunks adjoining a given document position. |
|
26 * @internalComponent |
|
27 */ |
|
28 class TTmChunkInterpreter : public TTmInterpreter |
|
29 { |
|
30 public: |
|
31 enum TContainment |
|
32 { |
|
33 ENotInChunk = 0, |
|
34 ELeftEdgeOfChunk = 1, |
|
35 ERightEdgeOfChunk = 2, |
|
36 EMiddleOfChunk = 3 |
|
37 }; |
|
38 TTmChunkInterpreter(const CTmTextLayout& aTextLayout); |
|
39 /** |
|
40 * Sets the iteration to the leftmost chunk of the line containing aDocPos. |
|
41 * @return |
|
42 * ETrue if this succeeded, EFalse if the line is not formatted, or |
|
43 * contains no text. |
|
44 */ |
|
45 TBool ChunkSetToLeftOfLine(const TTmDocPosSpec& aDocPos); |
|
46 /** |
|
47 * Returns the first character position in the current chunk. |
|
48 */ |
|
49 TInt ChunkStart() const { return iStart; } |
|
50 /** |
|
51 * Returns one past the last character position in the current chunk. |
|
52 */ |
|
53 TInt ChunkEnd() const { return iEnd; } |
|
54 /** |
|
55 * Returns ETrue if the current chunk is displayed right-to-left. |
|
56 */ |
|
57 TBool ChunkRightToLeft() const { return iRightToLeft; } |
|
58 /** |
|
59 * Returns whether aDocPos is in the chunk or not, and if so where in the |
|
60 * chunk it is. |
|
61 */ |
|
62 TContainment ChunkContainsPos(const TTmDocPosSpec& aDocPos) const; |
|
63 /** |
|
64 * Moves to the next chunk right within this line. |
|
65 * @return |
|
66 * ETrue if there is such a chunk, EFalse if the end of the line was |
|
67 * reached, so no chunk could be found. |
|
68 */ |
|
69 TBool ChunkNext(); |
|
70 |
|
71 private: |
|
72 TInt iStart; |
|
73 TInt iEnd; |
|
74 TBool iRightToLeft; |
|
75 }; |
|
76 |
|
77 #endif |