Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
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;
67 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
68 class CEikAvkonCustomDraw;
70 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
71 class CEikAvkonCustomDraw;
73 // For construction of Rich Text - based custom formatters
85 * This describes the features of a
86 * search-and-replace operation on a CEikEdwin.
88 * See CEikEdwin::ReplaceL().
90 struct SEdwinFindModel
92 /** Flags for the search (see CEikEdwin::TFindFlags) */
93 TInt iFlags; // TEdwinFindFlags
94 /** Text to search for. */
95 TBuf<EEikEdwinFindStringMaxLen> iText;
96 /** Text to replace it with. */
97 TBuf<EEikEdwinFindStringMaxLen> iReplaceText;
98 /** Replace options. */
99 TReplaceOption iReplaceOption;
103 * Styles for highlighting. See SetHighlightStyleL().
105 enum TAknsHighlightStyle
107 /** Normal highlighting. */
108 EEikEdwinHighlightNormal = 0,
109 /** Link highlighting. */
110 EEikEdwinHighlightLink
113 // inline utility to handle RGB values (set / unset)
121 SAknRgb():iIsSet(EFalse){}
122 TRgb Value(){return iValue;}
123 SAknRgb& operator=(TRgb aRgb)
129 TBool IsSet(){return iIsSet;}
133 * Base class for controls that display and allow manipulation of text.
135 * The properties of a particular Edwin object can be set using bitwise flags,
136 * which are defined in member enums (see @c TFlags for example).
138 * Edwins support Front End Processors, and so are a highly effective way of
139 * getting textual data from the user. The text currently being composed by the
140 * user is called the composition text.
142 class CEikEdwin : public CEikBorderedControl,
143 public MEikScrollBarObserver,
144 public CTextView::MObserver,
145 public MEditObserver,
146 public MEikCcpuEditor
152 NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback
156 * Allocates and constructs a CEikEdwinExtension.
158 * @param aEdwin Pointer to the CEikEdwin creating the extension.
159 * @return A newly constructed edwin extension.
161 static CEikEdwinExtension* NewL(CEikEdwin* aEdwin);
166 ~CEikEdwinExtension();
169 * Gets the form accessor.
171 * @return The form accessor.
173 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
176 * Sets the form accessor.
178 * @param aFormAccessor The form accessor.
180 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
183 * Sets the CIdle object to update scroll bar.
185 * @param The CIdle object to perform scroll bar updating.
187 IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter);
190 * Gets the CIdle object which updates scroll bar.
192 * @return The CIdle object used to perform scroll bar updating.
194 IMPORT_C CIdle* ScrollBarSetter();
197 * Gets the custom wrapper.
199 * @return The custom wrapper.
201 IMPORT_C const TAvkonEditorCustomWrap& TextWrapper();
203 // the following two methods are deprecated
204 IMPORT_C CFormCursorModifier* FormCursorModifier() const;
207 * Store a locally stored (but externally set) Skins background control context.
209 * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL.
211 void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext );
214 * Access to locally stored Skins background control context.
216 * @return Pointer to locally stored control context
219 MAknsControlContext* SkinBackgroundControlContext() const;
222 * This returns a flag that records whether the background context has ever been
225 * @return EFalse iff control context has never been set.
227 TBool SkinBackgroundControlContextHasBeenSet() const;
230 * Stores the alignment value.
232 * @param aAlignment Editor alignment to be stored.
234 void SetAlignment(TInt aAlignment);
237 * Returns the stored alignment value.
239 * @return Value of the current editor alignment.
241 TInt CurrentAlignment() const;
244 * Sets pictograph animation callback.
246 void SetPictoCallBack( TCallBack& aCallBack );
249 * Sets pictograph animation callback.
251 const TCallBack& PictoCallBack() const;
254 * Creates the CAknFormExtendedInterfaceProvider object if it does not exist.
256 void CreateFormExtendedInterfaceProviderIfNeededL();
259 * Access to Form's extended interface provider.
261 CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const;
264 * Create a custom formatter for pure phone number content.
266 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
267 * ExtendedInterfaceProvider object built.
269 * @param aTextLayout Reference to the CTextLayout object used for this editor.
270 * aText CPlainText object reference for the text used in the editor.
272 void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText);
275 * Create a custom formatter for pure phone number content.
277 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
278 * ExtendedInterfaceProvider object built.
280 * @param aTextLayout Reference to the CTextLayout object used for this editor
282 void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout );
285 * Create a custom formatter for rich text editor with general content. Phone numbers are
286 * recognized using an internal parser and formatted with the number grouping engine
288 * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an
289 * ExtendedInterfaceProvider object built.
291 * @param aTextLayout Reference to the CTextLayout object used for this editor
293 void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText );
296 * This allows the caller to access the single inline text interface that will be seen
297 * by Tagma. All installed inline text source classes are held behind this single interface
299 * @return pointer to the inline text source object that will be provided to Tagma
300 * Null is returned if none is installed.
302 CAknInlineTextSource* InlineTextSource() const;
305 * Returns pointer to pictograph interface.
307 * @return Pointer to pictograph interface. The value can be NULL if pictographs are not supported.
309 CAknPictographInterface* PictographInterface() const;
312 * Used for suppressing all editor's background drawing.
314 void SetSuppressBackgroundDrawing( TBool aSuppress );
317 * Tests if the background drawing is suppressed.
319 TBool IsBackgroundDrawingSuppressed() const;
322 * Returns the value of ClearDirection
324 * @return value of current ClearDirection
326 TInt ClearDirection() const;
328 public: // from MCenRepNotifyHandlerCallback
329 void HandleNotifyInt(TUint32 aId, TInt aNewValue);
333 CEikEdwinExtension();
334 void ConstructL(CEikEdwin* aEdwin);
340 ESkinBackgroundControlContextHasBeenSetIndex = 0,
341 ESuppressBackgroundDrawing
343 class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack
345 private: // From MAknPictographAnimatorCallBack
346 void DrawPictographArea();
351 CIdle* iSetScrollBar;
352 TAvkonEditorCustomWrap iTextWrapper;
353 CAknEdwinFormAccessor* iFormAccessor;
354 CFormCursorModifier* iFormCursorModifier;
355 MAknsControlContext* iSkinBackgroundControlContext;
358 TCallBack iPictoCallBack;
359 CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned
360 CAknInlineTextSource* iPhoneNumberFormatter; // Not owned
361 CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter; // Not owned
362 TAknEdwinPictographDrawer iPictographDrawer;
363 CAknPictographInterface* iPictographInterface;
364 // For clear direction.
365 CRepository* iCenRep; // Owned
366 CCenRepNotifyHandler* iCenRepNotifyHandler; // Owned
367 TInt iClearDirection; // Value of ClearDirection
371 TAknsHighlightStyle iSkinHighlightStyle;
372 SAknRgb iEditorBackgroundColor;
373 TInt iUpperFullFormattingLength;
374 CAknExtendedInputCapabilities* iExtendedInputCapabilities;
375 TRect iTextLinesRect;
380 CAknPointerEventSuppressor* iPtSuppressor;
385 * @c iDestroyedPtr is used for the object destruction check.
386 * If it has non-null value, the destruction check is turned on, and
387 * the value points to a local boolean variable that keeps the destroyed state.
389 TBool* iDestroyedPtr;
398 #ifdef FF_AVKON_EMOTION_ICON_ENABLED
400 CSmileyManager* iSmiley;
401 CSmileyCustomWrap* iSmileyWrap;
402 TBool iInlineEditing;
403 TBool iDisableConvertInFormat;
410 * The following flags may be combined with a bitwise OR to form the
411 * @c aEdwinFlags argument to @c ConstructL(TInt, ...) or the flags field
412 * of an EDWIN resource structure run through @c ConstructFromResourceL().
414 * These flags are duplicated in @c uikon.hrh (see @c EEikEdwinKeepDocument
420 EZeroEnumValue =0x00000000,
423 * If set, @c CEikEdwin does not destroy its content on destruction.
425 EKeepDocument =0x00000001,
428 * If set, the content buffer uses segmented storage (see
429 * @c CEditableText::ESegmentedStorage).
431 ESegmentedStorage =0x00000002,
434 * The size specified in the resource used to construct the object is
435 * given in pixels, not character widths.
437 EWidthInPixels =0x00000004,
440 * No automatic selection takes place. Normally the entire text is
441 * selected whenever the Edwin is created, resized or has its text
442 * set as one operation.
444 ENoAutoSelection =0x00000008,
447 * If set, then whenever the control is activated the cursor is
448 * moved to the end of the text.
450 EJustAutoCurEnd =0x00000010,
453 * Does not wrap the text being edited.
458 * Uses a line cursor instead of a block cursor.
460 ELineCursor =0x00000040,
463 * Does not perform horizontal scrolling.
465 ENoHorizScrolling =0x00000080,
468 * If set, scroll bars required to edit long documents appear inside
469 * the Edwin. This reduces the area used to display the Edwin.
471 * If not set, scroll bars appear outside the Edwin.
473 EInclusiveSizeFixed =0x00000100,
476 * Sets the Edwin’s height according to the number of lines of text
477 * supplied by the user.
479 EUserSuppliedText =0x00000200,
482 * The Edwin is a window-owning control.
484 EOwnsWindow =0x00000400,
487 * The Edwin does not respond to input at all.
489 EDisplayOnly =0x00000800,
492 * Does not hide the selection if the Edwin loses focus.
494 EAlwaysShowSelection =0x00001000,
497 * The Edwin is read-only so users cannot add text to any document it
500 EReadOnly =0x00002000,
503 * If set, no special attempt will be made to delete the embedded pictures cleanly.
505 * This flag does not apply to Edwins which do not edit rich text.
507 EAllowPictures =0x00004000,
510 * The Edwin supports undo operations.
512 EAllowUndo =0x00008000,
515 * Does not allow line or paragraph breaks in the text being edited.
517 ENoLineOrParaBreaks =0x00010000,
520 * Allows only ASCII characters.
522 EOnlyASCIIChars =0x00020000,
525 * The Edwin is resizable.
527 EResizable =0x00040000,
530 * The Edwin ignores the virtual cursor.
532 EIgnoreVirtualCursor =0x00080000,
535 * No custom draw is done.
537 ENoCustomDraw =0x01000000,
540 * Changes layout to Avkon style.
542 EAvkonEditor =0x02000000,
547 EAvkonDisableCursor =0x04000000,
550 * Changes text editor to non-editable mode.
552 EAvkonNotEditable =0x08000000,
555 * Sets the @c Avkon wrapping rules ON.
557 EEdwinAlternativeWrapping = 0x10000000,
560 * Enables tab key handling
562 EAvkonTabsEnabled = 0x20000000,
567 EAvkonDisableVKB = 0x40000000,
570 * Enable Smiley Support
572 EAvkonEnableSmileySupport = 0x80000000
576 * Defines the possible commands for @c ClipboardL().
594 * The following flags may be ORed together for text searches (see
595 * @c FindL() for example).
599 /** Search progresses up the screen. */
600 EFindDirectionUp =0x01,
602 /** Only whole-word matches count. */
603 EFindWholeWord =0x02,
605 /** Search is case-sensitive. */
606 EFindCaseSensitive =0x04,
611 /** Does not display a busy message. */
612 ENoBusyMessage =0x10,
615 EReadOnlyFile =0x20 // New for CKon
619 * When content is supplied to an Edwin using @c SetDocumentContentL(),
620 * this defines whether the new content is added to or has replaced the
625 /** Replaces the Edwin’s existing content. */
628 /** Copies the supplied content into the existing content. */
633 * Specifies whether the Edwin owns the document it is being used to edit.
635 * If the Edwin owns the document, the document object is destroyed on
640 /** Document is owned by the Edwin. */
643 /** Document is owned by some other object. */
647 // order of hotkeys defined in resource file. Not all applicable to plain
650 * Enumerates the hotkeys that are defined an @c r_eik_edwin_ctrl_hotkeys
651 * or @c r_eik_edwin_shift_ctrl_hotkeys resource.
653 * Not all are applicable to plain text editors.
672 /** Insert a character. */
687 /** Insert an object. */
690 /** Edit an object. */
693 /** Format an object. */
697 public: // construction and destruction
702 * Deletes objects and frees resources owned by this object. The Edwin’s
703 * editable text is freed if the @c EKeepDocument flag is not set.
705 IMPORT_C ~CEikEdwin();
708 * C++ default constructor.
710 * Creates a new @c Edwin, FEP support for the new editor will not be
711 * present if there is insufficient memory.
713 IMPORT_C CEikEdwin();
718 * Creates a new @c Edwin, specifying the border to use. As with the default
719 * constructor, FEP support for the new editor will not be present if there
720 * is insufficient memory. S60 Edwin does not support / draw any borders.
722 * @param aBorder The Edwin border.
724 IMPORT_C CEikEdwin(const TGulBorder& aBorder);
727 * Handles Symbian 2nd phase construction.
728 * Completes construction of a new @c Edwin, initialising its heap-stored
729 * members from the supplied arguments.
731 * @param aEdwinFlags Bitwise ORed combination of flags from @c TFlags.
733 * @param aWidthInChars Specifies the width for the Edwin, in characters or
734 pixels: see the @c EWidthInPixels flag. Default value is 0.
735 * @param aTextLimit Maximum length for the text to present as editable.
737 * @param aNumberOfLines Height for the Edwin, in lines. Default value
740 IMPORT_C void ConstructL(TInt aEdwinFlags=0,
741 TInt aWidthInChars=0,
743 TInt aNumberOfLines=0);
746 * Sets the Edwin observer. The Edwin’s observer will be called back with
747 * control events associated with the Edwin.
749 * @param aEdwinObserver New observer.
751 IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver);
754 * Adds an observer of standard Edwin events to the list of observers,
755 * creating the list if necessary. May be called any number of times and is
756 * independent of calls to @c SetEdwinObserver.
758 * @param aEdwinObserver The observer to add to the list of observers.
760 IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);
763 * Removes the specified observer from the list of observers. Does nothing
764 * if aEdwinObserver is not an observer.
766 * @param aEdwinObserver The observer to remove from the list of observers.
768 IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);
771 * Creates the containing window for the Edwin if it does not already have one.
773 IMPORT_C void SetContainerWindowL();
776 * Sets the Edwin’s editable content. Before calling this function you must
777 * get the @c iText pointer as @c iText is replaced by @c aText. You must
778 * also free the memory by deleting the previous @c iText contents.
780 * @param aText New value for the content.
781 * @param aContent Specifies whether to use @c aText itself, or to copy its
782 * content. Default value is @c CEikEdwin::ECopyText.
784 IMPORT_C void SetDocumentContentL(CGlobalText& aText,
785 TSetContent aContent=CEikEdwin::ECopyText);
787 public: // from CCoeControl
790 * From @c CCoeControl.
792 * Handles key events.
794 * @param aKeyEvent The key event.
795 * @param aType The type of the event: @c EEventKeyDown, @c EEventKeyUp
797 * @return A suitable response code.
799 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
803 * From @c CCoeControl.
805 * Responds to focus-changed events.
807 * @param aDrawNow Not used.
809 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
812 * From @c CCoeControl.
814 * Sets the Edwin as ready for drawing.
816 * @leave KErrNoMemory.
818 IMPORT_C void ActivateL();
821 * From @c CCoeControl.
823 * Completes the construction of a new @c Edwin. This function initialises
824 * the heap-stored members from an @c EDWIN resource.
826 * @param aReader A reader positioned for reading from an @c EDWIN resource.
828 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
831 * From @c CCoeControl.
833 * Handles pointer events.
835 * @param aPointerEvent Pointer event to respond to.
837 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
840 * From @c CCoeControl.
842 * Gets the minimum size of this Edwin for automatic-layout control
843 * contexts such as dialogs.
845 * @return Minimum size for the control.
847 IMPORT_C TSize MinimumSize();
850 * From @c CCoeControl.
852 * Draws the control on request.
854 * @param aRect If supplied, the rectangle in which to draw the Edwin.
856 IMPORT_C void Draw(const TRect& aRect) const;
859 * From @c CCoeControl.
861 * Dims or undims the Edwin.
863 * @param aDimmed @c ETrue to dim the Edwin. @c EFalse to undim the Edwin.
865 IMPORT_C void SetDimmed(TBool aDimmed);
868 * From @c CCoeControl.
870 * Sets the containing window for the Edwin by copying it from the specified
871 * parent. Also copies a control context from @c aParent if one has not been
874 *@param aParent The control to set as this Edwin’s parent.
876 IMPORT_C void SetContainerWindowL(const CCoeControl& aParent);
879 * From @c CCoeControl.
881 * Gets the list of logical colours employed in the drawing of the control,
882 * paired with an explanation of how they are used. Appends the list to
885 * @param[out] aColorUseList The list of logical colours.
887 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>&
888 aColorUseList) const; // not available before Release 005u
890 // not available before Release 005u
892 * From @c CCoeControl.
894 * Handles a change to Edwin’s resources which are shared across the
895 * environment. Colours or fonts for example.
897 * @param aType The type of resource that was changed.
899 IMPORT_C virtual void HandleResourceChange(TInt aType);
902 * From @c CCoeControl.
904 * Access to the input capabilities of the edwin.
906 * If this function is overrided in a subclass, the subclass should
907 * obtain this class' InputCapabilities' object provider through
908 * TCoeInputCapabilities::ObjectProvider() and set that as a part of
909 * the subclass' InputCapabilities object provider chain to ensure
910 * maximum functionality.
912 * @return The Edwin input capabilities.
914 IMPORT_C TCoeInputCapabilities InputCapabilities() const;
917 * From @c CCoeControl.
919 * This method sets the input capabilities of the edwin. Ownership of the
920 * T-class is not transferred.
922 * @param aInputCapabilities Reference to an input capabilities object
924 * @leave KErrNoMemory Edwin FEB support object is not created.
926 IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities&
930 * From @c CCoeControl.
932 * In debug mode writes the internal state to the given stream. Does
933 * nothing in release mode.
935 * @param[out] aWriteStream A stream for writing the internal state.
937 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
944 IMPORT_C void* ExtensionInterface( TUid aInterface );
946 public: // from MEikScrollBarObserver
949 * From @c MEikScrollBarObserver.
951 * Handles scrollbar key events.
953 * @param aScrollBar The scrollbar.
954 * @param aEventType The type of key event.
956 IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar,
957 TEikScrollEvent aEventType);
959 public: // from CTextView::MObserver
962 * From @c CTextView::MObserver.
964 * Called after reformatting but before redisplay so that edit windows
965 * etc. can be resized.
967 * @param aTextView Not used.
969 IMPORT_C void OnReformatL(const CTextView* aTextView);
974 * Gets the number of characters in the document.
976 * @return The number of characters in the document.
978 IMPORT_C TInt TextLength() const;
981 * Gets the cursor’s position within the document.
983 * @return The cursor’s position within the document.
985 IMPORT_C TInt CursorPos() const;
988 * Gets the number of characters including non-printing characters within
991 * @return The number of characters within the selection.
993 IMPORT_C TInt SelectionLength() const;
996 * Gets the cursor selection. If no text view is associated to the Edwin
997 * this returns @c TCursorSelection(0,0).
999 * @return The current selection.
1001 IMPORT_C TCursorSelection Selection() const;
1004 * Removes the selection and any composition text. The cursor position is
1005 * unaffected. If there is no selected region, this function has no effect.
1007 IMPORT_C void ClearSelectionL();
1010 * Sets the text selection. Highlights the selected area and makes the new
1011 * cursor position visible. Any previous selection is cancelled. This
1012 * function also updates the scroll bar thumbs if present.
1014 * @param aCursorPos The cursor’s position.
1015 * @param aAnchorPos The anchor’s position.
1017 IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos);
1020 * Sets the cursor’s position within the document. If the new position is
1021 * not visible the text is scrolled so that the line containing the
1022 * cursor is visible. This function also updates the scroll bar thumbs
1025 * @param aCursorPos New cursor position.
1026 * @param aSelect @c ETrue to extend the cursor’s selection to the new
1027 * position. @c EFalse otherwise.
1029 IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect);
1032 * Selects the entire document.
1034 IMPORT_C void SelectAllL();
1037 * Recalculates the screen width of an Edwin from the specified number
1038 * of character widths. This is called during construction. If the
1039 * Edwin only allows editing of numbers, the width of the zero
1040 * character (0) is used; otherwise
1041 * @c CFont::MaxNormalCharWidthInPixels() is used.
1043 * If the @c EWidthInPixels flag has been set, the @c aWidthInChars
1044 * argument is measured in pixels, not characters.
1046 * @param aWidthInChars Width in either pixels or characters.
1048 IMPORT_C void CalculateWidth(TInt aWidthInChars);
1051 * Copies the entire document’s content into a descriptor. It is the
1052 * caller's responsibility to provide a large enough buffer.
1054 * @param[out] aDes An initialised descriptor which on return contains a
1055 * copy of the content of this Edwin.
1057 IMPORT_C void GetText(TDes& aDes) const;
1060 * Gets a new buffer containing a copy of the whole text document.
1062 * @return A new copy of the document text.
1064 IMPORT_C HBufC* GetTextInHBufL() const;
1067 * Sets the document text of this Edwin from the contents of a descriptor.
1068 * This function removes any pictures, any invalid characters and cancels
1069 * any previous selection.
1071 * @param aDes Descriptor from which to copy.
1073 IMPORT_C void SetTextL(const TDesC* aDes);
1076 * Handles cut, copy and paste commands. This function also reports a
1077 * change of state of the control to the observer when necessary.
1079 * @param aClipboardFunc Clipboard operation.
1081 IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
1084 * Inserts a field at the current cursor position. If a selection was made
1085 * the field replaces that selection.
1087 * @param aField Text field to insert.
1088 * @param aFieldType Type of the field.
1090 IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType);
1093 * Updates all the fields in the document.
1095 IMPORT_C void UpdateAllFieldsL();
1098 * Updates any text field at the current cursor position. Updating involves
1099 * calculating the new value for the field, and replacing the field’s
1100 * existing text content with the new text.
1102 * This function does nothing if the cursor is not within a text field.
1104 IMPORT_C void UpdateCurrentFieldL();
1107 * Counts and returns the number of words in the document.
1109 * @return The number of words in the document.
1111 IMPORT_C TInt CountWords();
1114 * Inserts the contents of a text file into the text being edited at the
1115 * current cursor position.
1117 * @param aFileName The file to open and read.
1118 * @param aTextOrganisation How to handle line breaks. Default value is
1119 * @c CPlainText::EOrganiseByLine.
1121 IMPORT_C void InsertFromTextFileL(const TFileName &aFileName,
1122 const CPlainText::TTextOrganisation
1123 aTextOrganisation=CPlainText::EOrganiseByLine);
1126 * Uses @c SetScrollBarsL() to set the scrollbars.
1128 * @param aPtr Pointer to @c CEikEdwin instance.
1129 * @return Integer value of @c EFalse.
1131 IMPORT_C static TInt IdleL(TAny *aPtr);
1134 * Gets a pointer to the Edwin’s document contents.
1136 * @return A @c CPlainText pointer which contains the
1139 IMPORT_C CPlainText* Text() const;
1141 // this is particularly important for when the front-end processor is
1142 // inline-editing a CEikEdwin
1144 * Cancels any current transaction with the Edwin’s front-end processor.
1145 * Any front-end input windows are removed, and any highlighted text being
1146 * edited in the Edwin is removed. The Edwin is rolled back to the state
1147 * it was in before the FEP transaction started. This function is called
1148 * by @c CEikEdwin itself when the document content, the cursor position
1149 * or the current selection is changed.
1151 * Cancelling outstanding FEP transactions before performing operations
1152 * on the text programmatically is particularly important when the
1153 * front-end processor is inline-editing an Edwin.
1156 IMPORT_C void CancelFepTransaction();
1159 * Handles all modifications made by reformatting the entire document.
1160 * Calls @c CEikEdwin::FormatText() and redraws Edwin contents and
1161 * scroll bars if they are ready to be redrawn.
1163 IMPORT_C void HandleTextChangedL();
1166 * Gets the width used for laying out the text inside the Edwin in pixels.
1167 * This may be larger or smaller than the width of the Edwin itself.
1168 * See @c SetWysiwygModeOn() for example.
1170 * @return Width of the text layout area in pixels.
1172 IMPORT_C TInt LayoutWidth() const;
1175 * Formats and draws a new document, updates scrollbars if necessary.
1177 IMPORT_C void NotifyNewDocumentL();
1180 * Reformats and redraws the document, updates scrollbars if necessary.
1182 IMPORT_C void NotifyNewFormatL();
1185 * Gets true if a substring is present in the text being edited before or
1186 * after the cursor position. If @c aFindText is NULL, then the current
1187 * word or selection will be searched for again.
1189 * @param aFindText The substring to search for.
1190 * @param aFindFlags See @c TFindFlags. Default value is 0.
1191 * @return @c ETrue if aFindText is found.
1193 IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);
1196 * Gets the cursor position of the matching text in the document. The
1197 * search starts from @c aPos. If @c aFindText is NULL, then the
1198 * current word or selection will be searched for. If the substring
1199 * cannot be found, this function returns @c KErrNotFound.
1201 * @param aFindText The substring to search for.
1202 * @param aPos Starting position for the find.
1203 * @param aFindFlags See @c TFindFlags.
1204 * @return KErrNotFound if the text was not found, otherwise the
1205 * position of the matched substring.
1207 IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);
1210 * Replaces the highlighted text. See @c SEdwinFindModel struct.
1212 * @param[in,out] aFindModel Pointer to the replacement text.
1214 IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel);
1217 * Replaces all occurrences of a string with new text. Both old and new
1218 * text are held in @c aFindModel.
1220 * @param[in,out] aFindModel Pointer to the replacement text.
1221 * @leave This function will leave if the replace operation fails
1224 IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel);
1227 * Gets the current word or selection and searches for it. This function
1228 * is called by @c FindL() and @c FindTextL() when no text to search for
1231 * @param aFindText An empty descriptor.
1233 IMPORT_C void GetFindText(TDes* aFindText);
1236 * Updates scrollbars.
1238 IMPORT_C void UpdateScrollBarsL();
1241 * Creates the Edwin scroll bar frame with no pre-allocation of memory
1244 * @return The scroll bar frame.
1246 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL();
1249 * Creates a pre-allocated scroll bar frame.
1251 * @return Pre-allocated scroll bar frame.
1253 inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();
1256 * Gets the scroll bar frame surrounding this Edwin.
1258 * @return Pointer to this Edwin’s scroll bar frame.
1260 inline CEikScrollBarFrame* ScrollBarFrame();
1263 * Sets word wrapping on or off.
1265 * @param aWrapIsOn @c ETrue enables word wrapping, @c EFalse disables
1268 IMPORT_C void SetWordWrapL(TBool aWrapIsOn);
1271 * Gets the width of a line cursor in pixels.
1275 IMPORT_C virtual TInt LineCursorWidth() const;
1278 * Sets the zoom factor of the document and reformats the document.
1280 * @param aZoomFactor New value for the zooming factor.
1282 IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor);
1285 * Sets the Edwin’s background colour.
1287 * @param aBackground New value for the background colour.
1289 IMPORT_C void SetBackgroundColorL(TRgb aBackground);
1292 * Sets the format mode to be WYSIWYG.
1294 * @param aLayoutWidth Formatting width in twips.
1295 * @param aDevice Mapping between twips and pixels on the target device.
1297 IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth,
1298 MGraphicsDeviceMap* aDevice);
1301 * Switches off the WYSIWYG mode. This function sets the new format mode
1302 * to be @c EFScreenMode.
1304 IMPORT_C void SetWysiwygModeOff();
1307 * Updates the text wrap width. This function is for use in WYSIWYG mode
1310 * @param aLayoutWidth New width to wrap text at in WYSIWYG mode in twips.
1312 IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth);
1315 * Sends the Edwin’s document using an infra red beamer.
1317 IMPORT_C void SendDataOverIrL();
1320 * Receives an Edwin document using an infra red beamer.
1321 * This function will leave if the data received is not a suitable type
1322 * to be pasted into the Edwin.
1324 IMPORT_C void ReceiveDataOverIrL();
1327 * Controls the formatting mode of the editor.
1329 * The length of the text is compared against current formatting mode thresholds.
1330 * (See method SetUpperFullFormattingLength). If the length is greater than the
1331 * upper limit of full formatting, then the editor is set to "band" formatting,
1332 * where the editor attempts to format as little as is needed, e.g. the visible part
1333 * of the editor. If the text length is less than the lower limit of band formatting,
1334 * then the formatting mode is switched to full document formatting.
1336 * This method performs an immediate re-formatting of all or part of the text with the new formatting mode.
1338 * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting
1339 * If not EFalse, whole document it formatted from scratch
1340 * Note: This parameter is ignored if aReFormat is EFalse
1342 IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse);
1345 * Controls the formatting mode of the editor.
1347 * The length of the text is compared against the current formatting mode thresholds.
1348 * (See method SetUpperFullFormattingLength). If the length is greater than the
1349 * upper limit of full formatting, then the editor is set to "band" formatting,
1350 * where the editor attempts to format as little as is needed, e.g. the visible part
1351 * of the editor. If the text length is less than the lower limit of band formatting,
1352 * then the formatting mode is switched to full document formatting.
1354 * This method has a flag to allow any immediate re-formatting to be suppressed.
1355 * Formatting text can be a time-consuming operation. If the client is able to
1356 * ensure that no reformatting is needed, (for instance if a further re-formatting
1357 * API is going to be called later) then the reformatting flag can be called
1358 * with EFalse. Otherwise, a re-format will take place within this method.
1361 * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting
1362 * If not EFalse, whole document it formatted from scratch
1363 * Note: This parameter is ignored if aReFormat is EFalse
1364 * @param aReFormat If EFalse, do not perform any re-formatting
1366 IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat );
1369 * Sets the @c EPasteFromIrStore flag.
1371 * @param aPasteFromIrStore @c ETrue to set the @c EPasteFromIrStore flag.
1372 * @c EFalse to remove the @c EPasteFromIrStore flag.
1374 IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore);
1377 * Copies the contents of a stream store to the current cursor position,
1378 * replacing any selected text. This function is used to paste data from
1381 * @param[out] aStore Store from which to read.
1382 * @param[in] aDict Stream dictionary.
1384 IMPORT_C void PasteFromStoreL(CStreamStore& aStore,
1385 CStreamDictionary& aDict);
1388 * Copies the highlighted text into a stream store.
1390 * @param[out] aStore Store to write to.
1391 * @param[in] aDict Stream dictionary.
1393 IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict);
1396 * Sets the text view margins.
1398 * @param aMargins New value for the view’s margins.
1400 IMPORT_C void SetBorderViewMargins(TMargins8 aMargins);
1403 * Forces the scrollbars to update now; this is a synchronous function.
1405 IMPORT_C void ForceScrollBarUpdateL();
1408 * Sets whether the Edwin owns a document. Edwins can either be used as a
1409 * standalone text editor control, or as an editor for text owned by
1410 * another object. The document ownership setting determines whether the
1411 * Edwin or another object owns the document.
1413 * @param aOwner Whether Edwin or another object owns the document.
1414 * See @c TOwnershipType.
1416 IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner);
1419 * Sets the maximum number of characters that can be inserted.
1421 * @param aLimit New maximum for the number of characters that can be
1424 IMPORT_C void SetTextLimit(TInt aLimit);
1427 * Displays a dialog allowing the user to choose a character from the
1428 * character map. The selected character is inserted into the Edwin
1429 * at the current cursor position.
1431 IMPORT_C void RunCharMapDialogL();
1434 * Gets the text view margins.
1436 * @return The text view margins.
1438 IMPORT_C TMargins8 Margins() const;
1441 * Gets the upper limit for formatting. This returns the value of
1442 * @c KFullFormattingUpperThreshold which determines the maximum number of
1443 * characters that can be formatted, if it is exceeded then only visible
1444 * text is formatted. This is used with @c KPartialFormattingLowerThreshold
1445 * to control the extent of text formatting.
1447 * @return The value of @c KFullFormattingUpperThreshold.
1449 IMPORT_C TInt UpperFullFormattingLength() const;
1452 * Gets the lower limit for formatting. This returns the value of
1453 * @c KPartialFormattingLowerThreshold which determines when a switch is
1454 * made from formatting only visible text to formatting all text. When the
1455 * text length exceeds the @c KFullFormattingUpperThreshold only visible
1456 * text is formatted. If some characters are deleted so that the text
1457 * length is less than @c KFullFormattingUpperThreshold the entire text
1458 * is still not formatted. Instead, reformatting occurs only when the
1459 * number of characters is less than the value of
1460 * @c KPartialFormattingLowerThreshold.
1462 * @return The value of @c KPartialFormattingLowerThreshold.
1464 IMPORT_C TInt LowerPartialFormattingLength() const;
1467 * Sets the Edwin’s read-only flag so that documents displayed by Edwin
1468 * cannot be edited by users.
1470 * @param aReadOnly @c ETrue to set Edwin to display documents as
1471 * read-only. @c EFalse otherwise.
1473 IMPORT_C void SetReadOnly(TBool aReadOnly);
1476 * Determines whether the document being edited with Edwin is read-only.
1478 * @return @c ETrue if the document being edited is read-only.
1479 * @c EFalse otherwise.
1481 IMPORT_C TBool IsReadOnly() const;
1484 * Determines whether the document being edited is read only. Displays
1485 * a message with @c CEikonEnv::InfoMsg() if the document is set as
1488 IMPORT_C void CheckNotReadOnlyL();
1491 * Sets whether the document accepts pictures.
1493 * @param aAllow @c ETrue sets the document to accept pictures, @c EFalse
1494 * sets the document to not accept pictures.
1496 IMPORT_C void SetAllowPictures(TBool aAllow);
1499 * Removes unwanted pictures. If @c EAllowPictures has been set, returns
1500 * immediately. Otherwise, this function checks the document text between
1501 * two bounds and removes all pictures in that range.
1503 * @param aStartPos Where to start looking for unwanted pictures.
1504 * @param aLength Where to stop.
1506 IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength);
1509 * Sets the minimum gap between text and the right hand edge of the Edwin
1510 * when text is wrapped. This value is used to calculate the layout area
1513 * @param aGap Size of the gutter in pixels.
1515 IMPORT_C void SetRightWrapGutter(TInt aGap);
1518 * Undoes the most recent text operation when the Edwin supports this
1519 * feature and when the undo store is not empty.
1521 IMPORT_C void UndoL();
1524 * Deletes the undo store.
1526 IMPORT_C void ClearUndo();
1529 * Sets whether the undo operation is permitted.
1531 * @param aAllow ETrue to permit undo operations. EFalse to not permit undo
1534 IMPORT_C void SetAllowUndo(TBool aAllow);
1537 * Gets whether Edwin is set to support the undo command.
1539 * @return @c ETrue if edits can be undone. @c EFalse if edits cannot
1542 IMPORT_C TBool SupportsUndo() const;
1545 * Tests whether an undo is possible. Returns @c ETrue only if the undo
1546 * store is available to Edwin.
1548 * @return @c ETrue if the undo store is available. @c EFalse if the
1549 * undo store is not available.
1551 IMPORT_C TBool CanUndo() const;
1554 * Sets whether picture characters and/or punctuation should be treated as
1555 * word delimiters in addition to whitespace.
1557 * @param aPicture @c ETrue if picture characters should be treated as
1558 * delimiters for words.
1559 * @param aPunctuation @c ETrue if punctuation should be treated as
1560 * delimiters for words.
1562 IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation);
1565 * Gets the start position and the length of the word in which the
1566 * specified document position is located.
1568 * @param[in] aCurrentPos A position within a word in the text.
1569 * @param[out] aStartPos Returns the start position of the word.
1570 * @param[out] aLength Returns the word’s length.
1572 IMPORT_C void GetWordInfo(TInt aCurrentPos,
1574 TInt& aLength) const;
1577 * Sets the new cursor position. If the cursor is no longer visible the
1578 * document is scrolled to display the line containing the new cursor
1579 * position. Scrollbars are also updated if present.
1581 * @param aMovement The cursor movement.
1582 * @param aSelect If @c ETrue, the selection is extended. This corresponds
1583 * to holding down the Shift key on a machine keyboard.
1585 IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement,
1589 * Scrolls the text either horizontally or vertically without affecting
1590 * the cursor’s position.
1592 * @param aMovement The cursor's movement.
1594 IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement);
1597 * Removes all non-ASCII characters from the specified text. This can be
1598 * used to remove Unicode characters where they are not valid characters
1601 * @param aStartPos The start position in the text.
1602 * @param aLength The number of characters, beginning with aStartPos to
1605 IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength);
1608 * Sets the @c EOnlyASCIIChars flag.
1610 * @param aASCIIOnly If @c ETrue the EOnlyASCIIChars flag will be set. If
1611 * @c EFalse the EOnlyASCIIChars flag will be removed.
1613 IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly);
1616 * Tests whether the @c EOnlyASCIIChars flag is set.
1618 * @return @c ETrue if the @c EOnlyASCIIChars flag is set.
1620 IMPORT_C TBool OnlyASCIIChars() const;
1623 * Gets the average number of lines shown in Edwin’s view.
1625 * @return The average number of lines.
1627 inline TInt AvgLinesInViewRect() const;
1630 * Gets the average number of characters on a line.
1632 * @return The average number of characters on a line.
1634 inline TInt AvgCharsPerLine() const;
1637 * Sets the average number of lines displayed in Edwin’s view.
1639 * @param aAvgLines The average number of lines to display.
1641 inline void SetAvgLinesInViewRect(TInt aAvgLines);
1644 * Sets the average number of characters per line.
1646 * @param aAvgChars The average number of characters per line.
1648 inline void SetAvgCharsPerLine(TInt aAvgChars);
1651 * Sets the Edwin size observer. Does not imply transfer of ownership.
1653 * @param aEdwinSizeObserver The Edwin size observer.
1655 IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver*
1656 aEdwinSizeObserver);
1659 * Gets the minimum Edwin height.
1661 * @return The minimum Edwin height.
1663 IMPORT_C TInt MinimumHeight() const;
1666 * Gets the maximum Edwin height.
1668 * Please do not use the following method for deciding heights if you are
1669 * using edwins with Maximum Heights in forms. Use @c MaximumHeightInLines
1672 * @return The maximum Edwin height.
1674 IMPORT_C TInt MaximumHeight() const;
1677 * Sets the minimum Edwin height. This function also increases the maximum
1678 * Edwin height if its value is less than @c aHeight.
1680 IMPORT_C void SetMinimumHeight(TInt aHeight);
1683 * Sets the maximum Edwin height. This function also decreases the minimum
1684 * Edwin height if its value is greater than @c aHeight.
1686 * Please do not use the following method for setting maximum heights if
1687 * you are using edwins with maximum heights in forms. Use
1688 * @c MaximumHeightInLines instead.
1690 * @param aHeight The maximum Edwin height.
1692 IMPORT_C void SetMaximumHeight(TInt aHeight);
1694 public: // new utility methods
1697 * Replaces the cursor selection with the identified text.
1699 * @param aInsertPos The position at which text will be inserted.
1700 * @param aText The text to insert.
1701 * @param aDelete The cursor-selected text that will be replaced by @c
1704 IMPORT_C void InsertDeleteCharsL(TInt aInsertPos,
1706 const TCursorSelection& aDelete);
1709 * Sets non-printing characters?visibility.
1711 * @param aVisibility Non-printing characters?visibility.
1713 IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility
1717 * Sets non-printing characters?visibility.
1719 * @return Non-printing characters?visibility.
1721 IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
1723 public: // new Avkon wrap interface
1726 * Sets the @c EAvkonEditor flag.
1728 * @param aAvkonWrapIsOn If @c ETrue @c EAvkonEditor flag is set.
1730 IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn);
1732 public: // Avkon editor extensions
1735 * Sets default case for the editor. The case is used when the editor
1736 * is focused first time. Available case flags from @c uikon.hrh
1737 * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and
1738 * @c EAknEditorTextCase. @c EAknEditorTextCase is used if the initial
1739 * case is not set from EDWIN resource default_case or with this API.
1741 * @param aCase Initial case to be used in the editor.
1743 IMPORT_C void SetAknEditorCase(TInt aCase);
1746 * Sets permitted cases for the editor.
1747 * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes,
1748 * @c EAknEditorUpperCase, @c EAknEditorLowerCase and
1749 * @c EAknEditorTextCase. @c EAknEditorAllCaseModes is used if the value
1750 * is not set from EDWIN resource allowed_case_modes or with this API.
1752 * @param aPermittedCaseModes Case modes that are available in the editor.
1754 IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes);
1757 * Sets number mode key mapping for '*' and '#' keys. The key mapping is
1758 * used in editors when numeric input mode is used. Key mapping characters
1759 * for '*' key are shown on special character table if also text input
1760 * modes are allowed in the editor but the current input mode is numeric
1761 * mode. @c EAknEditorStandardNumberModeKeymap is used in editors that
1762 * allow only numeric input if the mapping is not set from EDWIN resource
1763 * @c numeric_keymap or with this API.
1764 * @c EAknEditorAlphanumericNumberModeKeymap is used as default if the
1765 * editor allows also text input mode.
1767 * @param aNumericKeymap Key mapping used in an editor with number input
1770 IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap
1774 * Sets default input mode for the editor. The input mode is used when
1775 * the editor is focused first time.
1776 * @c EAknEditorTextInputMode is used if the initial input mode is not set
1777 * from EDWIN resource default_input_mode or with this API.
1779 * @param aInputMode Initial input mode to be used in the editor.
1781 IMPORT_C void SetAknEditorInputMode(TInt aInputMode);
1784 * Sets allowed input modes for the editor.
1785 * All input modes are allowed (@c EAknEditorAllInputModes) if the value
1786 * is not set from EDWIN resource @c allowed_input_modes or with this API.
1788 * @param aInputModes Input modes that are allowed in the editor.
1790 IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes);
1793 * Sets editor specific special character table.
1795 * @param aSCTResId Special character table dialog resource.
1797 IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId);
1800 * Sets initial editor flags for the editor.
1801 * This method can be used also to update editor flags after the editor is
1802 * focused. FEP is automatically notified of the updated editor flags.
1804 * @param aFlags Avkon editor flags for the editor.
1806 IMPORT_C void SetAknEditorFlags(TInt aFlags);
1809 * Enables or disables CCPU interface provided functionalities
1810 * (cut, copy, paste and undo).
1812 * @param aSupport CCPU support enabled if @c ETrue.
1814 IMPORT_C void EnableCcpuSupportL(TBool aSupport);
1817 * Updates editor input mode. FEP is automatically notified of the
1818 * new input mode in editor state and FEP takes new input mode to use
1819 * immediatelly. Current inline editing is reset.
1820 * This method should not be used for setting initial input mode for the
1821 * editor. Use @c SetAknEditorInputMode() method instead for setting
1822 * initial input mode.
1824 * @param aInputMode New input mode for the editor.
1826 IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode);
1829 * Returns the input mode that has been saved to editor state.
1832 * @return Input Mode that is saved to editor state.
1834 IMPORT_C TInt AknEditorCurrentInputMode();
1837 * Updates editor case. FEP is automatically notified of the
1838 * case change in editor state and FEP takes new case to use immediately.
1839 * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase,
1840 * @c EAknEditorLowerCase and @c EAknEditorTextCase.
1841 * This method should not be used to set initial case for the editor.
1842 * Use @c SetAknEditorCase() method instead for setting initial case.
1844 * @param aCase New case for the editor.
1846 IMPORT_C void SetAknEditorCurrentCase(TInt aCase);
1849 * Sets new local input language for the editor. Global input language
1850 * changes have not effect for the input language but the user can still
1851 * change the input language from the edit menu.
1853 * @param aLanguage Editor local input language.
1855 IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage);
1858 * This call causes FEP to reset current editing state and
1859 * new editing state is fetched from @c CAknEdwinState object.
1861 IMPORT_C void NotifyEditorStateObserverOfStateChangeL();
1864 * Used for suppressing all editor's background drawing. This is
1865 * intended for internal use.
1867 * Note that when this is set, the background is not drawn with skin
1868 * nor cleared, so the background MUST be drawn by the parent control
1869 * every time the editor changes.
1871 * @param aSuppress If ETrue, suppress background drawing
1873 IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
1876 * Tests if the background drawing is suppressed.
1878 * @return ETrue if the background drawing is suppressed
1880 IMPORT_C TBool IsBackgroundDrawingSuppressed() const;
1883 * Used to prevent partial text lines from being drawn.
1884 * The client is responsible for giving a sane value. An empty
1885 * rect disables this feature. This is intended for internal use.
1887 * @param aRect The rect which contains text lines to be drawn
1889 IMPORT_C void SetTextLinesRect( const TRect& aRect );
1892 * Used to determine which area is used for scrolling
1894 IMPORT_C void SetScrollRect( const TRect & aRect );
1897 * Gets the rectangle set for drawing only full lines. In case
1898 * the feature is disabled, this returns an empty rect.
1899 * This is intended for internal use.
1901 * @return The rect which contains text lines to be drawn
1903 IMPORT_C TRect GetTextLinesRect() const;
1906 * Used to control cursor visibility
1908 IMPORT_C void SetCursorVisible(TBool aVisible);
1911 // These methods have been added for use with Avkon to set maximum
1914 * Sets editor's maximum height in lines.
1916 * @param aLines Maximum height in lines.
1918 IMPORT_C void SetMaximumHeightInLines(TInt aLines);
1921 * Gets editor maximum height in lines.
1923 * @return Maximum height in lines.
1925 IMPORT_C TInt MaximumHeightInLines() const;
1927 public: // From MEikCcpuEditor
1930 * Tests whether the editor is focused.
1932 * @return If editor is focused, @c ETrue is returned.
1934 IMPORT_C TBool CcpuIsFocused() const;
1937 * Tests whether the selected text can be cut.
1939 * @return @c ETrue if it is possible to cut the selected text.
1941 IMPORT_C TBool CcpuCanCut() const;
1944 * Cuts selected text.
1946 IMPORT_C void CcpuCutL();
1949 * Tests whether the selected text can be copied.
1951 * @return @c ETrue if it is possible to copy the selected text.
1953 IMPORT_C TBool CcpuCanCopy() const;
1956 * Copies selected text.
1958 IMPORT_C void CcpuCopyL();
1961 * Tests whether text can be pasted from the clipboard.
1963 * @return @c ETrue if it is possible to paste the clipboard text.
1965 IMPORT_C TBool CcpuCanPaste() const;
1968 * Pastes text from the clipboard to the editor.
1970 IMPORT_C void CcpuPasteL();
1973 * Tests is it possible to undo previous operation.
1975 * @return @c ETrue if it is possible to undo previous operation.
1977 IMPORT_C TBool CcpuCanUndo() const;
1980 * Undoes the most recent text operation when the Edwin supports this
1981 * feature and when the undo store is not empty
1983 IMPORT_C void CcpuUndoL();
1986 * Gets edwin's flags from @c CAknEdwinState.
1988 * @return The control's flags.
1990 IMPORT_C TInt AknEdwinFlags() const;
1993 public: // Internal to Symbian
1995 // the following methods are deprecated and will be removed in a future
1998 * Allocates memory for the Edwin text view.
2000 IMPORT_C void CreateTextViewL();
2003 * Gets Edwin text view.
2005 * @return Pointer to the Edwin text view.
2007 IMPORT_C CTextView* TextView() const;
2010 * Gets Edwins text layout.
2012 * @return Pointer to the text layout.
2014 IMPORT_C CTextLayout* TextLayout() const;
2017 * Sets undo buffer for the Edwin.
2019 * @param aSelection The current selection.
2020 * @return @c ETrue if buffer was set.
2022 IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection);
2025 * Sets new undoable text to the undo buffer.
2027 * @param aSelection The current selection.
2029 IMPORT_C void SetUndoableText(const TCursorSelection& aSelection);
2032 * Gets the editor state.
2034 * @return Pointer to editor state object.
2036 CAknEdwinState* EditorState() const;
2039 * Sets maximum length for the editor.
2041 * @param aLength Maximum length for the editor.
2043 inline void SetMaxLength(TInt aLength);
2046 * Gets the editor maximum length.
2048 * @return The editor maximum length
2050 inline TInt MaxLength() const;
2054 // added to get access to user flags without a get/set for every different
2060 * @param aFlag Flags to add.
2062 IMPORT_C void AddFlagToUserFlags(TUint32 aFlag);
2065 * Removes user flags.
2068 * @param aFlag Flags to remove.
2070 IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag);
2076 * @return The user flags.
2078 IMPORT_C TUint32 UserFlags() const ;
2083 * Sets the character format layer for the editor. Ownership of the
2084 * CCharFormatLayer is transferred.
2086 * @param aCharFormatLayer Pointer to the character format layer object.
2088 IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer);
2091 * Sets the paragraph format layer for the editor. Ownership of the
2092 * CParaFormatLayer is transferred.
2094 * @param aParaFormatLayer Pointer to the paragraph format layer object.
2096 IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer);
2099 public: // Skins support
2102 * Sets within in the editor an externally owned Skins background control
2103 * context. This background control context will then be used by the editor
2104 * to draw background.
2106 * If this API is not called, then the editor IS skin enabled, (that is
2107 * @c CEikEdwins are skin enabled by default) but it will try to find a
2108 * control context with which to perform background drawing from the
2109 * Control Environment, via the Object Provider.
2111 * Setting this control context to NULL will have the effect of turning off
2112 * background skinning.
2114 * @param aContext Control context to store. Not owned. Can be NULL.
2116 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext*
2120 * Access to Skins background control context that is potentially being
2121 * used by the Editor.
2123 * This API will first check to see if an control context has been set by
2124 * API, and if so, return that. If the background control context has been
2125 * set to NULL by API, then it will return NULL. If the background control
2126 * context has never been set by API, then this returns the control context
2127 * (if one exists) that the object obtains from Object Provider.
2129 * @return Pointer to control context potentially in
2132 MAknsControlContext* SkinBackgroundControlContext() const;
2135 * Access to disposition of the editor to perform Skinning. This does not
2136 * take into account whether the application is skin enabled or whether the
2137 * environment is providing a background control context. It is only a
2138 * function of whether editor's (default) disposition to skin has been
2139 * countered by calls on the editor API.
2141 * @return @c EFalse if SetSkinBackgroundControlContextL has been
2142 * called with NULL in its most recent call.
2144 TBool SkinEnabled() const;
2147 * Stores the alignment value for an editor.
2149 * @param aAlignment Editor alignment to be stored - must be supplied as
2150 * one of the values in Avkon editor alignment enum i.e.:
2151 * EAknEditorAlignCenter,
2152 * EAknEditorAlignLeft,
2153 * EAknEditorAlignRight,
2154 * EAknEditorAlignBidi
2156 IMPORT_C void SetAlignment(TInt aAlignment);
2158 public: // Pictograph support
2161 * Redraws text view. Used for pictograph animations.
2163 void DrawTextView() const;
2166 * Sets the callback, which the editor calls after having redrawn itself
2167 * for animated pictographs. @c CEikCaptionedControl uses it to draw the
2168 * highlight frame on top of the editor.
2171 * @param aCallBack The callback.
2173 IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack );
2176 * Returns pictograph animation callback. If it is not set, the function
2179 * @return Pictograph animation callback
2181 const TCallBack& PictographAnimationCallBack() const;
2184 * This method sets the upper limit of full document formatting.
2186 * At construction, the mode is full document formatting, where the text
2187 * formatter processes the whole document to determine its layout.
2189 * When the text content is set, or when user input causes the length of
2190 * text to exceed this value, the formatting mode switches to "Band"
2191 * formatting, where the text formatter attempts to format as little as
2192 * possible - optimally just the visible screen.
2194 * A lower limit is calculated from the passed-in value, by the subtraction
2195 * of a constant. When the text becomes smaller than this lower limit, the
2196 * formatting switches to full document formatting.
2198 * Internally-imposed limits prevent the client setting too small a value
2199 * for proper operation of the text formatting.
2201 * If this method is not called, the upper and lower limts are set to a
2202 * large default values.
2204 * Access to the actual limits is available via the methods
2205 * @c UpperFullFormattingLength() and @c LowerPartialFormattingLength().
2208 * @param aUpperFullFormattingLimit The upper limit of full document
2211 IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit );
2214 * Can be called to inhibit redrawing of the editor when NotifyNewFormatL()
2217 * @param aEnabled If ETrue, inhibit redrawing when notified of
2218 * new format from now on.
2220 IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled );
2223 * Can be called to inhibit formatting of the editor. Care is required to ensure that
2224 * the necessary reformatting is carried out later on if this API is used.
2226 * Note: When called with EFalse, it does not automatically trigger reformatting.
2229 * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse,
2230 * re-enable formatting from now on.
2232 IMPORT_C void SetSuppressFormatting( TBool aSuppressed );
2234 #ifdef FF_AVKON_EMOTION_ICON_ENABLED
2236 void EnableSmileySupportL( TBool aEnableSmiley );
2237 TBool IsSmileyEnabled() const;
2238 void DrawSmileyInTextL( CBitmapContext& aGc, CFont& aFont,
2239 const TDesC& aText, TPoint& aPt );
2240 void ConvertVisibleTextForSmileyL( TBool aTextToCode );
2241 void HandleScrollForSmileyL();
2242 TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect );
2245 void ConvertTextForSmileyL( TCursorSelection aSelect,
2246 TBool aTextToCode, TBool aRedraw = ETrue );
2247 void TrimText( TDes& aText );
2248 TCursorSelection GetVisibleTextRangeL();
2249 HBufC* ExtractTextLC( TCursorSelection aSelect );
2250 void ExtendedRangeForSmiley( TCursorSelection& aSelect );
2251 void ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace );
2252 void ConvertSmileyForDeleteL( const TCursorSelection &aSelect );
2258 * Specifies the end points of the editable area.
2262 /** The start of the editable area. */
2265 /** The end of the editable area. */
2270 * Specifies the chunk size as either a word, or a paragraph.
2282 * Specifies the chunk size as either a word, or a paragraph.
2284 enum TEikEdwinFlags // Internal flags
2286 /** Rich text editor used. */
2287 ERichText =0x00000001,
2289 /** For double item dragging. */
2290 EDragDouble =0x00000002,
2293 * If set, indicates the pointer being pressed inside the
2296 ELeftDownInViewRect =0x00000004,
2298 /** Used to calculate initial width. */
2299 ENumericCharacters =0x00000008,
2301 /** Edwin has one line and is not resizable. */
2302 EHasOneLineOnly =0x00000010,
2305 * Custom formatter is installed to find and format phone numbers
2306 * (@c CEikRichTextEditor only).
2308 EPhoneNumberGrouping = 0x00000020,
2309 ESuppressNotifyDraw = 0x00000040,
2310 ESuppressFormatting = 0x00000080 // Suppresses calls to formatting
2313 protected: // from MEditObserver
2316 * From @c MEditObserver.
2318 * Observer function called by the @c CRichText object when the object is
2319 * edited to give notification of changes to its text buffer. In this way,
2320 * the control knows how the text object has changed and can reformat and
2321 * redraw the text object appropriately.
2323 * @param aStartEdit The start position of the edit.
2324 * @param aEditLength The number of characters added or, if negative,
2325 * deleted after this position.
2327 IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength);
2332 * Draws the visible text and the cursor for DrawL(), but does not draw
2333 * the border. The @c DrawL() function is trapped to handle problems due
2334 * to insufficient resources being available.
2336 * @param aRect Rectangle in which to draw.
2338 IMPORT_C void TrappedDraw(const TRect& aRect) const;
2341 * Draws the visible text and the cursor.
2343 IMPORT_C void DrawContents();
2346 * Completes the second-phase construction of a @c CEikEdwin object. This
2347 * protected function is called by @c ConstructL() and
2348 * @c ConstructFromResourceL() after the Edwin’s size, flags and text
2349 * limit have been set. Derived classes should call either this function
2350 * or @c CEikEdwin’s @c ConstructL() or @c ConstructFromResourceL()
2351 * functions during their construction before initialising their own
2354 IMPORT_C void BaseConstructL();
2357 * Formats all the text in the text view. Called by several functions, for
2358 * example by @c CEikEdwin::HandleTextChangedL() and
2359 * @c CEikEdwin::SetTextL().
2361 IMPORT_C void FormatTextL();
2364 * Deletes the text under the cursor selection, also cancelling the
2365 * selection. This function asks the user to confirm this action if
2366 * aPromptConfirmation is ETrue.
2368 * @param[out] aChanged On return, @c ETrue if the text was changed.
2369 * @param[in] aIsBackSpace ETrue if this is in response to backspace being
2370 * pressed. Determines whether character formatting is preserved
2371 * or not. Default value is @c EFalse.
2372 * @param[in] aPromptConfirmation Optional. @c ETrue to ask the user to
2373 * confirm this action. Default value is @c ETrue.
2374 * @return The cursor position in the text after deletion.
2376 IMPORT_C TInt DeleteHighlightL(TBool& aChanged,
2377 TBool aIsBackSpace=EFalse,
2378 TBool aPromptConfirmation=ETrue);
2381 * Confirms whether the deletion of the user’s selection is required.
2383 * If the user’s selection is less than @c KBlockDeleteWarningSize and does
2384 * not contain a picture, this function returns @c ETrue.
2386 * If the user’s selection is greater than @c KBlockDeleteWarningSize or
2387 * contains a picture, this function asks the user to confirm deletion of
2388 * their selection and then returns the user’s response.
2392 IMPORT_C TBool OkToDeleteSelectionL();
2395 * Deletes the cursor’s selection. If no selection is made, this function
2396 * deletes only one character. The argument @c aIsBackSpace determines
2397 * whether to preserve the character formatting or not.
2399 * @param[out] aChanged On return, @c ETrue if the text was changed.
2400 * @param[in] aSelection The cursor selection describing the position to be
2402 * @param[in] aIsBackSpace @c ETrue if this in response to backspace being
2403 * pressed. Determines whether character formatting is preserved
2405 * @param[in] aAllowUndo @c ETrue if the user is permitted to undo this
2408 IMPORT_C void DeleteL(TBool& aChanged,
2409 const TCursorSelection& aSelection,
2410 TBool aIsBackSpace=EFalse,
2411 TBool aAllowUndo=ETrue);
2414 * Handles errors that occur when handling a change in Edwin’s size. Calls
2415 * @c CEikonEnv::NotifyIdleErrorWhileRedrawing().
2417 IMPORT_C void TrappedSizeChanged();
2420 * Handles a change in Edwin’s size. This function accounts for text wrap
2421 * settings and whether the Edwin is ready to be redrawn and also calls
2422 * functions to reformat text and to update the Edwin’s scroll bars.
2424 IMPORT_C void HandleSizeChangedL();
2427 * Cancels the selection and any FEP composition text. This function then
2428 * repositions the cursor at the specified end of the currently selected
2431 * @param aEndOfSelectionToLeaveCursor The end of the current selection at
2432 * which the cursor is repositioned.
2434 IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);
2437 * Moves the cursor to the beginning of the next word or paragraph. This
2438 * function cancels any front end processing transaction currently in
2439 * progress for the Edwin.
2441 * @param aSelect If @c ETrue the chunk is selected, otherwise @c EFalse.
2442 * @param aChunkSize The chunk size, this can be either a word or a
2443 * paragraph. See @c TChunkSize enum.
2444 * @param aEndScanningTowards Which direction to scan towards, the start
2445 * or the end of the document.
2447 IMPORT_C void MoveCursorToChunkStartL(TBool aSelect,
2448 TChunkSize aChunkSize,
2449 TEnd aEndScanningTowards);
2452 * Cancels the insertion of a character format. This can be used for rich
2455 IMPORT_C void CancelInsertCharFormat();
2458 * Copies the contents of the cursor selection onto the clipboard.
2460 IMPORT_C void PlaceDataOnClipboardL();
2463 * Reports an Edwin event of the specified type. The Edwin event is passed
2464 * first to the Edwin observer and then to the list of observers, even if
2465 * the first Edwin observer is not set. If the Edwin has a custom drawer,
2466 * and the event is of type @c EEventFormatChanged, the event is passed to
2467 * the custom drawer. If the Edwin has an observer the event is passed to
2468 * that observer. If no observer is set for the Edwin, this function passes
2469 * the event to each observer in the observer list.
2471 * @param aEventType The type of event to report.
2473 IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);
2476 * Sets margin widths and line cursor width.
2478 IMPORT_C void SetLineCursorDetailsL();
2481 * Replaces the current Edwin text.
2483 * @param aInText Text with which the current text is replaced.
2484 * @param aOutText On return, the replaced text.
2486 IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText,
2487 CGlobalText& aOutText);
2490 * Displays an information message to indicate that the specified text
2491 * could not be found. The information message is constructed from
2492 * @c R_EIK_TBUF_CANNOT_FIND_TEXT.
2494 * @param aFindText The text that could not be found.
2496 IMPORT_C void DisplayFindTextNotFound(TDes& aFindText);
2501 * @param aStartPos Not used.
2502 * @param aLength Not used.
2504 IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength);
2507 * Creates a new @c CLafEdwinCustomDrawBase instance.
2509 * @return Pointer to new custom @c CLafEdwinCustomDrawBase object.
2511 IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
2513 // Avkon editor extensions
2515 * Used in @c ConstructFromResourceL(). Sets Avkon editor properties.
2517 * @param aReader A reader positioned for reading from an EDWIN resource.
2519 IMPORT_C void ReadAknResourceL(TResourceReader& aReader);
2521 protected: // Internal to Symbian
2524 * Creates new text layout.
2526 * @param aLayDoc Pointer to the @c MLayDoc implementation that is the
2527 * source of the text and formatting information.
2529 IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc);
2532 * Creates new instance of @c CGlobalText and text layout based on it.
2534 * @param aParaFormatLayer Paragraph format layer pointer for
2535 * @c CGlobalText constructor.
2536 * @param aCharFormatLayer Character format layer pointer for
2537 * @c CGlobalText constructor.
2539 IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer,
2540 CCharFormatLayer* aCharFormatLayer);
2543 * Checks that is Edwin's extension created. If not, it will be created.
2545 * @leave KErrNoMemory If the Edwin FEP support pointer is NULL.
2547 IMPORT_C void CheckEdwinExtensionL();
2550 * Gets Edwin's extension.
2552 * @return Pointer to Edwin's extension.
2554 IMPORT_C CEikEdwinExtension* EdwinExtension();
2560 EWysiwygOn =0x00000010,
2561 EUnderOneScreenFormattedText =0x00000020,
2562 EPictureDelimits =0x00000040,
2563 EPunctuationDelimits =0x00000080,
2564 EPasteFromIrStore =0x00000100,
2565 ELockScrollBarState =0x00000200,
2566 EOnReformatting =0x00000400
2569 private: // from CCoeControl
2571 IMPORT_C void SizeChanged();
2572 IMPORT_C TInt CountComponentControls() const;
2573 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
2574 IMPORT_C void Reserved_2();
2578 IMPORT_C virtual void Reserved_3();
2579 IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL();
2580 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc);
2581 void SetVirtualCursorStateL(TBool aIsFocused) const;
2582 void SetHeightForNumOfLinesL();
2583 void ApplyAutoSelectionL();
2584 void SetScrollBarsL();
2585 void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const;
2586 void RetrieveDataFromClipboardL();
2587 void SetCursorVisibilityL(TBool aEmphasis);
2588 TBool OwnsScrollBars() const;
2589 void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
2590 void UpdateHorizScrollBarThumb();
2591 void UpdateVertScrollBarThumbL();
2592 void DoSetUndoBufferL(const TCursorSelection& aSelection);
2593 void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict);
2594 void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced);
2595 void DeleteExtraParasL(TInt aStartPos,TInt aLength);
2596 TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength);
2597 TBool IsValidChar(TInt aChar) const;
2598 TInt CalcMinimumHeightFromNumOfLinesL() const;
2599 void CheckEdwinHeight();
2600 TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const;
2601 void SetEdwinHeight(TInt aHeight);
2602 void DoCreateCustomDrawL();
2603 void SetCursorSizeAndType();
2604 TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
2605 void DoCcpuCanPasteL() const;
2606 void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent);
2607 void CheckIfEdwinIsResizable();
2608 void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const;
2609 HBufC* GetAllowedCharsLC() const;
2610 TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const;
2612 TInt CursorWidth() const;
2613 TFontSpec CursorFontSpec() const;
2615 void BuildEdwinFepSupport();
2616 void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer);
2617 void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer);
2618 void UpdateCache(TInt aId);
2619 void DrawBackgroundAroundTextView(
2621 const TRect& aOuterRect,
2622 const TRect& aInnerRect,
2623 const TRgb& aBackgroundColor ) const;
2624 TInt CurrentAlignment() const;
2626 void NewParagraphL();
2627 TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode);
2628 void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength );
2629 TRect AdjustedViewRect() const;
2630 void SetVKBStatus();
2631 void ScrollViewToCursorLineL();
2632 void PerformRecordedOperationL();
2633 void ScrollIfAtTopOrBottom();
2637 void DrawFirstLineTextL() const;
2638 CAknEdwinDrawingModifier* AknEdwinDrawingModifier();
2639 TBool EditorSupportsNeutralProtection() const;
2642 * Main routine for neutral protection. This routine returns a boolean stating if there is a
2643 * requirement for protection, but also returns the text that should replace the to-be-deleted text.
2645 * @param aPosOfLosEndOfDelete index of the first character deleted
2646 * @param aLengthToDelete length the text to be deleted
2647 * @param aNewText neutral protection characters to replace the delete
2648 * @param aForwardProtectionNeeded EFalse if only reverse protection needed; data valid only if
2649 * method does not return EFalse.
2650 * @return EFalse iff no deletion is to be performed
2652 TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded );
2655 * Returns whether the character is strongly directional
2657 * @param aChar character to be examined
2658 * @param aRightToLeft This is valid upon return only if EFalse is not returned.
2659 * Value is EFalse if the strong directionality is Left-to-right
2660 * @return EFalse if the character is not strongly directional.
2662 TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const;
2665 * Returns ETrue if the character at aPos is neutral
2667 * @param aPos index in editor; must be a valid index
2668 * @return EFalse iff the character is not neutral
2670 TBool CharIsNeutral( TInt aPos ) const;
2673 * Looks through the passed descriptor, looking for a strongly directional character.
2674 * Direction of search can be set. Search starts at the begining if searching forward;
2675 * starts at the end if searching backwards.
2677 * Search is carried out until a strong character is found or the end (or beginning)
2678 * of the descriptor has been reached.
2680 * @param aText Descriptor to search.
2681 * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer
2682 * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL
2684 * @return EFalse if no strong character was found.
2686 TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const;
2689 * Looks through the editor's text starting at character aPos, looking for a
2690 * strongly directional character. Direction of search can be set.
2691 * Search is carried out until a strong character is found or the end (or beginning)
2692 * of the editor text has been reached.
2694 * @param aPos First character to look at
2695 * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer
2696 * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL
2698 * @return EFalse if no strong character was found.
2700 TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const;
2703 * Routine to perform the operation of replacing a selection with new text.
2704 * This is intended for internal use.
2706 * The current selection, if non-zero length is deleted, and replace with aNewText if non-zero length
2707 * iTextView must be set.
2709 * @param aNewText Replacement text. May be zero length.
2710 * @param aCursorPosInNewText This is the position, relative to the beginning of the newtext,
2711 * that you want the cursor to be at when the operation is complete
2712 * @param aFormatHasChanged Set this to ETrue if you want the reformatting to start at
2713 * the beginning of the paragraph. EFalse if just to reformat the line.
2714 * This variable may also be set by the call to DeleteHighlight that this
2715 * code executes, so it may be set to ETrue upon return, even if EFalse was
2718 void ReplaceSelectionWithTextL( const TDesC& aNewText,
2719 TInt aCursorPosInNewText,
2720 TBool& aFormatHasChanged );
2723 * Returns EFalse iff ( phone number had only numeric input modes AND the keymap is a phone number
2725 * Phone number type keymaps are:
2726 * EAknEditorStandardNumberModeKeymap
2727 * EAknEditorFixedDiallingNumberModeKeymap
2729 * @return EFalse if the phone number will only contain a pure phone number
2731 TBool IsPurePhoneNumberEditor() const;
2734 * Standard check on upper and lower formatting thresholds versus current textview formatting mode.
2736 * @return EFalse iff the formatting mode does not need changing
2738 TBool NeedToChangeFormattingModeL() const;
2741 * When Band formatting is started, this should be called to update the cached
2742 * metrics used for the scroll bar calculations.
2744 void CalculateLineMetricsForBandFormattingL();
2746 protected: // from MObjectProvider
2749 * From @c MObjectProvider.
2751 * Retrieves an object of the same type as that encapsulated in @c aId.
2753 * This function is used to allow controls to ask their owners for access
2754 * to other objects that they own.
2756 * Other than in the case where NULL is returned, the object returned must
2757 * be of the same object type - that is, the @c ETypeId member of the
2758 * object pointed to by the pointer returned by this function must be equal
2759 * to the @c iUid member of @c aId.
2761 * @param aId An encapsulated object type ID.
2762 * @return Encapsulates the pointer to the object provided. Note that the
2763 * encapsulated pointer may be NULL.
2765 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
2767 public: // new since 3.0
2770 * Sets skin id for text.
2772 * @param aAknSkinIdForTextColor The skin id.
2774 IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor);
2777 * Sets highlight style.
2779 * @param aStyle The highlight style.
2781 IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle);
2783 // for custom drawer, not exported
2787 * @return The skin id.
2789 TInt SkinColorId() const;
2792 * Gets highlight style.
2794 * @return The highlight style.
2796 TAknsHighlightStyle HighlightStyle() const;
2799 * Called to determine the background color to draw. It is not to be used if skinning is
2800 * being used to draw the background.
2802 * This API can be used two ways:
2804 * i) If the caller has a default color to offer (to be used as
2805 * a fallback if SetBackgroundColorL has not been called), then he should use the
2806 * Input/Output parameter aConditionalColor, and ignore the return value. The output
2807 * parameter will only be over-written by the set background color if SetBackgroundColorL
2810 * ii) If the caller does not have a default color to offer, then he should pass in a dummy
2811 * input parameter and use the return value.
2813 * @param aConditionalColor Output parameter. Returns a color set by
2814 * SetBackgroundColorL. It is unchanged if
2815 * background color has not been set by SetBackgroundColorL
2816 * @return TRgb for the color to be used for background.
2818 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const;
2825 TUint32 iEdwinUserFlags;
2828 * Internal Edwin flags.
2830 TUint32 iEdwinInternalFlags;
2833 * Edwin's text content.
2837 protected: // Internal to Symbian
2840 * Edwin's text view.
2842 CTextView* iTextView;
2845 * Edwin's text layout.
2847 CTextLayout* iLayout;
2852 * Maximum length ot the edwin.
2857 * Number of lines in Edwin.
2859 TInt iNumberOfLines;
2862 * Current zoom factor.
2864 MGraphicsDeviceMap* iZoomFactor;
2869 TInt iLastPointerDocPos;
2878 friend class CEikEdwinFepSupport;
2879 friend class CEikEdwinExtension;
2880 // added this class to allow additional data members without breaking BC
2881 CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar
2882 CEikScrollBarFrame* iSBFrame;
2883 MEikEdwinObserver* iEdwinObserver;
2884 CArrayPtr<MEikEdwinObserver>* iObserverArray;
2885 CEikEdwinFepSupport* iEdwinFepSupport;
2886 CUndoBuffer* iUndoStore;
2887 TInt iAvgLinesInViewRect;
2888 TInt iAvgCharsPerLine;
2889 TInt iRightWrapGutter;
2891 MEikEdwinSizeObserver* iEdwinSizeObserver;
2892 TInt iMinimumHeight;
2893 TInt iMaximumHeight;
2895 iMaximumHeightInLines
2896 ---------------------
2897 This is simply a holder for the number, used to simplify some Avkon LAF requirements.
2898 The viewable region of an edwin is actually measured in pixels, However, if certain LAF
2899 requirements are enforced (that the view region has to be smaller than the number of
2900 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects
2904 That is to say, by simply setting iMaximumHeightInLines, this will not affect
2905 the actual maximum height of the edwin. To do this, you must set the iMaximumHeight
2907 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin.
2908 That method uses iMaximumHeightInLines along with the baseline separation, to set
2911 The general formula is very simple, to remove unneeded scrolling.
2912 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines
2914 If you cannot allocate sufficient space to the edwin, to permit so much viewable region
2915 then the method AlterViewRect can be called on the TextView() component. This will introduce
2916 a clipping rectangle, which allows blank space required by the edwin layout component
2919 TInt iMaximumHeightInLines;
2920 CLafEdwinCustomDrawBase* iCustomDrawer;
2921 TInt iLastPointerAnchorPos;
2922 CAknCcpuSupport* iCcpuSupport;
2923 CCharFormatLayer* iCharFormatLayer;
2924 CParaFormatLayer* iParaFormatLayer;
2930 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL()
2931 { return CreateScrollBarFrameL(ETrue);}
2932 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame()
2933 { return ((CEikScrollBarFrame* const)iSBFrame); }
2934 inline TInt CEikEdwin::AvgLinesInViewRect() const
2935 { return iAvgLinesInViewRect; }
2936 inline TInt CEikEdwin::AvgCharsPerLine() const
2937 { return iAvgCharsPerLine;}
2938 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines)
2939 { iAvgLinesInViewRect=aAvgLines; }
2940 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars)
2941 { iAvgCharsPerLine=aAvgChars; }
2943 inline void CEikEdwin::SetMaxLength(TInt aLength )
2944 { SetTextLimit(aLength); }
2945 inline TInt CEikEdwin::MaxLength() const
2946 { return iTextLimit; }