epoc32/include/mw/fepbase.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
// Copyright (c) 1997-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@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@2
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.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
#ifndef __FEPBASE_H__
williamr@2
    17
#define __FEPBASE_H__
williamr@2
    18
williamr@2
    19
#include <e32std.h>
williamr@2
    20
#include <e32base.h>
williamr@2
    21
#include <f32file.h>
williamr@2
    22
#include <w32std.h>
williamr@2
    23
#include <coedef.h>
williamr@2
    24
#include <coemain.h>
williamr@2
    25
#include <fepbutils.h>
williamr@2
    26
#include <fepbconfig.h>
williamr@2
    27
williamr@2
    28
class CCoeControl;
williamr@2
    29
williamr@2
    30
williamr@2
    31
/** Specifies the mixin protocol for observing a FEP transaction.
williamr@2
    32
williamr@2
    33
Applications which need to implement this protocol should derive from this 
williamr@2
    34
class. The functions are not pure virtual because most applications will only 
williamr@2
    35
need to override one of them.
williamr@2
    36
williamr@2
    37
@see CCoeFep::MakeDeferredFunctionCall() 
williamr@2
    38
@publishedAll 
williamr@2
    39
@released */
williamr@2
    40
class MCoeFepObserver
williamr@2
    41
	{
williamr@2
    42
public:
williamr@2
    43
	// both of these functions do nothing by default - the reason that they are not pure 
williamr@2
    44
	// virtual is that most applications will only want to override one of them
williamr@2
    45
	IMPORT_C virtual void HandleStartOfTransactionL(); // the responsibility of FEPs to call
williamr@2
    46
	IMPORT_C virtual void HandleCompletionOfTransactionL(); // the responsibility of FEPBASE to call - not to be called if the transaction is canceled
williamr@2
    47
private: // reserved. do not override!	
williamr@2
    48
	IMPORT_C virtual void MCoeFepObserver_Reserved_1();
williamr@2
    49
	IMPORT_C virtual void MCoeFepObserver_Reserved_2();
williamr@2
    50
	};
williamr@2
    51
williamr@2
    52
/** Handles the start of a FEP transaction. 
williamr@2
    53
williamr@2
    54
This is a non-member function which just calls aFepObserver.HandleStartOfTransactionL().
williamr@2
    55
williamr@2
    56
It is called indirectly by a FEP to notify the application that it is starting a transaction. 
williamr@2
    57
This is done by calling CCoeEnv::ForEachFepObserverCall() passing in 
williamr@2
    58
FepObserverHandleStartOfTransactionL. Internally, this calls HandleStartOfTransactionL() for 
williamr@2
    59
each MCoeFepObserver object that has been registered with the control environment.
williamr@2
    60
williamr@2
    61
@param aFepObserver The FEP observer.
williamr@2
    62
@see MCoeFepObserver::HandleStartOfTransactionL()
williamr@2
    63
@publishedAll 
williamr@2
    64
@released */
williamr@2
    65
IMPORT_C void FepObserverHandleStartOfTransactionL(MCoeFepObserver& aFepObserver);
williamr@2
    66
williamr@2
    67
williamr@2
    68
/** Abstract base class for all FEPs.
williamr@2
    69
williamr@2
    70
FEP authors must derive a class from CCoeFep. The CCoeFep-derived class should 
williamr@2
    71
implement all of its pure virtual functions including the ones which CCoeFep 
williamr@2
    72
inherits from its base classes. For information on these functions, see the 
williamr@2
    73
documentation of the base classes. The global NewFepL() function is used to 
williamr@2
    74
create a fully initialised object of the derived class. 
williamr@2
    75
williamr@2
    76
FEPs that need to intercept key events should own a CCoeControl-derived object. 
williamr@2
    77
This object is referred to as the FEP control. The FEP control should 
williamr@2
    78
be added to the control stack at a priority of ECoeStackPriorityFep, so that 
williamr@2
    79
it receives first refusal of key events from the window server.
williamr@2
    80
williamr@2
    81
In general, focus is retained by the underlying application. This has the 
williamr@2
    82
advantage that the user can see where the output produced by the FEP will 
williamr@2
    83
go. When focus is switched between controls, the FEP must be notified in case 
williamr@2
    84
the input capability of the focussed control changes. For instance, the FEP 
williamr@2
    85
needs to prevent the user composing a large amount of text only for it to 
williamr@2
    86
be passed to a newly focussed control that cannot accept text input. CCoeFep 
williamr@2
    87
derives from MCoeFocusObserver, which enables FEPs to receive notification 
williamr@2
    88
when the focus for the underlying control changes. The implementation of MCoeFocusObserver's 
williamr@2
    89
functions can call the enquiry functions of class TCoeInputCapabilities to 
williamr@2
    90
find out what input capabilities are supported by the new target control (you 
williamr@2
    91
need to get the TCoeInputCapabilities object from the application UI first: 
williamr@2
    92
see CCoeAppUi::InputCapabilities()).
williamr@2
    93
williamr@2
    94
@see NewFepL() 
williamr@2
    95
@publishedAll 
williamr@2
    96
@released */
williamr@2
    97
class CCoeFep : public CBase, protected MFepAttributeStorer, public MCoeForegroundObserver, public MCoeFocusObserver, private MCoeMessageObserver
williamr@2
    98
	{
williamr@2
    99
public:
williamr@2
   100
	/** Response to key or pointer event */
williamr@2
   101
	enum TEventResponse
williamr@2
   102
		{
williamr@2
   103
		EEventWasNotConsumed,	/** < Indicates that the FEP did not process the event. */
williamr@2
   104
		EEventWasConsumed		/** < Indicates that the FEP did process the event. */
williamr@2
   105
		};
williamr@2
   106
williamr@2
   107
	/** Enables FEPs to have some code called but not in the context of the current 
williamr@2
   108
	call stack, hence the name "deferred".
williamr@2
   109
williamr@2
   110
	For an explanation of the intended use of this class, see 
williamr@2
   111
	CCoeFep::MakeDeferredFunctionCall(). */
williamr@2
   112
	class MDeferredFunctionCall
williamr@2
   113
		{
williamr@2
   114
	public:
williamr@2
   115
		/** This function is called from within a high-priority active object's RunL() 
williamr@2
   116
		shortly after the active object has been queued by calling CCoeFep::MakeDeferredFunctionCall(). */
williamr@2
   117
		virtual void ExecuteFunctionL()=0;
williamr@2
   118
	private: // reserved. do not override!	
williamr@2
   119
		IMPORT_C virtual void MDeferredFunctionCall_Reserved_1();
williamr@2
   120
		IMPORT_C virtual void MDeferredFunctionCall_Reserved_2();
williamr@2
   121
		};
williamr@2
   122
williamr@2
   123
	/** FEPs send character codes to the application underneath them using SimulateKeyEventsL(). 
williamr@2
   124
	Occasionally a FEP may wish to also specify the modifiers (e.g. Fn, Ctrl, 
williamr@2
   125
	Shift) to be sent with that character code. In this case, they should use 
williamr@2
   126
	the overload of CCoeFep::SimulateKeyEventsL() which takes an array of MModifiedCharacters. */
williamr@2
   127
	class MModifiedCharacter
williamr@2
   128
		{
williamr@2
   129
	public:
williamr@2
   130
		/** Returns the character code of the key combination.
williamr@2
   131
		
williamr@2
   132
		@return The character code of the key combination. */
williamr@2
   133
		virtual TUint CharacterCode() const=0;
williamr@2
   134
		/** Returns a TUint which indicates which modifiers to override, rather than using 
williamr@2
   135
		the current state of the keyboard's modifiers.
williamr@2
   136
	
williamr@2
   137
		@return The modifiers to override in the key combination. */
williamr@2
   138
		virtual TUint ModifierMask() const=0;
williamr@2
   139
		/** Returns a TUint which indicates which of the modifiers specified in the mask 
williamr@2
   140
		(returned by ModifierMask()) must be on and which must be off.
williamr@2
   141
	
williamr@2
   142
		@return Indicates which of the modifiers specified in the mask (returned by 
williamr@2
   143
		ModifierMask()) must be on and which must be off. */
williamr@2
   144
		virtual TUint ModifierValues() const=0;
williamr@2
   145
	private: // reserved. do not override!	
williamr@2
   146
		IMPORT_C virtual void MModifiedCharacter_Reserved_1();
williamr@2
   147
		IMPORT_C virtual void MModifiedCharacter_Reserved_2();
williamr@2
   148
		};
williamr@2
   149
williamr@2
   150
public:
williamr@2
   151
	IMPORT_C virtual ~CCoeFep();
williamr@2
   152
	IMPORT_C TBool IsSimulatingKeyEvent() const;
williamr@2
   153
	IMPORT_C TBool IsTurnedOnByL(const TKeyEvent& aKeyEvent) const;
williamr@2
   154
	IMPORT_C TBool IsTurnedOffByL(const TKeyEvent& aKeyEvent) const;
williamr@2
   155
public: // new public virtual functions
williamr@2
   156
	/** Cancels the FEP transaction.
williamr@2
   157
	
williamr@2
   158
	A FEP transaction begins when an event is first intercepted by the FEP and 
williamr@2
   159
	ends either when the processed text is committed to the application underneath, 
williamr@2
   160
	or if it is cancelled. */
williamr@2
   161
	virtual void CancelTransaction()=0;
williamr@2
   162
public:
williamr@2
   163
	IMPORT_C void OnStartingHandlingKeyEvent_WithDownUpFilterLC();
williamr@2
   164
	IMPORT_C void OnStartingHandlingKeyEvent_NoDownUpFilterLC();
williamr@2
   165
	IMPORT_C TKeyResponse OnFinishingHandlingKeyEvent_WithDownUpFilterL(TEventCode aEventCode, const TKeyEvent& aKeyEvent, TKeyResponse aKeyResponse);
williamr@2
   166
	IMPORT_C TKeyResponse OnFinishingHandlingKeyEvent_NoDownUpFilterL(TEventCode aEventCode, const TKeyEvent& aKeyEvent, TKeyResponse aKeyResponse);
williamr@2
   167
protected:
williamr@2
   168
	IMPORT_C CCoeFep(CCoeEnv& aConeEnvironment);
williamr@2
   169
	IMPORT_C void BaseConstructL(const CCoeFepParameters& aFepParameters);
williamr@2
   170
	IMPORT_C void ReadAllAttributesL();
williamr@2
   171
	IMPORT_C void MakeDeferredFunctionCall(MDeferredFunctionCall& aDeferredFunctionCall);
williamr@2
   172
	IMPORT_C void SimulateKeyEventsL(const TArray<TUint>& aArrayOfCharacters);
williamr@2
   173
	IMPORT_C void SimulateKeyEventsL(const TArray<MModifiedCharacter>& aArrayOfModifiedCharacters);
williamr@2
   174
	IMPORT_C void WriteAttributeDataAndBroadcastL(TUid aAttributeUid);
williamr@2
   175
	IMPORT_C void WriteAttributeDataAndBroadcastL(const TArray<TUid>& aAttributeUids);
williamr@2
   176
	IMPORT_C TBool IsOn() const;
williamr@2
   177
public: // not for external use
williamr@2
   178
	void SetOnState(TBool aOnState);
williamr@2
   179
private:
williamr@2
   180
	class CHighPriorityActive;
williamr@2
   181
	class CLowPriorityActive;
williamr@2
   182
	class CCoeFepExtra;
williamr@2
   183
private:
williamr@2
   184
	void DoOnStartingHandlingKeyEventLC(TUint aFlagNoDownUpFilter);
williamr@2
   185
	TKeyResponse DoOnFinishingHandlingKeyEventL(TEventCode aEventCode, const TKeyEvent& aKeyEvent, TKeyResponse aKeyResponse);
williamr@2
   186
	static void TurnOffKeyEventHandlingFlags(TAny* aFlags);
williamr@2
   187
	// from MFepAttributeStorer
williamr@2
   188
	IMPORT_C virtual void MFepAttributeStorer_Reserved_1();
williamr@2
   189
	IMPORT_C virtual void MFepAttributeStorer_Reserved_2();
williamr@2
   190
	// from MCoeForegroundObserver
williamr@2
   191
	IMPORT_C virtual void MCoeForegroundObserver_Reserved_1();
williamr@2
   192
	IMPORT_C virtual void MCoeForegroundObserver_Reserved_2();
williamr@2
   193
	// from MCoeFocusObserver
williamr@2
   194
	IMPORT_C virtual void MCoeFocusObserver_Reserved_1();
williamr@2
   195
	IMPORT_C virtual void MCoeFocusObserver_Reserved_2();
williamr@2
   196
	// from MCoeMessageObserver
williamr@2
   197
	IMPORT_C virtual TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8& aMessageParameters);
williamr@2
   198
	IMPORT_C virtual void MCoeMessageObserver_Reserved_1();
williamr@2
   199
	IMPORT_C virtual void MCoeMessageObserver_Reserved_2();
williamr@2
   200
	// new private virtual functions
williamr@2
   201
	/** Called to notify the FEP that it has either just been turned on or just been 
williamr@2
   202
	turned off (it can find out which by calling CCoeFep::IsOn()). 
williamr@2
   203
	
williamr@2
   204
	If FEPs want to change their appearance when they are off (e.g. make themselves 
williamr@2
   205
	invisible), then they should implement this function accordingly. 
williamr@2
   206
williamr@2
   207
	@publishedAll
williamr@2
   208
	@released */
williamr@2
   209
	virtual void IsOnHasChangedState()=0;
williamr@2
   210
	
williamr@2
   211
	/**
williamr@2
   212
	@deprecated */
williamr@2
   213
	virtual void OfferKeyEventL(TEventResponse& /*aEventResponse*/, const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/){};
williamr@2
   214
williamr@2
   215
	/**
williamr@2
   216
	@deprecated */
williamr@2
   217
	virtual void OfferPointerEventL(TEventResponse& /*aEventResponse*/, const TPointerEvent& /*aPointerEvent*/, const CCoeControl* /*aWindowOwningControl*/){};
williamr@2
   218
williamr@2
   219
	/**
williamr@2
   220
	@deprecated */
williamr@2
   221
	virtual void OfferPointerBufferReadyEventL(TEventResponse& /*aEventResponse*/, const CCoeControl* /*aWindowOwningControl*/){};
williamr@2
   222
private:	// reserved. do not override!	
williamr@2
   223
	IMPORT_C virtual void CCoeFep_Reserved_1();
williamr@2
   224
	IMPORT_C virtual void CCoeFep_Reserved_2();
williamr@2
   225
private:
williamr@2
   226
	class SKeyEvent;
williamr@2
   227
	CCoeEnv& iConeEnvironment;
williamr@2
   228
	TUint iFlags;
williamr@2
   229
	CHighPriorityActive* iHighPriorityActive;
williamr@2
   230
	CCoeFepExtra* iExtra;
williamr@2
   231
	SKeyEvent* iLastKeyEvent;
williamr@2
   232
	TUint iSpare[13];
williamr@2
   233
	};
williamr@2
   234
williamr@2
   235
williamr@2
   236
/** Specifies the mixin protocol for handling pointer events in inline text. 
williamr@2
   237
williamr@2
   238
This class should be overridden by front end processors which support inline editing.
williamr@2
   239
williamr@2
   240
An instance of a class which implements this protocol should be passed to 
williamr@2
   241
MCoeFepAwareTextEditor::StartFepInlineEditL(). 
williamr@2
   242
williamr@2
   243
@publishedAll 
williamr@2
   244
@released */
williamr@2
   245
class MFepPointerEventHandlerDuringInlineEdit // to be overridden by inline-editing front-end processors
williamr@2
   246
	{
williamr@2
   247
public:
williamr@2
   248
	/** This function is called when a pointer event is received within the inline 
williamr@2
   249
	text. It may need to update the cursor position within the inline text and 
williamr@2
   250
	do text selection in response to drag events.
williamr@2
   251
	
williamr@2
   252
	@param aType Pointer event types.
williamr@2
   253
	@param aModifiers Modifier keys (SHIFT, CTRL, FN etc.).
williamr@2
   254
	@param aPositionInInlineText The position at which the pointer event occurred, 
williamr@2
   255
	as an offset from the start of the inline text string. */
williamr@2
   256
	virtual void HandlePointerEventInInlineTextL(TPointerEvent::TType aType, TUint aModifiers, TInt aPositionInInlineText)=0;
williamr@2
   257
private: // reserved. do not override!	
williamr@2
   258
	IMPORT_C virtual void MFepPointerEventHandlerDuringInlineEdit_Reserved_1();
williamr@2
   259
	IMPORT_C virtual void MFepPointerEventHandlerDuringInlineEdit_Reserved_2();
williamr@2
   260
	};
williamr@2
   261
williamr@2
   262
class TCharFormat;
williamr@2
   263
class TCursorSelection;
williamr@2
   264
class MFormCustomDraw;
williamr@2
   265
class MFepInlineTextFormatRetriever;
williamr@2
   266
class MCoeFepAwareTextEditor_Extension1;
williamr@2
   267
williamr@2
   268
williamr@2
   269
/** Specifies a protocol for FEP-aware text editors.
williamr@2
   270
williamr@2
   271
TCoeInputCapabilities::FepAwareTextEditor() returns a pointer to an object 
williamr@2
   272
of this class. A NULL return value indicates that the interface is not supported 
williamr@2
   273
by any of the currently focused controls.
williamr@2
   274
williamr@2
   275
Inline editing means composing text directly in the target text editor control 
williamr@2
   276
rather than in the FEP's edit window first. The target text editor must implement 
williamr@2
   277
the MCoeFepAwareTextEditor interface in order to support inline text. The 
williamr@2
   278
inline text may be differentiated from the surrounding text by the use of 
williamr@2
   279
different formatting. These differences are removed when the inline text transaction 
williamr@2
   280
is committed (causing the inline text to become a real part of the document). 
williamr@2
   281
Cancelling the inline text transaction deletes the inline text and restores 
williamr@2
   282
any previously selected text. A benefit of inline editing is that the user 
williamr@2
   283
only has to concentrate on one area of the screen rather than two. 
williamr@2
   284
williamr@2
   285
An inline editing transaction consists of the following sequence of function 
williamr@2
   286
calls:
williamr@2
   287
williamr@2
   288
- a call to StartFepInlineEditL()
williamr@2
   289
williamr@2
   290
- zero, one or more calls to UpdateFepInlineTextL()
williamr@2
   291
williamr@2
   292
- a call to either CommitFepInlineEditL() or CancelFepInlineEdit() 
williamr@2
   293
williamr@2
   294
@publishedAll 
williamr@2
   295
@released */
williamr@2
   296
class MCoeFepAwareTextEditor // to be overridden by text-editors
williamr@2
   297
	{
williamr@2
   298
public:
williamr@2
   299
	/** 
williamr@2
   300
	Starts a FEP inline editing transaction. 
williamr@2
   301
	
williamr@2
   302
	Inserts a descriptor containing the initial inline text into the text editor. 
williamr@2
   303
	The inline text should normally replace any selected text.
williamr@2
   304
	
williamr@2
   305
	The final three parameters are instances of abstract classes, so that the 
williamr@2
   306
	caller of this function must create and instantiate classes deriving from 
williamr@2
   307
	them. These instances must remain in existence for the entire duration of 
williamr@2
   308
	the inline editing transaction.
williamr@2
   309
	
williamr@2
   310
	Inline editing should not already be taking place when this function is called.
williamr@2
   311
	
williamr@2
   312
	@param aInitialInlineText The inline text to insert into the text editor.
williamr@2
   313
	@param aPositionOfInsertionPointInInlineText An insertion position within the 
williamr@2
   314
	inline text. This is an offset from the start of the inline text.
williamr@2
   315
	@param aCursorVisibility ETrue for visible text cursor, EFalse for invisible 
williamr@2
   316
	text cursor in the text editor.
williamr@2
   317
	@param aCustomDraw Pointer to a custom drawing object. May be used to do advanced 
williamr@2
   318
	formatting of the inline text. This parameter is optional; a NULL pointer 
williamr@2
   319
	may be specified.
williamr@2
   320
	@param aInlineTextFormatRetriever Defines a single member function, GetFormatOfFepInlineText() 
williamr@2
   321
	which is used by the text editor to find out the formatting to apply to the 
williamr@2
   322
	inline text. It is also possible to apply different formatting to different 
williamr@2
   323
	parts of the inline text.
williamr@2
   324
	@param aPointerEventHandlerDuringInlineEdit Defines a single function, HandlePointerEventInInlineTextL() 
williamr@2
   325
	which is called when a pointer event is received within the inline text. This 
williamr@2
   326
	function might update the cursor position within the inline text and do text 
williamr@2
   327
	selection. 
williamr@2
   328
	*/
williamr@2
   329
	virtual void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, 
williamr@2
   330
		TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, 
williamr@2
   331
		MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit)=0;
williamr@2
   332
	/** Updates the inline text. 
williamr@2
   333
	
williamr@2
   334
	Called when a character is added to or deleted from the inline text. 
williamr@2
   335
	
williamr@2
   336
	The descriptor aNewInlineText contains the entire new inline text string, 
williamr@2
   337
	not just the new text to be combined with the old inline text.
williamr@2
   338
	
williamr@2
   339
	@param aNewInlineText Descriptor which holds the entire new inline text string.
williamr@2
   340
	@param aPositionOfInsertionPointInInlineText The position of the insertion 
williamr@2
   341
	point (i.e. the cursor) within the inline text string aNewInlineText. This 
williamr@2
   342
	is an offset from the start of the string. */
williamr@2
   343
	virtual void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText)=0;
williamr@2
   344
	/** Sets the visibility of the text cursor in the text editor.
williamr@2
   345
	
williamr@2
   346
	The cursor visibility is initialised using StartFepInlineEditL(). SetInlineEditingCursorVisibilityL() 
williamr@2
   347
	is provided for FEPs which need to change the visibility of the cursor during 
williamr@2
   348
	the inline editing transaction.
williamr@2
   349
	
williamr@2
   350
	@param aCursorVisibility ETrue for visible text cursor, EFalse for invisible 
williamr@2
   351
	text cursor. */
williamr@2
   352
	virtual void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility)=0;
williamr@2
   353
	IMPORT_C void CommitFepInlineEditL(CCoeEnv& aConeEnvironment);
williamr@2
   354
	/** Cancels the inline editing transaction. 
williamr@2
   355
	
williamr@2
   356
	The edit window should be rolled back to the state it was in before the FEP 
williamr@2
   357
	transaction started, i.e. any inline text in the document which has not yet 
williamr@2
   358
	been committed should be removed. If the inline text has replaced existing text, 
williamr@2
   359
	(e.g. a selection) the replaced text should be reinstated. */
williamr@2
   360
	virtual void CancelFepInlineEdit()=0;
williamr@2
   361
	// with regard to the behaviour of the following functions (except GetScreenCoordinatesForFepL), 
williamr@2
   362
	// note that when inline editing, the contents of the editor will be such that the text constituting 
williamr@2
   363
	// the selection immediately prior to inline editing will be replaced by the inline text 
williamr@2
   364
	// (CancelFepInlineEdit reinstates the previous selection)
williamr@2
   365
	/** Returns the total number of characters in the text editor.
williamr@2
   366
	
williamr@2
   367
	@return The total number of characters in the text editor. */
williamr@2
   368
	virtual TInt DocumentLengthForFep() const=0;
williamr@2
   369
	/** Returns the upper limit (if any) on the length of text that the text editor 
williamr@2
   370
	can hold.
williamr@2
   371
	
williamr@2
   372
	@return The maximum number of characters that the text editor can hold. */
williamr@2
   373
	virtual TInt DocumentMaximumLengthForFep() const=0;
williamr@2
   374
	/** Sets the range of characters in the text editor which should be selected.
williamr@2
   375
	
williamr@2
   376
	@param aCursorSelection Contains the cursor and anchor positions for the selection. */
williamr@2
   377
	virtual void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection)=0;
williamr@2
   378
	/** Gets the range of characters in the text editor which are selected.
williamr@2
   379
	
williamr@2
   380
	@param aCursorSelection On return, contains the cursor and anchor positions 
williamr@2
   381
	of the selection. */
williamr@2
   382
	virtual void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const=0;
williamr@2
   383
	/** Copies a portion of the text editor's text content into a descriptor.
williamr@2
   384
	
williamr@2
   385
	@param aEditorContent A descriptor; on return contains a copy of a portion 
williamr@2
   386
	of the text.
williamr@2
   387
	@param aDocumentPosition The document position in the text editor from which 
williamr@2
   388
	to copy.
williamr@2
   389
	@param aLengthToRetrieve The number of characters to copy. */
williamr@2
   390
	virtual void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const=0;
williamr@2
   391
	/** Gets the character formatting which applies to the document position specified. 
williamr@2
   392
williamr@2
   393
	This function allows FEPs to find out the ambient formatting so that the FEP 
williamr@2
   394
	can choose a format for the inline text that will clearly differentiate it 
williamr@2
   395
	from the surrounding text.
williamr@2
   396
	
williamr@2
   397
	@param aFormat On return, contains the character formatting which applies 
williamr@2
   398
	to the character at aDocumentPosition.
williamr@2
   399
	@param aDocumentPosition The document position of interest. */
williamr@2
   400
	virtual void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const=0;
williamr@2
   401
	/** Gets the x,y screen coordinates for the left hand side of the baseline of the 
williamr@2
   402
	character located at a specified document position. 
williamr@2
   403
williamr@2
   404
	Also gets the height (ascent + descent) and ascent of the font of the character. 
williamr@2
   405
	This function could be used to position the FEP window as close as possible to 
williamr@2
   406
	the insertion point in the text editor.
williamr@2
   407
	
williamr@2
   408
	@param aLeftSideOfBaseLine On return, contains the x,y coordinates of the 
williamr@2
   409
	left side of the baseline of the character located at aDocumentPosition.
williamr@2
   410
	@param aHeight On return, contains the height (ascent + descent) of the font 
williamr@2
   411
	of the character at aDocumentPosition.
williamr@2
   412
	@param aAscent On return, contains the ascent of the font of the character 
williamr@2
   413
	at aDocumentPosition.
williamr@2
   414
	@param aDocumentPosition The document position of interest. */
williamr@2
   415
	virtual void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt aDocumentPosition) const=0;
williamr@2
   416
	
williamr@2
   417
	IMPORT_C MCoeFepAwareTextEditor_Extension1* Extension1();
williamr@2
   418
private:
williamr@2
   419
	/** Private function called by CommitFepInlineEditL(). 
williamr@2
   420
	
williamr@2
   421
	Implementations should commit the inline text to the document. This 
williamr@2
   422
	ends the inline editing transaction and causes the inline text to 
williamr@2
   423
	become a part of the document. 
williamr@2
   424
williamr@2
   425
	@publishedAll
williamr@2
   426
	@released */
williamr@2
   427
	virtual void DoCommitFepInlineEditL()=0;
williamr@2
   428
	IMPORT_C virtual MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
williamr@2
   429
private: // reserved. do not override!	
williamr@2
   430
	IMPORT_C virtual void MCoeFepAwareTextEditor_Reserved_2();
williamr@2
   431
	};
williamr@2
   432
williamr@2
   433
williamr@2
   434
class MLayDoc;
williamr@2
   435
williamr@2
   436
/**
williamr@2
   437
MCoeFepLayDocExtension is an interface class which should be derived from by test editors to
williamr@2
   438
provide access to the current MLayDoc object, and to set a new MLayDoc object.
williamr@2
   439
Used directly from the FEP to decorate the inline edit text, without changing
williamr@2
   440
the actual document text.
williamr@2
   441
williamr@2
   442
@publishedAll 
williamr@2
   443
@released  
williamr@2
   444
*/
williamr@2
   445
class MCoeFepLayDocExtension
williamr@2
   446
	{
williamr@2
   447
public:
williamr@2
   448
	/**
williamr@2
   449
	Retrives the current MLayDoc object from the text editor
williamr@2
   450
	
williamr@2
   451
	@return Pointer to a MLayDoc object.
williamr@2
   452
	*/
williamr@2
   453
	virtual MLayDoc* GetCurrentMLayDoc() const = 0;
williamr@2
   454
	
williamr@2
   455
	/**
williamr@2
   456
	Sets a new MLayDoc object into the CTextLayout object
williamr@2
   457
	
williamr@2
   458
	@param aLayDoc The new layout document
williamr@2
   459
	*/
williamr@2
   460
	virtual void SetMLayDoc(MLayDoc* aLayDoc) = 0;
williamr@2
   461
	
williamr@2
   462
	/**
williamr@2
   463
	Retrives inline edit positioning information from the editor
williamr@2
   464
	@param 	"TInt& aPositionInDocument" 		Position of the text in the document
williamr@2
   465
	@param 	"TInt& aCursorPositionInDocument" 	Position of the cursor in the document
williamr@2
   466
	@param 	"TInt& aSelectionLength"			The number of characters in the selected text
williamr@2
   467
	*/	 
williamr@2
   468
	virtual void GetFepEditorState(TInt& aPositionInDocument, TInt& aCursorPositionInDocument, TInt& aSelectionLength) = 0;
williamr@2
   469
williamr@2
   470
	/**
williamr@2
   471
	Used to tell the editor when the size of the inline edit has changed, so
williamr@2
   472
	the text layout can update itself. Should be called before and after the inline
williamr@2
   473
	edit has been decorated.
williamr@2
   474
	@param     	"TCursorSelection aSelection" 	Position of the line edit from the beginning of the text
williamr@2
   475
    @param     	"TInt aDeletedChars" 			Number of character deleted since the last time the text was formatted.
williamr@2
   476
	
williamr@2
   477
	*/
williamr@2
   478
	virtual void HandleInsertDeleteL(TCursorSelection aSelection,TInt aDeletedChars) = 0;
williamr@2
   479
private: // reserved. do not override!	
williamr@2
   480
	IMPORT_C virtual void MCoeFepLayDocExtension_Reserved_1();
williamr@2
   481
	IMPORT_C virtual void MCoeFepLayDocExtension_Reserved_2();
williamr@2
   482
	};
williamr@2
   483
williamr@2
   484
williamr@2
   485
/** An interface class which may be derived from by text editors to enable FEPs 
williamr@2
   486
to store state information inside the editor. 
williamr@2
   487
To be overridden by text-editors
williamr@2
   488
williamr@2
   489
The CState class, defined within the scope of MCoeFepAwareTextEditor_Extension1 
williamr@2
   490
represents the state information. This is information specific to the control 
williamr@2
   491
which is only of interest to the FEP.
williamr@2
   492
williamr@2
   493
A class which implements this interface must implement the pure virtual functions 
williamr@2
   494
State() and SetStateTransferingOwnershipL() , to get and set the state. The 
williamr@2
   495
class should also implement the MCoeFepAwareTextEditor interface. It must 
williamr@2
   496
override the private virtual MCoeFepAwareTextEditor::Extension1() to return 
williamr@2
   497
a pointer to itself (the default implementation returns NULL). The private 
williamr@2
   498
virtual MCoeFepAwareTextEditor::Extension1() function is called by the public, 
williamr@2
   499
non-virtual MCoeFepAwareTextEditor::Extension1() function.
williamr@2
   500
williamr@2
   501
For example, if a FEP wants to set some state information in a text editor 
williamr@2
   502
which is about to lose focus, the FEP should first call the editor's Extension1() 
williamr@2
   503
function. If this returns non-NULL, the FEP should call the editor's implementation 
williamr@2
   504
of SetStateTransferingOwnershipL() , passing in an object of a class derived 
williamr@2
   505
from CState , which holds the state information. It should also pass in a 
williamr@2
   506
UID which uniquely identifies the FEP. Later, when focus returns to the editor, 
williamr@2
   507
the FEP can call State() to retrieve the state information it previously set. 
williamr@2
   508
Note that CState has several reserved functions, to enable it to be extended 
williamr@2
   509
in future, while retaining backwards compatibility. 
williamr@2
   510
williamr@2
   511
@publishedAll 
williamr@2
   512
@released */
williamr@2
   513
class MCoeFepAwareTextEditor_Extension1 
williamr@2
   514
	{
williamr@2
   515
public:
williamr@2
   516
	class CState : public CBase
williamr@2
   517
	/** State information for a text editor control. 
williamr@2
   518
	This is information specific to the control which is only of interest to the 
williamr@2
   519
	FEP which sets it. */
williamr@2
   520
		{
williamr@2
   521
	protected:
williamr@2
   522
		IMPORT_C CState();
williamr@2
   523
		IMPORT_C void BaseConstructL();
williamr@2
   524
	public:
williamr@2
   525
		IMPORT_C virtual ~CState();
williamr@2
   526
	private: // reserved. do not override!	
williamr@2
   527
		IMPORT_C virtual void CState_Reserved_1();
williamr@2
   528
		IMPORT_C virtual void CState_Reserved_2();
williamr@2
   529
		IMPORT_C virtual void CState_Reserved_3();
williamr@2
   530
		IMPORT_C virtual void CState_Reserved_4();
williamr@2
   531
	private:
williamr@2
   532
		TAny* iSpareForFutureUse;
williamr@2
   533
		};
williamr@2
   534
public:
williamr@2
   535
	/** Sets state information in the text editor.
williamr@2
   536
	
williamr@2
   537
	This function must only transfer ownership of the state object after it has 
williamr@2
   538
	successfully done everything that can leave.
williamr@2
   539
	
williamr@2
   540
	@param aState Pointer to the state information object.
williamr@2
   541
	@param aTypeSafetyUid A UID which uniquely identifies the FEP which is calling 
williamr@2
   542
	this function. The text editor should store this value for use by the State() 
williamr@2
   543
	function. */
williamr@2
   544
	virtual void SetStateTransferingOwnershipL(CState* aState, TUid aTypeSafetyUid)=0; // this function must only transfer ownership after it has successfully done everything that can leave
williamr@2
   545
	/** Gets the state information previously set using SetStateTransferingOwnershipL(). 
williamr@2
   546
williamr@2
   547
	This function does not transfer ownership. The function should first check 
williamr@2
   548
	that aTypeSafetyUid matches the UID value previously specified by SetStateTransferingOwnershipL(). 
williamr@2
   549
	If it doesn't match, the function should return NULL.
williamr@2
   550
	
williamr@2
   551
	@param aTypeSafetyUid A UID which uniquely identifies the FEP which is calling 
williamr@2
   552
	this function. The purpose of this is to enable the FEP to safely downcast 
williamr@2
   553
	the CState pointer returned by this function to a pointer to a derived class 
williamr@2
   554
	known about by the FEP.
williamr@2
   555
	@return Pointer to the state information object. */
williamr@2
   556
	virtual CState* State(TUid aTypeSafetyUid)=0;
williamr@2
   557
public:
williamr@2
   558
	/** Updates the inline text. 
williamr@2
   559
	
williamr@2
   560
	Called when a character is added to or deleted from the inline text. 
williamr@2
   561
	
williamr@2
   562
	The descriptor aNewInlineText contains the entire new inline text string, 
williamr@2
   563
	not just the new text to be combined with the old inline text.
williamr@2
   564
	
williamr@2
   565
	@param aSetToTrue 		Boolean set to EFalse by the caller and subsequently to ETrue by the function indicating that
williamr@2
   566
							this is the implemented version and not the previous reserved funtion.
williamr@2
   567
	@param aCursorSelection The position of any hilighted text.
williamr@2
   568
	@param aNewInlineText 	Descriptor which holds the entire new inline text string.
williamr@2
   569
	@param aPositionOfInsertionPointInInlineText 
williamr@2
   570
	The position of the insertion point (i.e. the cursor) within the inline text string aNewInlineText. 
williamr@2
   571
	This is an offset from the start of the string. 
williamr@2
   572
	*/
williamr@2
   573
	IMPORT_C virtual void StartFepInlineEditL(TBool& aSetToTrue, const TCursorSelection& aCursorSelection, 
williamr@2
   574
		const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, 
williamr@2
   575
		const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, 
williamr@2
   576
		MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit);
williamr@2
   577
	
williamr@2
   578
	/** Changes the cursor displayed to indicate different modes of operation. For example how text is enterered
williamr@2
   579
	@param aSetToTrue 		Boolean set to EFalse by the caller and subsequently to ETrue by the function indicating that
williamr@2
   580
							this is the implemented version and not the previously reserved funtion.
williamr@2
   581
	@param aTextCursor		The new cursor to be displayed.
williamr@2
   582
	*/	
williamr@2
   583
	IMPORT_C virtual void SetCursorType(TBool& aSetToTrue, const TTextCursor& aTextCursor);
williamr@2
   584
	
williamr@2
   585
	/**
williamr@2
   586
	Retrieves the current MCoeFepLayDocExtension object from the text editor
williamr@2
   587
	@param aSetToTrue 		Boolean set to EFalse by the caller and subsequently to ETrue by the function indicating that
williamr@2
   588
							this is the implemented version and not the previously reserved funtion.
williamr@2
   589
	*/
williamr@2
   590
	IMPORT_C virtual MCoeFepLayDocExtension* GetFepLayDocExtension(TBool& aSetToTrue);
williamr@2
   591
private: // reserved. do not override!	
williamr@2
   592
	IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_4();
williamr@2
   593
	};
williamr@2
   594
williamr@2
   595
williamr@2
   596
/** Retrieves a control's caption for use by a FEP. 
williamr@2
   597
williamr@2
   598
An example of a caption is the non-editable text description displayed 
williamr@2
   599
alongside each item in a dialog.
williamr@2
   600
williamr@2
   601
TCoeInputCapabilities::CaptionRetrieverForFep() returns a pointer to an object 
williamr@2
   602
of this class. A NULL return value indicates that the interface is not supported 
williamr@2
   603
by any of the currently focused controls. If not NULL, call GetCaptionForFep(), 
williamr@2
   604
which fills the supplied buffer with the control's caption, truncating it 
williamr@2
   605
if the supplied buffer is too small for the whole caption. 
williamr@2
   606
williamr@2
   607
@publishedAll
williamr@2
   608
@released */
williamr@2
   609
class MCoeCaptionRetrieverForFep // to be overridden by captioned-controls
williamr@2
   610
	{
williamr@2
   611
public:
williamr@2
   612
	/** An implementation of this function should fill aCaption with the target control's 
williamr@2
   613
	caption (or as much of the caption as will fit).
williamr@2
   614
	
williamr@2
   615
	For example, code similar to the following might be used (assuming that your caption is 
williamr@2
   616
	stored internally in iCaption):
williamr@2
   617
	
williamr@2
   618
	@code
williamr@2
   619
	const TInt maximumLength=aCaption.MaxLength();
williamr@2
   620
	if (iCaption.Length()>maximumLength)
williamr@2
   621
	    aCaption=iCaption.Left(maximumLength);
williamr@2
   622
	else
williamr@2
   623
	    aCaption=iCaption;
williamr@2
   624
williamr@2
   625
	@endcode
williamr@2
   626
	@param aCaption On return, this should be set to the caption of the target 
williamr@2
   627
	control. */
williamr@2
   628
	virtual void GetCaptionForFep(TDes& aCaption) const=0; // gets as much as will fit in aCaption
williamr@2
   629
private: // reserved. do not override!	
williamr@2
   630
	IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_1();
williamr@2
   631
	IMPORT_C virtual void MCoeCaptionRetrieverForFep_Reserved_2();
williamr@2
   632
	};
williamr@2
   633
williamr@2
   634
#endif	// __FEPBASE_H__
williamr@4
   635