epoc32/include/mw/eikedwin.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
 
williamr@2
    19
#if !defined(__EIKEDWIN_H__)
williamr@2
    20
#define __EIKEDWIN_H__
williamr@2
    21
williamr@2
    22
#include <s32std.h>
williamr@2
    23
#include <gdi.h>
williamr@2
    24
#include <txtetext.h>
williamr@2
    25
#include <medobsrv.h>
williamr@2
    26
#include <gulutil.h>
williamr@2
    27
#include <fepbase.h>
williamr@2
    28
#include <frmvis.h>
williamr@2
    29
#include <frmtview.h>
williamr@2
    30
#include <uikon.hrh>
williamr@2
    31
#include <eikon.hrh>
williamr@2
    32
#include <eikbctrl.h>
williamr@2
    33
#include <eikedwob.h>
williamr@2
    34
#include <eiksbfrm.h>
williamr@2
    35
#include <eikccpu.h>
williamr@2
    36
#include <eiklay.h>
williamr@2
    37
#include <lafmain.h>
williamr@2
    38
#include <AknPictographDrawerInterface.h>
williamr@2
    39
#include <babitflags.h>
williamr@2
    40
#include <centralrepository.h>          // class CCenRepNotifyHandler;
williamr@2
    41
#include <cenrepnotifyhandler.h>        // class CRepository;
williamr@2
    42
williamr@2
    43
class CGlobalText;
williamr@2
    44
class CParaFormatLayer;
williamr@2
    45
class CCharFormatLayer;
williamr@2
    46
class MLayDoc;
williamr@2
    47
class CEikEdwinFepSupport;
williamr@2
    48
class CLafEdwinCustomDrawBase;
williamr@2
    49
class CClipboard;
williamr@2
    50
class CAknEdwinFormAccessor;
williamr@2
    51
class CAknEdwinState;
williamr@2
    52
class CAknInputPolicyManager;
williamr@2
    53
class CFormCursorModifier;
williamr@2
    54
class CTextView;
williamr@2
    55
class MAknsControlContext;
williamr@2
    56
class CAknEdwinDrawingModifier;
williamr@2
    57
class CAknEdwinFormExtendedInterfaceProvider;
williamr@2
    58
class CAknPhoneNumberInlineTextSource;
williamr@2
    59
class CAknNoMatchesIndicatorInlineTextSource;
williamr@2
    60
class CAknInlineTextSource;
williamr@2
    61
class CAknPictographInterface;
williamr@2
    62
class CAknExtendedInputCapabilities;
williamr@2
    63
class CAknPointerEventSuppressor;
williamr@2
    64
class CSmileyManager;
williamr@2
    65
class CSmileyCustomWrap;
williamr@2
    66
williamr@2
    67
// Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
williamr@2
    68
class CEikAvkonCustomDraw;
williamr@2
    69
williamr@2
    70
// Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
williamr@2
    71
class CEikAvkonCustomDraw;
williamr@2
    72
williamr@2
    73
// For construction of Rich Text - based custom formatters
williamr@2
    74
class CRichText;
williamr@2
    75
williamr@2
    76
enum TReplaceOption
williamr@2
    77
	{
williamr@2
    78
	ENoReplace,
williamr@2
    79
	EReplaceOnce,
williamr@2
    80
	EReplaceAll,
williamr@2
    81
	EReplaceSkip
williamr@2
    82
	};
williamr@2
    83
williamr@2
    84
/**
williamr@2
    85
 * This describes the features of a
williamr@2
    86
 * search-and-replace operation on a CEikEdwin.
williamr@2
    87
 * 
williamr@2
    88
 * See CEikEdwin::ReplaceL().
williamr@2
    89
 */
williamr@2
    90
struct SEdwinFindModel
williamr@2
    91
	{
williamr@2
    92
	/** Flags for the search (see CEikEdwin::TFindFlags) */
williamr@2
    93
	TInt iFlags; // TEdwinFindFlags
williamr@2
    94
	/** Text to search for. */
williamr@2
    95
	TBuf<EEikEdwinFindStringMaxLen> iText;
williamr@2
    96
	/** Text to replace it with. */
williamr@2
    97
	TBuf<EEikEdwinFindStringMaxLen> iReplaceText;
williamr@2
    98
	/** Replace options. */
williamr@2
    99
	TReplaceOption iReplaceOption;
williamr@2
   100
	};
williamr@2
   101
williamr@2
   102
/**
williamr@2
   103
 * Styles for highlighting. See SetHighlightStyleL().
williamr@2
   104
 */
williamr@2
   105
enum TAknsHighlightStyle
williamr@2
   106
    {
williamr@2
   107
    /** Normal highlighting. */
williamr@2
   108
    EEikEdwinHighlightNormal = 0,
williamr@2
   109
    /** Link highlighting. */
williamr@2
   110
    EEikEdwinHighlightLink
williamr@2
   111
    };
williamr@2
   112
williamr@2
   113
// inline utility to handle RGB values (set / unset)      
williamr@2
   114
williamr@2
   115
class SAknRgb
williamr@2
   116
    {
williamr@2
   117
// data (private)    
williamr@2
   118
    TRgb iValue;
williamr@2
   119
    TBool iIsSet;
williamr@2
   120
public: // utilities   
williamr@2
   121
    SAknRgb():iIsSet(EFalse){}
williamr@2
   122
    TRgb Value(){return iValue;}
williamr@2
   123
    SAknRgb& operator=(TRgb aRgb)
williamr@2
   124
        {
williamr@2
   125
        iValue = aRgb;
williamr@2
   126
        iIsSet = ETrue;
williamr@2
   127
        return *this;
williamr@2
   128
        }
williamr@2
   129
    TBool IsSet(){return iIsSet;}
williamr@2
   130
    };    
williamr@2
   131
williamr@2
   132
/** 
williamr@2
   133
 * Base class for controls that display and allow manipulation of text.
williamr@2
   134
 *
williamr@2
   135
 * The properties of a particular Edwin object can be set using bitwise flags, 
williamr@2
   136
 * which are defined in member enums (see @c TFlags for example).
williamr@2
   137
 *
williamr@2
   138
 * Edwins support Front End Processors, and so are a highly effective way of 
williamr@2
   139
 * getting textual data from the user. The text currently being composed by the
williamr@2
   140
 * user is called the composition text.
williamr@2
   141
 */
williamr@2
   142
class CEikEdwin : public CEikBorderedControl, 
williamr@2
   143
                  public MEikScrollBarObserver, 
williamr@2
   144
                  public CTextView::MObserver, 
williamr@2
   145
                  public MEditObserver, 
williamr@2
   146
                  public MEikCcpuEditor
williamr@2
   147
	{
williamr@2
   148
williamr@2
   149
private:
williamr@2
   150
williamr@2
   151
    class CUndoBuffer;
williamr@2
   152
    NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback
williamr@2
   153
        {
williamr@2
   154
    public:
williamr@2
   155
        /**
williamr@2
   156
         * Allocates and constructs a CEikEdwinExtension.
williamr@2
   157
         *
williamr@2
   158
         * @param aEdwin Pointer to the CEikEdwin creating the extension.
williamr@2
   159
         * @return A newly constructed edwin extension.
williamr@2
   160
         */
williamr@2
   161
		static CEikEdwinExtension* NewL(CEikEdwin* aEdwin);
williamr@2
   162
		
williamr@2
   163
		/**
williamr@2
   164
		 * Destructor.
williamr@2
   165
		 */
williamr@2
   166
		~CEikEdwinExtension();
williamr@2
   167
		
williamr@2
   168
		/**
williamr@2
   169
		 * Gets the form accessor.
williamr@2
   170
		 *
williamr@2
   171
		 * @return The form accessor.
williamr@2
   172
		 */
williamr@2
   173
		IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
williamr@2
   174
		
williamr@2
   175
		/**
williamr@2
   176
		 * Sets the form accessor.
williamr@2
   177
		 *
williamr@2
   178
		 * @param aFormAccessor The form accessor.
williamr@2
   179
		 */
williamr@2
   180
		IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
williamr@2
   181
		
williamr@2
   182
		/**
williamr@2
   183
		 * Sets the CIdle object to update scroll bar.
williamr@2
   184
		 *
williamr@2
   185
		 * @param The CIdle object to perform scroll bar updating.
williamr@2
   186
		 */
williamr@2
   187
		IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter);
williamr@2
   188
		
williamr@2
   189
		/**
williamr@2
   190
		 * Gets the CIdle object which updates scroll bar.
williamr@2
   191
		 *
williamr@2
   192
		 * @return The CIdle object used to perform scroll bar updating.
williamr@2
   193
		 */
williamr@2
   194
		IMPORT_C CIdle* ScrollBarSetter();
williamr@2
   195
		
williamr@2
   196
		/**
williamr@2
   197
		 * Gets the custom wrapper.
williamr@2
   198
		 *
williamr@2
   199
		 * @return The custom wrapper.
williamr@2
   200
		 */
williamr@2
   201
		IMPORT_C const TAvkonEditorCustomWrap& TextWrapper();
williamr@2
   202
williamr@2
   203
		// the following two methods are deprecated
williamr@2
   204
        IMPORT_C CFormCursorModifier* FormCursorModifier() const;
williamr@2
   205
        
williamr@2
   206
        /**
williamr@2
   207
        * Store a locally stored (but externally set) Skins background control context.
williamr@2
   208
        *
williamr@2
   209
        * @param aBackgroundControlContext   Control context to store. Not owned. Can be NULL.
williamr@2
   210
        */
williamr@2
   211
        void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext );
williamr@2
   212
        
williamr@2
   213
        /**
williamr@2
   214
        * Access to locally stored Skins background control context.
williamr@2
   215
        * 
williamr@2
   216
        * @return Pointer to locally stored control context
williamr@2
   217
        */
williamr@2
   218
        
williamr@2
   219
        MAknsControlContext* SkinBackgroundControlContext() const;
williamr@2
   220
        
williamr@2
   221
        /**
williamr@2
   222
        * This returns a flag that records whether the background context has ever been 
williamr@2
   223
        * set by API.
williamr@2
   224
        *
williamr@2
   225
        * @return   EFalse iff control context has never been set.
williamr@2
   226
        */
williamr@2
   227
        TBool SkinBackgroundControlContextHasBeenSet() const;
williamr@2
   228
williamr@2
   229
        /**
williamr@2
   230
        * Stores the alignment value.
williamr@2
   231
        *
williamr@2
   232
        * @param aAlignment   Editor alignment to be stored.
williamr@2
   233
        */
williamr@2
   234
        void SetAlignment(TInt aAlignment);
williamr@2
   235
williamr@2
   236
        /**
williamr@2
   237
        * Returns the stored alignment value.
williamr@2
   238
        *
williamr@2
   239
        * @return Value of the current editor alignment.
williamr@2
   240
        */
williamr@2
   241
        TInt CurrentAlignment() const;
williamr@2
   242
williamr@2
   243
        /**
williamr@2
   244
        * Sets pictograph animation callback.
williamr@2
   245
        */
williamr@2
   246
        void SetPictoCallBack( TCallBack& aCallBack );
williamr@2
   247
williamr@2
   248
        /**
williamr@2
   249
        * Sets pictograph animation callback.
williamr@2
   250
        */
williamr@2
   251
        const TCallBack& PictoCallBack() const;
williamr@2
   252
williamr@2
   253
        /**
williamr@2
   254
        * Creates the CAknFormExtendedInterfaceProvider object if it does not exist.
williamr@2
   255
        */
williamr@2
   256
        void CreateFormExtendedInterfaceProviderIfNeededL();
williamr@2
   257
williamr@2
   258
        /**
williamr@2
   259
        * Access to Form's extended interface provider.
williamr@2
   260
        */
williamr@2
   261
        CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const;
williamr@2
   262
williamr@2
   263
        /**
williamr@2
   264
        * Create a custom formatter for pure phone number content.
williamr@2
   265
        *
williamr@2
   266
        * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
williamr@2
   267
        * ExtendedInterfaceProvider object built.
williamr@2
   268
        *
williamr@2
   269
        * @param    aTextLayout     Reference to the CTextLayout object used for this editor.
williamr@2
   270
        *           aText           CPlainText object reference for the text used in the editor.
williamr@2
   271
        */
williamr@2
   272
        void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText);
williamr@2
   273
williamr@2
   274
        /**
williamr@2
   275
        * Create a custom formatter for pure phone number content.
williamr@2
   276
        *
williamr@2
   277
        * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
williamr@2
   278
        * ExtendedInterfaceProvider object built.
williamr@2
   279
        *
williamr@2
   280
        * @param    aTextLayout     Reference to the CTextLayout object used for this editor
williamr@2
   281
        */
williamr@2
   282
        void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout );
williamr@2
   283
williamr@2
   284
        /**
williamr@2
   285
        * Create a custom formatter for rich text editor with general content. Phone numbers are
williamr@2
   286
        * recognized using an internal parser and formatted with the number grouping engine
williamr@2
   287
        *
williamr@2
   288
        * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
williamr@2
   289
        * ExtendedInterfaceProvider object built.
williamr@2
   290
        *
williamr@2
   291
        * @param    aTextLayout     Reference to the CTextLayout object used for this editor
williamr@2
   292
        */
williamr@2
   293
        void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText );
williamr@2
   294
williamr@2
   295
        /**
williamr@2
   296
        * This allows the caller to access the single inline text interface that will be seen
williamr@2
   297
        * by Tagma.  All installed inline text source classes are held behind this single interface
williamr@2
   298
        * 
williamr@2
   299
        * @return   pointer to the inline text source object that will be provided to Tagma
williamr@2
   300
        *           Null is returned if none is installed.
williamr@2
   301
        */
williamr@2
   302
        CAknInlineTextSource* InlineTextSource() const;
williamr@2
   303
williamr@2
   304
        /**
williamr@2
   305
        * Returns pointer to pictograph interface.
williamr@2
   306
        *
williamr@2
   307
        * @return Pointer to pictograph interface. The value can be NULL if pictographs are not supported.
williamr@2
   308
        */
williamr@2
   309
        CAknPictographInterface* PictographInterface() const;
williamr@2
   310
        
williamr@2
   311
        /**
williamr@2
   312
        * Used for suppressing all editor's background drawing.
williamr@2
   313
        */
williamr@2
   314
        void SetSuppressBackgroundDrawing( TBool aSuppress );
williamr@2
   315
        
williamr@2
   316
        /**
williamr@2
   317
        * Tests if the background drawing is suppressed.
williamr@2
   318
        */
williamr@2
   319
        TBool IsBackgroundDrawingSuppressed() const;
williamr@2
   320
williamr@2
   321
        /**
williamr@2
   322
        * Returns the value of ClearDirection
williamr@2
   323
        *
williamr@2
   324
        * @return value of current ClearDirection
williamr@2
   325
        */
williamr@2
   326
        TInt ClearDirection() const;
williamr@2
   327
williamr@2
   328
    public: // from MCenRepNotifyHandlerCallback
williamr@2
   329
        void HandleNotifyInt(TUint32 aId, TInt aNewValue);
williamr@2
   330
williamr@2
   331
    private:
williamr@2
   332
williamr@2
   333
        CEikEdwinExtension();
williamr@2
   334
        void ConstructL(CEikEdwin* aEdwin);
williamr@2
   335
williamr@2
   336
    private:
williamr@2
   337
williamr@2
   338
        enum TFlagIndices
williamr@2
   339
            {
williamr@2
   340
            ESkinBackgroundControlContextHasBeenSetIndex = 0,
williamr@2
   341
            ESuppressBackgroundDrawing
williamr@2
   342
            };
williamr@2
   343
        class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack
williamr@2
   344
            {
williamr@2
   345
            private: // From MAknPictographAnimatorCallBack
williamr@2
   346
                void DrawPictographArea();
williamr@2
   347
            };        
williamr@2
   348
        
williamr@2
   349
	private:
williamr@2
   350
williamr@2
   351
		CIdle* iSetScrollBar;
williamr@2
   352
		TAvkonEditorCustomWrap iTextWrapper;
williamr@2
   353
		CAknEdwinFormAccessor* iFormAccessor;
williamr@2
   354
        CFormCursorModifier* iFormCursorModifier;
williamr@2
   355
        MAknsControlContext* iSkinBackgroundControlContext;
williamr@2
   356
        TBitFlags iFlags;
williamr@2
   357
        TInt iAlignment;
williamr@2
   358
        TCallBack iPictoCallBack;       
williamr@2
   359
        CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned
williamr@2
   360
        CAknInlineTextSource* iPhoneNumberFormatter;                 // Not owned
williamr@2
   361
        CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter;   // Not owned
williamr@2
   362
        TAknEdwinPictographDrawer iPictographDrawer;
williamr@2
   363
        CAknPictographInterface* iPictographInterface;
williamr@2
   364
        // For clear direction.
williamr@2
   365
        CRepository* iCenRep;                           // Owned
williamr@2
   366
        CCenRepNotifyHandler* iCenRepNotifyHandler;     // Owned
williamr@2
   367
        TInt iClearDirection;                           // Value of ClearDirection
williamr@2
   368
     public:
williamr@2
   369
williamr@2
   370
        TInt iSkinIdForText;
williamr@2
   371
        TAknsHighlightStyle iSkinHighlightStyle;
williamr@2
   372
        SAknRgb iEditorBackgroundColor;
williamr@2
   373
        TInt iUpperFullFormattingLength;
williamr@2
   374
        CAknExtendedInputCapabilities* iExtendedInputCapabilities;
williamr@2
   375
        TRect iTextLinesRect;
williamr@2
   376
        TRect iScrollRect;
williamr@2
   377
        TInt iTempCursorPos;
williamr@2
   378
        TInt iTempAnchorPos;
williamr@2
   379
        TInt iTempSelect;
williamr@2
   380
        CAknPointerEventSuppressor* iPtSuppressor;
williamr@2
   381
        TBool iDragging;
williamr@2
   382
        TInt iRecordCursor;
williamr@2
   383
        TBool iRecordScroll;
williamr@2
   384
        /**
williamr@2
   385
        * @c iDestroyedPtr is used for the object destruction check.
williamr@2
   386
        * If it has non-null value, the destruction check is turned on, and
williamr@2
   387
        * the value points to a local boolean variable that keeps the destroyed state.
williamr@2
   388
        */
williamr@2
   389
        TBool* iDestroyedPtr;
williamr@2
   390
        enum TDrawState
williamr@2
   391
            {
williamr@2
   392
            ENotDraw = 0,
williamr@2
   393
            EDrawn,
williamr@2
   394
            EDrawing
williamr@2
   395
            };
williamr@2
   396
        TInt iDrawInvoked;
williamr@2
   397
        TInt iThumbPos;        
williamr@2
   398
#ifdef FF_AVKON_EMOTION_ICON_ENABLED
williamr@2
   399
        // own
williamr@2
   400
        CSmileyManager* iSmiley;        
williamr@2
   401
        CSmileyCustomWrap* iSmileyWrap;
williamr@2
   402
        TBool iInlineEditing;
williamr@2
   403
        TBool iDisableConvertInFormat;
williamr@2
   404
#endif
williamr@2
   405
		};
williamr@2
   406
williamr@2
   407
public:
williamr@2
   408
williamr@2
   409
    /**
williamr@2
   410
     * The following flags may be combined with a bitwise OR to form the 
williamr@2
   411
     * @c aEdwinFlags argument to @c ConstructL(TInt, ...) or the flags field 
williamr@2
   412
     * of an EDWIN resource structure run through @c ConstructFromResourceL().
williamr@2
   413
     *
williamr@2
   414
     * These flags are duplicated in @c uikon.hrh (see @c EEikEdwinKeepDocument
williamr@2
   415
     * etc.)
williamr@2
   416
     */
williamr@2
   417
    enum TFlags
williamr@2
   418
        { // user flags
williamr@2
   419
        /**  */
williamr@2
   420
    	EZeroEnumValue			=0x00000000, 
williamr@2
   421
williamr@2
   422
        /** 
williamr@2
   423
         * If set, @c CEikEdwin does not destroy its content on destruction. 
williamr@2
   424
         */
williamr@2
   425
    	EKeepDocument			=0x00000001,
williamr@2
   426
williamr@2
   427
        /** 
williamr@2
   428
         * If set, the content buffer uses segmented storage (see 
williamr@2
   429
         * @c CEditableText::ESegmentedStorage).
williamr@2
   430
         */
williamr@2
   431
    	ESegmentedStorage		=0x00000002,
williamr@2
   432
williamr@2
   433
        /**
williamr@2
   434
         * The size specified in the resource used to construct the object is 
williamr@2
   435
         * given in pixels, not character widths.
williamr@2
   436
         */
williamr@2
   437
    	EWidthInPixels			=0x00000004,
williamr@2
   438
williamr@2
   439
        /**
williamr@2
   440
         * No automatic selection takes place. Normally the entire text is 
williamr@2
   441
         * selected whenever the Edwin is created, resized or has its text 
williamr@2
   442
         * set as one operation.
williamr@2
   443
         */
williamr@2
   444
    	ENoAutoSelection		=0x00000008,
williamr@2
   445
williamr@2
   446
        /**
williamr@2
   447
         * If set, then whenever the control is activated the cursor is 
williamr@2
   448
         * moved to the end of the text.
williamr@2
   449
         */
williamr@2
   450
    	EJustAutoCurEnd			=0x00000010,
williamr@2
   451
williamr@2
   452
        /**
williamr@2
   453
         * Does not wrap the text being edited.
williamr@2
   454
         */
williamr@2
   455
    	ENoWrap					=0x00000020,
williamr@2
   456
williamr@2
   457
        /**
williamr@2
   458
         * Uses a line cursor instead of a block cursor.
williamr@2
   459
         */
williamr@2
   460
    	ELineCursor				=0x00000040, 
williamr@2
   461
williamr@2
   462
        /**
williamr@2
   463
         * Does not perform horizontal scrolling.
williamr@2
   464
         */
williamr@2
   465
    	ENoHorizScrolling		=0x00000080, 
williamr@2
   466
williamr@2
   467
        /**
williamr@2
   468
         * If set, scroll bars required to edit long documents appear inside 
williamr@2
   469
         * the Edwin. This reduces the area used to display the Edwin.
williamr@2
   470
         * 
williamr@2
   471
         * If not set, scroll bars appear outside the Edwin.
williamr@2
   472
         */
williamr@2
   473
    	EInclusiveSizeFixed		=0x00000100, 
williamr@2
   474
williamr@2
   475
        /**
williamr@2
   476
         * Sets the Edwin’s height according to the number of lines of text 
williamr@2
   477
         * supplied by the user.
williamr@2
   478
         */
williamr@2
   479
    	EUserSuppliedText		=0x00000200,
williamr@2
   480
williamr@2
   481
        /**
williamr@2
   482
         * The Edwin is a window-owning control.
williamr@2
   483
         */
williamr@2
   484
    	EOwnsWindow				=0x00000400,
williamr@2
   485
williamr@2
   486
        /**
williamr@2
   487
         * The Edwin does not respond to input at all.
williamr@2
   488
         */
williamr@2
   489
    	EDisplayOnly			=0x00000800,
williamr@2
   490
williamr@2
   491
        /**
williamr@2
   492
         * Does not hide the selection if the Edwin loses focus.
williamr@2
   493
         */
williamr@2
   494
    	EAlwaysShowSelection	=0x00001000,
williamr@2
   495
williamr@2
   496
        /**
williamr@2
   497
         * The Edwin is read-only so users cannot add text to any document it 
williamr@2
   498
         * displays.
williamr@2
   499
         */
williamr@2
   500
    	EReadOnly				=0x00002000,
williamr@2
   501
williamr@2
   502
        /**
williamr@2
   503
         * If set, no special attempt will be made to delete the embedded pictures cleanly.
williamr@2
   504
         * 
williamr@2
   505
         * This flag does not apply to Edwins which do not edit rich text.
williamr@2
   506
         */
williamr@2
   507
    	EAllowPictures			=0x00004000,
williamr@2
   508
williamr@2
   509
        /**
williamr@2
   510
         * The Edwin supports undo operations.
williamr@2
   511
         */
williamr@2
   512
    	EAllowUndo				=0x00008000,
williamr@2
   513
williamr@2
   514
        /**
williamr@2
   515
         * Does not allow line or paragraph breaks in the text being edited.
williamr@2
   516
         */
williamr@2
   517
    	ENoLineOrParaBreaks		=0x00010000,
williamr@2
   518
williamr@2
   519
        /**
williamr@2
   520
         * Allows only ASCII characters.
williamr@2
   521
         */
williamr@2
   522
    	EOnlyASCIIChars			=0x00020000,
williamr@2
   523
williamr@2
   524
        /**
williamr@2
   525
         * The Edwin is resizable.
williamr@2
   526
         */
williamr@2
   527
    	EResizable				=0x00040000,
williamr@2
   528
williamr@2
   529
        /**
williamr@2
   530
         * The Edwin ignores the virtual cursor.
williamr@2
   531
         */
williamr@2
   532
    	EIgnoreVirtualCursor	=0x00080000,
williamr@2
   533
williamr@2
   534
        /**
williamr@2
   535
         * No custom draw is done.
williamr@2
   536
         */
williamr@2
   537
    	ENoCustomDraw			=0x01000000,
williamr@2
   538
williamr@2
   539
        /**
williamr@2
   540
         * Changes layout to Avkon style.
williamr@2
   541
         */
williamr@2
   542
    	EAvkonEditor			=0x02000000,
williamr@2
   543
williamr@2
   544
        /**
williamr@2
   545
         * Hides cursor.
williamr@2
   546
         */
williamr@2
   547
    	EAvkonDisableCursor		=0x04000000,
williamr@2
   548
williamr@2
   549
        /**
williamr@2
   550
         * Changes text editor to non-editable mode.
williamr@2
   551
         */
williamr@2
   552
    	EAvkonNotEditable		=0x08000000, 
williamr@2
   553
williamr@2
   554
        /**
williamr@2
   555
         * Sets the @c Avkon wrapping rules ON.
williamr@2
   556
         */
williamr@2
   557
    	EEdwinAlternativeWrapping = 0x10000000,
williamr@2
   558
    	
williamr@2
   559
    	/**
williamr@2
   560
    	 * Enables tab key handling
williamr@2
   561
    	 */
williamr@2
   562
    	EAvkonTabsEnabled = 0x20000000,
williamr@2
   563
    	
williamr@2
   564
    	/**
williamr@2
   565
    	 * Disable VKB input
williamr@2
   566
    	 */ 
williamr@2
   567
    	EAvkonDisableVKB = 0x40000000,
williamr@2
   568
    	
williamr@2
   569
    	/**
williamr@2
   570
    	 * Enable Smiley Support
williamr@2
   571
    	 */ 
williamr@2
   572
    	EAvkonEnableSmileySupport = 0x80000000
williamr@2
   573
    	};
williamr@2
   574
williamr@2
   575
    /**
williamr@2
   576
     * Defines the possible commands for @c ClipboardL().
williamr@2
   577
     */
williamr@2
   578
    enum TClipboardFunc
williamr@2
   579
		{
williamr@2
   580
        /** Do nothing. */
williamr@2
   581
		ENoClipboard,
williamr@2
   582
williamr@2
   583
        /** Cut. */
williamr@2
   584
		ECut,
williamr@2
   585
williamr@2
   586
        /** Copy. */
williamr@2
   587
		ECopy,
williamr@2
   588
williamr@2
   589
        /** Paste. */
williamr@2
   590
		EPaste
williamr@2
   591
		};
williamr@2
   592
williamr@2
   593
    /**
williamr@2
   594
     * The following flags may be ORed together for text searches (see 
williamr@2
   595
     * @c FindL() for example).
williamr@2
   596
     */
williamr@2
   597
	enum TFindFlags
williamr@2
   598
		{
williamr@2
   599
        /** Search progresses up the screen. */
williamr@2
   600
		EFindDirectionUp	=0x01,
williamr@2
   601
williamr@2
   602
        /** Only whole-word matches count. */
williamr@2
   603
		EFindWholeWord		=0x02,
williamr@2
   604
williamr@2
   605
        /** Search is case-sensitive. */
williamr@2
   606
		EFindCaseSensitive	=0x04,
williamr@2
   607
williamr@2
   608
        /** Finds again. */
williamr@2
   609
		EFindAgain			=0x08,
williamr@2
   610
williamr@2
   611
        /** Does not display a busy message. */
williamr@2
   612
		ENoBusyMessage		=0x10,
williamr@2
   613
williamr@2
   614
        /**  */
williamr@2
   615
		EReadOnlyFile		=0x20 // New for CKon
williamr@2
   616
		};
williamr@2
   617
williamr@2
   618
    /**
williamr@2
   619
     * When content is supplied to an Edwin using @c SetDocumentContentL(), 
williamr@2
   620
     * this defines whether the new content is added to or has replaced the 
williamr@2
   621
     * existing content.
williamr@2
   622
     */
williamr@2
   623
	enum TSetContent
williamr@2
   624
		{
williamr@2
   625
        /** Replaces the Edwin’s existing content. */
williamr@2
   626
		EUseText,
williamr@2
   627
williamr@2
   628
        /** Copies the supplied content into the existing content. */
williamr@2
   629
		ECopyText
williamr@2
   630
		};
williamr@2
   631
williamr@2
   632
    /**
williamr@2
   633
     * Specifies whether the Edwin owns the document it is being used to edit.
williamr@2
   634
     *
williamr@2
   635
     * If the Edwin owns the document, the document object is destroyed on 
williamr@2
   636
     * destruction.
williamr@2
   637
     */
williamr@2
   638
	enum TOwnershipType
williamr@2
   639
		{
williamr@2
   640
        /** Document is owned by the Edwin. */
williamr@2
   641
		EOwnsText,
williamr@2
   642
williamr@2
   643
        /** Document is owned by some other object. */
williamr@2
   644
		EDoesNotOwnText
williamr@2
   645
		};
williamr@2
   646
williamr@2
   647
    // order of hotkeys defined in resource file.  Not all applicable to plain 
williamr@2
   648
    // text editors
williamr@2
   649
    /**
williamr@2
   650
     * Enumerates the hotkeys that are defined an @c r_eik_edwin_ctrl_hotkeys 
williamr@2
   651
     * or @c r_eik_edwin_shift_ctrl_hotkeys resource.
williamr@2
   652
     *
williamr@2
   653
     * Not all are applicable to plain text editors.
williamr@2
   654
     */
williamr@2
   655
	enum TEdwinHotKeys 
williamr@2
   656
		{
williamr@2
   657
        /** Cut. */
williamr@2
   658
		EHotKeyCut,
williamr@2
   659
williamr@2
   660
        /** Copy. */
williamr@2
   661
		EHotKeyCopy,
williamr@2
   662
williamr@2
   663
        /** Paste. */
williamr@2
   664
		EHotKeyPaste,
williamr@2
   665
williamr@2
   666
        /** Undo. */
williamr@2
   667
		EHotKeyUndo,
williamr@2
   668
williamr@2
   669
        /** Find. */
williamr@2
   670
        EHotKeyFind,
williamr@2
   671
williamr@2
   672
        /** Insert a character. */
williamr@2
   673
		EHotKeyInsertChar,
williamr@2
   674
williamr@2
   675
        /** Bold. */
williamr@2
   676
		EHotKeyBold,
williamr@2
   677
williamr@2
   678
        /** Italic. */
williamr@2
   679
		EHotKeyItalic,
williamr@2
   680
williamr@2
   681
        /** Underline. */
williamr@2
   682
		EHotKeyUnderline,
williamr@2
   683
williamr@2
   684
        /** Font. */
williamr@2
   685
		EHotKeyFont,
williamr@2
   686
williamr@2
   687
        /** Insert an object. */
williamr@2
   688
		EHotKeyInsertObject,
williamr@2
   689
williamr@2
   690
        /** Edit an object. */
williamr@2
   691
		EHotKeyEditObject,
williamr@2
   692
williamr@2
   693
        /** Format an object. */
williamr@2
   694
		EHotKeyFormatObject
williamr@2
   695
		};
williamr@2
   696
williamr@2
   697
public: // construction and destruction
williamr@2
   698
williamr@2
   699
    /**
williamr@2
   700
     * Destructor.
williamr@2
   701
     *
williamr@2
   702
     * Deletes objects and frees resources owned by this object. The Edwin’s 
williamr@2
   703
     * editable text is freed if the @c EKeepDocument flag is not set.
williamr@2
   704
     */
williamr@2
   705
    IMPORT_C ~CEikEdwin();
williamr@2
   706
williamr@2
   707
    /**
williamr@2
   708
     * C++ default constructor.
williamr@2
   709
     *
williamr@2
   710
     * Creates a new @c Edwin, FEP support for the new editor will not be 
williamr@2
   711
     * present if there is insufficient memory.
williamr@2
   712
     */
williamr@2
   713
	IMPORT_C CEikEdwin();
williamr@2
   714
williamr@2
   715
    /**
williamr@2
   716
     * Constructor. 
williamr@2
   717
     *
williamr@2
   718
     * Creates a new @c Edwin, specifying the border to use. As with the default
williamr@2
   719
     * constructor, FEP support for the new editor will not be present if there
williamr@2
   720
     * is insufficient memory. S60 Edwin does not support / draw any borders.
williamr@2
   721
     *
williamr@2
   722
     * @param aBorder The Edwin border.
williamr@2
   723
     */
williamr@2
   724
	IMPORT_C CEikEdwin(const TGulBorder& aBorder);
williamr@2
   725
    
williamr@2
   726
    /**
williamr@2
   727
     * Handles Symbian 2nd phase construction.
williamr@2
   728
     * Completes construction of a new @c Edwin, initialising its heap-stored 
williamr@2
   729
     * members from the supplied arguments.
williamr@2
   730
     *
williamr@2
   731
     * @param aEdwinFlags Bitwise ORed combination of flags from @c TFlags. 
williamr@2
   732
              Default value is 0.
williamr@2
   733
     * @param aWidthInChars Specifies the width for the Edwin, in characters or
williamr@2
   734
              pixels: see the @c EWidthInPixels flag. Default value is 0.
williamr@2
   735
     * @param aTextLimit Maximum length for the text to present as editable. 
williamr@2
   736
              Default value is 0.
williamr@2
   737
     * @param aNumberOfLines Height for the Edwin, in lines. Default value 
williamr@2
   738
              is 0.
williamr@2
   739
     */
williamr@2
   740
	IMPORT_C void ConstructL(TInt aEdwinFlags=0,
williamr@2
   741
                             TInt aWidthInChars=0,
williamr@2
   742
                             TInt aTextLimit=0,
williamr@2
   743
                             TInt aNumberOfLines=0);
williamr@2
   744
	
williamr@2
   745
    /**
williamr@2
   746
     * Sets the Edwin observer. The Edwin’s observer will be called back with 
williamr@2
   747
     * control events associated with the Edwin.
williamr@2
   748
     *
williamr@2
   749
     * @param aEdwinObserver New observer.
williamr@2
   750
     */
williamr@2
   751
    IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver);
williamr@2
   752
	
williamr@2
   753
    /**
williamr@2
   754
     * Adds an observer of standard Edwin events to the list of observers, 
williamr@2
   755
     * creating the list if necessary. May be called any number of times and is
williamr@2
   756
     * independent of calls to @c SetEdwinObserver.
williamr@2
   757
     *
williamr@2
   758
     * @param aEdwinObserver The observer to add to the list of observers.
williamr@2
   759
     */
williamr@2
   760
    IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);
williamr@2
   761
	
williamr@2
   762
    /**
williamr@2
   763
     * Removes the specified observer from the list of observers. Does nothing 
williamr@2
   764
     * if aEdwinObserver is not an observer.
williamr@2
   765
     * 
williamr@2
   766
     * @param aEdwinObserver The observer to remove from the list of observers.
williamr@2
   767
     */
williamr@2
   768
    IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);
williamr@2
   769
	
williamr@2
   770
    /**
williamr@2
   771
     * Creates the containing window for the Edwin if it does not already have one. 
williamr@2
   772
     */
williamr@2
   773
    IMPORT_C void SetContainerWindowL();
williamr@2
   774
	
williamr@2
   775
    /**
williamr@2
   776
     * Sets the Edwin’s editable content. Before calling this function you must
williamr@2
   777
     * get the @c iText pointer as @c iText is replaced by @c aText. You must 
williamr@2
   778
     * also free the memory by deleting the previous @c iText contents.
williamr@2
   779
     *
williamr@2
   780
     * @param aText New value for the content.
williamr@2
   781
     * @param aContent Specifies whether to use @c aText itself, or to copy its
williamr@2
   782
     *        content. Default value is @c CEikEdwin::ECopyText.
williamr@2
   783
     */
williamr@2
   784
    IMPORT_C void SetDocumentContentL(CGlobalText& aText,
williamr@2
   785
                        TSetContent aContent=CEikEdwin::ECopyText);
williamr@2
   786
williamr@2
   787
public: // from CCoeControl
williamr@2
   788
    
williamr@2
   789
    /**
williamr@2
   790
     * From @c CCoeControl.
williamr@2
   791
     *
williamr@2
   792
     * Handles key events. 
williamr@2
   793
     * 
williamr@2
   794
     * @param aKeyEvent The key event.
williamr@2
   795
     * @param aType The type of the event: @c EEventKeyDown, @c EEventKeyUp 
williamr@2
   796
     *        or @c EEventKey.
williamr@2
   797
     * @return A suitable response code.
williamr@2
   798
     */
williamr@2
   799
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   800
                                         TEventCode aType);
williamr@2
   801
	
williamr@2
   802
    /**
williamr@2
   803
     * From @c CCoeControl.
williamr@2
   804
     *
williamr@2
   805
     * Responds to focus-changed events.
williamr@2
   806
     *
williamr@2
   807
     * @param aDrawNow Not used.
williamr@2
   808
     */
williamr@2
   809
    IMPORT_C void FocusChanged(TDrawNow aDrawNow);
williamr@2
   810
	
williamr@2
   811
    /**
williamr@2
   812
     * From @c CCoeControl.
williamr@2
   813
     *
williamr@2
   814
     * Sets the Edwin as ready for drawing.
williamr@2
   815
     *
williamr@2
   816
     * @leave KErrNoMemory.
williamr@2
   817
     */
williamr@2
   818
    IMPORT_C void ActivateL();
williamr@2
   819
	
williamr@2
   820
    /**
williamr@2
   821
     * From @c CCoeControl.
williamr@2
   822
     *
williamr@2
   823
     * Completes the construction of a new @c Edwin. This function initialises
williamr@2
   824
     * the heap-stored members from an @c EDWIN resource.
williamr@2
   825
     *
williamr@2
   826
     * @param aReader A reader positioned for reading from an @c EDWIN resource.
williamr@2
   827
     */
williamr@2
   828
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   829
	
williamr@2
   830
    /**
williamr@2
   831
     * From @c CCoeControl.
williamr@2
   832
     *
williamr@2
   833
     * Handles pointer events.
williamr@2
   834
     *
williamr@2
   835
     * @param aPointerEvent Pointer event to respond to.
williamr@2
   836
     */
williamr@2
   837
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   838
	
williamr@2
   839
    /**
williamr@2
   840
     * From @c CCoeControl.
williamr@2
   841
     *
williamr@2
   842
     * Gets the minimum size of this Edwin for automatic-layout control 
williamr@2
   843
     * contexts such as dialogs.
williamr@2
   844
     *
williamr@2
   845
     * @return Minimum size for the control.
williamr@2
   846
     */
williamr@2
   847
    IMPORT_C TSize MinimumSize();
williamr@2
   848
	
williamr@2
   849
    /**
williamr@2
   850
     * From @c CCoeControl.
williamr@2
   851
     *
williamr@2
   852
     * Draws the control on request. 
williamr@2
   853
     *
williamr@2
   854
     * @param aRect If supplied, the rectangle in which to draw the Edwin.
williamr@2
   855
     */
williamr@2
   856
    IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   857
	
williamr@2
   858
    /**
williamr@2
   859
     * From @c CCoeControl.
williamr@2
   860
     *
williamr@2
   861
     * Dims or undims the Edwin.
williamr@2
   862
     *
williamr@2
   863
     * @param aDimmed @c ETrue to dim the Edwin. @c EFalse to undim the Edwin.
williamr@2
   864
     */
williamr@2
   865
    IMPORT_C void SetDimmed(TBool aDimmed);
williamr@2
   866
	
williamr@2
   867
    /**
williamr@2
   868
     * From @c CCoeControl. 
williamr@2
   869
     *
williamr@2
   870
     * Sets the containing window for the Edwin by copying it from the specified
williamr@2
   871
     * parent. Also copies a control context from @c aParent if one has not been
williamr@2
   872
     * previously set.
williamr@2
   873
     *
williamr@2
   874
     *@param aParent The control to set as this Edwin’s parent.
williamr@2
   875
     */
williamr@2
   876
    IMPORT_C void SetContainerWindowL(const CCoeControl& aParent);
williamr@2
   877
	
williamr@2
   878
    /**
williamr@2
   879
     * From @c CCoeControl.
williamr@2
   880
     * 
williamr@2
   881
     * Gets the list of logical colours employed in the drawing of the control,
williamr@2
   882
     * paired with an explanation of how they are used. Appends the list to 
williamr@2
   883
     * @c aColorUseList.
williamr@2
   884
     *
williamr@2
   885
     * @param[out] aColorUseList The list of logical colours.
williamr@2
   886
     */
williamr@2
   887
    IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& 
williamr@2
   888
                     aColorUseList) const; // not available before Release 005u
williamr@2
   889
	
williamr@2
   890
    // not available before Release 005u    
williamr@2
   891
    /**
williamr@2
   892
     * From @c CCoeControl.
williamr@2
   893
     *
williamr@2
   894
     * Handles a change to Edwin’s resources which are shared across the 
williamr@2
   895
     * environment. Colours or fonts for example.
williamr@2
   896
     *
williamr@2
   897
     * @param aType The type of resource that was changed.
williamr@2
   898
     */
williamr@2
   899
    IMPORT_C virtual void HandleResourceChange(TInt aType);
williamr@2
   900
    
williamr@2
   901
    /**
williamr@2
   902
     * From @c CCoeControl.
williamr@2
   903
     *
williamr@2
   904
     * Access to the input capabilities of the edwin.
williamr@2
   905
     *
williamr@2
   906
     * If this function is overrided in a subclass, the subclass should
williamr@2
   907
     * obtain this class' InputCapabilities' object provider through
williamr@2
   908
     * TCoeInputCapabilities::ObjectProvider() and set that as a part of
williamr@2
   909
     * the subclass' InputCapabilities object provider chain to ensure
williamr@2
   910
     * maximum functionality.
williamr@2
   911
     *
williamr@2
   912
     * @return The Edwin input capabilities.
williamr@2
   913
     */
williamr@2
   914
    IMPORT_C TCoeInputCapabilities InputCapabilities() const;
williamr@2
   915
    
williamr@2
   916
    /**
williamr@2
   917
     * From @c CCoeControl.
williamr@2
   918
     *
williamr@2
   919
     * This method sets the input capabilities of the edwin. Ownership of the 
williamr@2
   920
     * T-class is not transferred.
williamr@2
   921
     *
williamr@2
   922
     * @param aInputCapabilities	Reference to an input capabilities object 
williamr@2
   923
     *        on the heap.
williamr@2
   924
     * @leave KErrNoMemory Edwin FEB support object is not created.
williamr@2
   925
     */
williamr@2
   926
    IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& 
williamr@2
   927
                                        aInputCapabilities); 
williamr@2
   928
williamr@2
   929
    /**
williamr@2
   930
     * From @c CCoeControl.
williamr@2
   931
     *
williamr@2
   932
     * In debug mode writes the internal state to the given stream. Does
williamr@2
   933
     * nothing in release mode.
williamr@2
   934
     *
williamr@2
   935
     * @param[out] aWriteStream A stream for writing the internal state.
williamr@2
   936
     */
williamr@2
   937
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   938
williamr@2
   939
private:
williamr@2
   940
williamr@2
   941
    /**
williamr@2
   942
    * From CAknControl
williamr@2
   943
    */
williamr@2
   944
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   945
williamr@2
   946
public: // from MEikScrollBarObserver
williamr@2
   947
williamr@2
   948
    /**
williamr@2
   949
     * From @c MEikScrollBarObserver.
williamr@2
   950
     *
williamr@2
   951
     * Handles scrollbar key events.
williamr@2
   952
     *
williamr@2
   953
     * @param aScrollBar The scrollbar.
williamr@2
   954
     * @param aEventType The type of key event.
williamr@2
   955
     */
williamr@2
   956
	IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, 
williamr@2
   957
                                     TEikScrollEvent aEventType); 
williamr@2
   958
williamr@2
   959
public: // from CTextView::MObserver
williamr@2
   960
	
williamr@2
   961
    /**
williamr@2
   962
     * From @c CTextView::MObserver.
williamr@2
   963
     *
williamr@2
   964
     * Called after reformatting but before redisplay so that edit windows 
williamr@2
   965
     * etc. can be resized. 
williamr@2
   966
     *
williamr@2
   967
     * @param aTextView Not used.
williamr@2
   968
     */
williamr@2
   969
    IMPORT_C void OnReformatL(const CTextView* aTextView);
williamr@2
   970
williamr@2
   971
public:
williamr@2
   972
    
williamr@2
   973
    /**
williamr@2
   974
     * Gets the number of characters in the document.
williamr@2
   975
     *
williamr@2
   976
     * @return The number of characters in the document.
williamr@2
   977
     */
williamr@2
   978
	IMPORT_C TInt TextLength() const;
williamr@2
   979
williamr@2
   980
    /**
williamr@2
   981
     * Gets the cursor’s position within the document.
williamr@2
   982
     *
williamr@2
   983
     * @return The cursor’s position within the document.
williamr@2
   984
     */
williamr@2
   985
	IMPORT_C TInt CursorPos() const;
williamr@2
   986
williamr@2
   987
    /**
williamr@2
   988
     * Gets the number of characters including non-printing characters within
williamr@2
   989
     * the selection.
williamr@2
   990
     *
williamr@2
   991
     * @return The number of characters within the selection.
williamr@2
   992
     */
williamr@2
   993
	IMPORT_C TInt SelectionLength() const;
williamr@2
   994
williamr@2
   995
    /**
williamr@2
   996
     * Gets the cursor selection. If no text view is associated to the Edwin 
williamr@2
   997
     * this returns @c TCursorSelection(0,0).
williamr@2
   998
     *
williamr@2
   999
     * @return The current selection.
williamr@2
  1000
     */
williamr@2
  1001
	IMPORT_C TCursorSelection Selection() const;
williamr@2
  1002
williamr@2
  1003
    /**
williamr@2
  1004
     * Removes the selection and any composition text. The cursor position is 
williamr@2
  1005
     * unaffected. If there is no selected region, this function has no effect.
williamr@2
  1006
     */
williamr@2
  1007
	IMPORT_C void ClearSelectionL();
williamr@2
  1008
williamr@2
  1009
    /**
williamr@2
  1010
     * Sets the text selection. Highlights the selected area and makes the new 
williamr@2
  1011
     * cursor position visible. Any previous selection is cancelled. This 
williamr@2
  1012
     * function also updates the scroll bar thumbs if present.
williamr@2
  1013
     *
williamr@2
  1014
     * @param aCursorPos The cursor’s position.
williamr@2
  1015
     * @param aAnchorPos The anchor’s position.
williamr@2
  1016
     */
williamr@2
  1017
	IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos);
williamr@2
  1018
williamr@2
  1019
    /**
williamr@2
  1020
     * Sets the cursor’s position within the document. If the new position is 
williamr@2
  1021
     * not visible the text is scrolled so that the line containing the 
williamr@2
  1022
     * cursor is visible. This function also updates the scroll bar thumbs 
williamr@2
  1023
     * if present. 
williamr@2
  1024
     *
williamr@2
  1025
     * @param aCursorPos New cursor position. 
williamr@2
  1026
     * @param aSelect @c ETrue to extend the cursor’s selection to the new 
williamr@2
  1027
     *        position. @c EFalse otherwise.
williamr@2
  1028
     */
williamr@2
  1029
	IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect);
williamr@2
  1030
williamr@2
  1031
    /**
williamr@2
  1032
     * Selects the entire document.
williamr@2
  1033
     */
williamr@2
  1034
	IMPORT_C void SelectAllL();
williamr@2
  1035
williamr@2
  1036
    /**
williamr@2
  1037
     * Recalculates the screen width of an Edwin from the specified number 
williamr@2
  1038
     * of character widths. This is called during construction. If the 
williamr@2
  1039
     * Edwin only allows editing of numbers, the width of the zero 
williamr@2
  1040
     * character (0) is used; otherwise 
williamr@2
  1041
     * @c CFont::MaxNormalCharWidthInPixels() is used.
williamr@2
  1042
     * 
williamr@2
  1043
     * If the @c EWidthInPixels flag has been set, the @c aWidthInChars 
williamr@2
  1044
     * argument is measured in pixels, not characters.
williamr@2
  1045
     * 
williamr@2
  1046
     * @param aWidthInChars Width in either pixels or characters.
williamr@2
  1047
     */
williamr@2
  1048
	IMPORT_C void CalculateWidth(TInt aWidthInChars);
williamr@2
  1049
williamr@2
  1050
    /**
williamr@2
  1051
     * Copies the entire document’s content into a descriptor. It is the 
williamr@2
  1052
     * caller's responsibility to provide a large enough buffer.
williamr@2
  1053
     * 
williamr@2
  1054
     * @param[out] aDes An initialised descriptor which on return contains a 
williamr@2
  1055
     *        copy of the content of this Edwin.
williamr@2
  1056
     */
williamr@2
  1057
	IMPORT_C void GetText(TDes& aDes) const;
williamr@2
  1058
	
williamr@2
  1059
    /**
williamr@2
  1060
     * Gets a new buffer containing a copy of the whole text document.
williamr@2
  1061
     * 
williamr@2
  1062
     * @return A new copy of the document text.
williamr@2
  1063
     */
williamr@2
  1064
    IMPORT_C HBufC* GetTextInHBufL() const;
williamr@2
  1065
williamr@2
  1066
    /**
williamr@2
  1067
     * Sets the document text of this Edwin from the contents of a descriptor. 
williamr@2
  1068
     * This function removes any pictures, any invalid characters and cancels 
williamr@2
  1069
     * any previous selection.
williamr@2
  1070
     *
williamr@2
  1071
     * @param aDes Descriptor from which to copy.
williamr@2
  1072
     */
williamr@2
  1073
	IMPORT_C void SetTextL(const TDesC* aDes);
williamr@2
  1074
williamr@2
  1075
    /**
williamr@2
  1076
     * Handles cut, copy and paste commands. This function also reports a 
williamr@2
  1077
     * change of state of the control to the observer when necessary.
williamr@2
  1078
     *
williamr@2
  1079
     * @param aClipboardFunc Clipboard operation.
williamr@2
  1080
     */
williamr@2
  1081
	IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
williamr@2
  1082
williamr@2
  1083
    /**
williamr@2
  1084
     * Inserts a field at the current cursor position. If a selection was made
williamr@2
  1085
     * the field replaces that selection.
williamr@2
  1086
     *
williamr@2
  1087
     * @param aField Text field to insert.
williamr@2
  1088
     * @param aFieldType Type of the field. 
williamr@2
  1089
     */
williamr@2
  1090
	IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType);
williamr@2
  1091
williamr@2
  1092
    /**
williamr@2
  1093
     * Updates all the fields in the document. 
williamr@2
  1094
     */
williamr@2
  1095
	IMPORT_C void UpdateAllFieldsL();
williamr@2
  1096
	
williamr@2
  1097
    /**
williamr@2
  1098
     * Updates any text field at the current cursor position. Updating involves
williamr@2
  1099
     * calculating the new value for the field, and replacing the field’s 
williamr@2
  1100
     * existing text content with the new text.
williamr@2
  1101
     *
williamr@2
  1102
     * This function does nothing if the cursor is not within a text field.
williamr@2
  1103
     */
williamr@2
  1104
    IMPORT_C void UpdateCurrentFieldL();
williamr@2
  1105
	
williamr@2
  1106
    /**
williamr@2
  1107
     * Counts and returns the number of words in the document.
williamr@2
  1108
     *
williamr@2
  1109
     * @return The number of words in the document.
williamr@2
  1110
     */
williamr@2
  1111
    IMPORT_C TInt CountWords();
williamr@2
  1112
williamr@2
  1113
    /**
williamr@2
  1114
     * Inserts the contents of a text file into the text being edited at the 
williamr@2
  1115
     * current cursor position.
williamr@2
  1116
     *
williamr@2
  1117
     * @param aFileName The file to open and read.
williamr@2
  1118
     * @param aTextOrganisation How to handle line breaks. Default value is 
williamr@2
  1119
     *        @c CPlainText::EOrganiseByLine.
williamr@2
  1120
     */
williamr@2
  1121
    IMPORT_C void InsertFromTextFileL(const TFileName &aFileName,
williamr@2
  1122
                    const CPlainText::TTextOrganisation 
williamr@2
  1123
                    aTextOrganisation=CPlainText::EOrganiseByLine);
williamr@2
  1124
williamr@2
  1125
    /**
williamr@2
  1126
     * Uses @c SetScrollBarsL() to set the scrollbars.
williamr@2
  1127
     * 
williamr@2
  1128
     * @param aPtr Pointer to @c CEikEdwin instance.
williamr@2
  1129
     * @return Integer value of @c EFalse.
williamr@2
  1130
     */
williamr@2
  1131
    IMPORT_C static TInt IdleL(TAny *aPtr);
williamr@2
  1132
williamr@2
  1133
    /**
williamr@2
  1134
     * Gets a pointer to the Edwin’s document contents.
williamr@2
  1135
     * 
williamr@2
  1136
     * @return A @c CPlainText pointer which contains the 
williamr@2
  1137
     *         document.
williamr@2
  1138
     */
williamr@2
  1139
    IMPORT_C CPlainText* Text() const;
williamr@2
  1140
williamr@2
  1141
    // this is particularly important for when the front-end processor is 
williamr@2
  1142
    // inline-editing a CEikEdwin
williamr@2
  1143
    /**
williamr@2
  1144
     * Cancels any current transaction with the Edwin’s front-end processor. 
williamr@2
  1145
     * Any front-end input windows are removed, and any highlighted text being
williamr@2
  1146
     * edited in the Edwin is removed. The Edwin is rolled back to the state 
williamr@2
  1147
     * it was in before the FEP transaction started. This function is called 
williamr@2
  1148
     * by @c CEikEdwin itself when the document content, the cursor position 
williamr@2
  1149
     * or the current selection is changed.
williamr@2
  1150
     *
williamr@2
  1151
     * Cancelling outstanding FEP transactions before performing operations 
williamr@2
  1152
     * on the text programmatically is particularly important when the 
williamr@2
  1153
     * front-end processor is inline-editing an Edwin.
williamr@2
  1154
     *
williamr@2
  1155
     */
williamr@2
  1156
    IMPORT_C void CancelFepTransaction(); 
williamr@2
  1157
    
williamr@2
  1158
    /**
williamr@2
  1159
     * Handles all modifications made by reformatting the entire document. 
williamr@2
  1160
     * Calls @c CEikEdwin::FormatText() and redraws Edwin contents and 
williamr@2
  1161
     * scroll bars if they are ready to be redrawn.
williamr@2
  1162
     */
williamr@2
  1163
    IMPORT_C void HandleTextChangedL();
williamr@2
  1164
	
williamr@2
  1165
    /**
williamr@2
  1166
     * Gets the width used for laying out the text inside the Edwin in pixels. 
williamr@2
  1167
     * This may be larger or smaller than the width of the Edwin itself. 
williamr@2
  1168
     * See @c SetWysiwygModeOn() for example.
williamr@2
  1169
     *
williamr@2
  1170
     * @return Width of the text layout area in pixels.
williamr@2
  1171
     */
williamr@2
  1172
    IMPORT_C TInt LayoutWidth() const;
williamr@2
  1173
williamr@2
  1174
    /**
williamr@2
  1175
     * Formats and draws a new document, updates scrollbars if necessary.
williamr@2
  1176
     */
williamr@2
  1177
	IMPORT_C void NotifyNewDocumentL();
williamr@2
  1178
williamr@2
  1179
    /**
williamr@2
  1180
     * Reformats and redraws the document, updates scrollbars if necessary.
williamr@2
  1181
     */
williamr@2
  1182
	IMPORT_C void NotifyNewFormatL();
williamr@2
  1183
	
williamr@2
  1184
    /**
williamr@2
  1185
     * Gets true if a substring is present in the text being edited before or 
williamr@2
  1186
     * after the cursor position. If @c aFindText is NULL, then the current 
williamr@2
  1187
     * word or selection will be searched for again. 
williamr@2
  1188
     * 
williamr@2
  1189
     * @param aFindText The substring to search for.
williamr@2
  1190
     * @param aFindFlags See @c TFindFlags. Default value is 0. 
williamr@2
  1191
     * @return @c ETrue if aFindText is found.
williamr@2
  1192
     */
williamr@2
  1193
    IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);
williamr@2
  1194
	
williamr@2
  1195
    /**
williamr@2
  1196
     * Gets the cursor position of the matching text in the document. The 
williamr@2
  1197
     * search starts from @c aPos. If @c aFindText is NULL, then the 
williamr@2
  1198
     * current word or selection will be searched for. If the substring 
williamr@2
  1199
     * cannot be found, this function returns @c KErrNotFound.
williamr@2
  1200
     * 
williamr@2
  1201
     * @param aFindText The substring to search for.
williamr@2
  1202
     * @param aPos Starting position for the find.
williamr@2
  1203
     * @param aFindFlags See @c TFindFlags. 
williamr@2
  1204
     * @return KErrNotFound if the text was not found, otherwise the 
williamr@2
  1205
     *         position of the matched substring.
williamr@2
  1206
     */
williamr@2
  1207
    IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);
williamr@2
  1208
	
williamr@2
  1209
    /**
williamr@2
  1210
     * Replaces the highlighted text. See @c SEdwinFindModel struct.
williamr@2
  1211
     *
williamr@2
  1212
     * @param[in,out] aFindModel Pointer to the replacement text.
williamr@2
  1213
     */
williamr@2
  1214
    IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel);
williamr@2
  1215
williamr@2
  1216
    /**
williamr@2
  1217
     * Replaces all occurrences of a string with new text. Both old and new 
williamr@2
  1218
     * text are held in @c aFindModel.
williamr@2
  1219
     *
williamr@2
  1220
     * @param[in,out] aFindModel Pointer to the replacement text.
williamr@2
  1221
     * @leave This function will leave if the replace operation fails
williamr@2
  1222
     *        unexpectedly.
williamr@2
  1223
     */
williamr@2
  1224
	IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel);
williamr@2
  1225
williamr@2
  1226
    /**
williamr@2
  1227
     * Gets the current word or selection and searches for it. This function 
williamr@2
  1228
     * is called by @c FindL() and @c FindTextL() when no text to search for 
williamr@2
  1229
     * is given.
williamr@2
  1230
     *
williamr@2
  1231
     * @param aFindText An empty descriptor.
williamr@2
  1232
     */
williamr@2
  1233
	IMPORT_C void GetFindText(TDes* aFindText);
williamr@2
  1234
williamr@2
  1235
    /**
williamr@2
  1236
     * Updates scrollbars.
williamr@2
  1237
     */
williamr@2
  1238
	IMPORT_C void UpdateScrollBarsL();
williamr@2
  1239
williamr@2
  1240
    /**
williamr@2
  1241
     * Creates the Edwin scroll bar frame with no pre-allocation of memory 
williamr@2
  1242
     * for scroll bars.
williamr@2
  1243
     *
williamr@2
  1244
     * @return The scroll bar frame.
williamr@2
  1245
     */
williamr@2
  1246
	IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL();
williamr@2
  1247
williamr@2
  1248
    /**
williamr@2
  1249
     * Creates a pre-allocated scroll bar frame.
williamr@2
  1250
     *
williamr@2
  1251
     * @return Pre-allocated scroll bar frame.
williamr@2
  1252
     */
williamr@2
  1253
	inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();
williamr@2
  1254
    
williamr@2
  1255
    /**
williamr@2
  1256
     * Gets the scroll bar frame surrounding this Edwin.
williamr@2
  1257
     *
williamr@2
  1258
     * @return Pointer to this Edwin’s scroll bar frame.
williamr@2
  1259
     */
williamr@2
  1260
	inline CEikScrollBarFrame* ScrollBarFrame();
williamr@2
  1261
    
williamr@2
  1262
    /**
williamr@2
  1263
     * Sets word wrapping on or off.
williamr@2
  1264
     *
williamr@2
  1265
     * @param aWrapIsOn @c ETrue enables word wrapping, @c EFalse disables 
williamr@2
  1266
     *        word wrapping.
williamr@2
  1267
     */
williamr@2
  1268
	IMPORT_C void SetWordWrapL(TBool aWrapIsOn);
williamr@2
  1269
	
williamr@2
  1270
    /**
williamr@2
  1271
     * Gets the width of a line cursor in pixels.
williamr@2
  1272
     *
williamr@2
  1273
     * @return Always 0.
williamr@2
  1274
     */
williamr@2
  1275
    IMPORT_C virtual TInt LineCursorWidth() const;
williamr@2
  1276
	
williamr@2
  1277
    /**
williamr@2
  1278
     * Sets the zoom factor of the document and reformats the document.
williamr@2
  1279
     *
williamr@2
  1280
     * @param aZoomFactor New value for the zooming factor.
williamr@2
  1281
     */
williamr@2
  1282
    IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor);
williamr@2
  1283
	
williamr@2
  1284
    /**
williamr@2
  1285
     * Sets the Edwin’s background colour.
williamr@2
  1286
     *
williamr@2
  1287
     * @param aBackground New value for the background colour. 
williamr@2
  1288
     */
williamr@2
  1289
    IMPORT_C void SetBackgroundColorL(TRgb aBackground);
williamr@2
  1290
	
williamr@2
  1291
    /**
williamr@2
  1292
     * Sets the format mode to be WYSIWYG.
williamr@2
  1293
     *
williamr@2
  1294
     * @param aLayoutWidth Formatting width in twips. 
williamr@2
  1295
     * @param aDevice Mapping between twips and pixels on the target device.
williamr@2
  1296
     */    
williamr@2
  1297
    IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth,
williamr@2
  1298
                                   MGraphicsDeviceMap* aDevice);
williamr@2
  1299
	
williamr@2
  1300
    /**
williamr@2
  1301
     * Switches off the WYSIWYG mode. This function sets the new format mode 
williamr@2
  1302
     * to be @c EFScreenMode.
williamr@2
  1303
     */
williamr@2
  1304
    IMPORT_C void SetWysiwygModeOff();
williamr@2
  1305
	
williamr@2
  1306
    /**
williamr@2
  1307
     * Updates the text wrap width. This function is for use in WYSIWYG mode
williamr@2
  1308
     * only.
williamr@2
  1309
     *
williamr@2
  1310
     * @param aLayoutWidth New width to wrap text at in WYSIWYG mode in twips.
williamr@2
  1311
     */
williamr@2
  1312
    IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); 
williamr@2
  1313
    	
williamr@2
  1314
    /**
williamr@2
  1315
     * Sends the Edwin’s document using an infra red beamer.
williamr@2
  1316
     */
williamr@2
  1317
    IMPORT_C void SendDataOverIrL();
williamr@2
  1318
	
williamr@2
  1319
    /**
williamr@2
  1320
     * Receives an Edwin document using an infra red beamer.
williamr@2
  1321
     * This function will leave if the data received is not a suitable type 
williamr@2
  1322
     * to be pasted into the Edwin.
williamr@2
  1323
     */
williamr@2
  1324
    IMPORT_C void ReceiveDataOverIrL();
williamr@2
  1325
	
williamr@2
  1326
	/**
williamr@2
  1327
	* Controls the formatting mode of the editor.
williamr@2
  1328
	*
williamr@2
  1329
	* The length of the text is compared against current formatting mode thresholds.
williamr@2
  1330
	* (See method SetUpperFullFormattingLength). If the length is greater than the 
williamr@2
  1331
	* upper limit of full formatting, then the editor is set to "band" formatting,
williamr@2
  1332
	* where the editor attempts to format as little as is needed, e.g. the visible part
williamr@2
  1333
	* of the editor. If the text length is less than the lower limit of band formatting, 
williamr@2
  1334
	* then the formatting mode is switched to full document formatting.
williamr@2
  1335
    *	
williamr@2
  1336
    * This method performs an immediate re-formatting of all or part of the text with the new formatting mode.
williamr@2
  1337
	* 
williamr@2
  1338
	* @param aIsNewDoc  If EFalse, attempts to perform re-formatting based upon current formatting
williamr@2
  1339
	*                   If not EFalse, whole document it formatted from scratch
williamr@2
  1340
	*                   Note: This parameter is ignored if aReFormat is EFalse
williamr@2
  1341
	*/
williamr@2
  1342
	IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse);
williamr@2
  1343
williamr@2
  1344
    /**
williamr@2
  1345
    * Controls the formatting mode of the editor.
williamr@2
  1346
    *
williamr@2
  1347
    * The length of the text is compared against the current formatting mode thresholds.
williamr@2
  1348
    * (See method SetUpperFullFormattingLength). If the length is greater than the 
williamr@2
  1349
    * upper limit of full formatting, then the editor is set to "band" formatting,
williamr@2
  1350
    * where the editor attempts to format as little as is needed, e.g. the visible part
williamr@2
  1351
    * of the editor. If the text length is less than the lower limit of band formatting, 
williamr@2
  1352
    * then the formatting mode is switched to full document formatting.
williamr@2
  1353
    *	
williamr@2
  1354
    * This method has a flag to allow any immediate re-formatting to be suppressed. 
williamr@2
  1355
    * Formatting text can be a time-consuming operation. If the client is able to 
williamr@2
  1356
    * ensure that no reformatting is needed, (for instance if a further re-formatting 
williamr@2
  1357
    * API is going to be called later) then the reformatting flag can be called
williamr@2
  1358
    * with EFalse. Otherwise, a re-format will take place within this method.
williamr@2
  1359
    * 
williamr@2
  1360
    * @since 3.1
williamr@2
  1361
    * @param aIsNewDoc  If EFalse, attempts to perform re-formatting based upon current formatting
williamr@2
  1362
    *                   If not EFalse, whole document it formatted from scratch
williamr@2
  1363
    *                   Note: This parameter is ignored if aReFormat is EFalse
williamr@2
  1364
    * @param aReFormat  If EFalse, do not perform any re-formatting 
williamr@2
  1365
    */
williamr@2
  1366
    IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat );
williamr@2
  1367
williamr@2
  1368
    /**
williamr@2
  1369
     * Sets the @c EPasteFromIrStore flag.
williamr@2
  1370
     *
williamr@2
  1371
     * @param aPasteFromIrStore @c ETrue to set the @c EPasteFromIrStore flag. 
williamr@2
  1372
     *        @c EFalse to remove the @c EPasteFromIrStore flag.
williamr@2
  1373
     */
williamr@2
  1374
    IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore);
williamr@2
  1375
	
williamr@2
  1376
    /**
williamr@2
  1377
     * Copies the contents of a stream store to the current cursor position, 
williamr@2
  1378
     * replacing any selected text. This function is used to paste data from 
williamr@2
  1379
     * the clipboard.
williamr@2
  1380
     *
williamr@2
  1381
     * @param[out] aStore Store from which to read.
williamr@2
  1382
     * @param[in] aDict Stream dictionary. 
williamr@2
  1383
     */
williamr@2
  1384
    IMPORT_C void PasteFromStoreL(CStreamStore& aStore, 
williamr@2
  1385
                                  CStreamDictionary& aDict);
williamr@2
  1386
	
williamr@2
  1387
    /**
williamr@2
  1388
     * Copies the highlighted text into a stream store.
williamr@2
  1389
     *
williamr@2
  1390
     * @param[out] aStore Store to write to. 
williamr@2
  1391
     * @param[in] aDict Stream dictionary.
williamr@2
  1392
     */
williamr@2
  1393
    IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict);
williamr@2
  1394
	
williamr@2
  1395
    /**
williamr@2
  1396
     * Sets the text view margins. 
williamr@2
  1397
     *
williamr@2
  1398
     * @param aMargins New value for the view’s margins. 
williamr@2
  1399
     */
williamr@2
  1400
    IMPORT_C void SetBorderViewMargins(TMargins8 aMargins);
williamr@2
  1401
	
williamr@2
  1402
    /**
williamr@2
  1403
     * Forces the scrollbars to update now; this is a synchronous function.
williamr@2
  1404
     */
williamr@2
  1405
    IMPORT_C void ForceScrollBarUpdateL();
williamr@2
  1406
	
williamr@2
  1407
    /**
williamr@2
  1408
     * Sets whether the Edwin owns a document. Edwins can either be used as a 
williamr@2
  1409
     * standalone text editor control, or as an editor for text owned by 
williamr@2
  1410
     * another object. The document ownership setting determines whether the 
williamr@2
  1411
     * Edwin or another object owns the document.
williamr@2
  1412
     *
williamr@2
  1413
     * @param aOwner Whether Edwin or another object owns the document. 
williamr@2
  1414
     *        See @c TOwnershipType.
williamr@2
  1415
     */
williamr@2
  1416
    IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner);
williamr@2
  1417
	
williamr@2
  1418
    /**
williamr@2
  1419
     * Sets the maximum number of characters that can be inserted.
williamr@2
  1420
     *
williamr@2
  1421
     * @param aLimit New maximum for the number of characters that can be
williamr@2
  1422
     *        inserted.
williamr@2
  1423
     */
williamr@2
  1424
    IMPORT_C void SetTextLimit(TInt aLimit);
williamr@2
  1425
	
williamr@2
  1426
    /**
williamr@2
  1427
     * Displays a dialog allowing the user to choose a character from the 
williamr@2
  1428
     * character map. The selected character is inserted into the Edwin 
williamr@2
  1429
     * at the current cursor position.
williamr@2
  1430
     */
williamr@2
  1431
    IMPORT_C void RunCharMapDialogL();
williamr@2
  1432
	
williamr@2
  1433
    /**
williamr@2
  1434
     * Gets the text view margins. 
williamr@2
  1435
     *
williamr@2
  1436
     * @return The text view margins.
williamr@2
  1437
     */
williamr@2
  1438
    IMPORT_C TMargins8 Margins() const;
williamr@2
  1439
	
williamr@2
  1440
    /**
williamr@2
  1441
     * Gets the upper limit for formatting. This returns the value of 
williamr@2
  1442
     * @c KFullFormattingUpperThreshold which determines the maximum number of 
williamr@2
  1443
     * characters that can be formatted, if it is exceeded then only visible 
williamr@2
  1444
     * text is formatted. This is used with @c KPartialFormattingLowerThreshold 
williamr@2
  1445
     * to control the extent of text formatting.
williamr@2
  1446
     *
williamr@2
  1447
     * @return The value of @c KFullFormattingUpperThreshold.
williamr@2
  1448
     */
williamr@2
  1449
    IMPORT_C TInt UpperFullFormattingLength() const;
williamr@2
  1450
	
williamr@2
  1451
    /**
williamr@2
  1452
     * Gets the lower limit for formatting. This returns the value of 
williamr@2
  1453
     * @c KPartialFormattingLowerThreshold which determines when a switch is 
williamr@2
  1454
     * made from formatting only visible text to formatting all text. When the 
williamr@2
  1455
     * text length exceeds the @c KFullFormattingUpperThreshold only visible 
williamr@2
  1456
     * text is formatted. If some characters are deleted so that the text 
williamr@2
  1457
     * length is less than @c KFullFormattingUpperThreshold the entire text 
williamr@2
  1458
     * is still not formatted. Instead, reformatting occurs only when the 
williamr@2
  1459
     * number of characters is less than the value of 
williamr@2
  1460
     * @c KPartialFormattingLowerThreshold.
williamr@2
  1461
     *
williamr@2
  1462
     * @return The value of @c KPartialFormattingLowerThreshold.
williamr@2
  1463
     */
williamr@2
  1464
    IMPORT_C TInt LowerPartialFormattingLength() const;
williamr@2
  1465
	
williamr@2
  1466
    /**
williamr@2
  1467
     * Sets the Edwin’s read-only flag so that documents displayed by Edwin 
williamr@2
  1468
     * cannot be edited by users.
williamr@2
  1469
     *
williamr@2
  1470
     * @param aReadOnly @c ETrue to set Edwin to display documents as 
williamr@2
  1471
     *        read-only. @c EFalse otherwise.
williamr@2
  1472
     */
williamr@2
  1473
    IMPORT_C void SetReadOnly(TBool aReadOnly);
williamr@2
  1474
	
williamr@2
  1475
    /**
williamr@2
  1476
     * Determines whether the document being edited with Edwin is read-only.
williamr@2
  1477
     *
williamr@2
  1478
     * @return @c ETrue if the document being edited is read-only. 
williamr@2
  1479
     *         @c EFalse otherwise. 
williamr@2
  1480
     */
williamr@2
  1481
    IMPORT_C TBool IsReadOnly() const;
williamr@2
  1482
	
williamr@2
  1483
    /**
williamr@2
  1484
     * Determines whether the document being edited is read only. Displays 
williamr@2
  1485
     * a message with @c CEikonEnv::InfoMsg() if the document is set as 
williamr@2
  1486
     * read-only.
williamr@2
  1487
     */
williamr@2
  1488
    IMPORT_C void CheckNotReadOnlyL();
williamr@2
  1489
	
williamr@2
  1490
    /**
williamr@2
  1491
     * Sets whether the document accepts pictures.
williamr@2
  1492
     *
williamr@2
  1493
     * @param aAllow @c ETrue sets the document to accept pictures, @c EFalse 
williamr@2
  1494
     *        sets the document to not accept pictures.
williamr@2
  1495
     */
williamr@2
  1496
    IMPORT_C void SetAllowPictures(TBool aAllow);
williamr@2
  1497
	
williamr@2
  1498
    /**
williamr@2
  1499
     * Removes unwanted pictures. If @c EAllowPictures has been set, returns 
williamr@2
  1500
     * immediately. Otherwise, this function checks the document text between 
williamr@2
  1501
     * two bounds and removes all pictures in that range.
williamr@2
  1502
     *
williamr@2
  1503
     * @param aStartPos Where to start looking for unwanted pictures.
williamr@2
  1504
     * @param aLength Where to stop. 
williamr@2
  1505
     */
williamr@2
  1506
    IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength);
williamr@2
  1507
	
williamr@2
  1508
    /**
williamr@2
  1509
     * Sets the minimum gap between text and the right hand edge of the Edwin 
williamr@2
  1510
     * when text is wrapped. This value is used to calculate the layout area 
williamr@2
  1511
     * for text.
williamr@2
  1512
     *
williamr@2
  1513
     * @param aGap Size of the gutter in pixels.
williamr@2
  1514
     */
williamr@2
  1515
    IMPORT_C void SetRightWrapGutter(TInt aGap);
williamr@2
  1516
	
williamr@2
  1517
    /**
williamr@2
  1518
     * Undoes the most recent text operation when the Edwin supports this 
williamr@2
  1519
     * feature and when the undo store is not empty.
williamr@2
  1520
     */
williamr@2
  1521
    IMPORT_C void UndoL();
williamr@2
  1522
	
williamr@2
  1523
    /**
williamr@2
  1524
     * Deletes the undo store.
williamr@2
  1525
     */
williamr@2
  1526
    IMPORT_C void ClearUndo();
williamr@2
  1527
	
williamr@2
  1528
    /**
williamr@2
  1529
     * Sets whether the undo operation is permitted.
williamr@2
  1530
     *
williamr@2
  1531
     * @param aAllow ETrue to permit undo operations. EFalse to not permit undo
williamr@2
  1532
     *        operations.
williamr@2
  1533
     */
williamr@2
  1534
    IMPORT_C void SetAllowUndo(TBool aAllow);
williamr@2
  1535
	
williamr@2
  1536
    /**
williamr@2
  1537
     * Gets whether Edwin is set to support the undo command.
williamr@2
  1538
     *
williamr@2
  1539
     * @return @c ETrue if edits can be undone. @c EFalse if edits cannot
williamr@2
  1540
     *         be undone.
williamr@2
  1541
     */
williamr@2
  1542
    IMPORT_C TBool SupportsUndo() const;
williamr@2
  1543
	
williamr@2
  1544
    /**
williamr@2
  1545
     * Tests whether an undo is possible. Returns @c ETrue only if the undo 
williamr@2
  1546
     * store is available to Edwin.
williamr@2
  1547
     *
williamr@2
  1548
     * @return @c ETrue if the undo store is available. @c EFalse if the 
williamr@2
  1549
     *         undo store is not available.
williamr@2
  1550
     */
williamr@2
  1551
    IMPORT_C TBool CanUndo() const;
williamr@2
  1552
	
williamr@2
  1553
    /**
williamr@2
  1554
     * Sets whether picture characters and/or punctuation should be treated as 
williamr@2
  1555
     * word delimiters in addition to whitespace. 
williamr@2
  1556
     *
williamr@2
  1557
     * @param aPicture @c ETrue if picture characters should be treated as 
williamr@2
  1558
     *        delimiters for words.
williamr@2
  1559
     * @param aPunctuation @c ETrue if punctuation should be treated as 
williamr@2
  1560
     *        delimiters for words. 
williamr@2
  1561
     */
williamr@2
  1562
    IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation);
williamr@2
  1563
	
williamr@2
  1564
    /**
williamr@2
  1565
     * Gets the start position and the length of the word in which the 
williamr@2
  1566
     * specified document position is located.
williamr@2
  1567
     *
williamr@2
  1568
     * @param[in] aCurrentPos A position within a word in the text. 
williamr@2
  1569
     * @param[out] aStartPos Returns the start position of the word.
williamr@2
  1570
     * @param[out] aLength Returns the word’s length. 
williamr@2
  1571
     */
williamr@2
  1572
    IMPORT_C void GetWordInfo(TInt aCurrentPos,
williamr@2
  1573
                              TInt& aStartPos,
williamr@2
  1574
                              TInt& aLength) const;
williamr@2
  1575
	
williamr@2
  1576
    /**
williamr@2
  1577
     * Sets the new cursor position. If the cursor is no longer visible the 
williamr@2
  1578
     * document is scrolled to display the line containing the new cursor 
williamr@2
  1579
     * position. Scrollbars are also updated if present.
williamr@2
  1580
     *
williamr@2
  1581
     * @param aMovement The cursor movement. 
williamr@2
  1582
     * @param aSelect If @c ETrue, the selection is extended. This corresponds 
williamr@2
  1583
     *        to holding down the Shift key on a machine keyboard.
williamr@2
  1584
     */
williamr@2
  1585
    IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement,
williamr@2
  1586
                              TBool aSelect);
williamr@2
  1587
	
williamr@2
  1588
    /**
williamr@2
  1589
     * Scrolls the text either horizontally or vertically without affecting 
williamr@2
  1590
     * the cursor’s position.
williamr@2
  1591
     *
williamr@2
  1592
     * @param aMovement The cursor's movement.
williamr@2
  1593
     */
williamr@2
  1594
    IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement);
williamr@2
  1595
	
williamr@2
  1596
    /**
williamr@2
  1597
     * Removes all non-ASCII characters from the specified text. This can be 
williamr@2
  1598
     * used to remove Unicode characters where they are not valid characters 
williamr@2
  1599
     * for example.
williamr@2
  1600
     *
williamr@2
  1601
     * @param aStartPos The start position in the text. 
williamr@2
  1602
     * @param aLength The number of characters, beginning with aStartPos to 
williamr@2
  1603
     *        check.
williamr@2
  1604
     */
williamr@2
  1605
    IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength);
williamr@2
  1606
	
williamr@2
  1607
    /**
williamr@2
  1608
     * Sets the @c EOnlyASCIIChars flag. 
williamr@2
  1609
     *
williamr@2
  1610
     * @param aASCIIOnly If @c ETrue the EOnlyASCIIChars flag will be set. If 
williamr@2
  1611
     *        @c EFalse the EOnlyASCIIChars flag will be removed.
williamr@2
  1612
     */
williamr@2
  1613
    IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly);
williamr@2
  1614
	
williamr@2
  1615
    /**
williamr@2
  1616
     * Tests whether the @c EOnlyASCIIChars flag is set. 
williamr@2
  1617
     *
williamr@2
  1618
     * @return @c ETrue if the @c EOnlyASCIIChars flag is set.
williamr@2
  1619
     */
williamr@2
  1620
    IMPORT_C TBool OnlyASCIIChars() const;
williamr@2
  1621
	
williamr@2
  1622
    /**
williamr@2
  1623
     * Gets the average number of lines shown in Edwin’s view.
williamr@2
  1624
     *
williamr@2
  1625
     * @return The average number of lines.
williamr@2
  1626
     */
williamr@2
  1627
    inline TInt AvgLinesInViewRect() const;
williamr@2
  1628
	
williamr@2
  1629
    /**
williamr@2
  1630
     * Gets the average number of characters on a line.
williamr@2
  1631
     *
williamr@2
  1632
     * @return The average number of characters on a line.
williamr@2
  1633
     */
williamr@2
  1634
    inline TInt AvgCharsPerLine() const;
williamr@2
  1635
	
williamr@2
  1636
    /**
williamr@2
  1637
     * Sets the average number of lines displayed in Edwin’s view.
williamr@2
  1638
     *
williamr@2
  1639
     * @param aAvgLines The average number of lines to display.
williamr@2
  1640
     */
williamr@2
  1641
    inline void SetAvgLinesInViewRect(TInt aAvgLines);
williamr@2
  1642
	
williamr@2
  1643
    /**
williamr@2
  1644
     * Sets the average number of characters per line.
williamr@2
  1645
     *
williamr@2
  1646
     * @param aAvgChars The average number of characters per line.
williamr@2
  1647
     */
williamr@2
  1648
    inline void SetAvgCharsPerLine(TInt aAvgChars);
williamr@2
  1649
	
williamr@2
  1650
    /**
williamr@2
  1651
     * Sets the Edwin size observer. Does not imply transfer of ownership.
williamr@2
  1652
     *
williamr@2
  1653
     * @param aEdwinSizeObserver The Edwin size observer.
williamr@2
  1654
     */
williamr@2
  1655
    IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* 
williamr@2
  1656
                                            aEdwinSizeObserver);
williamr@2
  1657
	
williamr@2
  1658
    /**
williamr@2
  1659
     * Gets the minimum Edwin height.
williamr@2
  1660
     *
williamr@2
  1661
     * @return The minimum Edwin height.
williamr@2
  1662
     */
williamr@2
  1663
    IMPORT_C TInt MinimumHeight() const;
williamr@2
  1664
williamr@2
  1665
    /**	
williamr@2
  1666
     * Gets the maximum Edwin height.
williamr@2
  1667
     *
williamr@2
  1668
     * Please do not use the following method for deciding heights if you are 
williamr@2
  1669
     * using edwins with Maximum Heights in forms. Use @c MaximumHeightInLines 
williamr@2
  1670
     * instead.
williamr@2
  1671
     *
williamr@2
  1672
     * @return The maximum Edwin height.
williamr@2
  1673
    */
williamr@2
  1674
	IMPORT_C TInt MaximumHeight() const;
williamr@2
  1675
    
williamr@2
  1676
    /**
williamr@2
  1677
     * Sets the minimum Edwin height. This function also increases the maximum 
williamr@2
  1678
     * Edwin height if its value is less than @c aHeight.
williamr@2
  1679
     */
williamr@2
  1680
	IMPORT_C void SetMinimumHeight(TInt aHeight);
williamr@2
  1681
williamr@2
  1682
    /**
williamr@2
  1683
     * Sets the maximum Edwin height. This function also decreases the minimum 
williamr@2
  1684
     * Edwin height if its value is greater than @c aHeight.
williamr@2
  1685
     * 
williamr@2
  1686
     * Please do not use the following method for setting maximum heights if 
williamr@2
  1687
     * you are using edwins with maximum heights in forms. Use 
williamr@2
  1688
     * @c MaximumHeightInLines instead.
williamr@2
  1689
     *
williamr@2
  1690
     * @param aHeight The maximum Edwin height.
williamr@2
  1691
    */
williamr@2
  1692
	IMPORT_C void SetMaximumHeight(TInt aHeight);
williamr@2
  1693
williamr@2
  1694
public: // new utility methods
williamr@2
  1695
williamr@2
  1696
    /**
williamr@2
  1697
     * Replaces the cursor selection with the identified text.
williamr@2
  1698
     * 
williamr@2
  1699
     * @param aInsertPos The position at which text will be inserted. 
williamr@2
  1700
     * @param aText The text to insert. 
williamr@2
  1701
     * @param aDelete The cursor-selected text that will be replaced by @c 
williamr@2
  1702
     *        aText.
williamr@2
  1703
     */
williamr@2
  1704
	IMPORT_C void InsertDeleteCharsL(TInt aInsertPos,
williamr@2
  1705
                                     const TDesC& aText,
williamr@2
  1706
                                     const TCursorSelection& aDelete);
williamr@2
  1707
	
williamr@2
  1708
    /**
williamr@2
  1709
     * Sets non-printing characters?visibility.
williamr@2
  1710
     *
williamr@2
  1711
     * @param aVisibility Non-printing characters?visibility.
williamr@2
  1712
     */
williamr@2
  1713
    IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility 
williamr@2
  1714
                                                aVisibility);
williamr@2
  1715
	
williamr@2
  1716
    /**
williamr@2
  1717
     * Sets non-printing characters?visibility.
williamr@2
  1718
     *
williamr@2
  1719
     * @return Non-printing characters?visibility.
williamr@2
  1720
     */
williamr@2
  1721
    IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
williamr@2
  1722
williamr@2
  1723
public: // new Avkon wrap interface
williamr@2
  1724
williamr@2
  1725
    /**
williamr@2
  1726
     * Sets the @c EAvkonEditor flag.
williamr@2
  1727
     *
williamr@2
  1728
     * @param aAvkonWrapIsOn If @c ETrue @c EAvkonEditor flag is set.
williamr@2
  1729
     */
williamr@2
  1730
	IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn);
williamr@2
  1731
williamr@2
  1732
public:	// Avkon editor extensions
williamr@2
  1733
williamr@2
  1734
    /**
williamr@2
  1735
     * Sets default case for the editor. The case is used when the editor
williamr@2
  1736
     * is focused first time. Available case flags from @c uikon.hrh
williamr@2
  1737
     * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and 
williamr@2
  1738
     * @c EAknEditorTextCase. @c EAknEditorTextCase is used if the initial 
williamr@2
  1739
     * case is not set from EDWIN resource default_case or with this API.
williamr@2
  1740
     *
williamr@2
  1741
     * @param aCase Initial case to be used in the editor.
williamr@2
  1742
     */
williamr@2
  1743
    IMPORT_C void SetAknEditorCase(TInt aCase);
williamr@2
  1744
williamr@2
  1745
    /**
williamr@2
  1746
     * Sets permitted cases for the editor.
williamr@2
  1747
     * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes, 
williamr@2
  1748
     * @c EAknEditorUpperCase, @c EAknEditorLowerCase and 
williamr@2
  1749
     * @c EAknEditorTextCase. @c EAknEditorAllCaseModes is used if the value 
williamr@2
  1750
     * is not set from EDWIN resource allowed_case_modes or with this API.
williamr@2
  1751
     *
williamr@2
  1752
     * @param aPermittedCaseModes Case modes that are available in the editor.
williamr@2
  1753
     */
williamr@2
  1754
    IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes);
williamr@2
  1755
williamr@2
  1756
    /**
williamr@2
  1757
     * Sets number mode key mapping for '*' and '#' keys. The key mapping is 
williamr@2
  1758
     * used in editors when numeric input mode is used. Key mapping characters
williamr@2
  1759
     * for '*' key are shown on special character table if also text input 
williamr@2
  1760
     * modes are allowed in the editor but the current input mode is numeric 
williamr@2
  1761
     * mode. @c EAknEditorStandardNumberModeKeymap is used in editors that 
williamr@2
  1762
     * allow only numeric input if the mapping is not set from EDWIN resource 
williamr@2
  1763
     * @c numeric_keymap or with this API. 
williamr@2
  1764
     * @c EAknEditorAlphanumericNumberModeKeymap is used as default if the 
williamr@2
  1765
     * editor allows also text input mode.
williamr@2
  1766
     *
williamr@2
  1767
     * @param aNumericKeymap Key mapping used in an editor with number input 
williamr@2
  1768
     *        mode.
williamr@2
  1769
     */
williamr@2
  1770
    IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap 
williamr@2
  1771
                                            aNumericKeymap);
williamr@2
  1772
williamr@2
  1773
    /**
williamr@2
  1774
     * Sets default input mode for the editor. The input mode is used when 
williamr@2
  1775
     * the editor is focused first time. 
williamr@2
  1776
     * @c EAknEditorTextInputMode is used if the initial input mode is not set 
williamr@2
  1777
     * from EDWIN resource default_input_mode or with this API.
williamr@2
  1778
     *
williamr@2
  1779
     * @param aInputMode Initial input mode to be used in the editor.
williamr@2
  1780
     */
williamr@2
  1781
    IMPORT_C void SetAknEditorInputMode(TInt aInputMode);
williamr@2
  1782
williamr@2
  1783
    /**
williamr@2
  1784
     * Sets allowed input modes for the editor. 
williamr@2
  1785
     * All input modes are allowed (@c EAknEditorAllInputModes) if the value 
williamr@2
  1786
     * is not set from EDWIN resource @c allowed_input_modes or with this API.
williamr@2
  1787
     *
williamr@2
  1788
     * @param aInputModes Input modes that are allowed in the editor.
williamr@2
  1789
     */
williamr@2
  1790
    IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes);
williamr@2
  1791
williamr@2
  1792
    /**
williamr@2
  1793
     * Sets editor specific special character table. 
williamr@2
  1794
     *
williamr@2
  1795
     * @param aSCTResId Special character table dialog resource.
williamr@2
  1796
     */
williamr@2
  1797
    IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId);
williamr@2
  1798
williamr@2
  1799
    /**
williamr@2
  1800
     * Sets initial editor flags for the editor.
williamr@2
  1801
     * This method can be used also to update editor flags after the editor is 
williamr@2
  1802
     * focused. FEP is automatically notified of the updated editor flags.
williamr@2
  1803
     *
williamr@2
  1804
     * @param aFlags Avkon editor flags for the editor.
williamr@2
  1805
     */
williamr@2
  1806
    IMPORT_C void SetAknEditorFlags(TInt aFlags);
williamr@2
  1807
williamr@2
  1808
    /**
williamr@2
  1809
     * Enables or disables CCPU interface provided functionalities 
williamr@2
  1810
     * (cut, copy, paste and undo).
williamr@2
  1811
     * 
williamr@2
  1812
     * @param aSupport CCPU support enabled if @c ETrue.
williamr@2
  1813
     */
williamr@2
  1814
    IMPORT_C void EnableCcpuSupportL(TBool aSupport);
williamr@2
  1815
williamr@2
  1816
    /**
williamr@2
  1817
     * Updates editor input mode. FEP is automatically notified of the
williamr@2
  1818
     * new input mode in editor state and FEP takes new input mode to use 
williamr@2
  1819
     * immediatelly. Current inline editing is reset.
williamr@2
  1820
     * This method should not be used for setting initial input mode for the 
williamr@2
  1821
     * editor. Use @c SetAknEditorInputMode() method instead for setting 
williamr@2
  1822
     * initial input mode.
williamr@2
  1823
     *
williamr@2
  1824
     * @param aInputMode New input mode for the editor.
williamr@2
  1825
     */
williamr@2
  1826
    IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode);
williamr@2
  1827
williamr@2
  1828
    /**
williamr@2
  1829
     * Returns the input mode that has been saved to editor state.
williamr@2
  1830
     *
williamr@2
  1831
     * @since S60 2.6
williamr@2
  1832
     * @return Input Mode that is saved to editor state.
williamr@2
  1833
     */
williamr@2
  1834
    IMPORT_C TInt AknEditorCurrentInputMode();
williamr@2
  1835
williamr@2
  1836
    /**
williamr@2
  1837
     * Updates editor case. FEP is automatically notified of the
williamr@2
  1838
     * case change in editor state and FEP takes new case to use immediately.
williamr@2
  1839
     * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase, 
williamr@2
  1840
     * @c EAknEditorLowerCase and @c EAknEditorTextCase.
williamr@2
  1841
     * This method should not be used to set initial case for the editor.
williamr@2
  1842
     * Use @c SetAknEditorCase() method instead for setting initial case.
williamr@2
  1843
     *
williamr@2
  1844
     * @param aCase New case for the editor.
williamr@2
  1845
     */
williamr@2
  1846
    IMPORT_C void SetAknEditorCurrentCase(TInt aCase);
williamr@2
  1847
williamr@2
  1848
    /**
williamr@2
  1849
     * Sets new local input language for the editor. Global input language
williamr@2
  1850
     * changes have not effect for the input language but the user can still
williamr@2
  1851
     * change the input language from the edit menu.
williamr@2
  1852
     *
williamr@2
  1853
     * @param aLanguage Editor local input language.
williamr@2
  1854
     */
williamr@2
  1855
    IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage);
williamr@2
  1856
williamr@2
  1857
    /** 
williamr@2
  1858
     * This call causes FEP to reset current editing state and
williamr@2
  1859
     * new editing state is fetched from @c CAknEdwinState object.
williamr@2
  1860
     */
williamr@2
  1861
    IMPORT_C void NotifyEditorStateObserverOfStateChangeL();
williamr@2
  1862
williamr@2
  1863
    /**
williamr@2
  1864
     * Used for suppressing all editor's background drawing. This is
williamr@2
  1865
     * intended for internal use.
williamr@2
  1866
     *
williamr@2
  1867
     * Note that when this is set, the background is not drawn with skin
williamr@2
  1868
     * nor cleared, so the background MUST be drawn by the parent control
williamr@2
  1869
     * every time the editor changes.
williamr@2
  1870
     *
williamr@2
  1871
     * @param aSuppress If ETrue, suppress background drawing
williamr@2
  1872
     */
williamr@2
  1873
    IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
williamr@2
  1874
    
williamr@2
  1875
    /**
williamr@2
  1876
     * Tests if the background drawing is suppressed.
williamr@2
  1877
     *
williamr@2
  1878
     * @return ETrue if the background drawing is suppressed
williamr@2
  1879
     */
williamr@2
  1880
    IMPORT_C TBool IsBackgroundDrawingSuppressed() const;
williamr@2
  1881
    
williamr@2
  1882
    /**
williamr@2
  1883
     * Used to prevent partial text lines from being drawn.
williamr@2
  1884
     * The client is responsible for giving a sane value. An empty
williamr@2
  1885
     * rect disables this feature. This is intended for internal use.
williamr@2
  1886
     *
williamr@2
  1887
     * @param aRect The rect which contains text lines to be drawn
williamr@2
  1888
     */
williamr@2
  1889
    IMPORT_C void SetTextLinesRect( const TRect& aRect );
williamr@2
  1890
    
williamr@2
  1891
	/**
williamr@2
  1892
	 * Used to determine which area is used for scrolling
williamr@2
  1893
	 */
williamr@2
  1894
	IMPORT_C void SetScrollRect( const TRect & aRect );
williamr@2
  1895
williamr@2
  1896
    /**
williamr@2
  1897
     * Gets the rectangle set for drawing only full lines. In case
williamr@2
  1898
     * the feature is disabled, this returns an empty rect.
williamr@2
  1899
     * This is intended for internal use.
williamr@2
  1900
     *
williamr@2
  1901
     * @return The rect which contains text lines to be drawn
williamr@2
  1902
     */
williamr@2
  1903
    IMPORT_C TRect GetTextLinesRect() const;
williamr@2
  1904
    
williamr@2
  1905
    /**
williamr@2
  1906
	 * Used to control cursor visibility
williamr@2
  1907
	 */
williamr@2
  1908
    IMPORT_C void SetCursorVisible(TBool aVisible);
williamr@2
  1909
public:
williamr@2
  1910
williamr@2
  1911
    // These methods have been added for use with Avkon to set maximum 
williamr@2
  1912
    // editor heights.
williamr@2
  1913
    /**
williamr@2
  1914
     * Sets editor's maximum height in lines.
williamr@2
  1915
     *
williamr@2
  1916
     * @param aLines Maximum height in lines.
williamr@2
  1917
     */
williamr@2
  1918
	IMPORT_C void SetMaximumHeightInLines(TInt aLines);
williamr@2
  1919
williamr@2
  1920
    /**
williamr@2
  1921
     * Gets editor maximum height in lines.
williamr@2
  1922
     *
williamr@2
  1923
     * @return Maximum height in lines.
williamr@2
  1924
     */
williamr@2
  1925
	IMPORT_C TInt MaximumHeightInLines() const;
williamr@2
  1926
williamr@2
  1927
public: // From MEikCcpuEditor
williamr@2
  1928
williamr@2
  1929
    /**
williamr@2
  1930
     * Tests whether the editor is focused.
williamr@2
  1931
     * 
williamr@2
  1932
     * @return If editor is focused, @c ETrue is returned.
williamr@2
  1933
     */
williamr@2
  1934
	IMPORT_C TBool CcpuIsFocused() const;
williamr@2
  1935
williamr@2
  1936
    /**
williamr@2
  1937
     * Tests whether the selected text can be cut.
williamr@2
  1938
     * 
williamr@2
  1939
     * @return @c ETrue if it is possible to cut the selected text.
williamr@2
  1940
     */
williamr@2
  1941
	IMPORT_C TBool CcpuCanCut() const;
williamr@2
  1942
williamr@2
  1943
    /**
williamr@2
  1944
     * Cuts selected text.
williamr@2
  1945
     */
williamr@2
  1946
	IMPORT_C void CcpuCutL();
williamr@2
  1947
	
williamr@2
  1948
    /**
williamr@2
  1949
     * Tests whether the selected text can be copied.
williamr@2
  1950
     * 
williamr@2
  1951
     * @return @c ETrue if it is possible to copy the selected text.
williamr@2
  1952
     */
williamr@2
  1953
    IMPORT_C TBool CcpuCanCopy() const;
williamr@2
  1954
williamr@2
  1955
    /**
williamr@2
  1956
     * Copies selected text.
williamr@2
  1957
     */
williamr@2
  1958
	IMPORT_C void CcpuCopyL();
williamr@2
  1959
	
williamr@2
  1960
    /**
williamr@2
  1961
     * Tests whether text can be pasted from the clipboard.
williamr@2
  1962
     * 
williamr@2
  1963
     * @return @c ETrue if it is possible to paste the clipboard text.
williamr@2
  1964
     */
williamr@2
  1965
    IMPORT_C TBool CcpuCanPaste() const;
williamr@2
  1966
williamr@2
  1967
    /**
williamr@2
  1968
     * Pastes text from the clipboard to the editor.
williamr@2
  1969
     */
williamr@2
  1970
	IMPORT_C void CcpuPasteL();
williamr@2
  1971
	
williamr@2
  1972
    /**
williamr@2
  1973
     * Tests is it possible to undo previous operation.
williamr@2
  1974
     * 
williamr@2
  1975
     * @return @c ETrue if it is possible to undo previous operation.
williamr@2
  1976
     */
williamr@2
  1977
    IMPORT_C TBool CcpuCanUndo() const;
williamr@2
  1978
williamr@2
  1979
    /**
williamr@2
  1980
     * Undoes the most recent text operation when the Edwin supports this
williamr@2
  1981
     * feature and when the undo store is not empty
williamr@2
  1982
     */
williamr@2
  1983
	IMPORT_C void CcpuUndoL();
williamr@2
  1984
	
williamr@2
  1985
    /**
williamr@2
  1986
     * Gets edwin's flags from @c CAknEdwinState.
williamr@2
  1987
     * 
williamr@2
  1988
     * @return The control's flags.
williamr@2
  1989
     */
williamr@2
  1990
    IMPORT_C TInt AknEdwinFlags() const;
williamr@2
  1991
 
williamr@2
  1992
williamr@2
  1993
public: // Internal to Symbian
williamr@2
  1994
	
williamr@2
  1995
    // the following methods are deprecated and will be removed in a future 
williamr@2
  1996
    // release
williamr@2
  1997
    /**
williamr@2
  1998
     * Allocates memory for the Edwin text view.
williamr@2
  1999
     */
williamr@2
  2000
	IMPORT_C void CreateTextViewL();
williamr@2
  2001
williamr@2
  2002
    /**
williamr@2
  2003
     * Gets Edwin text view.
williamr@2
  2004
     *
williamr@2
  2005
     * @return Pointer to the Edwin text view.
williamr@2
  2006
     */
williamr@2
  2007
	IMPORT_C CTextView* TextView() const;
williamr@2
  2008
williamr@2
  2009
    /**
williamr@2
  2010
     * Gets Edwins text layout.
williamr@2
  2011
     *
williamr@2
  2012
     * @return Pointer to the text layout.
williamr@2
  2013
     */
williamr@2
  2014
	IMPORT_C CTextLayout* TextLayout() const;
williamr@2
  2015
williamr@2
  2016
    /**
williamr@2
  2017
     * Sets undo buffer for the Edwin.
williamr@2
  2018
     *
williamr@2
  2019
     * @param aSelection The current selection.
williamr@2
  2020
     * @return @c ETrue if buffer was set.
williamr@2
  2021
     */
williamr@2
  2022
	IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection);
williamr@2
  2023
williamr@2
  2024
    /**
williamr@2
  2025
     * Sets new undoable text to the undo buffer.
williamr@2
  2026
     * 
williamr@2
  2027
     * @param aSelection The current selection.
williamr@2
  2028
     */
williamr@2
  2029
    IMPORT_C void SetUndoableText(const TCursorSelection& aSelection);
williamr@2
  2030
williamr@2
  2031
    /**
williamr@2
  2032
     * Gets the editor state.
williamr@2
  2033
     *
williamr@2
  2034
     * @return Pointer to editor state object.
williamr@2
  2035
     */
williamr@2
  2036
	CAknEdwinState* EditorState() const;
williamr@2
  2037
williamr@2
  2038
    /**
williamr@2
  2039
     * Sets maximum length for the editor.
williamr@2
  2040
     *
williamr@2
  2041
     * @param aLength Maximum length for the editor.
williamr@2
  2042
     */
williamr@2
  2043
	inline void SetMaxLength(TInt aLength);
williamr@2
  2044
williamr@2
  2045
    /**
williamr@2
  2046
     * Gets the editor maximum length.
williamr@2
  2047
     *
williamr@2
  2048
     * @return The editor maximum length
williamr@2
  2049
     */
williamr@2
  2050
	inline TInt MaxLength() const;
williamr@2
  2051
williamr@2
  2052
public:
williamr@2
  2053
williamr@2
  2054
	// added to get access to user flags without a get/set for every different
williamr@2
  2055
    // flag.
williamr@2
  2056
    /**
williamr@2
  2057
     * Adds user flags.
williamr@2
  2058
     * See @c TFlags.
williamr@2
  2059
     *
williamr@2
  2060
     * @param aFlag Flags to add.
williamr@2
  2061
     */
williamr@2
  2062
	IMPORT_C void AddFlagToUserFlags(TUint32 aFlag);
williamr@2
  2063
	
williamr@2
  2064
    /**
williamr@2
  2065
     * Removes user flags.
williamr@2
  2066
     * See @c TFlags.
williamr@2
  2067
     *
williamr@2
  2068
     * @param aFlag Flags to remove.
williamr@2
  2069
     */
williamr@2
  2070
    IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag);
williamr@2
  2071
williamr@2
  2072
    /**
williamr@2
  2073
     * Gets user flags.
williamr@2
  2074
     * See @c TFlags.
williamr@2
  2075
     *
williamr@2
  2076
     * @return The user flags.
williamr@2
  2077
     */
williamr@2
  2078
	IMPORT_C TUint32 UserFlags() const ;
williamr@2
  2079
williamr@2
  2080
public:
williamr@2
  2081
williamr@2
  2082
    /**
williamr@2
  2083
     * Sets the character format layer for the editor. Ownership of the 
williamr@2
  2084
     * CCharFormatLayer is transferred.
williamr@2
  2085
     *
williamr@2
  2086
     * @param aCharFormatLayer Pointer to the character format layer object.
williamr@2
  2087
     */
williamr@2
  2088
	IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer);
williamr@2
  2089
	
williamr@2
  2090
    /**
williamr@2
  2091
     * Sets the paragraph format layer for the editor. Ownership of the 
williamr@2
  2092
     * CParaFormatLayer is transferred.
williamr@2
  2093
     *
williamr@2
  2094
     * @param aParaFormatLayer Pointer to the paragraph format layer object.
williamr@2
  2095
     */
williamr@2
  2096
    IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer);
williamr@2
  2097
williamr@2
  2098
williamr@2
  2099
public: // Skins support
williamr@2
  2100
williamr@2
  2101
    /**
williamr@2
  2102
     * Sets within in the editor an externally owned Skins background control 
williamr@2
  2103
     * context. This background control context will then be used by the editor
williamr@2
  2104
     * to draw background.
williamr@2
  2105
     *
williamr@2
  2106
     * If this API is not called, then the editor IS skin enabled, (that is 
williamr@2
  2107
     * @c CEikEdwins are skin enabled by default) but it will try to find a 
williamr@2
  2108
     * control context with which to perform background drawing from the 
williamr@2
  2109
     * Control Environment, via the Object Provider.
williamr@2
  2110
     *
williamr@2
  2111
     * Setting this control context to NULL will have the effect of turning off
williamr@2
  2112
     * background skinning. 
williamr@2
  2113
     *
williamr@2
  2114
     * @param aContext Control context to store. Not owned. Can be NULL.
williamr@2
  2115
     */
williamr@2
  2116
    IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* 
williamr@2
  2117
                                                    aContext );
williamr@2
  2118
williamr@2
  2119
    /**
williamr@2
  2120
     * Access to Skins background control context that is potentially being 
williamr@2
  2121
     * used by the Editor.
williamr@2
  2122
     *
williamr@2
  2123
     * This API will first check to see if an control context has been set by 
williamr@2
  2124
     * API, and if so, return that. If the background control context has been 
williamr@2
  2125
     * set to NULL by API, then it will return NULL. If the background control 
williamr@2
  2126
     * context has never been set by API, then this returns the control context 
williamr@2
  2127
     * (if one exists) that the object obtains from Object Provider.
williamr@2
  2128
     * 
williamr@2
  2129
     * @return Pointer to control context potentially in 
williamr@2
  2130
     *         use, or NULL.
williamr@2
  2131
     */
williamr@2
  2132
    MAknsControlContext* SkinBackgroundControlContext() const;
williamr@2
  2133
williamr@2
  2134
    /**
williamr@2
  2135
     * Access to disposition of the editor to perform Skinning. This does not 
williamr@2
  2136
     * take into account whether the application is skin enabled or whether the 
williamr@2
  2137
     * environment is providing a background control context. It is only a 
williamr@2
  2138
     * function of whether editor's (default) disposition to skin has been 
williamr@2
  2139
     * countered by calls on the editor API.
williamr@2
  2140
     * 
williamr@2
  2141
     * @return @c EFalse if SetSkinBackgroundControlContextL has been 
williamr@2
  2142
     *         called with NULL in its most recent call.
williamr@2
  2143
     */
williamr@2
  2144
    TBool SkinEnabled() const;
williamr@2
  2145
williamr@2
  2146
	/**
williamr@2
  2147
	 * Stores the alignment value for an editor.
williamr@2
  2148
	 *
williamr@2
  2149
	 * @param aAlignment Editor alignment to be stored - must be supplied as
williamr@2
  2150
	 *	      one of the values in Avkon editor alignment enum i.e.:
williamr@2
  2151
	 *           EAknEditorAlignCenter,
williamr@2
  2152
	 *           EAknEditorAlignLeft,
williamr@2
  2153
	 *           EAknEditorAlignRight, 
williamr@2
  2154
	 *           EAknEditorAlignBidi
williamr@2
  2155
	 */
williamr@2
  2156
	IMPORT_C void SetAlignment(TInt aAlignment);
williamr@2
  2157
williamr@2
  2158
public: // Pictograph support
williamr@2
  2159
williamr@2
  2160
    /**
williamr@2
  2161
     * Redraws text view. Used for pictograph animations.
williamr@2
  2162
     */
williamr@2
  2163
    void DrawTextView() const;
williamr@2
  2164
williamr@2
  2165
    /**
williamr@2
  2166
     * Sets the callback, which the editor calls after having redrawn itself 
williamr@2
  2167
     * for animated pictographs. @c CEikCaptionedControl uses it to draw the 
williamr@2
  2168
     * highlight frame on top of the editor.
williamr@2
  2169
     *
williamr@2
  2170
     * @since S60 2.6
williamr@2
  2171
     * @param aCallBack The callback.
williamr@2
  2172
     */
williamr@2
  2173
    IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack );
williamr@2
  2174
williamr@2
  2175
    /**
williamr@2
  2176
     * Returns pictograph animation callback. If it is not set, the function
williamr@2
  2177
     * pointer is NULL.
williamr@2
  2178
     *
williamr@2
  2179
     * @return Pictograph animation callback
williamr@2
  2180
     */
williamr@2
  2181
    const TCallBack& PictographAnimationCallBack() const;
williamr@2
  2182
williamr@2
  2183
    /**
williamr@2
  2184
     * This method sets the upper limit of full document formatting.  
williamr@2
  2185
     *
williamr@2
  2186
     * At construction, the mode is full document formatting, where the text 
williamr@2
  2187
     * formatter processes the whole document to determine its layout.
williamr@2
  2188
     * 
williamr@2
  2189
     * When the text content is set, or when user input causes the length of 
williamr@2
  2190
     * text to exceed this value, the formatting mode switches to "Band" 
williamr@2
  2191
     * formatting, where the text formatter attempts to format as little as 
williamr@2
  2192
     * possible - optimally just the visible screen.
williamr@2
  2193
     * 
williamr@2
  2194
     * A lower limit is calculated from the passed-in value, by the subtraction
williamr@2
  2195
     * of a constant. When the text becomes smaller than this lower limit, the
williamr@2
  2196
     * formatting switches to full document formatting.
williamr@2
  2197
     * 
williamr@2
  2198
     * Internally-imposed limits prevent the client setting too small a value 
williamr@2
  2199
     * for proper operation of the text formatting.
williamr@2
  2200
     *
williamr@2
  2201
     * If this method is not called, the upper and lower limts are set to a 
williamr@2
  2202
     * large default values.
williamr@2
  2203
     *
williamr@2
  2204
     * Access to the actual limits is available via the methods 
williamr@2
  2205
     * @c UpperFullFormattingLength() and @c LowerPartialFormattingLength().
williamr@2
  2206
     *
williamr@2
  2207
     * @since 3.0
williamr@2
  2208
     * @param aUpperFullFormattingLimit The upper limit of full document 
williamr@2
  2209
     *        formatting.
williamr@2
  2210
     */
williamr@2
  2211
    IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit );
williamr@2
  2212
    
williamr@2
  2213
    /**
williamr@2
  2214
     * Can be called to inhibit redrawing of the editor when NotifyNewFormatL()
williamr@2
  2215
     * is called.
williamr@2
  2216
     *
williamr@2
  2217
     * @param aEnabled If ETrue, inhibit redrawing when notified of
williamr@2
  2218
     * new format from now on.
williamr@2
  2219
     */
williamr@2
  2220
	IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled );    
williamr@2
  2221
williamr@2
  2222
    /**
williamr@2
  2223
     * Can be called to inhibit formatting of the editor. Care is required to ensure that
williamr@2
  2224
     * the necessary reformatting is carried out later on if this API is used. 
williamr@2
  2225
     * 
williamr@2
  2226
     * Note: When called with EFalse, it does not automatically trigger reformatting.
williamr@2
  2227
     *
williamr@2
  2228
     * @since 3.1
williamr@2
  2229
     * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse,
williamr@2
  2230
     * re-enable formatting from now on. 
williamr@2
  2231
     */
williamr@2
  2232
    IMPORT_C void SetSuppressFormatting( TBool aSuppressed );
williamr@2
  2233
williamr@2
  2234
#ifdef FF_AVKON_EMOTION_ICON_ENABLED
williamr@2
  2235
public: 
williamr@2
  2236
    void EnableSmileySupportL( TBool aEnableSmiley );
williamr@2
  2237
    TBool IsSmileyEnabled() const;
williamr@2
  2238
    void DrawSmileyInTextL( CBitmapContext& aGc, CFont& aFont, 
williamr@2
  2239
        const TDesC& aText, TPoint& aPt );
williamr@2
  2240
    void ConvertVisibleTextForSmileyL( TBool aTextToCode );    
williamr@2
  2241
    void HandleScrollForSmileyL();
williamr@2
  2242
    TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect );
williamr@2
  2243
williamr@2
  2244
private:
williamr@2
  2245
    void ConvertTextForSmileyL( TCursorSelection aSelect, 
williamr@2
  2246
        TBool aTextToCode, TBool aRedraw = ETrue );
williamr@2
  2247
    void TrimText( TDes& aText );
williamr@2
  2248
    TCursorSelection GetVisibleTextRangeL();
williamr@2
  2249
    HBufC* ExtractTextLC( TCursorSelection aSelect );    
williamr@2
  2250
    void ExtendedRangeForSmiley( TCursorSelection& aSelect );
williamr@2
  2251
    void ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace ); 
williamr@2
  2252
    void ConvertSmileyForDeleteL( const TCursorSelection &aSelect );
williamr@2
  2253
#endif
williamr@2
  2254
	    
williamr@2
  2255
protected:
williamr@2
  2256
williamr@2
  2257
    /**
williamr@2
  2258
     * Specifies the end points of the editable area.
williamr@2
  2259
     */
williamr@2
  2260
	enum TEnd
williamr@2
  2261
		{
williamr@2
  2262
        /** The start of the editable area. */
williamr@2
  2263
		EStart,
williamr@2
  2264
williamr@2
  2265
        /** The end of the editable area. */
williamr@2
  2266
		EEnd   
williamr@2
  2267
		};
williamr@2
  2268
williamr@2
  2269
    /**
williamr@2
  2270
     * Specifies the chunk size as either a word, or a paragraph.
williamr@2
  2271
     */
williamr@2
  2272
	enum TChunkSize
williamr@2
  2273
		{
williamr@2
  2274
        /** A word. */
williamr@2
  2275
		EChunkWord,
williamr@2
  2276
williamr@2
  2277
        /** A paragraph. */
williamr@2
  2278
		EChunkPara
williamr@2
  2279
		};
williamr@2
  2280
williamr@2
  2281
    /**
williamr@2
  2282
     * Specifies the chunk size as either a word, or a paragraph.
williamr@2
  2283
     */
williamr@2
  2284
	enum TEikEdwinFlags // Internal flags
williamr@2
  2285
		{ 
williamr@2
  2286
        /** Rich text editor used. */
williamr@2
  2287
		ERichText           =0x00000001,
williamr@2
  2288
		
williamr@2
  2289
        /** For double item dragging. */
williamr@2
  2290
        EDragDouble			=0x00000002,
williamr@2
  2291
		
williamr@2
  2292
        /**
williamr@2
  2293
         * If set, indicates the pointer being pressed inside the 
williamr@2
  2294
         * editor rectangle.
williamr@2
  2295
         */
williamr@2
  2296
        ELeftDownInViewRect =0x00000004,
williamr@2
  2297
		
williamr@2
  2298
        /** Used to calculate initial width. */
williamr@2
  2299
        ENumericCharacters	=0x00000008, 
williamr@2
  2300
		
williamr@2
  2301
        /** Edwin has one line and is not resizable. */
williamr@2
  2302
        EHasOneLineOnly     =0x00000010,  
williamr@2
  2303
        
williamr@2
  2304
        /** 
williamr@2
  2305
         * Custom formatter is installed to find and format phone numbers 
williamr@2
  2306
         * (@c CEikRichTextEditor only).
williamr@2
  2307
         */
williamr@2
  2308
        EPhoneNumberGrouping = 0x00000020,
williamr@2
  2309
		ESuppressNotifyDraw  = 0x00000040,
williamr@2
  2310
		ESuppressFormatting  = 0x00000080 // Suppresses calls to formatting
williamr@2
  2311
        };
williamr@2
  2312
williamr@2
  2313
protected: // from MEditObserver
williamr@2
  2314
    
williamr@2
  2315
    /**
williamr@2
  2316
     * From @c MEditObserver.
williamr@2
  2317
     *
williamr@2
  2318
     * Observer function called by the @c CRichText object when the object is 
williamr@2
  2319
     * edited to give notification of changes to its text buffer. In this way,
williamr@2
  2320
     * the control knows how the text object has changed and can reformat and 
williamr@2
  2321
     * redraw the text object appropriately.
williamr@2
  2322
     * 
williamr@2
  2323
     * @param aStartEdit The start position of the edit. 
williamr@2
  2324
     * @param aEditLength The number of characters added or, if negative, 
williamr@2
  2325
     *        deleted after this position.
williamr@2
  2326
     */
williamr@2
  2327
	IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength);
williamr@2
  2328
williamr@2
  2329
protected:
williamr@2
  2330
    
williamr@2
  2331
    /**
williamr@2
  2332
     * Draws the visible text and the cursor for DrawL(), but does not draw 
williamr@2
  2333
     * the border. The @c DrawL() function is trapped to handle problems due
williamr@2
  2334
     * to insufficient resources being available.
williamr@2
  2335
     *
williamr@2
  2336
     * @param aRect Rectangle in which to draw.
williamr@2
  2337
     */
williamr@2
  2338
	IMPORT_C void TrappedDraw(const TRect& aRect) const;
williamr@2
  2339
    
williamr@2
  2340
    /**
williamr@2
  2341
     * Draws the visible text and the cursor.
williamr@2
  2342
     */
williamr@2
  2343
	IMPORT_C void DrawContents();
williamr@2
  2344
	
williamr@2
  2345
    /**
williamr@2
  2346
     * Completes the second-phase construction of a @c CEikEdwin object. This 
williamr@2
  2347
     * protected function is called by @c ConstructL() and 
williamr@2
  2348
     * @c ConstructFromResourceL() after the Edwin’s size, flags and text 
williamr@2
  2349
     * limit have been set. Derived classes should call either this function 
williamr@2
  2350
     * or @c CEikEdwin’s @c ConstructL() or @c ConstructFromResourceL() 
williamr@2
  2351
     * functions during their construction before initialising their own 
williamr@2
  2352
     * members.
williamr@2
  2353
     */
williamr@2
  2354
    IMPORT_C void BaseConstructL();
williamr@2
  2355
	
williamr@2
  2356
    /**
williamr@2
  2357
     * Formats all the text in the text view. Called by several functions, for 
williamr@2
  2358
     * example by @c CEikEdwin::HandleTextChangedL() and 
williamr@2
  2359
     * @c CEikEdwin::SetTextL().
williamr@2
  2360
     */
williamr@2
  2361
    IMPORT_C void FormatTextL();
williamr@2
  2362
	
williamr@2
  2363
    /**
williamr@2
  2364
     * Deletes the text under the cursor selection, also cancelling the
williamr@2
  2365
     * selection. This function asks the user to confirm this action if
williamr@2
  2366
     * aPromptConfirmation is ETrue.
williamr@2
  2367
     *
williamr@2
  2368
     * @param[out] aChanged On return, @c ETrue if the text was changed. 
williamr@2
  2369
     * @param[in] aIsBackSpace ETrue if this is in response to backspace being 
williamr@2
  2370
     *        pressed. Determines whether character formatting is preserved 
williamr@2
  2371
     *        or not. Default value is @c EFalse.
williamr@2
  2372
     * @param[in] aPromptConfirmation Optional. @c ETrue to ask the user to
williamr@2
  2373
     *            confirm this action. Default value is @c ETrue.
williamr@2
  2374
     * @return The cursor position in the text after deletion.
williamr@2
  2375
     */
williamr@2
  2376
    IMPORT_C TInt DeleteHighlightL(TBool& aChanged, 
williamr@2
  2377
                                   TBool aIsBackSpace=EFalse,
williamr@2
  2378
                                   TBool aPromptConfirmation=ETrue);
williamr@2
  2379
	
williamr@2
  2380
    /**
williamr@2
  2381
     * Confirms whether the deletion of the user’s selection is required.
williamr@2
  2382
     *
williamr@2
  2383
     * If the user’s selection is less than @c KBlockDeleteWarningSize and does
williamr@2
  2384
     * not contain a picture, this function returns @c ETrue.
williamr@2
  2385
     *
williamr@2
  2386
     * If the user’s selection is greater than @c KBlockDeleteWarningSize or 
williamr@2
  2387
     * contains a picture, this function asks the user to confirm deletion of 
williamr@2
  2388
     * their selection and then returns the user’s response.
williamr@2
  2389
     *
williamr@2
  2390
     * @return @c ETrue.
williamr@2
  2391
     */
williamr@2
  2392
    IMPORT_C TBool OkToDeleteSelectionL();
williamr@2
  2393
	
williamr@2
  2394
    /**
williamr@2
  2395
     * Deletes the cursor’s selection. If no selection is made, this function 
williamr@2
  2396
     * deletes only one character. The argument @c aIsBackSpace determines 
williamr@2
  2397
     * whether to preserve the character formatting or not.
williamr@2
  2398
     *
williamr@2
  2399
     * @param[out] aChanged On return, @c ETrue if the text was changed.
williamr@2
  2400
     * @param[in] aSelection The cursor selection describing the position to be
williamr@2
  2401
     *            deleted. 
williamr@2
  2402
     * @param[in] aIsBackSpace @c ETrue if this in response to backspace being 
williamr@2
  2403
     *            pressed. Determines whether character formatting is preserved
williamr@2
  2404
     *            or not.
williamr@2
  2405
     * @param[in] aAllowUndo @c ETrue if the user is permitted to undo this
williamr@2
  2406
     *            change.
williamr@2
  2407
     */
williamr@2
  2408
    IMPORT_C void DeleteL(TBool& aChanged,
williamr@2
  2409
                          const TCursorSelection& aSelection,
williamr@2
  2410
                          TBool aIsBackSpace=EFalse,
williamr@2
  2411
                          TBool aAllowUndo=ETrue);
williamr@2
  2412
	
williamr@2
  2413
    /**
williamr@2
  2414
     * Handles errors that occur when handling a change in Edwin’s size. Calls 
williamr@2
  2415
     * @c CEikonEnv::NotifyIdleErrorWhileRedrawing().
williamr@2
  2416
     */
williamr@2
  2417
    IMPORT_C void TrappedSizeChanged();
williamr@2
  2418
	
williamr@2
  2419
    /**
williamr@2
  2420
     * Handles a change in Edwin’s size. This function accounts for text wrap 
williamr@2
  2421
     * settings and whether the Edwin is ready to be redrawn and also calls 
williamr@2
  2422
     * functions to reformat text and to update the Edwin’s scroll bars.
williamr@2
  2423
     */
williamr@2
  2424
    IMPORT_C void HandleSizeChangedL();
williamr@2
  2425
	
williamr@2
  2426
    /**
williamr@2
  2427
     * Cancels the selection and any FEP composition text. This function then 
williamr@2
  2428
     * repositions the cursor at the specified end of the currently selected 
williamr@2
  2429
     * text.
williamr@2
  2430
     *
williamr@2
  2431
     * @param aEndOfSelectionToLeaveCursor The end of the current selection at 
williamr@2
  2432
     *        which the cursor is repositioned.
williamr@2
  2433
     */
williamr@2
  2434
    IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);
williamr@2
  2435
	
williamr@2
  2436
    /**
williamr@2
  2437
     * Moves the cursor to the beginning of the next word or paragraph. This 
williamr@2
  2438
     * function cancels any front end processing transaction currently in 
williamr@2
  2439
     * progress for the Edwin.
williamr@2
  2440
     *
williamr@2
  2441
     * @param aSelect If @c ETrue the chunk is selected, otherwise @c EFalse. 
williamr@2
  2442
     * @param aChunkSize The chunk size, this can be either a word or a 
williamr@2
  2443
     *        paragraph. See @c TChunkSize enum.
williamr@2
  2444
     * @param aEndScanningTowards Which direction to scan towards, the start 
williamr@2
  2445
     *        or the end of the document.  
williamr@2
  2446
     */
williamr@2
  2447
    IMPORT_C void MoveCursorToChunkStartL(TBool aSelect,
williamr@2
  2448
                                          TChunkSize aChunkSize,
williamr@2
  2449
                                          TEnd aEndScanningTowards);
williamr@2
  2450
	
williamr@2
  2451
    /**
williamr@2
  2452
     * Cancels the insertion of a character format. This can be used for rich 
williamr@2
  2453
     * text only.
williamr@2
  2454
     */
williamr@2
  2455
    IMPORT_C void CancelInsertCharFormat();
williamr@2
  2456
	
williamr@2
  2457
    /**
williamr@2
  2458
     * Copies the contents of the cursor selection onto the clipboard. 
williamr@2
  2459
     */
williamr@2
  2460
    IMPORT_C void PlaceDataOnClipboardL();
williamr@2
  2461
	
williamr@2
  2462
    /**
williamr@2
  2463
     * Reports an Edwin event of the specified type. The Edwin event is passed 
williamr@2
  2464
     * first to the Edwin observer and then to the list of observers, even if 
williamr@2
  2465
     * the first Edwin observer is not set. If the Edwin has a custom drawer, 
williamr@2
  2466
     * and the event is of type @c EEventFormatChanged, the event is passed to 
williamr@2
  2467
     * the custom drawer. If the Edwin has an observer the event is passed to 
williamr@2
  2468
     * that observer. If no observer is set for the Edwin, this function passes
williamr@2
  2469
     * the event to each observer in the observer list.
williamr@2
  2470
     *
williamr@2
  2471
     * @param aEventType The type of event to report.
williamr@2
  2472
     */
williamr@2
  2473
    IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);
williamr@2
  2474
	
williamr@2
  2475
    /**
williamr@2
  2476
     * Sets margin widths and line cursor width.
williamr@2
  2477
     */
williamr@2
  2478
    IMPORT_C void SetLineCursorDetailsL();
williamr@2
  2479
	
williamr@2
  2480
    /**
williamr@2
  2481
     * Replaces the current Edwin text.
williamr@2
  2482
     *
williamr@2
  2483
     * @param aInText Text with which the current text is replaced.
williamr@2
  2484
     * @param aOutText On return, the replaced text. 
williamr@2
  2485
     */
williamr@2
  2486
    IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText,
williamr@2
  2487
                                               CGlobalText& aOutText);
williamr@2
  2488
	
williamr@2
  2489
    /**
williamr@2
  2490
     * Displays an information message to indicate that the specified text 
williamr@2
  2491
     * could not be found. The information message is constructed from 
williamr@2
  2492
     * @c R_EIK_TBUF_CANNOT_FIND_TEXT.
williamr@2
  2493
     *
williamr@2
  2494
     * @param aFindText The text that could not be found.
williamr@2
  2495
     */
williamr@2
  2496
    IMPORT_C void DisplayFindTextNotFound(TDes& aFindText);
williamr@2
  2497
	
williamr@2
  2498
    /**
williamr@2
  2499
     * Not implemented.
williamr@2
  2500
     *
williamr@2
  2501
     * @param aStartPos Not used.
williamr@2
  2502
     * @param aLength Not used.
williamr@2
  2503
     */
williamr@2
  2504
    IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength);
williamr@2
  2505
	
williamr@2
  2506
    /**
williamr@2
  2507
     * Creates a new @c CLafEdwinCustomDrawBase instance.
williamr@2
  2508
     *
williamr@2
  2509
     * @return Pointer to new custom @c CLafEdwinCustomDrawBase object.
williamr@2
  2510
     */
williamr@2
  2511
    IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
williamr@2
  2512
	
williamr@2
  2513
    // Avkon editor extensions
williamr@2
  2514
    /**
williamr@2
  2515
     * Used in @c ConstructFromResourceL(). Sets Avkon editor properties.
williamr@2
  2516
     *
williamr@2
  2517
     * @param aReader A reader positioned for reading from an EDWIN resource.
williamr@2
  2518
     */
williamr@2
  2519
    IMPORT_C void ReadAknResourceL(TResourceReader& aReader);
williamr@2
  2520
williamr@2
  2521
protected: // Internal to Symbian
williamr@2
  2522
williamr@2
  2523
    /**
williamr@2
  2524
     * Creates new text layout.
williamr@2
  2525
     *
williamr@2
  2526
     * @param aLayDoc Pointer to the @c MLayDoc implementation that is the 
williamr@2
  2527
     *        source of the text and formatting information.
williamr@2
  2528
     */
williamr@2
  2529
	IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc);
williamr@2
  2530
	
williamr@2
  2531
    /**
williamr@2
  2532
     * Creates new instance of @c CGlobalText and text layout based on it. 
williamr@2
  2533
     * 
williamr@2
  2534
     * @param aParaFormatLayer Paragraph format layer pointer for 
williamr@2
  2535
     *        @c CGlobalText constructor.
williamr@2
  2536
     * @param aCharFormatLayer Character format layer pointer for 
williamr@2
  2537
     *        @c CGlobalText constructor.
williamr@2
  2538
     */
williamr@2
  2539
    IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer,
williamr@2
  2540
                                       CCharFormatLayer* aCharFormatLayer);
williamr@2
  2541
	
williamr@2
  2542
    /**
williamr@2
  2543
     * Checks that is Edwin's extension created. If not, it will be created.
williamr@2
  2544
     *
williamr@2
  2545
     * @leave KErrNoMemory If the Edwin FEP support pointer is NULL.
williamr@2
  2546
     */
williamr@2
  2547
    IMPORT_C void CheckEdwinExtensionL();
williamr@2
  2548
	
williamr@2
  2549
    /**
williamr@2
  2550
     * Gets Edwin's extension.
williamr@2
  2551
     *
williamr@2
  2552
     * @return Pointer to Edwin's extension. 
williamr@2
  2553
     */
williamr@2
  2554
    IMPORT_C CEikEdwinExtension* EdwinExtension();
williamr@2
  2555
williamr@2
  2556
private:
williamr@2
  2557
williamr@2
  2558
	enum
williamr@2
  2559
		{ // internal flags
williamr@2
  2560
		EWysiwygOn						=0x00000010,
williamr@2
  2561
		EUnderOneScreenFormattedText	=0x00000020,
williamr@2
  2562
		EPictureDelimits				=0x00000040,
williamr@2
  2563
		EPunctuationDelimits			=0x00000080,
williamr@2
  2564
		EPasteFromIrStore				=0x00000100,
williamr@2
  2565
		ELockScrollBarState				=0x00000200,
williamr@2
  2566
		EOnReformatting					=0x00000400
williamr@2
  2567
		};
williamr@2
  2568
williamr@2
  2569
private: // from CCoeControl
williamr@2
  2570
williamr@2
  2571
	IMPORT_C void SizeChanged();
williamr@2
  2572
	IMPORT_C TInt CountComponentControls() const;
williamr@2
  2573
	IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
williamr@2
  2574
	IMPORT_C void Reserved_2();
williamr@2
  2575
williamr@2
  2576
private:
williamr@2
  2577
williamr@2
  2578
	IMPORT_C virtual void Reserved_3();
williamr@2
  2579
	IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL();
williamr@2
  2580
	IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc);
williamr@2
  2581
	void SetVirtualCursorStateL(TBool aIsFocused) const;
williamr@2
  2582
	void SetHeightForNumOfLinesL();
williamr@2
  2583
	void ApplyAutoSelectionL();
williamr@2
  2584
	void SetScrollBarsL();
williamr@2
  2585
	void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const;
williamr@2
  2586
	void RetrieveDataFromClipboardL();
williamr@2
  2587
	void SetCursorVisibilityL(TBool aEmphasis);
williamr@2
  2588
	TBool OwnsScrollBars() const;
williamr@2
  2589
	void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
williamr@2
  2590
	void UpdateHorizScrollBarThumb();
williamr@2
  2591
	void UpdateVertScrollBarThumbL();
williamr@2
  2592
	void DoSetUndoBufferL(const TCursorSelection& aSelection);
williamr@2
  2593
	void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict);
williamr@2
  2594
	void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced);
williamr@2
  2595
	void DeleteExtraParasL(TInt aStartPos,TInt aLength);
williamr@2
  2596
	TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength);
williamr@2
  2597
	TBool IsValidChar(TInt aChar) const;
williamr@2
  2598
	TInt CalcMinimumHeightFromNumOfLinesL() const;
williamr@2
  2599
	void CheckEdwinHeight();
williamr@2
  2600
	TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const;
williamr@2
  2601
	void SetEdwinHeight(TInt aHeight);
williamr@2
  2602
	void DoCreateCustomDrawL();
williamr@2
  2603
	void SetCursorSizeAndType();
williamr@2
  2604
	TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
williamr@2
  2605
	void DoCcpuCanPasteL() const;
williamr@2
  2606
	void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent);
williamr@2
  2607
	void CheckIfEdwinIsResizable();
williamr@2
  2608
	void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const;
williamr@2
  2609
	HBufC* GetAllowedCharsLC() const;
williamr@2
  2610
	TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const;
williamr@2
  2611
williamr@2
  2612
	TInt CursorWidth() const;
williamr@2
  2613
	TFontSpec CursorFontSpec() const;
williamr@2
  2614
williamr@2
  2615
	void BuildEdwinFepSupport();
williamr@2
  2616
	void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer);
williamr@2
  2617
	void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer);
williamr@2
  2618
    void UpdateCache(TInt aId);
williamr@2
  2619
	void DrawBackgroundAroundTextView( 
williamr@2
  2620
		CWindowGc& gc, 
williamr@2
  2621
		const TRect& aOuterRect, 
williamr@2
  2622
		const TRect& aInnerRect, 
williamr@2
  2623
		const TRgb& aBackgroundColor  ) const;
williamr@2
  2624
	TInt CurrentAlignment() const;
williamr@2
  2625
	void DoAlignment();
williamr@2
  2626
	void NewParagraphL();
williamr@2
  2627
    TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode);
williamr@2
  2628
    void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength );
williamr@2
  2629
    TRect AdjustedViewRect() const;
williamr@2
  2630
    void SetVKBStatus();
williamr@2
  2631
    void ScrollViewToCursorLineL();
williamr@2
  2632
    void PerformRecordedOperationL();
williamr@2
  2633
    void ScrollIfAtTopOrBottom();
williamr@2
  2634
williamr@2
  2635
private:
williamr@2
  2636
williamr@2
  2637
	void DrawFirstLineTextL() const;
williamr@2
  2638
    CAknEdwinDrawingModifier* AknEdwinDrawingModifier();
williamr@2
  2639
    TBool EditorSupportsNeutralProtection() const;
williamr@2
  2640
williamr@2
  2641
    /**
williamr@2
  2642
    * Main routine for neutral protection.  This routine returns a boolean stating if there is a
williamr@2
  2643
    * requirement for protection, but also returns the text that should replace the to-be-deleted text.
williamr@2
  2644
    * 
williamr@2
  2645
    * @param aPosOfLosEndOfDelete   index of the first character deleted
williamr@2
  2646
    * @param aLengthToDelete        length the text to be deleted
williamr@2
  2647
    * @param aNewText               neutral protection characters to replace the delete 
williamr@2
  2648
    * @param aForwardProtectionNeeded EFalse if only reverse protection needed; data valid only if 
williamr@2
  2649
    *                               method does not return EFalse.
williamr@2
  2650
    * @return                       EFalse iff no deletion is to be performed
williamr@2
  2651
    */
williamr@2
  2652
    TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded );
williamr@2
  2653
williamr@2
  2654
    /**
williamr@2
  2655
    * Returns whether the character is strongly directional
williamr@2
  2656
    *
williamr@2
  2657
    * @param    aChar   character to be examined
williamr@2
  2658
    * @param    aRightToLeft    This is valid upon return only if EFalse is not returned. 
williamr@2
  2659
    *                           Value is EFalse if the strong directionality is Left-to-right
williamr@2
  2660
    * @return   EFalse if the character is not strongly directional.  
williamr@2
  2661
    */
williamr@2
  2662
    TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const;
williamr@2
  2663
williamr@2
  2664
    /**
williamr@2
  2665
    * Returns ETrue if the character at aPos is neutral
williamr@2
  2666
    *
williamr@2
  2667
    * @param    aPos    index in editor; must be a valid index
williamr@2
  2668
    * @return           EFalse iff the character is not neutral
williamr@2
  2669
    */
williamr@2
  2670
    TBool CharIsNeutral( TInt aPos ) const;
williamr@2
  2671
williamr@2
  2672
    /**
williamr@2
  2673
    * Looks through the passed descriptor, looking for a strongly directional character.  
williamr@2
  2674
    * Direction of search can be set. Search starts at the begining if searching forward; 
williamr@2
  2675
    * starts at the end if searching backwards.
williamr@2
  2676
    * 
williamr@2
  2677
    * Search is carried out until a strong character is found or the end (or beginning) 
williamr@2
  2678
    * of the descriptor has been reached.
williamr@2
  2679
    * 
williamr@2
  2680
    * @param aText      Descriptor to search.
williamr@2
  2681
    * @param aForward   If EFalse, then search is backward (decreasing index) in logical buffer
williamr@2
  2682
    * @param aIsRightToLeft     Set to ETrue on return if first strong character found is RTL
williamr@2
  2683
    *
williamr@2
  2684
    * @return           EFalse if no strong character was found.
williamr@2
  2685
    */
williamr@2
  2686
    TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const;
williamr@2
  2687
williamr@2
  2688
    /**
williamr@2
  2689
    * Looks through the editor's text starting at character aPos, looking for a
williamr@2
  2690
    * strongly directional character.  Direction of search can be set.
williamr@2
  2691
    * Search is carried out until a strong character is found or the end (or beginning) 
williamr@2
  2692
    * of the editor text has been reached.
williamr@2
  2693
    * 
williamr@2
  2694
    * @param aPos       First character to look at
williamr@2
  2695
    * @param aForward   If EFalse, then search is backward (decreasing index) in logical buffer
williamr@2
  2696
    * @param aIsRightToLeft     Set to ETrue on return if first strong character found is RTL
williamr@2
  2697
    *
williamr@2
  2698
    * @return           EFalse if no strong character was found.
williamr@2
  2699
    */
williamr@2
  2700
    TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const;
williamr@2
  2701
williamr@2
  2702
    /**
williamr@2
  2703
    * Routine to perform the operation of replacing a selection with new text. 
williamr@2
  2704
    * This is intended for internal use.
williamr@2
  2705
    * 
williamr@2
  2706
    * The current selection, if non-zero length is deleted, and replace with aNewText if non-zero length
williamr@2
  2707
    * iTextView must be set.
williamr@2
  2708
    * 
williamr@2
  2709
    * @param aNewText               Replacement text. May be zero length.
williamr@2
  2710
    * @param aCursorPosInNewText    This is the position, relative to the beginning of the newtext,
williamr@2
  2711
    *                               that you want the cursor to be at when the operation is complete
williamr@2
  2712
    * @param aFormatHasChanged  Set this to ETrue if you want the reformatting to start at
williamr@2
  2713
    *                           the beginning of the paragraph. EFalse if just to reformat the line.
williamr@2
  2714
    *                           This variable may also be set by the call to DeleteHighlight that this
williamr@2
  2715
    *                           code executes, so it may be set to ETrue upon return, even if EFalse was
williamr@2
  2716
    *                           passed.
williamr@2
  2717
    */
williamr@2
  2718
    void ReplaceSelectionWithTextL( const TDesC& aNewText, 
williamr@2
  2719
                                    TInt aCursorPosInNewText,
williamr@2
  2720
                                    TBool& aFormatHasChanged );
williamr@2
  2721
williamr@2
  2722
    /**
williamr@2
  2723
    * Returns EFalse iff ( phone number had only numeric input modes AND the keymap is a phone number
williamr@2
  2724
    * type keymap ). 
williamr@2
  2725
    * Phone number type keymaps are:
williamr@2
  2726
    *   EAknEditorStandardNumberModeKeymap
williamr@2
  2727
    *   EAknEditorFixedDiallingNumberModeKeymap
williamr@2
  2728
    *
williamr@2
  2729
    * @return       EFalse if the phone number will only contain a pure phone number
williamr@2
  2730
    */
williamr@2
  2731
    TBool IsPurePhoneNumberEditor() const;
williamr@2
  2732
williamr@2
  2733
    /**
williamr@2
  2734
    * Standard check on upper and lower formatting thresholds versus current textview formatting mode.
williamr@2
  2735
    *
williamr@2
  2736
    * @return       EFalse iff the formatting mode does not need changing
williamr@2
  2737
    */ 
williamr@2
  2738
    TBool NeedToChangeFormattingModeL() const;         	
williamr@2
  2739
    
williamr@2
  2740
    /**
williamr@2
  2741
    * When Band formatting is started, this should be called to update the cached
williamr@2
  2742
    * metrics used for the scroll bar calculations.
williamr@2
  2743
    */
williamr@2
  2744
    void CalculateLineMetricsForBandFormattingL();
williamr@2
  2745
williamr@2
  2746
protected:	// from MObjectProvider
williamr@2
  2747
williamr@2
  2748
    /**
williamr@2
  2749
     * From @c MObjectProvider.
williamr@2
  2750
     *
williamr@2
  2751
     * Retrieves an object of the same type as that encapsulated in @c aId.
williamr@2
  2752
     *
williamr@2
  2753
     * This function is used to allow controls to ask their owners for access 
williamr@2
  2754
     * to other objects that they own.
williamr@2
  2755
     *
williamr@2
  2756
     * Other than in the case where NULL is returned, the object returned must 
williamr@2
  2757
     * be of the same object type - that is, the @c ETypeId member of the 
williamr@2
  2758
     * object pointed to by the pointer returned by this function must be equal
williamr@2
  2759
     * to the @c iUid member of @c aId.
williamr@2
  2760
     *
williamr@2
  2761
     * @param aId An encapsulated object type ID.
williamr@2
  2762
     * @return Encapsulates the pointer to the object provided. Note that the
williamr@2
  2763
     *         encapsulated pointer may be NULL.
williamr@2
  2764
     */
williamr@2
  2765
	IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
williamr@2
  2766
	
williamr@2
  2767
public: // new since 3.0
williamr@2
  2768
williamr@2
  2769
    /**
williamr@2
  2770
     * Sets skin id for text.
williamr@2
  2771
     * 
williamr@2
  2772
     * @param aAknSkinIdForTextColor The skin id.
williamr@2
  2773
     */
williamr@2
  2774
    IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor);
williamr@2
  2775
williamr@2
  2776
    /**
williamr@2
  2777
     * Sets highlight style.
williamr@2
  2778
     *
williamr@2
  2779
     * @param aStyle The highlight style.
williamr@2
  2780
     */
williamr@2
  2781
    IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle);
williamr@2
  2782
    
williamr@2
  2783
    // for custom drawer, not exported
williamr@2
  2784
    /**
williamr@2
  2785
     * Gets skin id.
williamr@2
  2786
     * 
williamr@2
  2787
     * @return The skin id.
williamr@2
  2788
     */
williamr@2
  2789
    TInt SkinColorId() const;
williamr@2
  2790
williamr@2
  2791
    /**
williamr@2
  2792
     * Gets highlight style.
williamr@2
  2793
     * 
williamr@2
  2794
     * @return The highlight style.
williamr@2
  2795
     */
williamr@2
  2796
    TAknsHighlightStyle HighlightStyle() const;
williamr@2
  2797
    
williamr@2
  2798
    /**
williamr@2
  2799
    * Called to determine the background color to draw. It is not to be used if skinning is
williamr@2
  2800
    * being used to draw the background.
williamr@2
  2801
    * 
williamr@2
  2802
    * This API can be used two ways: 
williamr@2
  2803
    * 
williamr@2
  2804
    * i) If the caller has a default color to offer (to be used as 
williamr@2
  2805
    * a fallback if SetBackgroundColorL has not been called), then he should use the 
williamr@2
  2806
    * Input/Output parameter aConditionalColor, and ignore the return value. The output
williamr@2
  2807
    * parameter will only be over-written by the set background color if SetBackgroundColorL
williamr@2
  2808
    * has been called.
williamr@2
  2809
    * 
williamr@2
  2810
    * ii) If the caller does not have a default color to offer, then he should pass in a dummy
williamr@2
  2811
    * input parameter and use the return value. 
williamr@2
  2812
    * 
williamr@2
  2813
    * @param    aConditionalColor   Output parameter. Returns a color set by 
williamr@2
  2814
    *                               SetBackgroundColorL. It is unchanged if 
williamr@2
  2815
    *                               background color has not been set by SetBackgroundColorL
williamr@2
  2816
    * @return   TRgb for the color to be used for background.
williamr@2
  2817
    */
williamr@2
  2818
    TRgb EditorBackgroundColor(TRgb& aConditionalColor) const;
williamr@2
  2819
	
williamr@2
  2820
protected:
williamr@2
  2821
williamr@2
  2822
    /**
williamr@2
  2823
     * Edwin user flags.
williamr@2
  2824
     */
williamr@2
  2825
	TUint32 iEdwinUserFlags;
williamr@2
  2826
williamr@2
  2827
    /**
williamr@2
  2828
     * Internal Edwin flags.
williamr@2
  2829
     */
williamr@2
  2830
	TUint32 iEdwinInternalFlags;
williamr@2
  2831
williamr@2
  2832
    /**
williamr@2
  2833
     * Edwin's text content.
williamr@2
  2834
     */
williamr@2
  2835
	CPlainText* iText;
williamr@2
  2836
williamr@2
  2837
protected: // Internal to Symbian
williamr@2
  2838
williamr@2
  2839
    /**
williamr@2
  2840
     * Edwin's text view.
williamr@2
  2841
     */
williamr@2
  2842
	CTextView* iTextView;
williamr@2
  2843
williamr@2
  2844
    /**
williamr@2
  2845
     * Edwin's text layout.
williamr@2
  2846
     */
williamr@2
  2847
	CTextLayout* iLayout;
williamr@2
  2848
williamr@2
  2849
protected:
williamr@2
  2850
williamr@2
  2851
    /**
williamr@2
  2852
     * Maximum length ot the edwin.
williamr@2
  2853
     */
williamr@2
  2854
	TInt iTextLimit;
williamr@2
  2855
    
williamr@2
  2856
    /**
williamr@2
  2857
     * Number of lines in Edwin.
williamr@2
  2858
     */
williamr@2
  2859
	TInt iNumberOfLines;
williamr@2
  2860
	
williamr@2
  2861
    /**
williamr@2
  2862
     * Current zoom factor.
williamr@2
  2863
     */
williamr@2
  2864
    MGraphicsDeviceMap* iZoomFactor;
williamr@2
  2865
	
williamr@2
  2866
    /**
williamr@2
  2867
     * Cursor position.
williamr@2
  2868
     */
williamr@2
  2869
    TInt iLastPointerDocPos;
williamr@2
  2870
	
williamr@2
  2871
    /**
williamr@2
  2872
     * Edwin's margins.
williamr@2
  2873
     */
williamr@2
  2874
    TMargins8 iMargins;
williamr@2
  2875
williamr@2
  2876
private:
williamr@2
  2877
williamr@2
  2878
	friend class CEikEdwinFepSupport;
williamr@2
  2879
	friend class CEikEdwinExtension;
williamr@2
  2880
	// added this class to allow additional data members without breaking BC
williamr@2
  2881
	CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar
williamr@2
  2882
	CEikScrollBarFrame* iSBFrame;
williamr@2
  2883
	MEikEdwinObserver* iEdwinObserver;
williamr@2
  2884
	CArrayPtr<MEikEdwinObserver>* iObserverArray;
williamr@2
  2885
	CEikEdwinFepSupport* iEdwinFepSupport;
williamr@2
  2886
	CUndoBuffer* iUndoStore;
williamr@2
  2887
	TInt iAvgLinesInViewRect;
williamr@2
  2888
	TInt iAvgCharsPerLine;
williamr@2
  2889
	TInt iRightWrapGutter;
williamr@2
  2890
	TInt iLayoutWidth;
williamr@2
  2891
	MEikEdwinSizeObserver* iEdwinSizeObserver;
williamr@2
  2892
	TInt iMinimumHeight;
williamr@2
  2893
	TInt iMaximumHeight;
williamr@2
  2894
/* 
williamr@2
  2895
iMaximumHeightInLines
williamr@2
  2896
---------------------
williamr@2
  2897
This is simply a holder for the number, used to simplify some Avkon LAF requirements.
williamr@2
  2898
The viewable region of an edwin is actually measured in pixels, However, if certain LAF
williamr@2
  2899
requirements are enforced (that the view region has to be smaller than the number of 
williamr@2
  2900
lines viewable * the baseline separation (in pixels)) some undesired scrolling effects
williamr@2
  2901
occur.
williamr@2
  2902
williamr@2
  2903
williamr@2
  2904
That is to say, by simply setting iMaximumHeightInLines, this will not affect
williamr@2
  2905
the actual maximum height of the edwin.  To do this, you must set the iMaximumHeight
williamr@2
  2906
williamr@2
  2907
One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. 
williamr@2
  2908
That method uses iMaximumHeightInLines along with the baseline separation, to set 
williamr@2
  2909
the iMaximumHeight.
williamr@2
  2910
williamr@2
  2911
The general formula is very simple, to remove unneeded scrolling.
williamr@2
  2912
iMaximumHeight=baselineSeparation*iMaximumNumberOfLines
williamr@2
  2913
williamr@2
  2914
If you cannot allocate sufficient space to the edwin, to permit so much viewable region
williamr@2
  2915
then the method AlterViewRect can be called on the TextView() component.  This will introduce
williamr@2
  2916
a clipping rectangle, which allows blank space required by the edwin layout component
williamr@2
  2917
to not be shown.
williamr@2
  2918
*/
williamr@2
  2919
	TInt iMaximumHeightInLines; 
williamr@2
  2920
	CLafEdwinCustomDrawBase* iCustomDrawer;
williamr@2
  2921
	TInt iLastPointerAnchorPos;
williamr@2
  2922
	CAknCcpuSupport* iCcpuSupport;
williamr@2
  2923
	CCharFormatLayer* iCharFormatLayer;
williamr@2
  2924
	CParaFormatLayer* iParaFormatLayer;
williamr@2
  2925
	TInt iSpare_1;
williamr@2
  2926
	TInt iSpare_2;
williamr@2
  2927
	};
williamr@2
  2928
williamr@2
  2929
williamr@2
  2930
inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL()
williamr@2
  2931
	{ return CreateScrollBarFrameL(ETrue);}
williamr@2
  2932
inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame()
williamr@2
  2933
	{ return ((CEikScrollBarFrame* const)iSBFrame); }
williamr@2
  2934
inline TInt CEikEdwin::AvgLinesInViewRect() const
williamr@2
  2935
	{ return iAvgLinesInViewRect; }
williamr@2
  2936
inline TInt CEikEdwin::AvgCharsPerLine() const
williamr@2
  2937
	{ return iAvgCharsPerLine;}
williamr@2
  2938
inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines)
williamr@2
  2939
	{ iAvgLinesInViewRect=aAvgLines; }
williamr@2
  2940
inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars)
williamr@2
  2941
	{ iAvgCharsPerLine=aAvgChars; }
williamr@2
  2942
williamr@2
  2943
inline void CEikEdwin::SetMaxLength(TInt aLength ) 
williamr@2
  2944
	{ SetTextLimit(aLength); }
williamr@2
  2945
inline TInt CEikEdwin::MaxLength() const 
williamr@2
  2946
	{ return iTextLimit; }
williamr@2
  2947
williamr@2
  2948
#endif