filehandling/htmltorichtextconverter/inc/CHtmlToCrtConvCharsetConvert.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 2001-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 __CHTMLTOCRTCONVCHARSETCONVERT_H__
       
    17 #define __CHTMLTOCRTCONVCHARSETCONVERT_H__
       
    18 
       
    19 #include <f32file.h>
       
    20 #include <charconv.h>
       
    21 
       
    22 _LIT(KHtmlToCrtRequestCharset, "content-type: charset?");
       
    23 
       
    24 class CHtmlToCrtConvBuffer;
       
    25 class MHtmlToCrtConvResourceFile;
       
    26 class MConverterUiObserver;
       
    27 
       
    28 class CHtmlToCrtConvCharsetConvert : public CBase
       
    29 	{
       
    30 	public:
       
    31 		static CHtmlToCrtConvCharsetConvert* NewL(CHtmlToCrtConvBuffer& aBuffer, RFs& aFsSession, CCnvCharacterSetConverter& aCnvCharacterSetConverter, MHtmlToCrtConvResourceFile& aResourceFile, MConverterUiObserver* aObserver=NULL);
       
    32 		~CHtmlToCrtConvCharsetConvert();
       
    33 
       
    34 	/**
       
    35 		@fn		TBool GetCharSetFromPasswordL()
       
    36 		Intended Usage	:	attempts to get the character set from the mime message header
       
    37 		@return	TBool ETrue if successful, else EFalse
       
    38 	 */
       
    39 		TBool GetCharSetFromPasswordL();
       
    40 	/**
       
    41 		@fn		TBool GetCharSetFromMetaTagL()
       
    42 		Intended Usage	:	attempts to get the character set from the html meta tag
       
    43 		@return	TBool ETrue if successful, else EFalse
       
    44 	 */	
       
    45 		TBool GetCharSetFromMetaTagL();
       
    46 	/**
       
    47 		@fn		TBool GetCharSetUsingAutoDetectL()
       
    48 		Intended Usage	:	attempts to determine the character set by reading a sample of the text
       
    49 							from the file, and passes this to CCnvCharacterSetConverter::AutoDetectCharacterSetL()
       
    50 		@return	TBool ETrue if successful, else EFalse
       
    51 	 */
       
    52 		TBool GetCharSetUsingAutoDetectL();
       
    53 		void PrepareForConvertToUnicodeL();
       
    54 
       
    55 	private:
       
    56 		CHtmlToCrtConvCharsetConvert(CHtmlToCrtConvBuffer& aBuffer, MConverterUiObserver* aObserver, RFs& aFsSession, CCnvCharacterSetConverter& aCnvCharacterSetConverter, MHtmlToCrtConvResourceFile& aResourceFile);
       
    57 		void ConstructL();
       
    58 
       
    59 		TInt FindAndDeleteString(TDes8& aBuffer, const TDesC8& aString);
       
    60 		void ParseCharsetValue(TDes8& aBuffer);
       
    61 		void ConvertFromUnicodeL(const TDesC& aUnicode, HBufC8& aNarrow);
       
    62 
       
    63 	private:
       
    64 		CCnvCharacterSetConverter& iCnvCharacterSetConverter;
       
    65 		CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iArrayOfCharacterSetsAvailable;
       
    66 		
       
    67 		TUint iCharacterSetIdentifier;
       
    68 		CHtmlToCrtConvBuffer& iBuffer;
       
    69 		MConverterUiObserver* iObserver;
       
    70 		MHtmlToCrtConvResourceFile& iResourceFile;
       
    71 		RFs& iFsSession;
       
    72 	};
       
    73 
       
    74 #endif