|
1 // Copyright (c) 1997-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 __CHTMLTOCRTCONVERTER_H__ |
|
17 #define __CHTMLTOCRTCONVERTER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <conarc.h> |
|
21 #include <barsc.h> |
|
22 #include <charconv.h> |
|
23 |
|
24 #include "MHtmlToCrtConvResourceFile.h" |
|
25 |
|
26 class CRichText; |
|
27 class CParaFormatLayer; |
|
28 class CCharFormatLayer; |
|
29 class CHtmlToCrtConvParser; |
|
30 class CHtmlToCrtConvBuffer; |
|
31 class CHtmlToCrtConvCharsetConvert; |
|
32 |
|
33 class CHtmlToCrtConverter : public CConverterBase2, public MHtmlToCrtConvResourceFile |
|
34 { |
|
35 public: |
|
36 enum TConverterState |
|
37 { |
|
38 EGetCharsetFromPassword, |
|
39 EGetCharsetFromMetaTag, |
|
40 EGetCharsetUsingAutoDetect, |
|
41 EPrepareForConvertToUnicode, |
|
42 EDoOneStepOfParsing, |
|
43 EFinishedParsing |
|
44 }; |
|
45 |
|
46 public: |
|
47 CHtmlToCrtConverter(); |
|
48 ~CHtmlToCrtConverter(); |
|
49 |
|
50 //from CConverterBase |
|
51 public: |
|
52 void ConvertL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); |
|
53 void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); |
|
54 TBool DoConvertL(); |
|
55 TUid Uid(); |
|
56 TInt Capabilities(); |
|
57 void CancelConvert(); |
|
58 |
|
59 static CConverterBase2* NewL(); |
|
60 |
|
61 |
|
62 private: |
|
63 void PrepForConversionL(const TDesC& aSourceFile, const TDesC& aTargetFile); |
|
64 void LocateAndOpenResourceFileL(); |
|
65 void Cleanup(); |
|
66 void FinaliseConversionL(); |
|
67 |
|
68 //from MHtmlToCrtConvResourceFile |
|
69 HBufC* ReadResourceHBufCLC(TInt aResourceId); |
|
70 TRgb ReadResourceTRgbLC(TInt aResourceId); |
|
71 |
|
72 private: |
|
73 CRichText* iText; |
|
74 CParaFormatLayer* iParaFormatLayer; |
|
75 CCharFormatLayer* iCharFormatLayer; |
|
76 CHtmlToCrtConvBuffer* iBuffer; |
|
77 CHtmlToCrtConvParser* iParser; |
|
78 CHtmlToCrtConvCharsetConvert* iCharsetConvert; |
|
79 CCnvCharacterSetConverter* iCnvCharacterSetConverter; |
|
80 |
|
81 MConverterUiObserver* iObserver; |
|
82 HBufC* iSourceFileName; |
|
83 HBufC* iTargetFileName; |
|
84 RFs iFsSession; |
|
85 RResourceFile iResourceFile; |
|
86 TConverterState iConverterState; |
|
87 }; |
|
88 |
|
89 #endif |