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