|
1 // Copyright (c) 1999-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __MSVFTEXT_H__ |
|
17 #define __MSVFTEXT_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include <mentact.h> |
|
22 #include <mtclbase.h> |
|
23 #include <mtmdef.h> |
|
24 |
|
25 class CRichText; |
|
26 |
|
27 class CMsvFindText : public CMsgActive |
|
28 /** A utility class which searches through given plain text or rich text for a |
|
29 specified text string. |
|
30 |
|
31 The class is an active object and searching can be done synchronously or asynchronously. |
|
32 An instance of this class can be re-used to perform multiple searches for |
|
33 text. |
|
34 @publishedAll |
|
35 @released |
|
36 */ |
|
37 { |
|
38 public: |
|
39 IMPORT_C static CMsvFindText* NewLC(TInt aPriority = EPriorityStandard); |
|
40 IMPORT_C static CMsvFindText* NewL(TInt aPriority = EPriorityStandard); |
|
41 IMPORT_C ~CMsvFindText(); |
|
42 // |
|
43 IMPORT_C void FindTextL(const TDesC& aFind, const TDesC& aSource, TMsvPartList aFlags, TRequestStatus& aStatus); |
|
44 IMPORT_C void FindRichTextL(const TDesC& aFind, const CRichText& aSource, TMsvPartList aFlags, TRequestStatus& aStatus); |
|
45 // |
|
46 IMPORT_C TBool FindTextL(const TDesC& aFind, const TDesC& aSource, TMsvPartList aFlags); |
|
47 IMPORT_C TBool FindRichTextL(const TDesC& aFind, const CRichText& aSource, TMsvPartList aFlags); |
|
48 // |
|
49 inline TBool FoundText() const; |
|
50 // |
|
51 private: |
|
52 CMsvFindText(TInt aPriority); |
|
53 // |
|
54 void InitialiseL(const TDesC& aFind, const TDesC* aPlainSource, const CRichText* aRichSource, TMsvPartList aFlags); |
|
55 void DoFindAsyncL(TRequestStatus& aStatus); |
|
56 void DoComplete(TInt&); |
|
57 TBool DoFindSyncL(); |
|
58 TBool DoFindStepL(); |
|
59 TBool DoFindTextL(); |
|
60 void DoRunL(); |
|
61 void Check(); |
|
62 // |
|
63 private: |
|
64 HBufC* iBuf; |
|
65 HBufC* iFind; |
|
66 TInt iSourcePos; |
|
67 TInt iMaxRead; |
|
68 TInt iSourceLen; |
|
69 const CRichText* iRichText; |
|
70 const TDesC* iPlainText; |
|
71 TMsvPartList iFlags; |
|
72 TChar iPreChar; |
|
73 TChar iPostChar; |
|
74 TBool iFoundText; |
|
75 }; |
|
76 |
|
77 #include <msvftext.inl> |
|
78 |
|
79 #endif |