epoc32/include/mtclbase.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 mtclbase.h
     1 // Copyright (c) 1998-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 
       
    17 #ifndef __MTCLBASE_H__
       
    18 #define __MTCLBASE_H__
       
    19 
       
    20 #include <e32base.h>		
       
    21 #include <badesca.h>
       
    22 #include <msvapi.h>
       
    23 
       
    24 #include <cmsvattachment.h>
       
    25 #include <msvstd.hrh>
       
    26 #include <cmsvrecipientlist.h>
       
    27 
       
    28 /**
       
    29 UId for 8-bit/16-bit Character set mechanism.
       
    30 @internalTechnology
       
    31 @prototype
       
    32 */
       
    33 const TInt KUIDCharacterSet = 999; 
       
    34 
       
    35 class CMsvAttachmentWaiter;
       
    36 
       
    37 
       
    38 /** Specifies one or more parts of a message in message-forwarding, message-reply, 
       
    39 and message-validation functions.
       
    40 
       
    41 Standard message parts are defined by the constants that can be added (or 
       
    42 bitwise-or'ed) together to specify multiple parts. Some message parts may 
       
    43 not be meaningful for some MTMs.
       
    44 
       
    45 Specifies find attributes which modify the behaviour of the search text utility 
       
    46 provided by the Global Find API. This does not apply to v5.1 nor to v5. */
       
    47 typedef TUint TMsvPartList;
       
    48 
       
    49 class CParaFormatLayer;
       
    50 class CCharFormatLayer;
       
    51 
       
    52 
       
    53 /** Specifies function IDs for standard MTM functions.
       
    54 
       
    55 The function IDs are specified such that they do not coincide
       
    56 with the free area defined for MTM commands.
       
    57 
       
    58 If MTMs also offer their own equivalents of these functions,
       
    59 they may implement these function IDs by considering the
       
    60 two IDs to be the same in their client MTM.
       
    61 
       
    62 MTMs that support SendAs must support SendMessage.
       
    63 */
       
    64 enum TMtmStandardAsyncCommands
       
    65 	{
       
    66 	KMTMStandardFunctionsSendMessage = KMtmFirstFreeStandardMtmFunctionId
       
    67 	};
       
    68 
       
    69 
       
    70 ////////////////////////////////////////////////////////
       
    71 // Prototype of expected factory function
       
    72 
       
    73 typedef CBaseMtm* MtmFactoryFunctionL(CRegisteredMtmDll&, CMsvSession&);
       
    74 
       
    75 
       
    76 /***********************************************
       
    77 ***********************************************/
       
    78 class CBaseMtm : public CBase, public MMsvEntryObserver
       
    79 /** Provides a high-level interface for accessing and manipulating a Message Server 
       
    80 entry. 
       
    81 
       
    82 Message client applications use the class to access such functionality polymorphically. 
       
    83 MTM implementers implement a derived class to provide such functionality for 
       
    84 their message protocol. 
       
    85 
       
    86 The following are some significant groups of functions:
       
    87 
       
    88 Context functions: the SetCurrentEntryL() and SwitchCurrentEntryL() functions 
       
    89 change the context - the entry on which later actions are performed. After 
       
    90 creating a new Client-side MTM object, a message client application should 
       
    91 set an initial context before using other functions. Note that: any changes 
       
    92 made to an existing context are not automatically saved: the message client 
       
    93 application should ensure this itself by calling SaveMessageL(); no message 
       
    94 data for the new context is retrieved from the Message Server, to retrieve 
       
    95 entry data, call LoadMessageL() after setting the context; calling Body() 
       
    96 immediately after setting the context returns an empty CRichText object: this 
       
    97 is because the private cache of context body text that the base class maintains 
       
    98 is re-initialised to an empty value. MTM implementers should note that the 
       
    99 virtual ContextEntrySwitched() is called from these functions to allow derived 
       
   100 classes to also clear any caches of MTM-specific entry data.
       
   101 
       
   102 Store and restore entry data functions: the changes that a message client 
       
   103 application makes to a message context through Client-side MTM functions, 
       
   104 such as altering the body text obtained through Body(), are, for efficiency, 
       
   105 cached in memory by a Client-side MTM. The message store and restore functions 
       
   106 are concerned with transferring data between that cache and committed storage. 
       
   107 Note that, unlike message contexts, message client applications are not expected 
       
   108 to manipulate directly service contexts. Instead, the corresponding User Interface 
       
   109 MTM will provide dialogs to allow the user to alter service settings, and 
       
   110 call Client-side MTM functions to handle their retrieval and storage. Symbian 
       
   111 OS v5 expects the base class functions to handle storage and retrieval for 
       
   112 both message and service contexts, and their implementations must detect what 
       
   113 the context is, and act accordingly. Post-v5, the API is clarified by restricting 
       
   114 the base class functions to handle message contexts only. To handle service 
       
   115 contexts, a Client-side MTM must define its own functions for the User Interface 
       
   116 MTM to call.
       
   117 
       
   118 Store and restore body text functions: the base class maintains a private 
       
   119 CRichText object cache to store the body text for the current context. This 
       
   120 can be accessed for reading and writing by message client applications through 
       
   121 Body(). StoreBodyL() and RestoreBodyL() encapsulate for implementers of derived 
       
   122 classes the retrieval and storage of this CRichText object to a CMsvStore.
       
   123 
       
   124 Address list functions: the format and storage of message addresses is MTM-specific. 
       
   125 AddresseeList(), AddAddresseeL(), and RemoveAddressee() are designed to allow 
       
   126 clients with no MTM-specific knowledge to access address information in a 
       
   127 generic way. The base class has a protected data member iAddresseeList, an 
       
   128 array of descriptors, which these functions manipulate. Implementations should 
       
   129 save the address information to the appropriate place in the message store 
       
   130 when the message is stored.
       
   131 
       
   132 MTM-specific functionality: MTM components can offer protocol-specific functionality 
       
   133 not provided by base class interface functions. MTM components define IDs 
       
   134 that correspond to each protocol-specific operation offered, and implement 
       
   135 the InvokeSyncFunctionL() and InvokeAsyncFunctionL() functions to allow clients 
       
   136 to access these operations by passing in the appropriate ID. Two functions 
       
   137 are provided to allow the MTM component to offer both synchronous and asynchronous 
       
   138 functionality. Message client applications can dynamically add user-interface 
       
   139 features for these operations using CBaseMtmUiData::MtmSpecificFunctions(). 
       
   140 MTM developers should document the IDs if they wish to make the operations 
       
   141 available to clients. 
       
   142 @publishedAll
       
   143 @released
       
   144 */
       
   145 	{
       
   146 public:
       
   147 	IMPORT_C ~CBaseMtm();
       
   148 	IMPORT_C TUid Type() const;
       
   149 	//
       
   150 	// context related
       
   151 	IMPORT_C void SetCurrentEntryL(CMsvEntry* aEntry);
       
   152 	IMPORT_C void SwitchCurrentEntryL(TMsvId aId);
       
   153 	IMPORT_C CMsvEntry& Entry() const;
       
   154 	IMPORT_C TBool HasContext() const;
       
   155 	//
       
   156 	//
       
   157 	/** Commits cached changes to the storage controlled by the Message Server.
       
   158 	
       
   159 	It can only be called on message contexts. It should be called in the following circumstances:
       
   160 	
       
   161 	1. to preserve changes when the context is changed, or when the Client-side MTM 
       
   162 	object is deleted 
       
   163 	
       
   164 	2. to enable other parts of the Messaging to access the updated entry, as required, 
       
   165 	for example, before sending a message 
       
   166 	
       
   167 	Requirements:
       
   168 	
       
   169 	An implementation must update the store and index entry relating to the message 
       
   170 	context. Typically, the message store should be opened for editing with CMsvEntry::EditStoreL(). 
       
   171 	It should be updated as follows:
       
   172 	
       
   173 	1. body text: call StoreBodyL() to update the store's body text stream
       
   174 	
       
   175 	2. address list: update the appropriate MTM-specific area of the store from the 
       
   176 	data in iAddresseeList
       
   177 	
       
   178 	3. subject: if supported, update the appropriate MTM-specific area of the store 
       
   179 	from the private cache set by SetSubjectL()
       
   180 	
       
   181 	Changes can then be committed to the store with CMsvStore::CommitL().
       
   182 	
       
   183 	The index entry should also be updated to reflect changes. Possible fields 
       
   184 	that may need updating include: Description (for subject changes); Details 
       
   185 	and Multiple Recipients (for recipient changes); and Size. Index entry changes 
       
   186 	are committed using CMsvEntry::ChangeL().
       
   187 	
       
   188 	The function should panic for non-message contexts. */
       
   189 	virtual void SaveMessageL()=0; 
       
   190 	/** Loads the cache with the message data for the current context.
       
   191 	
       
   192 	It can only be called on message contexts. 
       
   193 	
       
   194 	It is typically used after the context has been set with SetCurrentEntryL() 
       
   195 	or SwitchCurrentEntryL(). CBaseMtm functions to manipulate the entry can only 
       
   196 	be called after this function has been called.
       
   197 	
       
   198 	Requirements:
       
   199 	
       
   200 	An implementation must restore the store and index entry relating to the message 
       
   201 	context. Typically, the message store should be opened for reading with CMsvEntry::ReadStoreL(). 
       
   202 	It should be then be read to set the following:
       
   203 	
       
   204 	1. body text: call RestoreBodyL() to update the cached body text
       
   205 	
       
   206 	2. address list: read the appropriate MTM-specific area of the store to update 
       
   207 	iAddresseeList
       
   208 	
       
   209 	3. subject: if supported, read the appropriate MTM-specific area of the store 
       
   210 	and update the cache with SetSubjectL()
       
   211 	
       
   212 	The function should panic for non-message contexts. */
       
   213 	virtual void LoadMessageL()=0;
       
   214 	/** Validates the current message context. 
       
   215 	
       
   216 	The precise validation performed is specific to the MTM, but, typically, checks 
       
   217 	that the specified message parts are well-formed. 
       
   218 	
       
   219 	Requirements:
       
   220 	
       
   221 	Implementation of this function is highly protocol-specific. A minimum step 
       
   222 	is to check that the current context is a message.
       
   223 	
       
   224 	@param aPartList Indicates the message parts for which validation is requested 
       
   225 	
       
   226 	@return If valid, KErrNone If invalid, identifies the invalid part(s). The 
       
   227 	error value is the bitmask of the TMsvPartList IDs for each invalid part */
       
   228 	virtual TMsvPartList ValidateMessage(TMsvPartList aPartList)=0;
       
   229 	/** Searches the specified message part(s) for the plain-text version of the text 
       
   230 	to be found. 
       
   231 	
       
   232 	If the specified part list indicates a part that is not supported, or is not 
       
   233 	present in the current message, the function behaves as if the specified part 
       
   234 	exists but does not contain the required text.
       
   235 	
       
   236 	Requirements:
       
   237 	
       
   238 	The parts of the entry for which searching is allowed is implementation specific. 
       
   239 	If no searching is supported, always return 0.
       
   240 	
       
   241 	@param aTextToFind The plain-text version of the text to be found. 
       
   242 	@param aPartList Indicates the message parts which should be searched. 
       
   243 	@return If the text was not found, or searching is unsupported, 0. If the text 
       
   244 	was found, a bitmask of the TMsvPartList IDs for each part in which the text 
       
   245 	was present. */
       
   246 	virtual TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList)=0;
       
   247 	//
       
   248 	//
       
   249 	/** Creates a reply message to the current message context. 
       
   250 	
       
   251 	Some MTMs may support inclusion of elements, specified by aPartlist, from 
       
   252 	the original message in the reply. The parent for the new entry is specified 
       
   253 	in aDestination. 
       
   254 	
       
   255 	The returned CMsvOperation object completes when creating the reply is complete. 
       
   256 	On completion, the context is set to the reply message.
       
   257 	
       
   258 	Requirements:
       
   259 	
       
   260 	A typical implementation for this function would include the following steps: 
       
   261 	
       
   262 	1. create a new message in the specified destination by calling CMsvEntry::CreateL()
       
   263 	
       
   264 	2. set the entry index values as appropriate
       
   265 	
       
   266 	3. set the properties of the message as required. The normal minimum is to set 
       
   267 	the address to the sender of the original message. An implementation may also 
       
   268 	follow the options specified in aPartlist to set other properties, for example, 
       
   269 	to include the original message text.
       
   270 	
       
   271 	4. set the context to the reply 
       
   272 	
       
   273 	5. return a CMsvOperation-derived object to provide asynchronous control and 
       
   274 	monitoring of the operation
       
   275 	
       
   276 	If message replies are not supported, implementations should leave with KErrNotSupported.
       
   277 	
       
   278 	The implementation of this function may be similar to that of ForwardL(), 
       
   279 	allowing opportunities for code sharing.
       
   280 	
       
   281 	@param aDestination The entry to which to assign the reply 
       
   282 	@param aPartlist Defines the parts that are to be copied from the original 
       
   283 	message into the reply 
       
   284 	@param aCompletionStatus The request status to be completed when the operation 
       
   285 	has finished 
       
   286 	@leave KErrNotSupported The Client-side MTM does not support reply operations 
       
   287 	@leave Other leave codes Dependent on implementation 
       
   288 	@return If successful, this is an asynchronously completing reply operation. 
       
   289 	If failed, this is a completed operation, with status set to the relevant 
       
   290 	error code. */
       
   291 	virtual CMsvOperation* ReplyL(TMsvId aDestination, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus)=0;
       
   292 	/** Creates a forwarded message from the current message context. 
       
   293 	
       
   294 	Some MTMs may 
       
   295 	support inclusion of elements, specified by aPartlist, from the original message 
       
   296 	in the forwarded message. The parent for the new entry is specified in aDestination. 
       
   297 	The returned CMsvOperation object completes when editing the forwarded message 
       
   298 	is complete. On completion, the context is set to the forwarded message.
       
   299 	
       
   300 	Requirements:
       
   301 	
       
   302 	A typical implementation for this function would include the following steps: 
       
   303 	
       
   304 	1. create a new message in the specified destination by calling CMsvEntry::CreateL()
       
   305 	
       
   306 	2. set the entry index values as appropriate
       
   307 	
       
   308 	3. set message content as required. The normal minimum is to include the text 
       
   309 	of the original message. An implementation may also follow the options specified 
       
   310 	in aPartlist to include other properties of the original message.
       
   311 	
       
   312 	4. set the context to the reply 
       
   313 	
       
   314 	5. return a CMsvOperation-derived object to provide asynchronous control and 
       
   315 	monitoring of the operation
       
   316 	
       
   317 	If forwarded messages are not supported, implementations should leave with 
       
   318 	KErrNotSupported.
       
   319 	
       
   320 	The implementation of this function may be similar to that of ReplyL(), allowing 
       
   321 	opportunities for code sharing.
       
   322 	
       
   323 	@param aDestination The entry to which to assign the forwarded message 
       
   324 	@param aPartList Defines the parts that are to be copied from the original 
       
   325 	message into the forwarded message 
       
   326 	@param aCompletionStatus The request status to be completed when the operation 
       
   327 	has finished 
       
   328 	@leave KErrNotSupported The Client-side MTM does not support creation of forwarded 
       
   329 	messages 
       
   330 	@leave Other leave codes Dependent on implementation 
       
   331 	@return If successful, this is an asynchronously completing forward message 
       
   332 	operation. If failed, this is a completed operation, with status set to the 
       
   333 	relevant error code. */
       
   334 	virtual CMsvOperation* ForwardL(TMsvId aDestination, TMsvPartList aPartList, TRequestStatus& aCompletionStatus)=0;
       
   335 	//
       
   336 	// addresssee list (used by objects with no MTM knowledge)
       
   337 	IMPORT_C const CMsvRecipientList& AddresseeList() const;
       
   338 
       
   339 	/** Adds an addressee for the current context.
       
   340 	
       
   341 	Addresses are not validated by checking their format by this function. Usually 
       
   342 	that is performed by calling ValidateMessage().
       
   343 	
       
   344 	Requirements:
       
   345 	
       
   346 	Implementations should append the address to the object's address cache 
       
   347 	in the protected iAddresseeList data member. Some implementations may also 
       
   348 	wish to store addresses in an internal data structure appropriate for the 
       
   349 	protocol, for example, a class holding message header information. 
       
   350 	
       
   351 	@param aRealAddress String representing an address to be added to the list 
       
   352 	for the current message 
       
   353 	@leave KErrNotSupported The message already has the maximum number of addressees 
       
   354 	
       
   355 	@leave Other leave codes Dependent on implementation */
       
   356 	virtual void AddAddresseeL(const TDesC& aRealAddress)=0;
       
   357 	/** Adds an addressee for the current context, and enables the client to specify 
       
   358 	an alias, which may be useful for some protocols. For example, for fax, if 
       
   359 	the address is the fax number, the alias could supply the recipient's name. 
       
   360 	
       
   361 	Addresses are not validated by checking their format by this function. Usually 
       
   362 	that is performed by calling ValidateMessage().
       
   363 	
       
   364 	Requirements:
       
   365 	
       
   366 	Implementations should append the address to the object's address cache 
       
   367 	in the protected iAddresseeList data member. Some implementations may also 
       
   368 	wish to store addresses in an internal data structure appropriate for the 
       
   369 	protocol, for example, a class holding message header information. 
       
   370 	
       
   371 	@param aRealAddress String representing an address to be added to the list 
       
   372 	for the current message 
       
   373 	@param aAlias Alias information 
       
   374 	@leave KErrNotSupported The message already has the maximum number of addressees 
       
   375 	
       
   376 	@leave Other leave codes Dependent on implementation */
       
   377 	virtual void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias)=0;
       
   378 	
       
   379 	IMPORT_C virtual void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress);
       
   380 	IMPORT_C virtual void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress, const TDesC& aAlias);
       
   381 	
       
   382 	/** Removes an address from the current address list. The address is specified 
       
   383 	by a zero-based index into the address list. If the index is not known, applications 
       
   384 	can use AddresseeList() to retrieve the entire list to find the item.
       
   385 	
       
   386 	Requirements:
       
   387 	
       
   388 	Implementations should call iAddresseeList->Delete(aIndex) to remove the address 
       
   389 	from in the address list protected data member.
       
   390 	
       
   391 	@param aIndex Index of address to be removed */
       
   392 	virtual void RemoveAddressee(TInt aIndex)=0;
       
   393 	//
       
   394 	// standard data accessor/mutators
       
   395 	IMPORT_C CRichText& Body();
       
   396 	IMPORT_C const CRichText& Body() const;
       
   397 	IMPORT_C virtual void SetSubjectL(const TDesC& aSubject); // default leaves with KErrNotSupported
       
   398 	IMPORT_C virtual const TPtrC SubjectL() const; // default leaves with KErrNotSupported
       
   399 	//
       
   400 	// RTTI functions
       
   401 	IMPORT_C virtual TInt QueryCapability(TUid aCapability, TInt& aResponse); // default returns KErrNotSupported
       
   402 	/** Invokes synchronous protocol-specific operations. For asynchronous operations, 
       
   403 	a similar function, InvokeAsyncFunctionL(), is available.
       
   404 	
       
   405 	aSelection and aParameter allow data to be passed to the operation. 
       
   406 	
       
   407 	Requirements:
       
   408 	
       
   409 	For functionality that requires message transport access, such as making a 
       
   410 	connection, the implementation should pass the request onto the corresponding 
       
   411 	Server-side MTM. This is done through calling CMsvSession::TransferCommandL(). 
       
   412 	Implementations may also provide protocol-specific functions themselves if 
       
   413 	this is useful.
       
   414 	
       
   415 	@param aFunctionId ID of the requested operation 
       
   416 	@param aSelection Selection of message entries. This is used if the operation 
       
   417 	requires message entries to work on. 
       
   418 	@param aParameter Buffer containing input and output parameters. The format 
       
   419 	of this is specific to the operation. 
       
   420 	@leave KErrNotSupported aFunctionId is not a recognised operation ID 
       
   421 	@leave Other leave codes Dependent on implementation */
       
   422 	virtual void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter)=0;
       
   423 	/** Invokes asynchronous protocol-specific operations. For synchronous operations, 
       
   424 	a similar function, InvokeSyncFunctionL(), is available.
       
   425 	
       
   426 	aSelection and aParameter allow data to be passed to the operation. The TRequestStatus 
       
   427 	and CMsvOperation objects are used as normal to control and monitor the operation.
       
   428 	
       
   429 	Requirements:
       
   430 	
       
   431 	For functionality that requires message transport access, such as making a 
       
   432 	connection, the implementation should pass the request onto the corresponding 
       
   433 	Server-side MTM. This is done through calling CMsvSession::TransferCommandL(). 
       
   434 	Implementations may also provide protocol-specific functions themselves if 
       
   435 	this is useful.
       
   436 	
       
   437 	InvokeAsyncFunctionL() should return a CMsvOperation-derived object to provide 
       
   438 	asynchronous control and monitoring of the operation. If CMsvSession::TransferCommandL() 
       
   439 	is called, this should be the CMsvOperation object returned by that function.
       
   440 	
       
   441 	@param aFunctionId ID of the requested operation 
       
   442 	@param aSelection Selection of message entries. This is used if the operation 
       
   443 	requires message entries to work on. 
       
   444 	@param aParameter Buffer containing input and output parameters. The format 
       
   445 	of this is specific to the operation. 
       
   446 	@param aCompletionStatus The request status to be completed when the operation 
       
   447 	has finished 
       
   448 	@leave KErrNotSupported aFunctionId is not a recognised operation ID 
       
   449 	@leave Other leave codes Dependent on implementation 
       
   450 	@return If successful, this is an asynchronously completing operation. If failed, 
       
   451 	this is a completed operation, with status set to the relevant error code. */
       
   452 	virtual CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus)=0;
       
   453 	//
       
   454 	IMPORT_C CMsvSession& Session();
       
   455 
       
   456 	// Attachment functions to support the SendAs API
       
   457 	virtual inline void Filler1() {};
       
   458 	virtual inline void Filler2() {};
       
   459 	IMPORT_C virtual void AddAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   460 	IMPORT_C virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   461 	IMPORT_C virtual void AddLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   462 	IMPORT_C virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus);
       
   463 	IMPORT_C virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
       
   464 	IMPORT_C virtual void CancelAttachmentOperation();
       
   465 
       
   466 	IMPORT_C virtual void CreateMessageL(TMsvId aServiceId);
       
   467 
       
   468 	// BIO functions to support the SendAs API
       
   469 	// Entry().Entry().iBioType will be set by SendAs if this function does not leave.
       
   470 	// The default implementation in CBaseMtm is to do nothing.
       
   471 	IMPORT_C virtual void BioTypeChangedL(TUid aBioTypeUid);
       
   472 	
       
   473  	IMPORT_C virtual TMsvId DefaultServiceL() const;
       
   474  	IMPORT_C virtual void RemoveDefaultServiceL();
       
   475  	IMPORT_C virtual void ChangeDefaultServiceL(const TMsvId& aService);
       
   476  	
       
   477  	//For setting the character encoding value, options are 7-bit, 8-bit and 16-bit Unicode.
       
   478  	IMPORT_C TInt SetMessageCharacterSet(TUint aCharSet);
       
   479 
       
   480 protected:
       
   481 	IMPORT_C CBaseMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aSession);
       
   482 	//
       
   483 	IMPORT_C void StoreBodyL(CMsvStore& aStore);
       
   484 	IMPORT_C void RestoreBodyL(CMsvStore& aStore);
       
   485 	//
       
   486 	/** Called by the base class functions SwitchCurrentEntryL() and SetCurrentEntryL() 
       
   487 	when the context is changed to another entry. 
       
   488 	
       
   489 	Client applications do not use this function. It is relevant only to implementers 
       
   490 	of derived classes.
       
   491 	
       
   492 	Requirements: 
       
   493 	
       
   494 	An implementation should clear:
       
   495 	
       
   496 	1. address data stored in iAddresseeList
       
   497 	
       
   498 	2. any caches of MTM-specific entry data relating to a previous context. For 
       
   499 	example, if the implementation has a private buffer storing a message subject, 
       
   500 	for access through Subject(), this buffer should be cleared. */
       
   501 	virtual void ContextEntrySwitched()=0; // called after the context of this instance has been changed to another entry
       
   502 	//
       
   503 	IMPORT_C void HandleEntryEventL(TMsvEntryEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
       
   504 
       
   505 	// Method used for extension: called by non virtual methods that need 
       
   506 	// to have a polymorphic behaviour.
       
   507 	IMPORT_C virtual TAny* GetInterface(TUid aUid);
       
   508 	
       
   509 	// From CBase
       
   510 	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
       
   511 
       
   512 
       
   513 private:
       
   514 	void DeleteEntry();
       
   515 	
       
   516 	void AddFilePathAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, CMsvAttachment::TMsvAttachmentType aType, TRequestStatus& aStatus);
       
   517 
       
   518 protected:
       
   519 	/** The current context. */
       
   520 	CMsvEntry*		iMsvEntry;
       
   521 	/** The address list for the current context. */
       
   522 	CMsvRecipientList* iAddresseeList;
       
   523 
       
   524 	/** Paragraph formatting applied to the CRichText object for the body text, as 
       
   525 	returned by Body(). This is set to an empty CParaFormatLayer instance whenever 
       
   526 	the context is set.
       
   527 	
       
   528 	Implementations can modify this if they wish to apply particular formatting 
       
   529 	to body text. */
       
   530 	CParaFormatLayer* iParaFormatLayer;
       
   531 	/** Character formatting applied to the CRichText object for the body text, as 
       
   532 	returned by Body().
       
   533 	
       
   534 	Implementations can modify this if they wish to apply particular formatting 
       
   535 	to body text. */
       
   536 	CCharFormatLayer* iCharFormatLayer;
       
   537 	
       
   538 private:
       
   539 	TMsvId	iEntryId;
       
   540 	CRichText* iRichTextBody;
       
   541 	CRegisteredMtmDll& iRegisteredMtmDll;
       
   542 	CMsvSession& iSession;
       
   543 	CMsvAttachmentWaiter* iAttachmentWaiter;
       
   544 
       
   545 	// Extra data member to allow for future extensions
       
   546 	TAny* iExtensionData;
       
   547 	};
       
   548 
       
   549 
       
   550 #endif // __MTCLBASE_H__