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