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