epoc32/include/miutconv.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/miutconv.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/miutconv.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,206 @@
     1.4 -miutconv.h
     1.5 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __MIUTCONV_H__
    1.21 +#define __MIUTCONV_H__
    1.22 +
    1.23 +#include <e32base.h>
    1.24 +
    1.25 +
    1.26 +#if !defined (__CHARCONV_H_)
    1.27 +#include <charconv.h>
    1.28 +#endif
    1.29 +
    1.30 +#if !defined (__MIUTHDR_H__)
    1.31 +#include <miuthdr.h>		
    1.32 +#endif
    1.33 +
    1.34 +#if !defined (__UTF_H_)
    1.35 +#include <utf.h>
    1.36 +#endif
    1.37 +
    1.38 +// IMail-specific stream type within an IMail file store for TImEmailTransformingInfo
    1.39 +//
    1.40 +const TUint KUidMsvCharsetNone				= {0x10003C7F};		// 268450943
    1.41 +const TUid KUidMsgFileTransformingInfo		= {0x100094A5};		// 268473509
    1.42 +const TUid KUidMsgEmailGeneralCenRep		= {0x10285A25};		// 271079973
    1.43 +
    1.44 +// No longer used as the charset information retrieved from resource file.
    1.45 +// Might possibly needed in the future ? maybe
    1.46 +// const TUid KUidMiutSystemDefaultCharset		= {0x10009418};		// 268473368
    1.47 +// const TUid KUidMiutOverrideCharset			= {0x10009419};		// 268473369
    1.48 +
    1.49 +_LIT8(KMiutUndisplayableChar, "?");
    1.50 +
    1.51 +/** SMTP send methods. 
    1.52 +@publishedAll
    1.53 +@released
    1.54 +*/
    1.55 +enum TImSendMethod
    1.56 +	{ 
    1.57 +	/** Simple email. */
    1.58 +	ESendAsSimpleEmail,
    1.59 +	/** MIME email. */
    1.60 +	ESendAsMimeEmail
    1.61 +	};	
    1.62 +
    1.63 +
    1.64 +// Information to be used when sending an email message.
    1.65 +// Relating to how parts are encoded and converted.
    1.66 +//
    1.67 +class TImEmailTransformingInfo
    1.68 +/** Encapsulates character conversion and encoding settings for sending SMTP email.
    1.69 +
    1.70 +The default outcomes for header, body, HTML, and attachment parts respectively 
    1.71 +for each of the listed categories are given below:
    1.72 +
    1.73 +Plain Charset: ISO-8859-1,ISO-8859-1,N/A,N/A
    1.74 +
    1.75 +Plain Encoding:None,None,N/A,UU
    1.76 +
    1.77 +MIME Charset:UTF8,UTF8,UTF8*,N/A
    1.78 +
    1.79 +MIME Encoding:B,QP,Base64,Base64
    1.80 +
    1.81 +*: the UTF8 value set in the header field, but no conversion is done. The 
    1.82 +HTML converter converts to UTF8. 
    1.83 +@publishedAll
    1.84 +@released
    1.85 +*/
    1.86 +	{
    1.87 +public:
    1.88 +    IMPORT_C TImEmailTransformingInfo& operator=(const TImEmailTransformingInfo& aInfo);
    1.89 +    IMPORT_C TBool operator==(const TImEmailTransformingInfo& aInfo);
    1.90 +	
    1.91 +	// streaming operations
    1.92 +	IMPORT_C void ExternalizeL( RWriteStream& aWriteStream ) const;
    1.93 +	IMPORT_C void InternalizeL( RReadStream& aReadStream );
    1.94 +	IMPORT_C void StoreL( CMsvStore& aStore ) const;
    1.95 +	IMPORT_C void RestoreL( CMsvStore& aStore );
    1.96 +
    1.97 +	// Setting functions
    1.98 +	IMPORT_C void SetToDefault(const TImSendMethod aMethod);
    1.99 +	IMPORT_C void SetSendMethod(const TImSendMethod aMethod);
   1.100 +	IMPORT_C TImSendMethod SendMethod() const;
   1.101 +
   1.102 +	IMPORT_C void SetHeaderEncodingQ();
   1.103 +	IMPORT_C void SetHeaderEncodingB();
   1.104 +	IMPORT_C void SetBodyTextEncoding(TImEncodingType aType);
   1.105 +	IMPORT_C void SetHTMLEncoding(TImEncodingType aType);
   1.106 +	IMPORT_C void SetAttachmentEncoding(TImEncodingType aType);
   1.107 +	
   1.108 +	IMPORT_C void SetHeaderAndBodyCharset(TUint aCharset);
   1.109 +	IMPORT_C void SetHeaderCharset(TUint aCharset);
   1.110 +	IMPORT_C void SetBodyTextCharset(TUint aCharset);
   1.111 +	IMPORT_C void SetHTMLCharset(TUint aCharset);
   1.112 +
   1.113 +	// Accessor functions
   1.114 +	IMPORT_C TImEncodingType HeaderEncoding() const;
   1.115 +	IMPORT_C TImEncodingType BodyTextEncoding() const;
   1.116 +	IMPORT_C TImEncodingType HTMLEncoding() const;
   1.117 +	IMPORT_C TImEncodingType AttachmentEncoding() const;
   1.118 +	
   1.119 +	IMPORT_C TUint HeaderCharset() const;
   1.120 +	IMPORT_C TUint BodyTextCharset() const;
   1.121 +	IMPORT_C TUint HTMLCharset() const;
   1.122 +
   1.123 +private:
   1.124 +	void SetHeaderEncoding(TImEncodingType aType);
   1.125 +
   1.126 +private:
   1.127 +	TImEncodingType	iHeaderEncoding;	
   1.128 +	TImEncodingType	iBodyEncoding;	
   1.129 +	TImEncodingType	iHTMLEncoding;	
   1.130 +	TImEncodingType	iAttachmentEncoding;	
   1.131 +
   1.132 +	TUint	iHeaderCharset;	
   1.133 +	TUint	iBodyCharset;	
   1.134 +	TUint	iHTMLCharset;	
   1.135 +	TUint	iTextAttachmentCharset;	
   1.136 +
   1.137 +	TImSendMethod iSendMethod;
   1.138 +	};
   1.139 +
   1.140 +
   1.141 +// Default Sending Charset/Encoding Values
   1.142 +const TImEncodingType KDefaultMIMEHeaderEncoding	=	EEncodingTypeBASE64;		// MIME
   1.143 +const TImEncodingType KDefaultMIMEBodyTextEncoding	=	EEncodingTypeQP;
   1.144 +const TImEncodingType KDefaultMIMEHTMLEncoding		=	EEncodingTypeBASE64;
   1.145 +const TImEncodingType KDefaultMIMEAttachmentEncoding=	EEncodingTypeBASE64;
   1.146 +
   1.147 +#define KDefaultPlainCharset		KCharacterSetIdentifierIso88591
   1.148 +
   1.149 +const TImEncodingType	KDefaultPlainHeaderEncoding		=	EEncodingTypeNone;	// Non-MIME or Plain
   1.150 +const TImEncodingType	KDefaultPlainBodyTextEncoding	=	EEncodingTypeNone;
   1.151 +const TImEncodingType KDefaultPlainAttachmentEncoding	=	EEncodingTypeUU;
   1.152 +
   1.153 +
   1.154 +
   1.155 +
   1.156 +// Wrapper class for CHARCONV.
   1.157 +// 'Our' charset dependant on build, UNICODE or CodePage 1252.
   1.158 +//
   1.159 +class CImConvertCharconv : public CBase
   1.160 +/**
   1.161 +@internalTechnology
   1.162 +@released
   1.163 +*/
   1.164 +	{
   1.165 +public:	
   1.166 +	IMPORT_C static CImConvertCharconv* NewL(CCnvCharacterSetConverter& aConverter, RFs& anFs);
   1.167 +	~CImConvertCharconv();
   1.168 +
   1.169 +	// MUST call prepare function first.
   1.170 +	IMPORT_C TInt ConvertToOurCharsetL( const TDesC8& aBufIn, TDes& rBufOut, 
   1.171 +										TInt& rNumUnconvertedChars, 
   1.172 +										TInt& rIndexOfFirstUnconvertedChar);
   1.173 +	IMPORT_C TInt ConvertFromOurCharsetL(const TDesC& aBufIn, TDes8& rBufOut, 
   1.174 +										 TInt& rNumUnconvertedChars,
   1.175 +										 TInt& rIndexOfFirstUnconvertedChar);
   1.176 +
   1.177 +	// MUST be called prior to calling above two functions.
   1.178 +	IMPORT_C TInt PrepareToConvertToFromOurCharsetL(const TUint aUid);
   1.179 +
   1.180 +	IMPORT_C TUint GetMimeCharsetUidL(const TDesC8& aBufIn) const;
   1.181 +	IMPORT_C HBufC8* GetMimeCharsetTextStringL(const TUint& aUid) const;
   1.182 +	IMPORT_C TUint DefaultCharset() const;
   1.183 +	IMPORT_C TUint SystemDefaultCharset() const;
   1.184 +
   1.185 +	static TInt StraightCopy( const TDesC8& aBufIn, TDes& rBufOut);
   1.186 +	static TInt StraightCopy( const TDesC& aBufIn, TDes8& rBufOut);
   1.187 +private:
   1.188 +	void ConstructL();
   1.189 +	CImConvertCharconv(CCnvCharacterSetConverter& aConverter, RFs& anFs);
   1.190 +	TBool CharsetAvailable(const TUint aUid);
   1.191 +	void SetSystemDefaultCharsetL();
   1.192 +
   1.193 +	TInt GetSystemCharsetFromCenRepL(TDes8& aMimeCharSet);
   1.194 +
   1.195 +	enum TEmailGeneralSettingsCenRepId
   1.196 +		{
   1.197 +		EEmailGeneralCharSetId				= 0x00000000
   1.198 +		};
   1.199 +
   1.200 +private:
   1.201 +	CCnvCharacterSetConverter& iConverter;
   1.202 +	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* iCharsetsAvailable; 
   1.203 +
   1.204 +	RFs& iFs;
   1.205 +	TUint iCharsetUid;
   1.206 +	TUint iSystemDefaultCharset;		// Value obtained from .ini file
   1.207 +	TInt  iCharconvState;
   1.208 +	};
   1.209 +
   1.210 +#endif