2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKEDWIN_H__)
20 #define __EIKEDWIN_H__
38 #include <AknPictographDrawerInterface.h>
39 #include <babitflags.h>
40 #include <centralrepository.h> // class CCenRepNotifyHandler;
41 #include <cenrepnotifyhandler.h> // class CRepository;
44 class CParaFormatLayer;
45 class CCharFormatLayer;
47 class CEikEdwinFepSupport;
48 class CLafEdwinCustomDrawBase;
50 class CAknEdwinFormAccessor;
52 class CAknInputPolicyManager;
53 class CFormCursorModifier;
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;
65 class CSmileyCustomWrap;
66 class CAknEdwinPhysicsHandler;
67 class CEdwinAsyncFormat;
69 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
70 class CEikAvkonCustomDraw;
72 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
73 class CEikAvkonCustomDraw;
75 // For construction of Rich Text - based custom formatters
87 * This describes the features of a
88 * search-and-replace operation on a CEikEdwin.
90 * See CEikEdwin::ReplaceL().
92 struct SEdwinFindModel
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;
105 * Styles for highlighting. See SetHighlightStyleL().
107 enum TAknsHighlightStyle
109 /** Normal highlighting. */
110 EEikEdwinHighlightNormal = 0,
111 /** Link highlighting. */
112 EEikEdwinHighlightLink
115 // inline utility to handle RGB values (set / unset)
123 SAknRgb():iIsSet(EFalse){}
124 TRgb Value(){return iValue;}
125 SAknRgb& operator=(TRgb aRgb)
131 TBool IsSet(){return iIsSet;}
135 * Base class for controls that display and allow manipulation of text.
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).
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.
144 class CEikEdwin : public CEikBorderedControl,
145 public MEikScrollBarObserver,
146 public CTextView::MObserver,
147 public MEditObserver,
148 public MEikCcpuEditor
154 NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback
158 * Allocates and constructs a CEikEdwinExtension.
160 * @param aEdwin Pointer to the CEikEdwin creating the extension.
161 * @return A newly constructed edwin extension.
163 static CEikEdwinExtension* NewL(CEikEdwin* aEdwin);
168 ~CEikEdwinExtension();
171 * Gets the form accessor.
173 * @return The form accessor.
175 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
178 * Sets the form accessor.
180 * @param aFormAccessor The form accessor.
182 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
185 * Sets the CIdle object to update scroll bar.
187 * @param The CIdle object to perform scroll bar updating.
189 IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter);
192 * Gets the CIdle object which updates scroll bar.
194 * @return The CIdle object used to perform scroll bar updating.
196 IMPORT_C CIdle* ScrollBarSetter();
199 * Gets the custom wrapper.
201 * @return The custom wrapper.
203 IMPORT_C const TAvkonEditorCustomWrap& TextWrapper();
205 // the following two methods are deprecated
206 IMPORT_C CFormCursorModifier* FormCursorModifier() const;
209 * Store a locally stored (but externally set) Skins background control context.
211 * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL.
213 void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext );
216 * Access to locally stored Skins background control context.
218 * @return Pointer to locally stored control context
221 MAknsControlContext* SkinBackgroundControlContext() const;
224 * This returns a flag that records whether the background context has ever been
227 * @return EFalse iff control context has never been set.
229 TBool SkinBackgroundControlContextHasBeenSet() const;
232 * Stores the alignment value.
234 * @param aAlignment Editor alignment to be stored.
236 void SetAlignment(TInt aAlignment);
239 * Returns the stored alignment value.
241 * @return Value of the current editor alignment.
243 TInt CurrentAlignment() const;
246 * Sets pictograph animation callback.
248 void SetPictoCallBack( TCallBack& aCallBack );
251 * Sets pictograph animation callback.
253 const TCallBack& PictoCallBack() const;
256 * Creates the CAknFormExtendedInterfaceProvider object if it does not exist.
258 void CreateFormExtendedInterfaceProviderIfNeededL();
261 * Access to Form's extended interface provider.
263 CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const;
266 * Create a custom formatter for pure phone number content.
268 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
269 * ExtendedInterfaceProvider object built.
271 * @param aTextLayout Reference to the CTextLayout object used for this editor.
272 * aText CPlainText object reference for the text used in the editor.
274 void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText);
277 * Create a custom formatter for pure phone number content.
279 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
280 * ExtendedInterfaceProvider object built.
282 * @param aTextLayout Reference to the CTextLayout object used for this editor
284 void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout );
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
290 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
291 * ExtendedInterfaceProvider object built.
293 * @param aTextLayout Reference to the CTextLayout object used for this editor
295 void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText );
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
301 * @return pointer to the inline text source object that will be provided to Tagma
302 * Null is returned if none is installed.
304 CAknInlineTextSource* InlineTextSource() const;
307 * Returns pointer to pictograph interface.
309 * @return Pointer to pictograph interface. The value can be NULL if pictographs are not supported.
311 CAknPictographInterface* PictographInterface() const;
314 * Used for suppressing all editor's background drawing.
316 void SetSuppressBackgroundDrawing( TBool aSuppress );
319 * Tests if the background drawing is suppressed.
321 TBool IsBackgroundDrawingSuppressed() const;
324 * Returns the value of ClearDirection
326 * @return value of current ClearDirection
328 TInt ClearDirection() const;
331 * Enables kinetic scrolling.
333 void EnableKineticScrollingL();
338 void EnablePhysicsL();
341 * Initializes physics.
345 public: // from MCenRepNotifyHandlerCallback
346 void HandleNotifyInt(TUint32 aId, TInt aNewValue);
350 CEikEdwinExtension();
351 void ConstructL(CEikEdwin* aEdwin);
357 ESkinBackgroundControlContextHasBeenSetIndex = 0,
358 ESuppressBackgroundDrawing,
359 EKineticScrollingEnabled
361 class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack
363 private: // From MAknPictographAnimatorCallBack
364 void DrawPictographArea();
369 CIdle* iSetScrollBar;
370 TAvkonEditorCustomWrap iTextWrapper;
371 CAknEdwinFormAccessor* iFormAccessor;
372 CFormCursorModifier* iFormCursorModifier;
373 MAknsControlContext* iSkinBackgroundControlContext;
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
389 TAknsHighlightStyle iSkinHighlightStyle;
390 SAknRgb iEditorBackgroundColor;
391 TInt iUpperFullFormattingLength;
392 CAknExtendedInputCapabilities* iExtendedInputCapabilities;
393 TRect iTextLinesRect;
398 CAknPointerEventSuppressor* iPtSuppressor;
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.
407 TBool* iDestroyedPtr;
417 CSmileyManager* iSmiley;
418 CSmileyCustomWrap* iSmileyWrap;
419 TBool iInlineEditing;
420 TBool iDisableConvertInFormat;
421 TCursorSelection iVisibleRange;
422 CEdwinAsyncFormat* iAsyncFormat;
425 * Pointer to CEikEdwin.
431 * Scrolled offset if using rate scroll way.
436 * If ETrue, uses rate scroll. Otherwise uses original way.
438 TBool iUseRateScroll;
441 * Used with each step of dragging scrollbar to record
442 * the thumb position before dragging action
444 TInt iScrollbarPosition;
447 * Physics handler. Used only when physics feature is enabled.
450 CAknEdwinPhysicsHandler* iPhysicsHandler;
453 * Content has moved down so that empty space
454 * above the editor content is visible.
456 TBool iStartBorderExceeded;
459 * Content has moved up so that empty space
460 * below the editor content is visible.
462 TBool iEndBorderExceeded;
465 * Amount of pixels out of border. In practice width
466 * of empty space above or below editor content.
468 TInt iPixelsOutOfBorder;
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.
475 TBool iCursorWasVisible;
478 * If ETrue, ongoing scrolling is caused by moving scrollbar thumb.
480 TBool iScrolledByScrollBar;
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().
490 * These flags are duplicated in @c uikon.hrh (see @c EEikEdwinKeepDocument
496 EZeroEnumValue =0x00000000,
499 * If set, @c CEikEdwin does not destroy its content on destruction.
501 EKeepDocument =0x00000001,
504 * If set, the content buffer uses segmented storage (see
505 * @c CEditableText::ESegmentedStorage).
507 ESegmentedStorage =0x00000002,
510 * The size specified in the resource used to construct the object is
511 * given in pixels, not character widths.
513 EWidthInPixels =0x00000004,
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.
520 ENoAutoSelection =0x00000008,
523 * If set, then whenever the control is activated the cursor is
524 * moved to the end of the text.
526 EJustAutoCurEnd =0x00000010,
529 * Does not wrap the text being edited.
534 * Uses a line cursor instead of a block cursor.
536 ELineCursor =0x00000040,
539 * Does not perform horizontal scrolling.
541 ENoHorizScrolling =0x00000080,
544 * If set, scroll bars required to edit long documents appear inside
545 * the Edwin. This reduces the area used to display the Edwin.
547 * If not set, scroll bars appear outside the Edwin.
549 EInclusiveSizeFixed =0x00000100,
552 * Sets the Edwin’s height according to the number of lines of text
553 * supplied by the user.
555 EUserSuppliedText =0x00000200,
558 * The Edwin is a window-owning control.
560 EOwnsWindow =0x00000400,
563 * The Edwin does not respond to input at all.
565 EDisplayOnly =0x00000800,
568 * Does not hide the selection if the Edwin loses focus.
570 EAlwaysShowSelection =0x00001000,
573 * The Edwin is read-only so users cannot add text to any document it
576 EReadOnly =0x00002000,
579 * If set, no special attempt will be made to delete the embedded pictures cleanly.
581 * This flag does not apply to Edwins which do not edit rich text.
583 EAllowPictures =0x00004000,
586 * The Edwin supports undo operations.
588 EAllowUndo =0x00008000,
591 * Does not allow line or paragraph breaks in the text being edited.
593 ENoLineOrParaBreaks =0x00010000,
596 * Allows only ASCII characters.
598 EOnlyASCIIChars =0x00020000,
601 * The Edwin is resizable.
603 EResizable =0x00040000,
606 * The Edwin ignores the virtual cursor.
608 EIgnoreVirtualCursor =0x00080000,
611 * No custom draw is done.
613 ENoCustomDraw =0x01000000,
616 * Changes layout to Avkon style.
618 EAvkonEditor =0x02000000,
623 EAvkonDisableCursor =0x04000000,
626 * Changes text editor to non-editable mode.
628 EAvkonNotEditable =0x08000000,
631 * Sets the @c Avkon wrapping rules ON.
633 EEdwinAlternativeWrapping = 0x10000000,
636 * Enables tab key handling
638 EAvkonTabsEnabled = 0x20000000,
643 EAvkonDisableVKB = 0x40000000,
646 * Enable Smiley Support
648 EAvkonEnableSmileySupport = 0x80000000
652 * Defines the possible commands for @c ClipboardL().
670 * The following flags may be ORed together for text searches (see
671 * @c FindL() for example).
675 /** Search progresses up the screen. */
676 EFindDirectionUp =0x01,
678 /** Only whole-word matches count. */
679 EFindWholeWord =0x02,
681 /** Search is case-sensitive. */
682 EFindCaseSensitive =0x04,
687 /** Does not display a busy message. */
688 ENoBusyMessage =0x10,
691 EReadOnlyFile =0x20 // New for CKon
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
701 /** Replaces the Edwin’s existing content. */
704 /** Copies the supplied content into the existing content. */
709 * Specifies whether the Edwin owns the document it is being used to edit.
711 * If the Edwin owns the document, the document object is destroyed on
716 /** Document is owned by the Edwin. */
719 /** Document is owned by some other object. */
723 // order of hotkeys defined in resource file. Not all applicable to plain
726 * Enumerates the hotkeys that are defined an @c r_eik_edwin_ctrl_hotkeys
727 * or @c r_eik_edwin_shift_ctrl_hotkeys resource.
729 * Not all are applicable to plain text editors.
748 /** Insert a character. */
763 /** Insert an object. */
766 /** Edit an object. */
769 /** Format an object. */
773 public: // construction and destruction
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.
781 IMPORT_C ~CEikEdwin();
784 * C++ default constructor.
786 * Creates a new @c Edwin, FEP support for the new editor will not be
787 * present if there is insufficient memory.
789 IMPORT_C CEikEdwin();
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.
798 * @param aBorder The Edwin border.
800 IMPORT_C CEikEdwin(const TGulBorder& aBorder);
803 * Handles Symbian 2nd phase construction.
804 * Completes construction of a new @c Edwin, initialising its heap-stored
805 * members from the supplied arguments.
807 * @param aEdwinFlags Bitwise ORed combination of flags from @c TFlags.
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.
813 * @param aNumberOfLines Height for the Edwin, in lines. Default value
816 IMPORT_C void ConstructL(TInt aEdwinFlags=0,
817 TInt aWidthInChars=0,
819 TInt aNumberOfLines=0);
822 * Sets the Edwin observer. The Edwin’s observer will be called back with
823 * control events associated with the Edwin.
825 * @param aEdwinObserver New observer.
827 IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver);
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.
834 * @param aEdwinObserver The observer to add to the list of observers.
836 IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);
839 * Removes the specified observer from the list of observers. Does nothing
840 * if aEdwinObserver is not an observer.
842 * @param aEdwinObserver The observer to remove from the list of observers.
844 IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);
847 * Creates the containing window for the Edwin if it does not already have one.
849 IMPORT_C void SetContainerWindowL();
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.
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.
860 IMPORT_C void SetDocumentContentL(CGlobalText& aText,
861 TSetContent aContent=CEikEdwin::ECopyText);
863 public: // from CCoeControl
866 * From @c CCoeControl.
868 * Handles key events.
870 * @param aKeyEvent The key event.
871 * @param aType The type of the event: @c EEventKeyDown, @c EEventKeyUp
873 * @return A suitable response code.
875 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
879 * From @c CCoeControl.
881 * Responds to focus-changed events.
883 * @param aDrawNow Not used.
885 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
888 * From @c CCoeControl.
890 * Sets the Edwin as ready for drawing.
892 * @leave KErrNoMemory.
894 IMPORT_C void ActivateL();
897 * From @c CCoeControl.
899 * Completes the construction of a new @c Edwin. This function initialises
900 * the heap-stored members from an @c EDWIN resource.
902 * @param aReader A reader positioned for reading from an @c EDWIN resource.
904 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
907 * From @c CCoeControl.
909 * Handles pointer events.
911 * @param aPointerEvent Pointer event to respond to.
913 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
916 * From @c CCoeControl.
918 * Gets the minimum size of this Edwin for automatic-layout control
919 * contexts such as dialogs.
921 * @return Minimum size for the control.
923 IMPORT_C TSize MinimumSize();
926 * From @c CCoeControl.
928 * Draws the control on request.
930 * @param aRect If supplied, the rectangle in which to draw the Edwin.
932 IMPORT_C void Draw(const TRect& aRect) const;
935 * From @c CCoeControl.
937 * Dims or undims the Edwin.
939 * @param aDimmed @c ETrue to dim the Edwin. @c EFalse to undim the Edwin.
941 IMPORT_C void SetDimmed(TBool aDimmed);
944 * From @c CCoeControl.
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
950 *@param aParent The control to set as this Edwin’s parent.
952 IMPORT_C void SetContainerWindowL(const CCoeControl& aParent);
955 * From @c CCoeControl.
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
961 * @param[out] aColorUseList The list of logical colours.
963 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>&
964 aColorUseList) const; // not available before Release 005u
966 // not available before Release 005u
968 * From @c CCoeControl.
970 * Handles a change to Edwin’s resources which are shared across the
971 * environment. Colours or fonts for example.
973 * @param aType The type of resource that was changed.
975 IMPORT_C virtual void HandleResourceChange(TInt aType);
978 * From @c CCoeControl.
980 * Access to the input capabilities of the edwin.
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.
988 * @return The Edwin input capabilities.
990 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
993 * From @c CCoeControl.
995 * This method sets the input capabilities of the edwin. Ownership of the
996 * T-class is not transferred.
998 * @param aInputCapabilities Reference to an input capabilities object
1000 * @leave KErrNoMemory Edwin FEB support object is not created.
1002 IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities&
1003 aInputCapabilities);
1006 * From @c CCoeControl.
1008 * In debug mode writes the internal state to the given stream. Does
1009 * nothing in release mode.
1011 * @param[out] aWriteStream A stream for writing the internal state.
1013 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1020 IMPORT_C void* ExtensionInterface( TUid aInterface );
1022 public: // from MEikScrollBarObserver
1025 * From @c MEikScrollBarObserver.
1027 * Handles scrollbar key events.
1029 * @param aScrollBar The scrollbar.
1030 * @param aEventType The type of key event.
1032 IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar,
1033 TEikScrollEvent aEventType);
1035 public: // from CTextView::MObserver
1038 * From @c CTextView::MObserver.
1040 * Called after reformatting but before redisplay so that edit windows
1041 * etc. can be resized.
1043 * @param aTextView Not used.
1045 IMPORT_C void OnReformatL(const CTextView* aTextView);
1050 * Gets the number of characters in the document.
1052 * @return The number of characters in the document.
1054 IMPORT_C TInt TextLength() const;
1057 * Gets the cursor’s position within the document.
1059 * @return The cursor’s position within the document.
1061 IMPORT_C TInt CursorPos() const;
1064 * Gets the number of characters including non-printing characters within
1067 * @return The number of characters within the selection.
1069 IMPORT_C TInt SelectionLength() const;
1072 * Gets the cursor selection. If no text view is associated to the Edwin
1073 * this returns @c TCursorSelection(0,0).
1075 * @return The current selection.
1077 IMPORT_C TCursorSelection Selection() const;
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.
1083 IMPORT_C void ClearSelectionL();
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.
1090 * @param aCursorPos The cursor’s position.
1091 * @param aAnchorPos The anchor’s position.
1093 IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos);
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
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.
1105 IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect);
1108 * Selects the entire document.
1110 IMPORT_C void SelectAllL();
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.
1119 * If the @c EWidthInPixels flag has been set, the @c aWidthInChars
1120 * argument is measured in pixels, not characters.
1122 * @param aWidthInChars Width in either pixels or characters.
1124 IMPORT_C void CalculateWidth(TInt aWidthInChars);
1127 * Copies the entire document’s content into a descriptor. It is the
1128 * caller's responsibility to provide a large enough buffer.
1130 * @param[out] aDes An initialised descriptor which on return contains a
1131 * copy of the content of this Edwin.
1133 IMPORT_C void GetText(TDes& aDes) const;
1136 * Gets a new buffer containing a copy of the whole text document.
1138 * @return A new copy of the document text.
1140 IMPORT_C HBufC* GetTextInHBufL() const;
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.
1147 * @param aDes Descriptor from which to copy.
1149 IMPORT_C void SetTextL(const TDesC* aDes);
1152 * Handles cut, copy and paste commands. This function also reports a
1153 * change of state of the control to the observer when necessary.
1155 * @param aClipboardFunc Clipboard operation.
1157 IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
1160 * Inserts a field at the current cursor position. If a selection was made
1161 * the field replaces that selection.
1163 * @param aField Text field to insert.
1164 * @param aFieldType Type of the field.
1166 IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType);
1169 * Updates all the fields in the document.
1171 IMPORT_C void UpdateAllFieldsL();
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.
1178 * This function does nothing if the cursor is not within a text field.
1180 IMPORT_C void UpdateCurrentFieldL();
1183 * Counts and returns the number of words in the document.
1185 * @return The number of words in the document.
1187 IMPORT_C TInt CountWords();
1190 * Inserts the contents of a text file into the text being edited at the
1191 * current cursor position.
1193 * @param aFileName The file to open and read.
1194 * @param aTextOrganisation How to handle line breaks. Default value is
1195 * @c CPlainText::EOrganiseByLine.
1197 IMPORT_C void InsertFromTextFileL(const TFileName &aFileName,
1198 const CPlainText::TTextOrganisation
1199 aTextOrganisation=CPlainText::EOrganiseByLine);
1202 * Uses @c SetScrollBarsL() to set the scrollbars.
1204 * @param aPtr Pointer to @c CEikEdwin instance.
1205 * @return Integer value of @c EFalse.
1207 IMPORT_C static TInt IdleL(TAny *aPtr);
1210 * Gets a pointer to the Edwin’s document contents.
1212 * @return A @c CPlainText pointer which contains the
1215 IMPORT_C CPlainText* Text() const;
1217 // this is particularly important for when the front-end processor is
1218 // inline-editing a CEikEdwin
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.
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.
1232 IMPORT_C void CancelFepTransaction();
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.
1239 IMPORT_C void HandleTextChangedL();
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.
1246 * @return Width of the text layout area in pixels.
1248 IMPORT_C TInt LayoutWidth() const;
1251 * Formats and draws a new document, updates scrollbars if necessary.
1253 IMPORT_C void NotifyNewDocumentL();
1256 * Reformats and redraws the document, updates scrollbars if necessary.
1258 IMPORT_C void NotifyNewFormatL();
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.
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.
1269 IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);
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.
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.
1283 IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);
1286 * Replaces the highlighted text. See @c SEdwinFindModel struct.
1288 * @param[in,out] aFindModel Pointer to the replacement text.
1290 IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel);
1293 * Replaces all occurrences of a string with new text. Both old and new
1294 * text are held in @c aFindModel.
1296 * @param[in,out] aFindModel Pointer to the replacement text.
1297 * @leave This function will leave if the replace operation fails
1300 IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel);
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
1307 * @param aFindText An empty descriptor.
1309 IMPORT_C void GetFindText(TDes* aFindText);
1312 * Updates scrollbars.
1314 IMPORT_C void UpdateScrollBarsL();
1317 * Creates the Edwin scroll bar frame with no pre-allocation of memory
1320 * @return The scroll bar frame.
1322 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL();
1325 * Creates a pre-allocated scroll bar frame.
1327 * @return Pre-allocated scroll bar frame.
1329 inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();
1332 * Gets the scroll bar frame surrounding this Edwin.
1334 * @return Pointer to this Edwin’s scroll bar frame.
1336 inline CEikScrollBarFrame* ScrollBarFrame();
1339 * Sets word wrapping on or off.
1341 * @param aWrapIsOn @c ETrue enables word wrapping, @c EFalse disables
1344 IMPORT_C void SetWordWrapL(TBool aWrapIsOn);
1347 * Gets the width of a line cursor in pixels.
1351 IMPORT_C virtual TInt LineCursorWidth() const;
1354 * Sets the zoom factor of the document and reformats the document.
1356 * @param aZoomFactor New value for the zooming factor.
1358 IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor);
1361 * Sets the Edwin’s background colour.
1363 * @param aBackground New value for the background colour.
1365 IMPORT_C void SetBackgroundColorL(TRgb aBackground);
1368 * Sets the format mode to be WYSIWYG.
1370 * @param aLayoutWidth Formatting width in twips.
1371 * @param aDevice Mapping between twips and pixels on the target device.
1373 IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth,
1374 MGraphicsDeviceMap* aDevice);
1377 * Switches off the WYSIWYG mode. This function sets the new format mode
1378 * to be @c EFScreenMode.
1380 IMPORT_C void SetWysiwygModeOff();
1383 * Updates the text wrap width. This function is for use in WYSIWYG mode
1386 * @param aLayoutWidth New width to wrap text at in WYSIWYG mode in twips.
1388 IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth);
1391 * Sends the Edwin’s document using an infra red beamer.
1393 IMPORT_C void SendDataOverIrL();
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.
1400 IMPORT_C void ReceiveDataOverIrL();
1403 * Controls the formatting mode of the editor.
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.
1412 * This method performs an immediate re-formatting of all or part of the text with the new formatting mode.
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
1418 IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse);
1421 * Controls the formatting mode of the editor.
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.
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.
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
1442 IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat );
1445 * Sets the @c EPasteFromIrStore flag.
1447 * @param aPasteFromIrStore @c ETrue to set the @c EPasteFromIrStore flag.
1448 * @c EFalse to remove the @c EPasteFromIrStore flag.
1450 IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore);
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
1457 * @param[out] aStore Store from which to read.
1458 * @param[in] aDict Stream dictionary.
1460 IMPORT_C void PasteFromStoreL(CStreamStore& aStore,
1461 CStreamDictionary& aDict);
1464 * Copies the highlighted text into a stream store.
1466 * @param[out] aStore Store to write to.
1467 * @param[in] aDict Stream dictionary.
1469 IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict);
1472 * Sets the text view margins.
1474 * @param aMargins New value for the view’s margins.
1476 IMPORT_C void SetBorderViewMargins(TMargins8 aMargins);
1479 * Forces the scrollbars to update now; this is a synchronous function.
1481 IMPORT_C void ForceScrollBarUpdateL();
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.
1489 * @param aOwner Whether Edwin or another object owns the document.
1490 * See @c TOwnershipType.
1492 IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner);
1495 * Sets the maximum number of characters that can be inserted.
1497 * @param aLimit New maximum for the number of characters that can be
1500 IMPORT_C void SetTextLimit(TInt aLimit);
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.
1507 IMPORT_C void RunCharMapDialogL();
1510 * Gets the text view margins.
1512 * @return The text view margins.
1514 IMPORT_C TMargins8 Margins() const;
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.
1523 * @return The value of @c KFullFormattingUpperThreshold.
1525 IMPORT_C TInt UpperFullFormattingLength() const;
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.
1538 * @return The value of @c KPartialFormattingLowerThreshold.
1540 IMPORT_C TInt LowerPartialFormattingLength() const;
1543 * Sets the Edwin’s read-only flag so that documents displayed by Edwin
1544 * cannot be edited by users.
1546 * @param aReadOnly @c ETrue to set Edwin to display documents as
1547 * read-only. @c EFalse otherwise.
1549 IMPORT_C void SetReadOnly(TBool aReadOnly);
1552 * Determines whether the document being edited with Edwin is read-only.
1554 * @return @c ETrue if the document being edited is read-only.
1555 * @c EFalse otherwise.
1557 IMPORT_C TBool IsReadOnly() const;
1560 * Gets editor flags from the editor.
1561 * @return editor flags if existed
1562 * @or return KErrNotFound
1564 IMPORT_C TInt CEikEdwin::AknEditorFlags();
1569 * Determines whether the document being edited is read only. Displays
1570 * a message with @c CEikonEnv::InfoMsg() if the document is set as
1573 IMPORT_C void CheckNotReadOnlyL();
1576 * Sets whether the document accepts pictures.
1578 * @param aAllow @c ETrue sets the document to accept pictures, @c EFalse
1579 * sets the document to not accept pictures.
1581 IMPORT_C void SetAllowPictures(TBool aAllow);
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.
1588 * @param aStartPos Where to start looking for unwanted pictures.
1589 * @param aLength Where to stop.
1591 IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength);
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
1598 * @param aGap Size of the gutter in pixels.
1600 IMPORT_C void SetRightWrapGutter(TInt aGap);
1603 * Undoes the most recent text operation when the Edwin supports this
1604 * feature and when the undo store is not empty.
1606 IMPORT_C void UndoL();
1609 * Deletes the undo store.
1611 IMPORT_C void ClearUndo();
1614 * Sets whether the undo operation is permitted.
1616 * @param aAllow ETrue to permit undo operations. EFalse to not permit undo
1619 IMPORT_C void SetAllowUndo(TBool aAllow);
1622 * Gets whether Edwin is set to support the undo command.
1624 * @return @c ETrue if edits can be undone. @c EFalse if edits cannot
1627 IMPORT_C TBool SupportsUndo() const;
1630 * Tests whether an undo is possible. Returns @c ETrue only if the undo
1631 * store is available to Edwin.
1633 * @return @c ETrue if the undo store is available. @c EFalse if the
1634 * undo store is not available.
1636 IMPORT_C TBool CanUndo() const;
1639 * Sets whether picture characters and/or punctuation should be treated as
1640 * word delimiters in addition to whitespace.
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.
1647 IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation);
1650 * Gets the start position and the length of the word in which the
1651 * specified document position is located.
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.
1657 IMPORT_C void GetWordInfo(TInt aCurrentPos,
1659 TInt& aLength) const;
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.
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.
1670 IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement,
1674 * Scrolls the text either horizontally or vertically without affecting
1675 * the cursor’s position.
1677 * @param aMovement The cursor's movement.
1679 IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement);
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
1686 * @param aStartPos The start position in the text.
1687 * @param aLength The number of characters, beginning with aStartPos to
1690 IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength);
1693 * Sets the @c EOnlyASCIIChars flag.
1695 * @param aASCIIOnly If @c ETrue the EOnlyASCIIChars flag will be set. If
1696 * @c EFalse the EOnlyASCIIChars flag will be removed.
1698 IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly);
1701 * Tests whether the @c EOnlyASCIIChars flag is set.
1703 * @return @c ETrue if the @c EOnlyASCIIChars flag is set.
1705 IMPORT_C TBool OnlyASCIIChars() const;
1708 * Gets the average number of lines shown in Edwin’s view.
1710 * @return The average number of lines.
1712 inline TInt AvgLinesInViewRect() const;
1715 * Gets the average number of characters on a line.
1717 * @return The average number of characters on a line.
1719 inline TInt AvgCharsPerLine() const;
1722 * Sets the average number of lines displayed in Edwin’s view.
1724 * @param aAvgLines The average number of lines to display.
1726 inline void SetAvgLinesInViewRect(TInt aAvgLines);
1729 * Sets the average number of characters per line.
1731 * @param aAvgChars The average number of characters per line.
1733 inline void SetAvgCharsPerLine(TInt aAvgChars);
1736 * Sets the Edwin size observer. Does not imply transfer of ownership.
1738 * @param aEdwinSizeObserver The Edwin size observer.
1740 IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver*
1741 aEdwinSizeObserver);
1744 * Gets the minimum Edwin height.
1746 * @return The minimum Edwin height.
1748 IMPORT_C TInt MinimumHeight() const;
1751 * Gets the maximum Edwin height.
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
1757 * @return The maximum Edwin height.
1759 IMPORT_C TInt MaximumHeight() const;
1762 * Sets the minimum Edwin height. This function also increases the maximum
1763 * Edwin height if its value is less than @c aHeight.
1765 IMPORT_C void SetMinimumHeight(TInt aHeight);
1768 * Sets the maximum Edwin height. This function also decreases the minimum
1769 * Edwin height if its value is greater than @c aHeight.
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.
1775 * @param aHeight The maximum Edwin height.
1777 IMPORT_C void SetMaximumHeight(TInt aHeight);
1779 void OnEditorStateFlagChange( TInt aOldFlag, TInt aNewFlag );
1780 void ReportChinesePopupEventL( TBool aChinesePopupOpen );
1782 public: // new utility methods
1785 * Replaces the cursor selection with the identified text.
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
1792 IMPORT_C void InsertDeleteCharsL(TInt aInsertPos,
1794 const TCursorSelection& aDelete);
1797 * Sets non-printing characters?visibility.
1799 * @param aVisibility Non-printing characters?visibility.
1801 IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility
1805 * Sets non-printing characters?visibility.
1807 * @return Non-printing characters?visibility.
1809 IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
1811 public: // new Avkon wrap interface
1814 * Sets the @c EAvkonEditor flag.
1816 * @param aAvkonWrapIsOn If @c ETrue @c EAvkonEditor flag is set.
1818 IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn);
1820 public: // Avkon editor extensions
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.
1829 * @param aCase Initial case to be used in the editor.
1831 IMPORT_C void SetAknEditorCase(TInt aCase);
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.
1840 * @param aPermittedCaseModes Case modes that are available in the editor.
1842 IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes);
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.
1855 * @param aNumericKeymap Key mapping used in an editor with number input
1858 IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap
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.
1867 * @param aInputMode Initial input mode to be used in the editor.
1869 IMPORT_C void SetAknEditorInputMode(TInt aInputMode);
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.
1876 * @param aInputModes Input modes that are allowed in the editor.
1878 IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes);
1881 * Sets editor specific special character table.
1883 * @param aSCTResId Special character table dialog resource.
1885 IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId);
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.
1892 * @param aFlags Avkon editor flags for the editor.
1894 IMPORT_C void SetAknEditorFlags(TInt aFlags);
1897 * Enables or disables CCPU interface provided functionalities
1898 * (cut, copy, paste and undo).
1900 * @param aSupport CCPU support enabled if @c ETrue.
1902 IMPORT_C void EnableCcpuSupportL(TBool aSupport);
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.
1912 * @param aInputMode New input mode for the editor.
1914 IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode);
1917 * Returns the input mode that has been saved to editor state.
1920 * @return Input Mode that is saved to editor state.
1922 IMPORT_C TInt AknEditorCurrentInputMode();
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.
1932 * @param aCase New case for the editor.
1934 IMPORT_C void SetAknEditorCurrentCase(TInt aCase);
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.
1941 * @param aLanguage Editor local input language.
1943 IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage);
1946 * This call causes FEP to reset current editing state and
1947 * new editing state is fetched from @c CAknEdwinState object.
1949 IMPORT_C void NotifyEditorStateObserverOfStateChangeL();
1952 * Used for suppressing all editor's background drawing. This is
1953 * intended for internal use.
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.
1959 * @param aSuppress If ETrue, suppress background drawing
1961 IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
1964 * Tests if the background drawing is suppressed.
1966 * @return ETrue if the background drawing is suppressed
1968 IMPORT_C TBool IsBackgroundDrawingSuppressed() const;
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.
1975 * @param aRect The rect which contains text lines to be drawn
1977 IMPORT_C void SetTextLinesRect( const TRect& aRect );
1980 * Used to determine which area is used for scrolling
1982 IMPORT_C void SetScrollRect( const TRect & aRect );
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.
1989 * @return The rect which contains text lines to be drawn
1991 IMPORT_C TRect GetTextLinesRect() const;
1994 * Used to control cursor visibility
1996 IMPORT_C void SetCursorVisible(TBool aVisible);
1999 // These methods have been added for use with Avkon to set maximum
2002 * Sets editor's maximum height in lines.
2004 * @param aLines Maximum height in lines.
2006 IMPORT_C void SetMaximumHeightInLines(TInt aLines);
2009 * Gets editor maximum height in lines.
2011 * @return Maximum height in lines.
2013 IMPORT_C TInt MaximumHeightInLines() const;
2015 public: // From MEikCcpuEditor
2018 * Tests whether the editor is focused.
2020 * @return If editor is focused, @c ETrue is returned.
2022 IMPORT_C TBool CcpuIsFocused() const;
2025 * Tests whether the selected text can be cut.
2027 * @return @c ETrue if it is possible to cut the selected text.
2029 IMPORT_C TBool CcpuCanCut() const;
2032 * Cuts selected text.
2034 IMPORT_C void CcpuCutL();
2037 * Tests whether the selected text can be copied.
2039 * @return @c ETrue if it is possible to copy the selected text.
2041 IMPORT_C TBool CcpuCanCopy() const;
2044 * Copies selected text.
2046 IMPORT_C void CcpuCopyL();
2049 * Tests whether text can be pasted from the clipboard.
2051 * @return @c ETrue if it is possible to paste the clipboard text.
2053 IMPORT_C TBool CcpuCanPaste() const;
2056 * Pastes text from the clipboard to the editor.
2058 IMPORT_C void CcpuPasteL();
2061 * Tests is it possible to undo previous operation.
2063 * @return @c ETrue if it is possible to undo previous operation.
2065 IMPORT_C TBool CcpuCanUndo() const;
2068 * Undoes the most recent text operation when the Edwin supports this
2069 * feature and when the undo store is not empty
2071 IMPORT_C void CcpuUndoL();
2074 * Gets edwin's flags from @c CAknEdwinState.
2076 * @return The control's flags.
2078 IMPORT_C TInt AknEdwinFlags() const;
2081 public: // Internal to Symbian
2083 // the following methods are deprecated and will be removed in a future
2086 * Allocates memory for the Edwin text view.
2088 IMPORT_C void CreateTextViewL();
2091 * Gets Edwin text view.
2093 * @return Pointer to the Edwin text view.
2095 IMPORT_C CTextView* TextView() const;
2098 * Gets Edwins text layout.
2100 * @return Pointer to the text layout.
2102 IMPORT_C CTextLayout* TextLayout() const;
2105 * Sets undo buffer for the Edwin.
2107 * @param aSelection The current selection.
2108 * @return @c ETrue if buffer was set.
2110 IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection);
2113 * Sets new undoable text to the undo buffer.
2115 * @param aSelection The current selection.
2117 IMPORT_C void SetUndoableText(const TCursorSelection& aSelection);
2120 * Gets the editor state.
2122 * @return Pointer to editor state object.
2124 CAknEdwinState* EditorState() const;
2127 * Sets maximum length for the editor.
2129 * @param aLength Maximum length for the editor.
2131 inline void SetMaxLength(TInt aLength);
2134 * Gets the editor maximum length.
2136 * @return The editor maximum length
2138 inline TInt MaxLength() const;
2142 // added to get access to user flags without a get/set for every different
2148 * @param aFlag Flags to add.
2150 IMPORT_C void AddFlagToUserFlags(TUint32 aFlag);
2153 * Removes user flags.
2156 * @param aFlag Flags to remove.
2158 IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag);
2164 * @return The user flags.
2166 IMPORT_C TUint32 UserFlags() const ;
2171 * Sets the character format layer for the editor. Ownership of the
2172 * CCharFormatLayer is transferred.
2174 * @param aCharFormatLayer Pointer to the character format layer object.
2176 IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer);
2179 * Sets the paragraph format layer for the editor. Ownership of the
2180 * CParaFormatLayer is transferred.
2182 * @param aParaFormatLayer Pointer to the paragraph format layer object.
2184 IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer);
2187 public: // Skins support
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.
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.
2199 * Setting this control context to NULL will have the effect of turning off
2200 * background skinning.
2202 * @param aContext Control context to store. Not owned. Can be NULL.
2204 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext*
2208 * Access to Skins background control context that is potentially being
2209 * used by the Editor.
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.
2217 * @return Pointer to control context potentially in
2220 MAknsControlContext* SkinBackgroundControlContext() const;
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.
2229 * @return @c EFalse if SetSkinBackgroundControlContextL has been
2230 * called with NULL in its most recent call.
2232 TBool SkinEnabled() const;
2235 * Stores the alignment value for an editor.
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
2244 IMPORT_C void SetAlignment(TInt aAlignment);
2246 public: // Pictograph support
2249 * Redraws text view. Used for pictograph animations.
2251 void DrawTextView() const;
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.
2259 * @param aCallBack The callback.
2261 IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack );
2264 * Returns pictograph animation callback. If it is not set, the function
2267 * @return Pictograph animation callback
2269 const TCallBack& PictographAnimationCallBack() const;
2272 * This method sets the upper limit of full document formatting.
2274 * At construction, the mode is full document formatting, where the text
2275 * formatter processes the whole document to determine its layout.
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.
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.
2286 * Internally-imposed limits prevent the client setting too small a value
2287 * for proper operation of the text formatting.
2289 * If this method is not called, the upper and lower limts are set to a
2290 * large default values.
2292 * Access to the actual limits is available via the methods
2293 * @c UpperFullFormattingLength() and @c LowerPartialFormattingLength().
2296 * @param aUpperFullFormattingLimit The upper limit of full document
2299 IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit );
2302 * Can be called to inhibit redrawing of the editor when NotifyNewFormatL()
2305 * @param aEnabled If ETrue, inhibit redrawing when notified of
2306 * new format from now on.
2308 IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled );
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.
2314 * Note: When called with EFalse, it does not automatically trigger reformatting.
2317 * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse,
2318 * re-enable formatting from now on.
2320 IMPORT_C void SetSuppressFormatting( TBool aSuppressed );
2323 * Enables kinetic scrolling in editor.
2325 * Note that when kinetic scrolling is enabled, it is
2326 * no longer possible to disable it with this function.
2329 * @param aEnable ETrue if kinetic scrolling should be enabled.
2331 IMPORT_C void EnableKineticScrollingL( TBool aEnable );
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 );
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,
2357 void HandleSelectionForSmiley( TCursorSelection aSelect );
2362 * Specifies the end points of the editable area.
2366 /** The start of the editable area. */
2369 /** The end of the editable area. */
2374 * Specifies the chunk size as either a word, or a paragraph.
2386 * Specifies the chunk size as either a word, or a paragraph.
2388 enum TEikEdwinFlags // Internal flags
2390 /** Rich text editor used. */
2391 ERichText =0x00000001,
2393 /** For double item dragging. */
2394 EDragDouble =0x00000002,
2397 * If set, indicates the pointer being pressed inside the
2400 ELeftDownInViewRect =0x00000004,
2402 /** Used to calculate initial width. */
2403 ENumericCharacters =0x00000008,
2405 /** Edwin has one line and is not resizable. */
2406 EHasOneLineOnly =0x00000010,
2409 * Custom formatter is installed to find and format phone numbers
2410 * (@c CEikRichTextEditor only).
2412 EPhoneNumberGrouping = 0x00000020,
2413 ESuppressNotifyDraw = 0x00000040,
2414 ESuppressFormatting = 0x00000080, // Suppresses calls to formatting
2415 ESkipBackgroundDrawer = 0x00000100
2418 protected: // from MEditObserver
2421 * From @c MEditObserver.
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.
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.
2432 IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength);
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.
2441 * @param aRect Rectangle in which to draw.
2443 IMPORT_C void TrappedDraw(const TRect& aRect) const;
2446 * Draws the visible text and the cursor.
2448 IMPORT_C void DrawContents();
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
2459 IMPORT_C void BaseConstructL();
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().
2466 IMPORT_C void FormatTextL();
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.
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.
2481 IMPORT_C TInt DeleteHighlightL(TBool& aChanged,
2482 TBool aIsBackSpace=EFalse,
2483 TBool aPromptConfirmation=ETrue);
2486 * Confirms whether the deletion of the user’s selection is required.
2488 * If the user’s selection is less than @c KBlockDeleteWarningSize and does
2489 * not contain a picture, this function returns @c ETrue.
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.
2497 IMPORT_C TBool OkToDeleteSelectionL();
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.
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
2507 * @param[in] aIsBackSpace @c ETrue if this in response to backspace being
2508 * pressed. Determines whether character formatting is preserved
2510 * @param[in] aAllowUndo @c ETrue if the user is permitted to undo this
2513 IMPORT_C void DeleteL(TBool& aChanged,
2514 const TCursorSelection& aSelection,
2515 TBool aIsBackSpace=EFalse,
2516 TBool aAllowUndo=ETrue);
2519 * Handles errors that occur when handling a change in Edwin’s size. Calls
2520 * @c CEikonEnv::NotifyIdleErrorWhileRedrawing().
2522 IMPORT_C void TrappedSizeChanged();
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.
2529 IMPORT_C void HandleSizeChangedL();
2532 * Cancels the selection and any FEP composition text. This function then
2533 * repositions the cursor at the specified end of the currently selected
2536 * @param aEndOfSelectionToLeaveCursor The end of the current selection at
2537 * which the cursor is repositioned.
2539 IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);
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.
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.
2552 IMPORT_C void MoveCursorToChunkStartL(TBool aSelect,
2553 TChunkSize aChunkSize,
2554 TEnd aEndScanningTowards);
2557 * Cancels the insertion of a character format. This can be used for rich
2560 IMPORT_C void CancelInsertCharFormat();
2563 * Copies the contents of the cursor selection onto the clipboard.
2565 IMPORT_C void PlaceDataOnClipboardL();
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.
2576 * @param aEventType The type of event to report.
2578 IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);
2581 * Sets margin widths and line cursor width.
2583 IMPORT_C void SetLineCursorDetailsL();
2586 * Replaces the current Edwin text.
2588 * @param aInText Text with which the current text is replaced.
2589 * @param aOutText On return, the replaced text.
2591 IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText,
2592 CGlobalText& aOutText);
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.
2599 * @param aFindText The text that could not be found.
2601 IMPORT_C void DisplayFindTextNotFound(TDes& aFindText);
2606 * @param aStartPos Not used.
2607 * @param aLength Not used.
2609 IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength);
2612 * Creates a new @c CLafEdwinCustomDrawBase instance.
2614 * @return Pointer to new custom @c CLafEdwinCustomDrawBase object.
2616 IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
2618 // Avkon editor extensions
2620 * Used in @c ConstructFromResourceL(). Sets Avkon editor properties.
2622 * @param aReader A reader positioned for reading from an EDWIN resource.
2624 IMPORT_C void ReadAknResourceL(TResourceReader& aReader);
2626 protected: // Internal to Symbian
2629 * Creates new text layout.
2631 * @param aLayDoc Pointer to the @c MLayDoc implementation that is the
2632 * source of the text and formatting information.
2634 IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc);
2637 * Creates new instance of @c CGlobalText and text layout based on it.
2639 * @param aParaFormatLayer Paragraph format layer pointer for
2640 * @c CGlobalText constructor.
2641 * @param aCharFormatLayer Character format layer pointer for
2642 * @c CGlobalText constructor.
2644 IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer,
2645 CCharFormatLayer* aCharFormatLayer);
2648 * Checks that is Edwin's extension created. If not, it will be created.
2650 * @leave KErrNoMemory If the Edwin FEP support pointer is NULL.
2652 IMPORT_C void CheckEdwinExtensionL();
2655 * Gets Edwin's extension.
2657 * @return Pointer to Edwin's extension.
2659 IMPORT_C CEikEdwinExtension* EdwinExtension();
2665 EWysiwygOn =0x00000010,
2666 EUnderOneScreenFormattedText =0x00000020,
2667 EPictureDelimits =0x00000040,
2668 EPunctuationDelimits =0x00000080,
2669 EPasteFromIrStore =0x00000100,
2670 ELockScrollBarState =0x00000200,
2671 EOnReformatting =0x00000400
2674 private: // from CCoeControl
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();
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;
2717 TInt CursorWidth() const;
2718 TFontSpec CursorFontSpec() const;
2720 void BuildEdwinFepSupport();
2721 void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer);
2722 void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer);
2723 void UpdateCache(TInt aId);
2724 void DrawBackgroundAroundTextView(
2726 const TRect& aOuterRect,
2727 const TRect& aInnerRect,
2728 const TRgb& aBackgroundColor ) const;
2729 TInt CurrentAlignment() const;
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);
2742 * Sets scrollbars with kinetic scrolling.
2744 void SetKineticScrollingScrollBarsL();
2747 * Sets vertical scrollbar model with kinetic scrolling.
2749 * @param aVertModel Vertical scrollbar model
2751 void SetKineticScrollingScrollBarModel(
2752 TEikScrollBarModel& aVertModel ) const;
2755 * Enables rate scrolling in editor.
2757 * @param aEnable ETrue if rate scrolling should be enabled.
2759 void EnableRateScrolling( TBool aEnable );
2763 void DrawFirstLineTextL() const;
2764 CAknEdwinDrawingModifier* AknEdwinDrawingModifier();
2765 TBool EditorSupportsNeutralProtection() const;
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.
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
2778 TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded );
2781 * Returns whether the character is strongly directional
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.
2788 TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const;
2791 * Returns ETrue if the character at aPos is neutral
2793 * @param aPos index in editor; must be a valid index
2794 * @return EFalse iff the character is not neutral
2796 TBool CharIsNeutral( TInt aPos ) const;
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.
2803 * Search is carried out until a strong character is found or the end (or beginning)
2804 * of the descriptor has been reached.
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
2810 * @return EFalse if no strong character was found.
2812 TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const;
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.
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
2824 * @return EFalse if no strong character was found.
2826 TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const;
2829 * Routine to perform the operation of replacing a selection with new text.
2830 * This is intended for internal use.
2832 * The current selection, if non-zero length is deleted, and replace with aNewText if non-zero length
2833 * iTextView must be set.
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
2844 void ReplaceSelectionWithTextL( const TDesC& aNewText,
2845 TInt aCursorPosInNewText,
2846 TBool& aFormatHasChanged );
2849 * Returns EFalse iff ( phone number had only numeric input modes AND the keymap is a phone number
2851 * Phone number type keymaps are:
2852 * EAknEditorStandardNumberModeKeymap
2853 * EAknEditorFixedDiallingNumberModeKeymap
2855 * @return EFalse if the phone number will only contain a pure phone number
2857 TBool IsPurePhoneNumberEditor() const;
2860 * Standard check on upper and lower formatting thresholds versus current textview formatting mode.
2862 * @return EFalse iff the formatting mode does not need changing
2864 TBool NeedToChangeFormattingModeL() const;
2867 * When Band formatting is started, this should be called to update the cached
2868 * metrics used for the scroll bar calculations.
2870 void CalculateLineMetricsForBandFormattingL();
2873 * check the selection content is visible character or not
2875 TBool IsSelectionVisible();
2878 protected: // from MObjectProvider
2881 * From @c MObjectProvider.
2883 * Retrieves an object of the same type as that encapsulated in @c aId.
2885 * This function is used to allow controls to ask their owners for access
2886 * to other objects that they own.
2888 * Other than in the case where NULL is returned, the object returned must
2889 * be of the same object type - that is, the @c ETypeId member of the
2890 * object pointed to by the pointer returned by this function must be equal
2891 * to the @c iUid member of @c aId.
2893 * @param aId An encapsulated object type ID.
2894 * @return Encapsulates the pointer to the object provided. Note that the
2895 * encapsulated pointer may be NULL.
2897 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
2899 public: // new since 3.0
2902 * Sets skin id for text.
2904 * @param aAknSkinIdForTextColor The skin id.
2906 IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor);
2909 * Sets highlight style.
2911 * @param aStyle The highlight style.
2913 IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle);
2915 // for custom drawer, not exported
2919 * @return The skin id.
2921 TInt SkinColorId() const;
2924 * Gets highlight style.
2926 * @return The highlight style.
2928 TAknsHighlightStyle HighlightStyle() const;
2931 * Called to determine the background color to draw. It is not to be used if skinning is
2932 * being used to draw the background.
2934 * This API can be used two ways:
2936 * i) If the caller has a default color to offer (to be used as
2937 * a fallback if SetBackgroundColorL has not been called), then he should use the
2938 * Input/Output parameter aConditionalColor, and ignore the return value. The output
2939 * parameter will only be over-written by the set background color if SetBackgroundColorL
2942 * ii) If the caller does not have a default color to offer, then he should pass in a dummy
2943 * input parameter and use the return value.
2945 * @param aConditionalColor Output parameter. Returns a color set by
2946 * SetBackgroundColorL. It is unchanged if
2947 * background color has not been set by SetBackgroundColorL
2948 * @return TRgb for the color to be used for background.
2950 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const;
2954 * Can be used by custom drawers to check if background drawing should be
2955 * performed. This is meant to be used only if editor has
2956 * MCoeControlBackground object attached.
2958 * @return ETrue if custom drawer shouldn't draw background.
2960 TBool SkipBackgroundDrawer() const;
2963 * Scrolls view by amount of pixels.
2964 * Stops scrolling when beginning or end of content exceeded.
2965 * This function should be used when scrolling starts from inside content
2966 * (in other words in normal situation when begin- or end-border has not
2969 * @param aPixelsToScroll Amount of pixels to scroll
2970 * @param aBorderExceeded returns ETrue if border was exceeded
2971 * @param aRestOfPixels Amount of pixels not scrolled because border
2974 * @return Amount of scrolled pixels.
2976 TInt ScrollView( TInt aPixelsToScroll, TBool& aBorderExceeded,
2977 TInt& aRestOfPixels );
2980 * Scrolls view by amount of pixels.
2982 * This function should be used to scroll when we have already
2983 * exceeded begin- or end-border (we are out of borders).
2984 * This function supports scrolling so that there can be empty space
2985 * above or below the editor content (used in bounce effect).
2986 * Stops scrolling when we return back to inside borders.
2988 * @param aPixelsToScroll Amount of pixels to scroll
2989 * @param aEndOfBounce returns ETrue if content scrolled back
2990 * to inside of borders
2991 * @param aRestOfPixels Amount of pixels not scrolled
2993 * @return Amount of scrolled pixels.
2995 TInt ScrollViewWithBounce( TInt aPixelsToScroll, TBool& aEndOfBounce,
2996 TInt& aRestOfPixels );
2999 * Returns amount of pixels how much we are out of borders.
3001 * @return Amount of pixels scrolled out of borders.
3003 TInt PixelsOutOfBorder() const;
3006 * Handles scrollbar events with kinetic scrolling.
3008 * @param aScrollBar The scrollbar.
3010 void HandleScrollEventWithPhysics( CEikScrollBar* aScrollBar );
3013 * If cursor is visible, disables it and stores cursor visibility info.
3015 void StoreCursorState();
3018 * Show cursor again if needed (based on stored cursor visibility info).
3020 void RestoreCursorState();
3023 * Returns ETrue if kinetic scrolling is enabled.
3025 * @return ETrue if kinetic scrolling is enabled.
3027 TBool KineticScrollingEnabled() const;
3035 TUint32 iEdwinUserFlags;
3038 * Internal Edwin flags.
3040 TUint32 iEdwinInternalFlags;
3043 * Edwin's text content.
3047 protected: // Internal to Symbian
3050 * Edwin's text view.
3052 CTextView* iTextView;
3055 * Edwin's text layout.
3057 CTextLayout* iLayout;
3062 * Maximum length ot the edwin.
3067 * Number of lines in Edwin.
3069 TInt iNumberOfLines;
3072 * Current zoom factor.
3074 MGraphicsDeviceMap* iZoomFactor;
3079 TInt iLastPointerDocPos;
3088 friend class CEikEdwinFepSupport;
3089 friend class CEikEdwinExtension;
3090 // added this class to allow additional data members without breaking BC
3091 CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar
3092 CEikScrollBarFrame* iSBFrame;
3093 MEikEdwinObserver* iEdwinObserver;
3094 CArrayPtr<MEikEdwinObserver>* iObserverArray;
3095 CEikEdwinFepSupport* iEdwinFepSupport;
3096 CUndoBuffer* iUndoStore;
3097 TInt iAvgLinesInViewRect;
3098 TInt iAvgCharsPerLine;
3099 TInt iRightWrapGutter;
3101 MEikEdwinSizeObserver* iEdwinSizeObserver;
3102 TInt iMinimumHeight;
3103 TInt iMaximumHeight;
3105 iMaximumHeightInLines
3106 ---------------------
3107 This is simply a holder for the number, used to simplify some Avkon LAF requirements.
3108 The viewable region of an edwin is actually measured in pixels, However, if certain LAF
3109 requirements are enforced (that the view region has to be smaller than the number of
3110 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects
3114 That is to say, by simply setting iMaximumHeightInLines, this will not affect
3115 the actual maximum height of the edwin. To do this, you must set the iMaximumHeight
3117 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin.
3118 That method uses iMaximumHeightInLines along with the baseline separation, to set
3121 The general formula is very simple, to remove unneeded scrolling.
3122 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines
3124 If you cannot allocate sufficient space to the edwin, to permit so much viewable region
3125 then the method AlterViewRect can be called on the TextView() component. This will introduce
3126 a clipping rectangle, which allows blank space required by the edwin layout component
3129 TInt iMaximumHeightInLines;
3130 CLafEdwinCustomDrawBase* iCustomDrawer;
3131 TInt iLastPointerAnchorPos;
3132 CAknCcpuSupport* iCcpuSupport;
3133 CCharFormatLayer* iCharFormatLayer;
3134 CParaFormatLayer* iParaFormatLayer;
3140 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL()
3141 { return CreateScrollBarFrameL(ETrue);}
3142 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame()
3143 { return ((CEikScrollBarFrame* const)iSBFrame); }
3144 inline TInt CEikEdwin::AvgLinesInViewRect() const
3145 { return iAvgLinesInViewRect; }
3146 inline TInt CEikEdwin::AvgCharsPerLine() const
3147 { return iAvgCharsPerLine;}
3148 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines)
3149 { iAvgLinesInViewRect=aAvgLines; }
3150 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars)
3151 { iAvgCharsPerLine=aAvgChars; }
3153 inline void CEikEdwin::SetMaxLength(TInt aLength )
3154 { SetTextLimit(aLength); }
3155 inline TInt CEikEdwin::MaxLength() const
3156 { return iTextLimit; }