|
1 /* |
|
2 * Copyright (c) 2007 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: Parser class for parsing CFsRichText |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSTEXTPARSER_H |
|
20 #define C_FSTEXTPARSER_H |
|
21 |
|
22 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
23 //#include <fsconfig.h> |
|
24 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 // <cmail> SF |
|
28 #include <alf/alfenv.h> |
|
29 // </cmail> |
|
30 #include "fstextureobserver.h" |
|
31 |
|
32 |
|
33 class CFsRichText; |
|
34 class MFsRichTextObject; |
|
35 class CFsSmileyParser; |
|
36 class TRichTextExapandArea; |
|
37 class TRichTextHotSpotArea; |
|
38 class CFsTextureLoader; |
|
39 class CFsTextStyleManager; |
|
40 class CEikonEnv; |
|
41 |
|
42 class TTextureIndex |
|
43 { |
|
44 public: |
|
45 TInt iPositionInText; |
|
46 TInt iTextureId; |
|
47 }; |
|
48 |
|
49 class CFsTextParser: public CBase |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * NewL( CFsRichText& aText, CHuiEnv& aEnv ); |
|
54 * |
|
55 * @param aText |
|
56 * @param aEnv |
|
57 */ |
|
58 static CFsTextParser* NewL( |
|
59 CFsRichText& aText, |
|
60 CAlfEnv& aEnv, |
|
61 CFsTextureLoader* aTextureLoader ); |
|
62 |
|
63 /** |
|
64 * ~CFsTextParser(); |
|
65 * |
|
66 * |
|
67 */ |
|
68 ~CFsTextParser(); |
|
69 |
|
70 /** |
|
71 * SetParsingPosition( TInt aPosition ); |
|
72 * |
|
73 * @param aPosition |
|
74 */ |
|
75 TBool SetParsingPosition( TInt aPosition ); |
|
76 |
|
77 /** |
|
78 * MoveParsingPosition( TInt aMoveParsingPositionBy); |
|
79 * |
|
80 * @param aMoveParsingPositionBy |
|
81 */ |
|
82 TBool MoveParsingPosition( TInt aMoveParsingPositionBy); |
|
83 |
|
84 /** |
|
85 * GetNextObjectL(); |
|
86 * |
|
87 * @param |
|
88 */ |
|
89 MFsRichTextObject * GetNextObjectL(); |
|
90 |
|
91 /** |
|
92 * ParseTextL(); |
|
93 * |
|
94 * @param |
|
95 */ |
|
96 TBool ParseTextL(); |
|
97 |
|
98 /** |
|
99 * IsNextObject() const; |
|
100 * |
|
101 * |
|
102 */ |
|
103 TBool IsNextObject() const; |
|
104 |
|
105 /** |
|
106 * MoveBack(); |
|
107 * |
|
108 * |
|
109 */ |
|
110 void MoveBack(); |
|
111 |
|
112 /** |
|
113 * SetSmileyParser(CFsSmileyParser* aSmileyParser); |
|
114 * |
|
115 * @param aSmileyParser |
|
116 */ |
|
117 void SetSmileyParser(CFsSmileyParser* aSmileyParser); |
|
118 |
|
119 /** |
|
120 * SetExpandStatusL(TInt aIdOfExpand, TBool aStatus); |
|
121 * |
|
122 * @param aIdOfExpand |
|
123 * @param aStatus |
|
124 */ |
|
125 TBool SetExpandStatusL(TInt aIdOfExpand, TBool aStatus); |
|
126 |
|
127 /** |
|
128 * GetRichTextL(TInt aBeginIndex, TInt aEndIndex); |
|
129 * |
|
130 * @param aBeginIndex |
|
131 * @param aEndIndex |
|
132 */ |
|
133 CFsRichText* GetRichTextL(TInt aBeginIndex, TInt aEndIndex); |
|
134 |
|
135 /** |
|
136 * GetEndIndexOfExpandAreaL(TInt aId); |
|
137 * |
|
138 * @param aId |
|
139 */ |
|
140 TInt GetEndIndexOfExpandAreaL(TInt aId); |
|
141 |
|
142 /** |
|
143 * GetStartIndexOfExpandAreaL(TInt aId); |
|
144 * |
|
145 * @param aId |
|
146 */ |
|
147 TInt GetStartIndexOfExpandAreaL(TInt aId); |
|
148 |
|
149 /** |
|
150 * GetBodyIndexOfExpandAreaL(TInt aId); |
|
151 * |
|
152 * @param aId |
|
153 */ |
|
154 TInt GetBodyIndexOfExpandAreaL(TInt aId); |
|
155 |
|
156 /** |
|
157 * GetEndIndexOfHotSpotAreaL(TInt aId); |
|
158 * |
|
159 * @param aId |
|
160 */ |
|
161 TInt GetEndIndexOfHotSpotAreaL(TInt aId, TBool aOriginal = EFalse); |
|
162 |
|
163 /** |
|
164 * GetStartIndexOfHotSpotAreaL(TInt aId); |
|
165 * |
|
166 * @param aId |
|
167 */ |
|
168 TInt GetStartIndexOfHotSpotAreaL(TInt aId, TBool aOriginal = EFalse ); |
|
169 |
|
170 /** |
|
171 * SetSizeOfSmile(TSize aSizeOfSmiley); |
|
172 * |
|
173 * @param aSizeOfSmiley |
|
174 */ |
|
175 void SetSizeOfSmile(TSize aSizeOfSmiley); |
|
176 |
|
177 /** |
|
178 * SetTextStylemanager(CFsTextStyleManager* aTextStyleManager); |
|
179 * |
|
180 * @param aTextStyleManager |
|
181 */ |
|
182 void SetTextStylemanager(CFsTextStyleManager* aTextStyleManager); |
|
183 |
|
184 /** |
|
185 * CutWord(TInt aBeginOfWord, TInt aNewLengthOfWord); |
|
186 * |
|
187 * @param aBeginOfWord |
|
188 * @param aNewLengthOfWord |
|
189 */ |
|
190 void CutWord(TInt aBeginOfWord, TInt aNewLengthOfWord); |
|
191 |
|
192 /** |
|
193 * GetTextL(TInt aStart, TInt aEnd, TInt& aStyle); |
|
194 * |
|
195 * @param aStart |
|
196 * @param aEnd |
|
197 * @param aStyle |
|
198 */ |
|
199 HBufC* GetTextL(TInt aStart, TInt aEnd) const; |
|
200 |
|
201 /** |
|
202 * GetTextureL(TInt aPos); |
|
203 * |
|
204 * @param aPos |
|
205 */ |
|
206 CFsTexture& GetTextureL(TInt aPos); |
|
207 |
|
208 /** |
|
209 * GetParagraphDirection(TInt aPosInText); |
|
210 * |
|
211 * @param aPosInText |
|
212 */ |
|
213 TBidiText::TDirectionality GetParagraphDirection(TInt aPosInText); |
|
214 |
|
215 /** |
|
216 * GetParagraphDirection(TInt aPosInText); |
|
217 * |
|
218 * @param aPosInText |
|
219 */ |
|
220 TBool SetTextDirection(TInt aStartPosInText, TInt aEndPosInText, |
|
221 TBidiText::TDirectionality aDirection); |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 private: |
|
228 /** |
|
229 * CFsTextParser( CFsRichText& aText, CHuiEnv& aEnv ); |
|
230 * |
|
231 * @param aText |
|
232 * @param aEnv |
|
233 */ |
|
234 CFsTextParser( |
|
235 CFsRichText& aText, |
|
236 CAlfEnv& aEnv, |
|
237 CFsTextureLoader* aTextureLoader ); |
|
238 |
|
239 /** |
|
240 * IsWordPartOfExpandArea(TInt aStartPosition, TInt aEndPosition); |
|
241 * |
|
242 * @param aStartPosition |
|
243 * @param aEndPosition |
|
244 */ |
|
245 TInt IsWordPartOfExpandArea(TInt aStartPosition, TInt aEndPosition); |
|
246 |
|
247 /** |
|
248 * ConstructL(); |
|
249 * |
|
250 * |
|
251 */ |
|
252 void ConstructL(); |
|
253 |
|
254 /** |
|
255 * IsPartOfHotSpot(TInt aIndex); |
|
256 * |
|
257 * @param aIndex |
|
258 */ |
|
259 TBool IsPartOfHotSpot(TInt aIndex); |
|
260 |
|
261 /** |
|
262 * IsWordPartOfHotSpotArea(TInt aStartPosition, TInt aEndPosition); |
|
263 * |
|
264 * @param aStartPosition |
|
265 * @param aEndPosition |
|
266 */ |
|
267 TInt IsWordPartOfHotSpotArea(TInt aStartPosition, TInt aEndPosition); |
|
268 |
|
269 /** |
|
270 * ConvertBitmapL(CPicture* aPicture, CFbsBitmap*& aBitmap); |
|
271 * |
|
272 * @param aPicture |
|
273 * @param aBitmap |
|
274 */ |
|
275 void ConvertBitmapL(CPicture* aPicture, CFbsBitmap*& aBitmap); |
|
276 |
|
277 /** |
|
278 * IsFieldInrange(); |
|
279 * |
|
280 * |
|
281 */ |
|
282 TBool IsFieldInrange(TInt aStartPosition, TInt aRange); |
|
283 |
|
284 /** |
|
285 * IsTexturePosition(TInt aPos, TInt &aId) |
|
286 * |
|
287 */ |
|
288 TBool IsTexturePosition(TInt aPos, TInt &aId); |
|
289 |
|
290 /** |
|
291 * IsNewLinePresent(TInt aPosition, TInt aLength) |
|
292 * |
|
293 */ |
|
294 TInt IsNewLinePresent(TInt aPosition, TInt aLength); |
|
295 |
|
296 /* |
|
297 * FindBlokOfText(); |
|
298 * |
|
299 */ |
|
300 void FindBlokOfText(); |
|
301 |
|
302 /* |
|
303 * FindNextBlokOfText(); |
|
304 * |
|
305 */ |
|
306 void FindNextBlokOfText(); |
|
307 |
|
308 private: |
|
309 CFsRichText& iText; |
|
310 TInt iPosition; |
|
311 TInt iLastPosition; |
|
312 TInt iTypeOfLastObject; |
|
313 CFsSmileyParser* iSmileyParser; |
|
314 RArray<TRichTextExapandArea> iExpandArray; |
|
315 RArray<TRichTextHotSpotArea> iHotSpotArray; |
|
316 RArray<TInt> iNewLineArray; |
|
317 RArray<TBidiText::TDirectionality> iLineDirection; |
|
318 CFsTextureLoader* iTextureLoader; |
|
319 CAlfEnv& iEnv; |
|
320 |
|
321 CFsTextStyleManager* iTextStyleManager; |
|
322 |
|
323 TBool iIsWordTooLong; |
|
324 TInt iNewLengthOfWord; |
|
325 |
|
326 TBool iIsSetSizeOfSmiley; |
|
327 TSize iSizeOfSmiley; |
|
328 CEikonEnv* iEikon; |
|
329 RArray<TInt> iFieldLocation; |
|
330 RArray<TTextureIndex> iTextureIndex; |
|
331 |
|
332 //new |
|
333 TInt iLastWordPosition; |
|
334 TInt iLastLength; |
|
335 |
|
336 |
|
337 |
|
338 //variables used in GetNetxObject |
|
339 TCharFormat iGNOCharFormat; |
|
340 TPtrC iGNOSomeText; |
|
341 |
|
342 TCharFormat iGNOCharFormatOfNextBlock; |
|
343 TPtrC iGNOSomeTextOfNextBlock; |
|
344 TInt iGNONextPosition; |
|
345 //end of variables used in GetNetxObject |
|
346 |
|
347 TInt iLastGetCharsPos; |
|
348 TInt iLastGetCharsLength; |
|
349 TBool iGetCharsUsed; |
|
350 |
|
351 TInt iLastGetCharsPosOfNextBlock; |
|
352 TInt iLastGetCharsLengthOfNextBlock; |
|
353 TBool iGetCharsUsedOfNextBlock; |
|
354 |
|
355 TInt iNewLineArrayIndex; |
|
356 TInt iLastNewLinePositionIndex; |
|
357 |
|
358 }; |
|
359 |
|
360 #endif // C_FSTEXTPARSER_H |
|
361 |