williamr@2: /* williamr@2: * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined(__EIKEDWIN_H__) williamr@2: #define __EIKEDWIN_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include // class CCenRepNotifyHandler; williamr@2: #include // class CRepository; williamr@2: williamr@2: class CGlobalText; williamr@2: class CParaFormatLayer; williamr@2: class CCharFormatLayer; williamr@2: class MLayDoc; williamr@2: class CEikEdwinFepSupport; williamr@2: class CLafEdwinCustomDrawBase; williamr@2: class CClipboard; williamr@2: class CAknEdwinFormAccessor; williamr@2: class CAknEdwinState; williamr@2: class CAknInputPolicyManager; williamr@2: class CFormCursorModifier; williamr@2: class CTextView; williamr@2: class MAknsControlContext; williamr@2: class CAknEdwinDrawingModifier; williamr@2: class CAknEdwinFormExtendedInterfaceProvider; williamr@2: class CAknPhoneNumberInlineTextSource; williamr@2: class CAknNoMatchesIndicatorInlineTextSource; williamr@2: class CAknInlineTextSource; williamr@2: class CAknPictographInterface; williamr@2: class CAknExtendedInputCapabilities; williamr@2: class CAknPointerEventSuppressor; williamr@2: class CSmileyManager; williamr@2: class CSmileyCustomWrap; williamr@2: williamr@2: // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin williamr@2: class CEikAvkonCustomDraw; williamr@2: williamr@2: // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin williamr@2: class CEikAvkonCustomDraw; williamr@2: williamr@2: // For construction of Rich Text - based custom formatters williamr@2: class CRichText; williamr@2: williamr@2: enum TReplaceOption williamr@2: { williamr@2: ENoReplace, williamr@2: EReplaceOnce, williamr@2: EReplaceAll, williamr@2: EReplaceSkip williamr@2: }; williamr@2: williamr@2: /** williamr@2: * This describes the features of a williamr@2: * search-and-replace operation on a CEikEdwin. williamr@2: * williamr@2: * See CEikEdwin::ReplaceL(). williamr@2: */ williamr@2: struct SEdwinFindModel williamr@2: { williamr@2: /** Flags for the search (see CEikEdwin::TFindFlags) */ williamr@2: TInt iFlags; // TEdwinFindFlags williamr@2: /** Text to search for. */ williamr@2: TBuf iText; williamr@2: /** Text to replace it with. */ williamr@2: TBuf iReplaceText; williamr@2: /** Replace options. */ williamr@2: TReplaceOption iReplaceOption; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Styles for highlighting. See SetHighlightStyleL(). williamr@2: */ williamr@2: enum TAknsHighlightStyle williamr@2: { williamr@2: /** Normal highlighting. */ williamr@2: EEikEdwinHighlightNormal = 0, williamr@2: /** Link highlighting. */ williamr@2: EEikEdwinHighlightLink williamr@2: }; williamr@2: williamr@2: // inline utility to handle RGB values (set / unset) williamr@2: williamr@2: class SAknRgb williamr@2: { williamr@2: // data (private) williamr@2: TRgb iValue; williamr@2: TBool iIsSet; williamr@2: public: // utilities williamr@2: SAknRgb():iIsSet(EFalse){} williamr@2: TRgb Value(){return iValue;} williamr@2: SAknRgb& operator=(TRgb aRgb) williamr@2: { williamr@2: iValue = aRgb; williamr@2: iIsSet = ETrue; williamr@2: return *this; williamr@2: } williamr@2: TBool IsSet(){return iIsSet;} williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Base class for controls that display and allow manipulation of text. williamr@2: * williamr@2: * The properties of a particular Edwin object can be set using bitwise flags, williamr@2: * which are defined in member enums (see @c TFlags for example). williamr@2: * williamr@2: * Edwins support Front End Processors, and so are a highly effective way of williamr@2: * getting textual data from the user. The text currently being composed by the williamr@2: * user is called the composition text. williamr@2: */ williamr@2: class CEikEdwin : public CEikBorderedControl, williamr@2: public MEikScrollBarObserver, williamr@2: public CTextView::MObserver, williamr@2: public MEditObserver, williamr@2: public MEikCcpuEditor williamr@2: { williamr@2: williamr@2: private: williamr@2: williamr@2: class CUndoBuffer; williamr@2: NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Allocates and constructs a CEikEdwinExtension. williamr@2: * williamr@2: * @param aEdwin Pointer to the CEikEdwin creating the extension. williamr@2: * @return A newly constructed edwin extension. williamr@2: */ williamr@2: static CEikEdwinExtension* NewL(CEikEdwin* aEdwin); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: ~CEikEdwinExtension(); williamr@2: williamr@2: /** williamr@2: * Gets the form accessor. williamr@2: * williamr@2: * @return The form accessor. williamr@2: */ williamr@2: IMPORT_C CAknEdwinFormAccessor* FormAccessor() const; williamr@2: williamr@2: /** williamr@2: * Sets the form accessor. williamr@2: * williamr@2: * @param aFormAccessor The form accessor. williamr@2: */ williamr@2: IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor); williamr@2: williamr@2: /** williamr@2: * Sets the CIdle object to update scroll bar. williamr@2: * williamr@2: * @param The CIdle object to perform scroll bar updating. williamr@2: */ williamr@2: IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter); williamr@2: williamr@2: /** williamr@2: * Gets the CIdle object which updates scroll bar. williamr@2: * williamr@2: * @return The CIdle object used to perform scroll bar updating. williamr@2: */ williamr@2: IMPORT_C CIdle* ScrollBarSetter(); williamr@2: williamr@2: /** williamr@2: * Gets the custom wrapper. williamr@2: * williamr@2: * @return The custom wrapper. williamr@2: */ williamr@2: IMPORT_C const TAvkonEditorCustomWrap& TextWrapper(); williamr@2: williamr@2: // the following two methods are deprecated williamr@2: IMPORT_C CFormCursorModifier* FormCursorModifier() const; williamr@2: williamr@2: /** williamr@2: * Store a locally stored (but externally set) Skins background control context. williamr@2: * williamr@2: * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL. williamr@2: */ williamr@2: void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext ); williamr@2: williamr@2: /** williamr@2: * Access to locally stored Skins background control context. williamr@2: * williamr@2: * @return Pointer to locally stored control context williamr@2: */ williamr@2: williamr@2: MAknsControlContext* SkinBackgroundControlContext() const; williamr@2: williamr@2: /** williamr@2: * This returns a flag that records whether the background context has ever been williamr@2: * set by API. williamr@2: * williamr@2: * @return EFalse iff control context has never been set. williamr@2: */ williamr@2: TBool SkinBackgroundControlContextHasBeenSet() const; williamr@2: williamr@2: /** williamr@2: * Stores the alignment value. williamr@2: * williamr@2: * @param aAlignment Editor alignment to be stored. williamr@2: */ williamr@2: void SetAlignment(TInt aAlignment); williamr@2: williamr@2: /** williamr@2: * Returns the stored alignment value. williamr@2: * williamr@2: * @return Value of the current editor alignment. williamr@2: */ williamr@2: TInt CurrentAlignment() const; williamr@2: williamr@2: /** williamr@2: * Sets pictograph animation callback. williamr@2: */ williamr@2: void SetPictoCallBack( TCallBack& aCallBack ); williamr@2: williamr@2: /** williamr@2: * Sets pictograph animation callback. williamr@2: */ williamr@2: const TCallBack& PictoCallBack() const; williamr@2: williamr@2: /** williamr@2: * Creates the CAknFormExtendedInterfaceProvider object if it does not exist. williamr@2: */ williamr@2: void CreateFormExtendedInterfaceProviderIfNeededL(); williamr@2: williamr@2: /** williamr@2: * Access to Form's extended interface provider. williamr@2: */ williamr@2: CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const; williamr@2: williamr@2: /** williamr@2: * Create a custom formatter for pure phone number content. williamr@2: * williamr@2: * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an williamr@2: * ExtendedInterfaceProvider object built. williamr@2: * williamr@2: * @param aTextLayout Reference to the CTextLayout object used for this editor. williamr@2: * aText CPlainText object reference for the text used in the editor. williamr@2: */ williamr@2: void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText); williamr@2: williamr@2: /** williamr@2: * Create a custom formatter for pure phone number content. williamr@2: * williamr@2: * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an williamr@2: * ExtendedInterfaceProvider object built. williamr@2: * williamr@2: * @param aTextLayout Reference to the CTextLayout object used for this editor williamr@2: */ williamr@2: void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout ); williamr@2: williamr@2: /** williamr@2: * Create a custom formatter for rich text editor with general content. Phone numbers are williamr@2: * recognized using an internal parser and formatted with the number grouping engine williamr@2: * williamr@2: * Calls CreateFormExtendedInterfaceProviderIfNeededL to ensure that there is an williamr@2: * ExtendedInterfaceProvider object built. williamr@2: * williamr@2: * @param aTextLayout Reference to the CTextLayout object used for this editor williamr@2: */ williamr@2: void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText ); williamr@2: williamr@2: /** williamr@2: * This allows the caller to access the single inline text interface that will be seen williamr@2: * by Tagma. All installed inline text source classes are held behind this single interface williamr@2: * williamr@2: * @return pointer to the inline text source object that will be provided to Tagma williamr@2: * Null is returned if none is installed. williamr@2: */ williamr@2: CAknInlineTextSource* InlineTextSource() const; williamr@2: williamr@2: /** williamr@2: * Returns pointer to pictograph interface. williamr@2: * williamr@2: * @return Pointer to pictograph interface. The value can be NULL if pictographs are not supported. williamr@2: */ williamr@2: CAknPictographInterface* PictographInterface() const; williamr@2: williamr@2: /** williamr@2: * Used for suppressing all editor's background drawing. williamr@2: */ williamr@2: void SetSuppressBackgroundDrawing( TBool aSuppress ); williamr@2: williamr@2: /** williamr@2: * Tests if the background drawing is suppressed. williamr@2: */ williamr@2: TBool IsBackgroundDrawingSuppressed() const; williamr@2: williamr@2: /** williamr@2: * Returns the value of ClearDirection williamr@2: * williamr@2: * @return value of current ClearDirection williamr@2: */ williamr@2: TInt ClearDirection() const; williamr@2: williamr@2: public: // from MCenRepNotifyHandlerCallback williamr@2: void HandleNotifyInt(TUint32 aId, TInt aNewValue); williamr@2: williamr@2: private: williamr@2: williamr@2: CEikEdwinExtension(); williamr@2: void ConstructL(CEikEdwin* aEdwin); williamr@2: williamr@2: private: williamr@2: williamr@2: enum TFlagIndices williamr@2: { williamr@2: ESkinBackgroundControlContextHasBeenSetIndex = 0, williamr@2: ESuppressBackgroundDrawing williamr@2: }; williamr@2: class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack williamr@2: { williamr@2: private: // From MAknPictographAnimatorCallBack williamr@2: void DrawPictographArea(); williamr@2: }; williamr@2: williamr@2: private: williamr@2: williamr@2: CIdle* iSetScrollBar; williamr@2: TAvkonEditorCustomWrap iTextWrapper; williamr@2: CAknEdwinFormAccessor* iFormAccessor; williamr@2: CFormCursorModifier* iFormCursorModifier; williamr@2: MAknsControlContext* iSkinBackgroundControlContext; williamr@2: TBitFlags iFlags; williamr@2: TInt iAlignment; williamr@2: TCallBack iPictoCallBack; williamr@2: CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned williamr@2: CAknInlineTextSource* iPhoneNumberFormatter; // Not owned williamr@2: CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter; // Not owned williamr@2: TAknEdwinPictographDrawer iPictographDrawer; williamr@2: CAknPictographInterface* iPictographInterface; williamr@2: // For clear direction. williamr@2: CRepository* iCenRep; // Owned williamr@2: CCenRepNotifyHandler* iCenRepNotifyHandler; // Owned williamr@2: TInt iClearDirection; // Value of ClearDirection williamr@2: public: williamr@2: williamr@2: TInt iSkinIdForText; williamr@2: TAknsHighlightStyle iSkinHighlightStyle; williamr@2: SAknRgb iEditorBackgroundColor; williamr@2: TInt iUpperFullFormattingLength; williamr@2: CAknExtendedInputCapabilities* iExtendedInputCapabilities; williamr@2: TRect iTextLinesRect; williamr@2: TRect iScrollRect; williamr@2: TInt iTempCursorPos; williamr@2: TInt iTempAnchorPos; williamr@2: TInt iTempSelect; williamr@2: CAknPointerEventSuppressor* iPtSuppressor; williamr@2: TBool iDragging; williamr@2: TInt iRecordCursor; williamr@2: TBool iRecordScroll; williamr@2: /** williamr@2: * @c iDestroyedPtr is used for the object destruction check. williamr@2: * If it has non-null value, the destruction check is turned on, and williamr@2: * the value points to a local boolean variable that keeps the destroyed state. williamr@2: */ williamr@2: TBool* iDestroyedPtr; williamr@2: enum TDrawState williamr@2: { williamr@2: ENotDraw = 0, williamr@2: EDrawn, williamr@2: EDrawing williamr@2: }; williamr@2: TInt iDrawInvoked; williamr@2: TInt iThumbPos; williamr@2: #ifdef FF_AVKON_EMOTION_ICON_ENABLED williamr@2: // own williamr@2: CSmileyManager* iSmiley; williamr@2: CSmileyCustomWrap* iSmileyWrap; williamr@2: TBool iInlineEditing; williamr@2: TBool iDisableConvertInFormat; williamr@2: #endif williamr@2: }; williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * The following flags may be combined with a bitwise OR to form the williamr@2: * @c aEdwinFlags argument to @c ConstructL(TInt, ...) or the flags field williamr@2: * of an EDWIN resource structure run through @c ConstructFromResourceL(). williamr@2: * williamr@2: * These flags are duplicated in @c uikon.hrh (see @c EEikEdwinKeepDocument williamr@2: * etc.) williamr@2: */ williamr@2: enum TFlags williamr@2: { // user flags williamr@2: /** */ williamr@2: EZeroEnumValue =0x00000000, williamr@2: williamr@2: /** williamr@2: * If set, @c CEikEdwin does not destroy its content on destruction. williamr@2: */ williamr@2: EKeepDocument =0x00000001, williamr@2: williamr@2: /** williamr@2: * If set, the content buffer uses segmented storage (see williamr@2: * @c CEditableText::ESegmentedStorage). williamr@2: */ williamr@2: ESegmentedStorage =0x00000002, williamr@2: williamr@2: /** williamr@2: * The size specified in the resource used to construct the object is williamr@2: * given in pixels, not character widths. williamr@2: */ williamr@2: EWidthInPixels =0x00000004, williamr@2: williamr@2: /** williamr@2: * No automatic selection takes place. Normally the entire text is williamr@2: * selected whenever the Edwin is created, resized or has its text williamr@2: * set as one operation. williamr@2: */ williamr@2: ENoAutoSelection =0x00000008, williamr@2: williamr@2: /** williamr@2: * If set, then whenever the control is activated the cursor is williamr@2: * moved to the end of the text. williamr@2: */ williamr@2: EJustAutoCurEnd =0x00000010, williamr@2: williamr@2: /** williamr@2: * Does not wrap the text being edited. williamr@2: */ williamr@2: ENoWrap =0x00000020, williamr@2: williamr@2: /** williamr@2: * Uses a line cursor instead of a block cursor. williamr@2: */ williamr@2: ELineCursor =0x00000040, williamr@2: williamr@2: /** williamr@2: * Does not perform horizontal scrolling. williamr@2: */ williamr@2: ENoHorizScrolling =0x00000080, williamr@2: williamr@2: /** williamr@2: * If set, scroll bars required to edit long documents appear inside williamr@2: * the Edwin. This reduces the area used to display the Edwin. williamr@2: * williamr@2: * If not set, scroll bars appear outside the Edwin. williamr@2: */ williamr@2: EInclusiveSizeFixed =0x00000100, williamr@2: williamr@2: /** williamr@2: * Sets the Edwin’s height according to the number of lines of text williamr@2: * supplied by the user. williamr@2: */ williamr@2: EUserSuppliedText =0x00000200, williamr@2: williamr@2: /** williamr@2: * The Edwin is a window-owning control. williamr@2: */ williamr@2: EOwnsWindow =0x00000400, williamr@2: williamr@2: /** williamr@2: * The Edwin does not respond to input at all. williamr@2: */ williamr@2: EDisplayOnly =0x00000800, williamr@2: williamr@2: /** williamr@2: * Does not hide the selection if the Edwin loses focus. williamr@2: */ williamr@2: EAlwaysShowSelection =0x00001000, williamr@2: williamr@2: /** williamr@2: * The Edwin is read-only so users cannot add text to any document it williamr@2: * displays. williamr@2: */ williamr@2: EReadOnly =0x00002000, williamr@2: williamr@2: /** williamr@2: * If set, no special attempt will be made to delete the embedded pictures cleanly. williamr@2: * williamr@2: * This flag does not apply to Edwins which do not edit rich text. williamr@2: */ williamr@2: EAllowPictures =0x00004000, williamr@2: williamr@2: /** williamr@2: * The Edwin supports undo operations. williamr@2: */ williamr@2: EAllowUndo =0x00008000, williamr@2: williamr@2: /** williamr@2: * Does not allow line or paragraph breaks in the text being edited. williamr@2: */ williamr@2: ENoLineOrParaBreaks =0x00010000, williamr@2: williamr@2: /** williamr@2: * Allows only ASCII characters. williamr@2: */ williamr@2: EOnlyASCIIChars =0x00020000, williamr@2: williamr@2: /** williamr@2: * The Edwin is resizable. williamr@2: */ williamr@2: EResizable =0x00040000, williamr@2: williamr@2: /** williamr@2: * The Edwin ignores the virtual cursor. williamr@2: */ williamr@2: EIgnoreVirtualCursor =0x00080000, williamr@2: williamr@2: /** williamr@2: * No custom draw is done. williamr@2: */ williamr@2: ENoCustomDraw =0x01000000, williamr@2: williamr@2: /** williamr@2: * Changes layout to Avkon style. williamr@2: */ williamr@2: EAvkonEditor =0x02000000, williamr@2: williamr@2: /** williamr@2: * Hides cursor. williamr@2: */ williamr@2: EAvkonDisableCursor =0x04000000, williamr@2: williamr@2: /** williamr@2: * Changes text editor to non-editable mode. williamr@2: */ williamr@2: EAvkonNotEditable =0x08000000, williamr@2: williamr@2: /** williamr@2: * Sets the @c Avkon wrapping rules ON. williamr@2: */ williamr@2: EEdwinAlternativeWrapping = 0x10000000, williamr@2: williamr@2: /** williamr@2: * Enables tab key handling williamr@2: */ williamr@2: EAvkonTabsEnabled = 0x20000000, williamr@2: williamr@2: /** williamr@2: * Disable VKB input williamr@2: */ williamr@2: EAvkonDisableVKB = 0x40000000, williamr@2: williamr@2: /** williamr@2: * Enable Smiley Support williamr@2: */ williamr@2: EAvkonEnableSmileySupport = 0x80000000 williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Defines the possible commands for @c ClipboardL(). williamr@2: */ williamr@2: enum TClipboardFunc williamr@2: { williamr@2: /** Do nothing. */ williamr@2: ENoClipboard, williamr@2: williamr@2: /** Cut. */ williamr@2: ECut, williamr@2: williamr@2: /** Copy. */ williamr@2: ECopy, williamr@2: williamr@2: /** Paste. */ williamr@2: EPaste williamr@2: }; williamr@2: williamr@2: /** williamr@2: * The following flags may be ORed together for text searches (see williamr@2: * @c FindL() for example). williamr@2: */ williamr@2: enum TFindFlags williamr@2: { williamr@2: /** Search progresses up the screen. */ williamr@2: EFindDirectionUp =0x01, williamr@2: williamr@2: /** Only whole-word matches count. */ williamr@2: EFindWholeWord =0x02, williamr@2: williamr@2: /** Search is case-sensitive. */ williamr@2: EFindCaseSensitive =0x04, williamr@2: williamr@2: /** Finds again. */ williamr@2: EFindAgain =0x08, williamr@2: williamr@2: /** Does not display a busy message. */ williamr@2: ENoBusyMessage =0x10, williamr@2: williamr@2: /** */ williamr@2: EReadOnlyFile =0x20 // New for CKon williamr@2: }; williamr@2: williamr@2: /** williamr@2: * When content is supplied to an Edwin using @c SetDocumentContentL(), williamr@2: * this defines whether the new content is added to or has replaced the williamr@2: * existing content. williamr@2: */ williamr@2: enum TSetContent williamr@2: { williamr@2: /** Replaces the Edwin’s existing content. */ williamr@2: EUseText, williamr@2: williamr@2: /** Copies the supplied content into the existing content. */ williamr@2: ECopyText williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Specifies whether the Edwin owns the document it is being used to edit. williamr@2: * williamr@2: * If the Edwin owns the document, the document object is destroyed on williamr@2: * destruction. williamr@2: */ williamr@2: enum TOwnershipType williamr@2: { williamr@2: /** Document is owned by the Edwin. */ williamr@2: EOwnsText, williamr@2: williamr@2: /** Document is owned by some other object. */ williamr@2: EDoesNotOwnText williamr@2: }; williamr@2: williamr@2: // order of hotkeys defined in resource file. Not all applicable to plain williamr@2: // text editors williamr@2: /** williamr@2: * Enumerates the hotkeys that are defined an @c r_eik_edwin_ctrl_hotkeys williamr@2: * or @c r_eik_edwin_shift_ctrl_hotkeys resource. williamr@2: * williamr@2: * Not all are applicable to plain text editors. williamr@2: */ williamr@2: enum TEdwinHotKeys williamr@2: { williamr@2: /** Cut. */ williamr@2: EHotKeyCut, williamr@2: williamr@2: /** Copy. */ williamr@2: EHotKeyCopy, williamr@2: williamr@2: /** Paste. */ williamr@2: EHotKeyPaste, williamr@2: williamr@2: /** Undo. */ williamr@2: EHotKeyUndo, williamr@2: williamr@2: /** Find. */ williamr@2: EHotKeyFind, williamr@2: williamr@2: /** Insert a character. */ williamr@2: EHotKeyInsertChar, williamr@2: williamr@2: /** Bold. */ williamr@2: EHotKeyBold, williamr@2: williamr@2: /** Italic. */ williamr@2: EHotKeyItalic, williamr@2: williamr@2: /** Underline. */ williamr@2: EHotKeyUnderline, williamr@2: williamr@2: /** Font. */ williamr@2: EHotKeyFont, williamr@2: williamr@2: /** Insert an object. */ williamr@2: EHotKeyInsertObject, williamr@2: williamr@2: /** Edit an object. */ williamr@2: EHotKeyEditObject, williamr@2: williamr@2: /** Format an object. */ williamr@2: EHotKeyFormatObject williamr@2: }; williamr@2: williamr@2: public: // construction and destruction williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: * williamr@2: * Deletes objects and frees resources owned by this object. The Edwin’s williamr@2: * editable text is freed if the @c EKeepDocument flag is not set. williamr@2: */ williamr@2: IMPORT_C ~CEikEdwin(); williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: * williamr@2: * Creates a new @c Edwin, FEP support for the new editor will not be williamr@2: * present if there is insufficient memory. williamr@2: */ williamr@2: IMPORT_C CEikEdwin(); williamr@2: williamr@2: /** williamr@2: * Constructor. williamr@2: * williamr@2: * Creates a new @c Edwin, specifying the border to use. As with the default williamr@2: * constructor, FEP support for the new editor will not be present if there williamr@2: * is insufficient memory. S60 Edwin does not support / draw any borders. williamr@2: * williamr@2: * @param aBorder The Edwin border. williamr@2: */ williamr@2: IMPORT_C CEikEdwin(const TGulBorder& aBorder); williamr@2: williamr@2: /** williamr@2: * Handles Symbian 2nd phase construction. williamr@2: * Completes construction of a new @c Edwin, initialising its heap-stored williamr@2: * members from the supplied arguments. williamr@2: * williamr@2: * @param aEdwinFlags Bitwise ORed combination of flags from @c TFlags. williamr@2: Default value is 0. williamr@2: * @param aWidthInChars Specifies the width for the Edwin, in characters or williamr@2: pixels: see the @c EWidthInPixels flag. Default value is 0. williamr@2: * @param aTextLimit Maximum length for the text to present as editable. williamr@2: Default value is 0. williamr@2: * @param aNumberOfLines Height for the Edwin, in lines. Default value williamr@2: is 0. williamr@2: */ williamr@2: IMPORT_C void ConstructL(TInt aEdwinFlags=0, williamr@2: TInt aWidthInChars=0, williamr@2: TInt aTextLimit=0, williamr@2: TInt aNumberOfLines=0); williamr@2: williamr@2: /** williamr@2: * Sets the Edwin observer. The Edwin’s observer will be called back with williamr@2: * control events associated with the Edwin. williamr@2: * williamr@2: * @param aEdwinObserver New observer. williamr@2: */ williamr@2: IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver); williamr@2: williamr@2: /** williamr@2: * Adds an observer of standard Edwin events to the list of observers, williamr@2: * creating the list if necessary. May be called any number of times and is williamr@2: * independent of calls to @c SetEdwinObserver. williamr@2: * williamr@2: * @param aEdwinObserver The observer to add to the list of observers. williamr@2: */ williamr@2: IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver); williamr@2: williamr@2: /** williamr@2: * Removes the specified observer from the list of observers. Does nothing williamr@2: * if aEdwinObserver is not an observer. williamr@2: * williamr@2: * @param aEdwinObserver The observer to remove from the list of observers. williamr@2: */ williamr@2: IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver); williamr@2: williamr@2: /** williamr@2: * Creates the containing window for the Edwin if it does not already have one. williamr@2: */ williamr@2: IMPORT_C void SetContainerWindowL(); williamr@2: williamr@2: /** williamr@2: * Sets the Edwin’s editable content. Before calling this function you must williamr@2: * get the @c iText pointer as @c iText is replaced by @c aText. You must williamr@2: * also free the memory by deleting the previous @c iText contents. williamr@2: * williamr@2: * @param aText New value for the content. williamr@2: * @param aContent Specifies whether to use @c aText itself, or to copy its williamr@2: * content. Default value is @c CEikEdwin::ECopyText. williamr@2: */ williamr@2: IMPORT_C void SetDocumentContentL(CGlobalText& aText, williamr@2: TSetContent aContent=CEikEdwin::ECopyText); williamr@2: williamr@2: public: // from CCoeControl williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles key events. williamr@2: * williamr@2: * @param aKeyEvent The key event. williamr@2: * @param aType The type of the event: @c EEventKeyDown, @c EEventKeyUp williamr@2: * or @c EEventKey. williamr@2: * @return A suitable response code. williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, williamr@2: TEventCode aType); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Responds to focus-changed events. williamr@2: * williamr@2: * @param aDrawNow Not used. williamr@2: */ williamr@2: IMPORT_C void FocusChanged(TDrawNow aDrawNow); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Sets the Edwin as ready for drawing. williamr@2: * williamr@2: * @leave KErrNoMemory. williamr@2: */ williamr@2: IMPORT_C void ActivateL(); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Completes the construction of a new @c Edwin. This function initialises williamr@2: * the heap-stored members from an @c EDWIN resource. williamr@2: * williamr@2: * @param aReader A reader positioned for reading from an @c EDWIN resource. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles pointer events. williamr@2: * williamr@2: * @param aPointerEvent Pointer event to respond to. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Gets the minimum size of this Edwin for automatic-layout control williamr@2: * contexts such as dialogs. williamr@2: * williamr@2: * @return Minimum size for the control. williamr@2: */ williamr@2: IMPORT_C TSize MinimumSize(); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Draws the control on request. williamr@2: * williamr@2: * @param aRect If supplied, the rectangle in which to draw the Edwin. williamr@2: */ williamr@2: IMPORT_C void Draw(const TRect& aRect) const; williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Dims or undims the Edwin. williamr@2: * williamr@2: * @param aDimmed @c ETrue to dim the Edwin. @c EFalse to undim the Edwin. williamr@2: */ williamr@2: IMPORT_C void SetDimmed(TBool aDimmed); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Sets the containing window for the Edwin by copying it from the specified williamr@2: * parent. Also copies a control context from @c aParent if one has not been williamr@2: * previously set. williamr@2: * williamr@2: *@param aParent The control to set as this Edwin’s parent. williamr@2: */ williamr@2: IMPORT_C void SetContainerWindowL(const CCoeControl& aParent); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Gets the list of logical colours employed in the drawing of the control, williamr@2: * paired with an explanation of how they are used. Appends the list to williamr@2: * @c aColorUseList. williamr@2: * williamr@2: * @param[out] aColorUseList The list of logical colours. williamr@2: */ williamr@2: IMPORT_C virtual void GetColorUseListL(CArrayFix& williamr@2: aColorUseList) const; // not available before Release 005u williamr@2: williamr@2: // not available before Release 005u williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles a change to Edwin’s resources which are shared across the williamr@2: * environment. Colours or fonts for example. williamr@2: * williamr@2: * @param aType The type of resource that was changed. williamr@2: */ williamr@2: IMPORT_C virtual void HandleResourceChange(TInt aType); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Access to the input capabilities of the edwin. williamr@2: * williamr@2: * If this function is overrided in a subclass, the subclass should williamr@2: * obtain this class' InputCapabilities' object provider through williamr@2: * TCoeInputCapabilities::ObjectProvider() and set that as a part of williamr@2: * the subclass' InputCapabilities object provider chain to ensure williamr@2: * maximum functionality. williamr@2: * williamr@2: * @return The Edwin input capabilities. williamr@2: */ williamr@2: IMPORT_C TCoeInputCapabilities InputCapabilities() const; williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * This method sets the input capabilities of the edwin. Ownership of the williamr@2: * T-class is not transferred. williamr@2: * williamr@2: * @param aInputCapabilities Reference to an input capabilities object williamr@2: * on the heap. williamr@2: * @leave KErrNoMemory Edwin FEB support object is not created. williamr@2: */ williamr@2: IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& williamr@2: aInputCapabilities); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * In debug mode writes the internal state to the given stream. Does williamr@2: * nothing in release mode. williamr@2: * williamr@2: * @param[out] aWriteStream A stream for writing the internal state. williamr@2: */ williamr@2: IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: public: // from MEikScrollBarObserver williamr@2: williamr@2: /** williamr@2: * From @c MEikScrollBarObserver. williamr@2: * williamr@2: * Handles scrollbar key events. williamr@2: * williamr@2: * @param aScrollBar The scrollbar. williamr@2: * @param aEventType The type of key event. williamr@2: */ williamr@2: IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, williamr@2: TEikScrollEvent aEventType); williamr@2: williamr@2: public: // from CTextView::MObserver williamr@2: williamr@2: /** williamr@2: * From @c CTextView::MObserver. williamr@2: * williamr@2: * Called after reformatting but before redisplay so that edit windows williamr@2: * etc. can be resized. williamr@2: * williamr@2: * @param aTextView Not used. williamr@2: */ williamr@2: IMPORT_C void OnReformatL(const CTextView* aTextView); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Gets the number of characters in the document. williamr@2: * williamr@2: * @return The number of characters in the document. williamr@2: */ williamr@2: IMPORT_C TInt TextLength() const; williamr@2: williamr@2: /** williamr@2: * Gets the cursor’s position within the document. williamr@2: * williamr@2: * @return The cursor’s position within the document. williamr@2: */ williamr@2: IMPORT_C TInt CursorPos() const; williamr@2: williamr@2: /** williamr@2: * Gets the number of characters including non-printing characters within williamr@2: * the selection. williamr@2: * williamr@2: * @return The number of characters within the selection. williamr@2: */ williamr@2: IMPORT_C TInt SelectionLength() const; williamr@2: williamr@2: /** williamr@2: * Gets the cursor selection. If no text view is associated to the Edwin williamr@2: * this returns @c TCursorSelection(0,0). williamr@2: * williamr@2: * @return The current selection. williamr@2: */ williamr@2: IMPORT_C TCursorSelection Selection() const; williamr@2: williamr@2: /** williamr@2: * Removes the selection and any composition text. The cursor position is williamr@2: * unaffected. If there is no selected region, this function has no effect. williamr@2: */ williamr@2: IMPORT_C void ClearSelectionL(); williamr@2: williamr@2: /** williamr@2: * Sets the text selection. Highlights the selected area and makes the new williamr@2: * cursor position visible. Any previous selection is cancelled. This williamr@2: * function also updates the scroll bar thumbs if present. williamr@2: * williamr@2: * @param aCursorPos The cursor’s position. williamr@2: * @param aAnchorPos The anchor’s position. williamr@2: */ williamr@2: IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos); williamr@2: williamr@2: /** williamr@2: * Sets the cursor’s position within the document. If the new position is williamr@2: * not visible the text is scrolled so that the line containing the williamr@2: * cursor is visible. This function also updates the scroll bar thumbs williamr@2: * if present. williamr@2: * williamr@2: * @param aCursorPos New cursor position. williamr@2: * @param aSelect @c ETrue to extend the cursor’s selection to the new williamr@2: * position. @c EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect); williamr@2: williamr@2: /** williamr@2: * Selects the entire document. williamr@2: */ williamr@2: IMPORT_C void SelectAllL(); williamr@2: williamr@2: /** williamr@2: * Recalculates the screen width of an Edwin from the specified number williamr@2: * of character widths. This is called during construction. If the williamr@2: * Edwin only allows editing of numbers, the width of the zero williamr@2: * character (0) is used; otherwise williamr@2: * @c CFont::MaxNormalCharWidthInPixels() is used. williamr@2: * williamr@2: * If the @c EWidthInPixels flag has been set, the @c aWidthInChars williamr@2: * argument is measured in pixels, not characters. williamr@2: * williamr@2: * @param aWidthInChars Width in either pixels or characters. williamr@2: */ williamr@2: IMPORT_C void CalculateWidth(TInt aWidthInChars); williamr@2: williamr@2: /** williamr@2: * Copies the entire document’s content into a descriptor. It is the williamr@2: * caller's responsibility to provide a large enough buffer. williamr@2: * williamr@2: * @param[out] aDes An initialised descriptor which on return contains a williamr@2: * copy of the content of this Edwin. williamr@2: */ williamr@2: IMPORT_C void GetText(TDes& aDes) const; williamr@2: williamr@2: /** williamr@2: * Gets a new buffer containing a copy of the whole text document. williamr@2: * williamr@2: * @return A new copy of the document text. williamr@2: */ williamr@2: IMPORT_C HBufC* GetTextInHBufL() const; williamr@2: williamr@2: /** williamr@2: * Sets the document text of this Edwin from the contents of a descriptor. williamr@2: * This function removes any pictures, any invalid characters and cancels williamr@2: * any previous selection. williamr@2: * williamr@2: * @param aDes Descriptor from which to copy. williamr@2: */ williamr@2: IMPORT_C void SetTextL(const TDesC* aDes); williamr@2: williamr@2: /** williamr@2: * Handles cut, copy and paste commands. This function also reports a williamr@2: * change of state of the control to the observer when necessary. williamr@2: * williamr@2: * @param aClipboardFunc Clipboard operation. williamr@2: */ williamr@2: IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc); williamr@2: williamr@2: /** williamr@2: * Inserts a field at the current cursor position. If a selection was made williamr@2: * the field replaces that selection. williamr@2: * williamr@2: * @param aField Text field to insert. williamr@2: * @param aFieldType Type of the field. williamr@2: */ williamr@2: IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType); williamr@2: williamr@2: /** williamr@2: * Updates all the fields in the document. williamr@2: */ williamr@2: IMPORT_C void UpdateAllFieldsL(); williamr@2: williamr@2: /** williamr@2: * Updates any text field at the current cursor position. Updating involves williamr@2: * calculating the new value for the field, and replacing the field’s williamr@2: * existing text content with the new text. williamr@2: * williamr@2: * This function does nothing if the cursor is not within a text field. williamr@2: */ williamr@2: IMPORT_C void UpdateCurrentFieldL(); williamr@2: williamr@2: /** williamr@2: * Counts and returns the number of words in the document. williamr@2: * williamr@2: * @return The number of words in the document. williamr@2: */ williamr@2: IMPORT_C TInt CountWords(); williamr@2: williamr@2: /** williamr@2: * Inserts the contents of a text file into the text being edited at the williamr@2: * current cursor position. williamr@2: * williamr@2: * @param aFileName The file to open and read. williamr@2: * @param aTextOrganisation How to handle line breaks. Default value is williamr@2: * @c CPlainText::EOrganiseByLine. williamr@2: */ williamr@2: IMPORT_C void InsertFromTextFileL(const TFileName &aFileName, williamr@2: const CPlainText::TTextOrganisation williamr@2: aTextOrganisation=CPlainText::EOrganiseByLine); williamr@2: williamr@2: /** williamr@2: * Uses @c SetScrollBarsL() to set the scrollbars. williamr@2: * williamr@2: * @param aPtr Pointer to @c CEikEdwin instance. williamr@2: * @return Integer value of @c EFalse. williamr@2: */ williamr@2: IMPORT_C static TInt IdleL(TAny *aPtr); williamr@2: williamr@2: /** williamr@2: * Gets a pointer to the Edwin’s document contents. williamr@2: * williamr@2: * @return A @c CPlainText pointer which contains the williamr@2: * document. williamr@2: */ williamr@2: IMPORT_C CPlainText* Text() const; williamr@2: williamr@2: // this is particularly important for when the front-end processor is williamr@2: // inline-editing a CEikEdwin williamr@2: /** williamr@2: * Cancels any current transaction with the Edwin’s front-end processor. williamr@2: * Any front-end input windows are removed, and any highlighted text being williamr@2: * edited in the Edwin is removed. The Edwin is rolled back to the state williamr@2: * it was in before the FEP transaction started. This function is called williamr@2: * by @c CEikEdwin itself when the document content, the cursor position williamr@2: * or the current selection is changed. williamr@2: * williamr@2: * Cancelling outstanding FEP transactions before performing operations williamr@2: * on the text programmatically is particularly important when the williamr@2: * front-end processor is inline-editing an Edwin. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void CancelFepTransaction(); williamr@2: williamr@2: /** williamr@2: * Handles all modifications made by reformatting the entire document. williamr@2: * Calls @c CEikEdwin::FormatText() and redraws Edwin contents and williamr@2: * scroll bars if they are ready to be redrawn. williamr@2: */ williamr@2: IMPORT_C void HandleTextChangedL(); williamr@2: williamr@2: /** williamr@2: * Gets the width used for laying out the text inside the Edwin in pixels. williamr@2: * This may be larger or smaller than the width of the Edwin itself. williamr@2: * See @c SetWysiwygModeOn() for example. williamr@2: * williamr@2: * @return Width of the text layout area in pixels. williamr@2: */ williamr@2: IMPORT_C TInt LayoutWidth() const; williamr@2: williamr@2: /** williamr@2: * Formats and draws a new document, updates scrollbars if necessary. williamr@2: */ williamr@2: IMPORT_C void NotifyNewDocumentL(); williamr@2: williamr@2: /** williamr@2: * Reformats and redraws the document, updates scrollbars if necessary. williamr@2: */ williamr@2: IMPORT_C void NotifyNewFormatL(); williamr@2: williamr@2: /** williamr@2: * Gets true if a substring is present in the text being edited before or williamr@2: * after the cursor position. If @c aFindText is NULL, then the current williamr@2: * word or selection will be searched for again. williamr@2: * williamr@2: * @param aFindText The substring to search for. williamr@2: * @param aFindFlags See @c TFindFlags. Default value is 0. williamr@2: * @return @c ETrue if aFindText is found. williamr@2: */ williamr@2: IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0); williamr@2: williamr@2: /** williamr@2: * Gets the cursor position of the matching text in the document. The williamr@2: * search starts from @c aPos. If @c aFindText is NULL, then the williamr@2: * current word or selection will be searched for. If the substring williamr@2: * cannot be found, this function returns @c KErrNotFound. williamr@2: * williamr@2: * @param aFindText The substring to search for. williamr@2: * @param aPos Starting position for the find. williamr@2: * @param aFindFlags See @c TFindFlags. williamr@2: * @return KErrNotFound if the text was not found, otherwise the williamr@2: * position of the matched substring. williamr@2: */ williamr@2: IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags); williamr@2: williamr@2: /** williamr@2: * Replaces the highlighted text. See @c SEdwinFindModel struct. williamr@2: * williamr@2: * @param[in,out] aFindModel Pointer to the replacement text. williamr@2: */ williamr@2: IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel); williamr@2: williamr@2: /** williamr@2: * Replaces all occurrences of a string with new text. Both old and new williamr@2: * text are held in @c aFindModel. williamr@2: * williamr@2: * @param[in,out] aFindModel Pointer to the replacement text. williamr@2: * @leave This function will leave if the replace operation fails williamr@2: * unexpectedly. williamr@2: */ williamr@2: IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel); williamr@2: williamr@2: /** williamr@2: * Gets the current word or selection and searches for it. This function williamr@2: * is called by @c FindL() and @c FindTextL() when no text to search for williamr@2: * is given. williamr@2: * williamr@2: * @param aFindText An empty descriptor. williamr@2: */ williamr@2: IMPORT_C void GetFindText(TDes* aFindText); williamr@2: williamr@2: /** williamr@2: * Updates scrollbars. williamr@2: */ williamr@2: IMPORT_C void UpdateScrollBarsL(); williamr@2: williamr@2: /** williamr@2: * Creates the Edwin scroll bar frame with no pre-allocation of memory williamr@2: * for scroll bars. williamr@2: * williamr@2: * @return The scroll bar frame. williamr@2: */ williamr@2: IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(); williamr@2: williamr@2: /** williamr@2: * Creates a pre-allocated scroll bar frame. williamr@2: * williamr@2: * @return Pre-allocated scroll bar frame. williamr@2: */ williamr@2: inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL(); williamr@2: williamr@2: /** williamr@2: * Gets the scroll bar frame surrounding this Edwin. williamr@2: * williamr@2: * @return Pointer to this Edwin’s scroll bar frame. williamr@2: */ williamr@2: inline CEikScrollBarFrame* ScrollBarFrame(); williamr@2: williamr@2: /** williamr@2: * Sets word wrapping on or off. williamr@2: * williamr@2: * @param aWrapIsOn @c ETrue enables word wrapping, @c EFalse disables williamr@2: * word wrapping. williamr@2: */ williamr@2: IMPORT_C void SetWordWrapL(TBool aWrapIsOn); williamr@2: williamr@2: /** williamr@2: * Gets the width of a line cursor in pixels. williamr@2: * williamr@2: * @return Always 0. williamr@2: */ williamr@2: IMPORT_C virtual TInt LineCursorWidth() const; williamr@2: williamr@2: /** williamr@2: * Sets the zoom factor of the document and reformats the document. williamr@2: * williamr@2: * @param aZoomFactor New value for the zooming factor. williamr@2: */ williamr@2: IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor); williamr@2: williamr@2: /** williamr@2: * Sets the Edwin’s background colour. williamr@2: * williamr@2: * @param aBackground New value for the background colour. williamr@2: */ williamr@2: IMPORT_C void SetBackgroundColorL(TRgb aBackground); williamr@2: williamr@2: /** williamr@2: * Sets the format mode to be WYSIWYG. williamr@2: * williamr@2: * @param aLayoutWidth Formatting width in twips. williamr@2: * @param aDevice Mapping between twips and pixels on the target device. williamr@2: */ williamr@2: IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth, williamr@2: MGraphicsDeviceMap* aDevice); williamr@2: williamr@2: /** williamr@2: * Switches off the WYSIWYG mode. This function sets the new format mode williamr@2: * to be @c EFScreenMode. williamr@2: */ williamr@2: IMPORT_C void SetWysiwygModeOff(); williamr@2: williamr@2: /** williamr@2: * Updates the text wrap width. This function is for use in WYSIWYG mode williamr@2: * only. williamr@2: * williamr@2: * @param aLayoutWidth New width to wrap text at in WYSIWYG mode in twips. williamr@2: */ williamr@2: IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); williamr@2: williamr@2: /** williamr@2: * Sends the Edwin’s document using an infra red beamer. williamr@2: */ williamr@2: IMPORT_C void SendDataOverIrL(); williamr@2: williamr@2: /** williamr@2: * Receives an Edwin document using an infra red beamer. williamr@2: * This function will leave if the data received is not a suitable type williamr@2: * to be pasted into the Edwin. williamr@2: */ williamr@2: IMPORT_C void ReceiveDataOverIrL(); williamr@2: williamr@2: /** williamr@2: * Controls the formatting mode of the editor. williamr@2: * williamr@2: * The length of the text is compared against current formatting mode thresholds. williamr@2: * (See method SetUpperFullFormattingLength). If the length is greater than the williamr@2: * upper limit of full formatting, then the editor is set to "band" formatting, williamr@2: * where the editor attempts to format as little as is needed, e.g. the visible part williamr@2: * of the editor. If the text length is less than the lower limit of band formatting, williamr@2: * then the formatting mode is switched to full document formatting. williamr@2: * williamr@2: * This method performs an immediate re-formatting of all or part of the text with the new formatting mode. williamr@2: * williamr@2: * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting williamr@2: * If not EFalse, whole document it formatted from scratch williamr@2: * Note: This parameter is ignored if aReFormat is EFalse williamr@2: */ williamr@2: IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse); williamr@2: williamr@2: /** williamr@2: * Controls the formatting mode of the editor. williamr@2: * williamr@2: * The length of the text is compared against the current formatting mode thresholds. williamr@2: * (See method SetUpperFullFormattingLength). If the length is greater than the williamr@2: * upper limit of full formatting, then the editor is set to "band" formatting, williamr@2: * where the editor attempts to format as little as is needed, e.g. the visible part williamr@2: * of the editor. If the text length is less than the lower limit of band formatting, williamr@2: * then the formatting mode is switched to full document formatting. williamr@2: * williamr@2: * This method has a flag to allow any immediate re-formatting to be suppressed. williamr@2: * Formatting text can be a time-consuming operation. If the client is able to williamr@2: * ensure that no reformatting is needed, (for instance if a further re-formatting williamr@2: * API is going to be called later) then the reformatting flag can be called williamr@2: * with EFalse. Otherwise, a re-format will take place within this method. williamr@2: * williamr@2: * @since 3.1 williamr@2: * @param aIsNewDoc If EFalse, attempts to perform re-formatting based upon current formatting williamr@2: * If not EFalse, whole document it formatted from scratch williamr@2: * Note: This parameter is ignored if aReFormat is EFalse williamr@2: * @param aReFormat If EFalse, do not perform any re-formatting williamr@2: */ williamr@2: IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat ); williamr@2: williamr@2: /** williamr@2: * Sets the @c EPasteFromIrStore flag. williamr@2: * williamr@2: * @param aPasteFromIrStore @c ETrue to set the @c EPasteFromIrStore flag. williamr@2: * @c EFalse to remove the @c EPasteFromIrStore flag. williamr@2: */ williamr@2: IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore); williamr@2: williamr@2: /** williamr@2: * Copies the contents of a stream store to the current cursor position, williamr@2: * replacing any selected text. This function is used to paste data from williamr@2: * the clipboard. williamr@2: * williamr@2: * @param[out] aStore Store from which to read. williamr@2: * @param[in] aDict Stream dictionary. williamr@2: */ williamr@2: IMPORT_C void PasteFromStoreL(CStreamStore& aStore, williamr@2: CStreamDictionary& aDict); williamr@2: williamr@2: /** williamr@2: * Copies the highlighted text into a stream store. williamr@2: * williamr@2: * @param[out] aStore Store to write to. williamr@2: * @param[in] aDict Stream dictionary. williamr@2: */ williamr@2: IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict); williamr@2: williamr@2: /** williamr@2: * Sets the text view margins. williamr@2: * williamr@2: * @param aMargins New value for the view’s margins. williamr@2: */ williamr@2: IMPORT_C void SetBorderViewMargins(TMargins8 aMargins); williamr@2: williamr@2: /** williamr@2: * Forces the scrollbars to update now; this is a synchronous function. williamr@2: */ williamr@2: IMPORT_C void ForceScrollBarUpdateL(); williamr@2: williamr@2: /** williamr@2: * Sets whether the Edwin owns a document. Edwins can either be used as a williamr@2: * standalone text editor control, or as an editor for text owned by williamr@2: * another object. The document ownership setting determines whether the williamr@2: * Edwin or another object owns the document. williamr@2: * williamr@2: * @param aOwner Whether Edwin or another object owns the document. williamr@2: * See @c TOwnershipType. williamr@2: */ williamr@2: IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner); williamr@2: williamr@2: /** williamr@2: * Sets the maximum number of characters that can be inserted. williamr@2: * williamr@2: * @param aLimit New maximum for the number of characters that can be williamr@2: * inserted. williamr@2: */ williamr@2: IMPORT_C void SetTextLimit(TInt aLimit); williamr@2: williamr@2: /** williamr@2: * Displays a dialog allowing the user to choose a character from the williamr@2: * character map. The selected character is inserted into the Edwin williamr@2: * at the current cursor position. williamr@2: */ williamr@2: IMPORT_C void RunCharMapDialogL(); williamr@2: williamr@2: /** williamr@2: * Gets the text view margins. williamr@2: * williamr@2: * @return The text view margins. williamr@2: */ williamr@2: IMPORT_C TMargins8 Margins() const; williamr@2: williamr@2: /** williamr@2: * Gets the upper limit for formatting. This returns the value of williamr@2: * @c KFullFormattingUpperThreshold which determines the maximum number of williamr@2: * characters that can be formatted, if it is exceeded then only visible williamr@2: * text is formatted. This is used with @c KPartialFormattingLowerThreshold williamr@2: * to control the extent of text formatting. williamr@2: * williamr@2: * @return The value of @c KFullFormattingUpperThreshold. williamr@2: */ williamr@2: IMPORT_C TInt UpperFullFormattingLength() const; williamr@2: williamr@2: /** williamr@2: * Gets the lower limit for formatting. This returns the value of williamr@2: * @c KPartialFormattingLowerThreshold which determines when a switch is williamr@2: * made from formatting only visible text to formatting all text. When the williamr@2: * text length exceeds the @c KFullFormattingUpperThreshold only visible williamr@2: * text is formatted. If some characters are deleted so that the text williamr@2: * length is less than @c KFullFormattingUpperThreshold the entire text williamr@2: * is still not formatted. Instead, reformatting occurs only when the williamr@2: * number of characters is less than the value of williamr@2: * @c KPartialFormattingLowerThreshold. williamr@2: * williamr@2: * @return The value of @c KPartialFormattingLowerThreshold. williamr@2: */ williamr@2: IMPORT_C TInt LowerPartialFormattingLength() const; williamr@2: williamr@2: /** williamr@2: * Sets the Edwin’s read-only flag so that documents displayed by Edwin williamr@2: * cannot be edited by users. williamr@2: * williamr@2: * @param aReadOnly @c ETrue to set Edwin to display documents as williamr@2: * read-only. @c EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C void SetReadOnly(TBool aReadOnly); williamr@2: williamr@2: /** williamr@2: * Determines whether the document being edited with Edwin is read-only. williamr@2: * williamr@2: * @return @c ETrue if the document being edited is read-only. williamr@2: * @c EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsReadOnly() const; williamr@2: williamr@2: /** williamr@2: * Determines whether the document being edited is read only. Displays williamr@2: * a message with @c CEikonEnv::InfoMsg() if the document is set as williamr@2: * read-only. williamr@2: */ williamr@2: IMPORT_C void CheckNotReadOnlyL(); williamr@2: williamr@2: /** williamr@2: * Sets whether the document accepts pictures. williamr@2: * williamr@2: * @param aAllow @c ETrue sets the document to accept pictures, @c EFalse williamr@2: * sets the document to not accept pictures. williamr@2: */ williamr@2: IMPORT_C void SetAllowPictures(TBool aAllow); williamr@2: williamr@2: /** williamr@2: * Removes unwanted pictures. If @c EAllowPictures has been set, returns williamr@2: * immediately. Otherwise, this function checks the document text between williamr@2: * two bounds and removes all pictures in that range. williamr@2: * williamr@2: * @param aStartPos Where to start looking for unwanted pictures. williamr@2: * @param aLength Where to stop. williamr@2: */ williamr@2: IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength); williamr@2: williamr@2: /** williamr@2: * Sets the minimum gap between text and the right hand edge of the Edwin williamr@2: * when text is wrapped. This value is used to calculate the layout area williamr@2: * for text. williamr@2: * williamr@2: * @param aGap Size of the gutter in pixels. williamr@2: */ williamr@2: IMPORT_C void SetRightWrapGutter(TInt aGap); williamr@2: williamr@2: /** williamr@2: * Undoes the most recent text operation when the Edwin supports this williamr@2: * feature and when the undo store is not empty. williamr@2: */ williamr@2: IMPORT_C void UndoL(); williamr@2: williamr@2: /** williamr@2: * Deletes the undo store. williamr@2: */ williamr@2: IMPORT_C void ClearUndo(); williamr@2: williamr@2: /** williamr@2: * Sets whether the undo operation is permitted. williamr@2: * williamr@2: * @param aAllow ETrue to permit undo operations. EFalse to not permit undo williamr@2: * operations. williamr@2: */ williamr@2: IMPORT_C void SetAllowUndo(TBool aAllow); williamr@2: williamr@2: /** williamr@2: * Gets whether Edwin is set to support the undo command. williamr@2: * williamr@2: * @return @c ETrue if edits can be undone. @c EFalse if edits cannot williamr@2: * be undone. williamr@2: */ williamr@2: IMPORT_C TBool SupportsUndo() const; williamr@2: williamr@2: /** williamr@2: * Tests whether an undo is possible. Returns @c ETrue only if the undo williamr@2: * store is available to Edwin. williamr@2: * williamr@2: * @return @c ETrue if the undo store is available. @c EFalse if the williamr@2: * undo store is not available. williamr@2: */ williamr@2: IMPORT_C TBool CanUndo() const; williamr@2: williamr@2: /** williamr@2: * Sets whether picture characters and/or punctuation should be treated as williamr@2: * word delimiters in addition to whitespace. williamr@2: * williamr@2: * @param aPicture @c ETrue if picture characters should be treated as williamr@2: * delimiters for words. williamr@2: * @param aPunctuation @c ETrue if punctuation should be treated as williamr@2: * delimiters for words. williamr@2: */ williamr@2: IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation); williamr@2: williamr@2: /** williamr@2: * Gets the start position and the length of the word in which the williamr@2: * specified document position is located. williamr@2: * williamr@2: * @param[in] aCurrentPos A position within a word in the text. williamr@2: * @param[out] aStartPos Returns the start position of the word. williamr@2: * @param[out] aLength Returns the word’s length. williamr@2: */ williamr@2: IMPORT_C void GetWordInfo(TInt aCurrentPos, williamr@2: TInt& aStartPos, williamr@2: TInt& aLength) const; williamr@2: williamr@2: /** williamr@2: * Sets the new cursor position. If the cursor is no longer visible the williamr@2: * document is scrolled to display the line containing the new cursor williamr@2: * position. Scrollbars are also updated if present. williamr@2: * williamr@2: * @param aMovement The cursor movement. williamr@2: * @param aSelect If @c ETrue, the selection is extended. This corresponds williamr@2: * to holding down the Shift key on a machine keyboard. williamr@2: */ williamr@2: IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement, williamr@2: TBool aSelect); williamr@2: williamr@2: /** williamr@2: * Scrolls the text either horizontally or vertically without affecting williamr@2: * the cursor’s position. williamr@2: * williamr@2: * @param aMovement The cursor's movement. williamr@2: */ williamr@2: IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement); williamr@2: williamr@2: /** williamr@2: * Removes all non-ASCII characters from the specified text. This can be williamr@2: * used to remove Unicode characters where they are not valid characters williamr@2: * for example. williamr@2: * williamr@2: * @param aStartPos The start position in the text. williamr@2: * @param aLength The number of characters, beginning with aStartPos to williamr@2: * check. williamr@2: */ williamr@2: IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength); williamr@2: williamr@2: /** williamr@2: * Sets the @c EOnlyASCIIChars flag. williamr@2: * williamr@2: * @param aASCIIOnly If @c ETrue the EOnlyASCIIChars flag will be set. If williamr@2: * @c EFalse the EOnlyASCIIChars flag will be removed. williamr@2: */ williamr@2: IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly); williamr@2: williamr@2: /** williamr@2: * Tests whether the @c EOnlyASCIIChars flag is set. williamr@2: * williamr@2: * @return @c ETrue if the @c EOnlyASCIIChars flag is set. williamr@2: */ williamr@2: IMPORT_C TBool OnlyASCIIChars() const; williamr@2: williamr@2: /** williamr@2: * Gets the average number of lines shown in Edwin’s view. williamr@2: * williamr@2: * @return The average number of lines. williamr@2: */ williamr@2: inline TInt AvgLinesInViewRect() const; williamr@2: williamr@2: /** williamr@2: * Gets the average number of characters on a line. williamr@2: * williamr@2: * @return The average number of characters on a line. williamr@2: */ williamr@2: inline TInt AvgCharsPerLine() const; williamr@2: williamr@2: /** williamr@2: * Sets the average number of lines displayed in Edwin’s view. williamr@2: * williamr@2: * @param aAvgLines The average number of lines to display. williamr@2: */ williamr@2: inline void SetAvgLinesInViewRect(TInt aAvgLines); williamr@2: williamr@2: /** williamr@2: * Sets the average number of characters per line. williamr@2: * williamr@2: * @param aAvgChars The average number of characters per line. williamr@2: */ williamr@2: inline void SetAvgCharsPerLine(TInt aAvgChars); williamr@2: williamr@2: /** williamr@2: * Sets the Edwin size observer. Does not imply transfer of ownership. williamr@2: * williamr@2: * @param aEdwinSizeObserver The Edwin size observer. williamr@2: */ williamr@2: IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* williamr@2: aEdwinSizeObserver); williamr@2: williamr@2: /** williamr@2: * Gets the minimum Edwin height. williamr@2: * williamr@2: * @return The minimum Edwin height. williamr@2: */ williamr@2: IMPORT_C TInt MinimumHeight() const; williamr@2: williamr@2: /** williamr@2: * Gets the maximum Edwin height. williamr@2: * williamr@2: * Please do not use the following method for deciding heights if you are williamr@2: * using edwins with Maximum Heights in forms. Use @c MaximumHeightInLines williamr@2: * instead. williamr@2: * williamr@2: * @return The maximum Edwin height. williamr@2: */ williamr@2: IMPORT_C TInt MaximumHeight() const; williamr@2: williamr@2: /** williamr@2: * Sets the minimum Edwin height. This function also increases the maximum williamr@2: * Edwin height if its value is less than @c aHeight. williamr@2: */ williamr@2: IMPORT_C void SetMinimumHeight(TInt aHeight); williamr@2: williamr@2: /** williamr@2: * Sets the maximum Edwin height. This function also decreases the minimum williamr@2: * Edwin height if its value is greater than @c aHeight. williamr@2: * williamr@2: * Please do not use the following method for setting maximum heights if williamr@2: * you are using edwins with maximum heights in forms. Use williamr@2: * @c MaximumHeightInLines instead. williamr@2: * williamr@2: * @param aHeight The maximum Edwin height. williamr@2: */ williamr@2: IMPORT_C void SetMaximumHeight(TInt aHeight); williamr@2: williamr@2: public: // new utility methods williamr@2: williamr@2: /** williamr@2: * Replaces the cursor selection with the identified text. williamr@2: * williamr@2: * @param aInsertPos The position at which text will be inserted. williamr@2: * @param aText The text to insert. williamr@2: * @param aDelete The cursor-selected text that will be replaced by @c williamr@2: * aText. williamr@2: */ williamr@2: IMPORT_C void InsertDeleteCharsL(TInt aInsertPos, williamr@2: const TDesC& aText, williamr@2: const TCursorSelection& aDelete); williamr@2: williamr@2: /** williamr@2: * Sets non-printing characters?visibility. williamr@2: * williamr@2: * @param aVisibility Non-printing characters?visibility. williamr@2: */ williamr@2: IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility williamr@2: aVisibility); williamr@2: williamr@2: /** williamr@2: * Sets non-printing characters?visibility. williamr@2: * williamr@2: * @return Non-printing characters?visibility. williamr@2: */ williamr@2: IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const; williamr@2: williamr@2: public: // new Avkon wrap interface williamr@2: williamr@2: /** williamr@2: * Sets the @c EAvkonEditor flag. williamr@2: * williamr@2: * @param aAvkonWrapIsOn If @c ETrue @c EAvkonEditor flag is set. williamr@2: */ williamr@2: IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn); williamr@2: williamr@2: public: // Avkon editor extensions williamr@2: williamr@2: /** williamr@2: * Sets default case for the editor. The case is used when the editor williamr@2: * is focused first time. Available case flags from @c uikon.hrh williamr@2: * are @c EAknEditorUpperCase, @c EAknEditorLowerCase and williamr@2: * @c EAknEditorTextCase. @c EAknEditorTextCase is used if the initial williamr@2: * case is not set from EDWIN resource default_case or with this API. williamr@2: * williamr@2: * @param aCase Initial case to be used in the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorCase(TInt aCase); williamr@2: williamr@2: /** williamr@2: * Sets permitted cases for the editor. williamr@2: * Possible flags from @c uikon.hrh are @c EAknEditorAllCaseModes, williamr@2: * @c EAknEditorUpperCase, @c EAknEditorLowerCase and williamr@2: * @c EAknEditorTextCase. @c EAknEditorAllCaseModes is used if the value williamr@2: * is not set from EDWIN resource allowed_case_modes or with this API. williamr@2: * williamr@2: * @param aPermittedCaseModes Case modes that are available in the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes); williamr@2: williamr@2: /** williamr@2: * Sets number mode key mapping for '*' and '#' keys. The key mapping is williamr@2: * used in editors when numeric input mode is used. Key mapping characters williamr@2: * for '*' key are shown on special character table if also text input williamr@2: * modes are allowed in the editor but the current input mode is numeric williamr@2: * mode. @c EAknEditorStandardNumberModeKeymap is used in editors that williamr@2: * allow only numeric input if the mapping is not set from EDWIN resource williamr@2: * @c numeric_keymap or with this API. williamr@2: * @c EAknEditorAlphanumericNumberModeKeymap is used as default if the williamr@2: * editor allows also text input mode. williamr@2: * williamr@2: * @param aNumericKeymap Key mapping used in an editor with number input williamr@2: * mode. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap williamr@2: aNumericKeymap); williamr@2: williamr@2: /** williamr@2: * Sets default input mode for the editor. The input mode is used when williamr@2: * the editor is focused first time. williamr@2: * @c EAknEditorTextInputMode is used if the initial input mode is not set williamr@2: * from EDWIN resource default_input_mode or with this API. williamr@2: * williamr@2: * @param aInputMode Initial input mode to be used in the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorInputMode(TInt aInputMode); williamr@2: williamr@2: /** williamr@2: * Sets allowed input modes for the editor. williamr@2: * All input modes are allowed (@c EAknEditorAllInputModes) if the value williamr@2: * is not set from EDWIN resource @c allowed_input_modes or with this API. williamr@2: * williamr@2: * @param aInputModes Input modes that are allowed in the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes); williamr@2: williamr@2: /** williamr@2: * Sets editor specific special character table. williamr@2: * williamr@2: * @param aSCTResId Special character table dialog resource. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId); williamr@2: williamr@2: /** williamr@2: * Sets initial editor flags for the editor. williamr@2: * This method can be used also to update editor flags after the editor is williamr@2: * focused. FEP is automatically notified of the updated editor flags. williamr@2: * williamr@2: * @param aFlags Avkon editor flags for the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorFlags(TInt aFlags); williamr@2: williamr@2: /** williamr@2: * Enables or disables CCPU interface provided functionalities williamr@2: * (cut, copy, paste and undo). williamr@2: * williamr@2: * @param aSupport CCPU support enabled if @c ETrue. williamr@2: */ williamr@2: IMPORT_C void EnableCcpuSupportL(TBool aSupport); williamr@2: williamr@2: /** williamr@2: * Updates editor input mode. FEP is automatically notified of the williamr@2: * new input mode in editor state and FEP takes new input mode to use williamr@2: * immediatelly. Current inline editing is reset. williamr@2: * This method should not be used for setting initial input mode for the williamr@2: * editor. Use @c SetAknEditorInputMode() method instead for setting williamr@2: * initial input mode. williamr@2: * williamr@2: * @param aInputMode New input mode for the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode); williamr@2: williamr@2: /** williamr@2: * Returns the input mode that has been saved to editor state. williamr@2: * williamr@2: * @since S60 2.6 williamr@2: * @return Input Mode that is saved to editor state. williamr@2: */ williamr@2: IMPORT_C TInt AknEditorCurrentInputMode(); williamr@2: williamr@2: /** williamr@2: * Updates editor case. FEP is automatically notified of the williamr@2: * case change in editor state and FEP takes new case to use immediately. williamr@2: * Available case flags from @c uikon.hrh are @c EAknEditorUpperCase, williamr@2: * @c EAknEditorLowerCase and @c EAknEditorTextCase. williamr@2: * This method should not be used to set initial case for the editor. williamr@2: * Use @c SetAknEditorCase() method instead for setting initial case. williamr@2: * williamr@2: * @param aCase New case for the editor. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorCurrentCase(TInt aCase); williamr@2: williamr@2: /** williamr@2: * Sets new local input language for the editor. Global input language williamr@2: * changes have not effect for the input language but the user can still williamr@2: * change the input language from the edit menu. williamr@2: * williamr@2: * @param aLanguage Editor local input language. williamr@2: */ williamr@2: IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage); williamr@2: williamr@2: /** williamr@2: * This call causes FEP to reset current editing state and williamr@2: * new editing state is fetched from @c CAknEdwinState object. williamr@2: */ williamr@2: IMPORT_C void NotifyEditorStateObserverOfStateChangeL(); williamr@2: williamr@2: /** williamr@2: * Used for suppressing all editor's background drawing. This is williamr@2: * intended for internal use. williamr@2: * williamr@2: * Note that when this is set, the background is not drawn with skin williamr@2: * nor cleared, so the background MUST be drawn by the parent control williamr@2: * every time the editor changes. williamr@2: * williamr@2: * @param aSuppress If ETrue, suppress background drawing williamr@2: */ williamr@2: IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress ); williamr@2: williamr@2: /** williamr@2: * Tests if the background drawing is suppressed. williamr@2: * williamr@2: * @return ETrue if the background drawing is suppressed williamr@2: */ williamr@2: IMPORT_C TBool IsBackgroundDrawingSuppressed() const; williamr@2: williamr@2: /** williamr@2: * Used to prevent partial text lines from being drawn. williamr@2: * The client is responsible for giving a sane value. An empty williamr@2: * rect disables this feature. This is intended for internal use. williamr@2: * williamr@2: * @param aRect The rect which contains text lines to be drawn williamr@2: */ williamr@2: IMPORT_C void SetTextLinesRect( const TRect& aRect ); williamr@2: williamr@2: /** williamr@2: * Used to determine which area is used for scrolling williamr@2: */ williamr@2: IMPORT_C void SetScrollRect( const TRect & aRect ); williamr@2: williamr@2: /** williamr@2: * Gets the rectangle set for drawing only full lines. In case williamr@2: * the feature is disabled, this returns an empty rect. williamr@2: * This is intended for internal use. williamr@2: * williamr@2: * @return The rect which contains text lines to be drawn williamr@2: */ williamr@2: IMPORT_C TRect GetTextLinesRect() const; williamr@2: williamr@2: /** williamr@2: * Used to control cursor visibility williamr@2: */ williamr@2: IMPORT_C void SetCursorVisible(TBool aVisible); williamr@2: public: williamr@2: williamr@2: // These methods have been added for use with Avkon to set maximum williamr@2: // editor heights. williamr@2: /** williamr@2: * Sets editor's maximum height in lines. williamr@2: * williamr@2: * @param aLines Maximum height in lines. williamr@2: */ williamr@2: IMPORT_C void SetMaximumHeightInLines(TInt aLines); williamr@2: williamr@2: /** williamr@2: * Gets editor maximum height in lines. williamr@2: * williamr@2: * @return Maximum height in lines. williamr@2: */ williamr@2: IMPORT_C TInt MaximumHeightInLines() const; williamr@2: williamr@2: public: // From MEikCcpuEditor williamr@2: williamr@2: /** williamr@2: * Tests whether the editor is focused. williamr@2: * williamr@2: * @return If editor is focused, @c ETrue is returned. williamr@2: */ williamr@2: IMPORT_C TBool CcpuIsFocused() const; williamr@2: williamr@2: /** williamr@2: * Tests whether the selected text can be cut. williamr@2: * williamr@2: * @return @c ETrue if it is possible to cut the selected text. williamr@2: */ williamr@2: IMPORT_C TBool CcpuCanCut() const; williamr@2: williamr@2: /** williamr@2: * Cuts selected text. williamr@2: */ williamr@2: IMPORT_C void CcpuCutL(); williamr@2: williamr@2: /** williamr@2: * Tests whether the selected text can be copied. williamr@2: * williamr@2: * @return @c ETrue if it is possible to copy the selected text. williamr@2: */ williamr@2: IMPORT_C TBool CcpuCanCopy() const; williamr@2: williamr@2: /** williamr@2: * Copies selected text. williamr@2: */ williamr@2: IMPORT_C void CcpuCopyL(); williamr@2: williamr@2: /** williamr@2: * Tests whether text can be pasted from the clipboard. williamr@2: * williamr@2: * @return @c ETrue if it is possible to paste the clipboard text. williamr@2: */ williamr@2: IMPORT_C TBool CcpuCanPaste() const; williamr@2: williamr@2: /** williamr@2: * Pastes text from the clipboard to the editor. williamr@2: */ williamr@2: IMPORT_C void CcpuPasteL(); williamr@2: williamr@2: /** williamr@2: * Tests is it possible to undo previous operation. williamr@2: * williamr@2: * @return @c ETrue if it is possible to undo previous operation. williamr@2: */ williamr@2: IMPORT_C TBool CcpuCanUndo() const; williamr@2: williamr@2: /** williamr@2: * Undoes the most recent text operation when the Edwin supports this williamr@2: * feature and when the undo store is not empty williamr@2: */ williamr@2: IMPORT_C void CcpuUndoL(); williamr@2: williamr@2: /** williamr@2: * Gets edwin's flags from @c CAknEdwinState. williamr@2: * williamr@2: * @return The control's flags. williamr@2: */ williamr@2: IMPORT_C TInt AknEdwinFlags() const; williamr@2: williamr@2: williamr@2: public: // Internal to Symbian williamr@2: williamr@2: // the following methods are deprecated and will be removed in a future williamr@2: // release williamr@2: /** williamr@2: * Allocates memory for the Edwin text view. williamr@2: */ williamr@2: IMPORT_C void CreateTextViewL(); williamr@2: williamr@2: /** williamr@2: * Gets Edwin text view. williamr@2: * williamr@2: * @return Pointer to the Edwin text view. williamr@2: */ williamr@2: IMPORT_C CTextView* TextView() const; williamr@2: williamr@2: /** williamr@2: * Gets Edwins text layout. williamr@2: * williamr@2: * @return Pointer to the text layout. williamr@2: */ williamr@2: IMPORT_C CTextLayout* TextLayout() const; williamr@2: williamr@2: /** williamr@2: * Sets undo buffer for the Edwin. williamr@2: * williamr@2: * @param aSelection The current selection. williamr@2: * @return @c ETrue if buffer was set. williamr@2: */ williamr@2: IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection); williamr@2: williamr@2: /** williamr@2: * Sets new undoable text to the undo buffer. williamr@2: * williamr@2: * @param aSelection The current selection. williamr@2: */ williamr@2: IMPORT_C void SetUndoableText(const TCursorSelection& aSelection); williamr@2: williamr@2: /** williamr@2: * Gets the editor state. williamr@2: * williamr@2: * @return Pointer to editor state object. williamr@2: */ williamr@2: CAknEdwinState* EditorState() const; williamr@2: williamr@2: /** williamr@2: * Sets maximum length for the editor. williamr@2: * williamr@2: * @param aLength Maximum length for the editor. williamr@2: */ williamr@2: inline void SetMaxLength(TInt aLength); williamr@2: williamr@2: /** williamr@2: * Gets the editor maximum length. williamr@2: * williamr@2: * @return The editor maximum length williamr@2: */ williamr@2: inline TInt MaxLength() const; williamr@2: williamr@2: public: williamr@2: williamr@2: // added to get access to user flags without a get/set for every different williamr@2: // flag. williamr@2: /** williamr@2: * Adds user flags. williamr@2: * See @c TFlags. williamr@2: * williamr@2: * @param aFlag Flags to add. williamr@2: */ williamr@2: IMPORT_C void AddFlagToUserFlags(TUint32 aFlag); williamr@2: williamr@2: /** williamr@2: * Removes user flags. williamr@2: * See @c TFlags. williamr@2: * williamr@2: * @param aFlag Flags to remove. williamr@2: */ williamr@2: IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag); williamr@2: williamr@2: /** williamr@2: * Gets user flags. williamr@2: * See @c TFlags. williamr@2: * williamr@2: * @return The user flags. williamr@2: */ williamr@2: IMPORT_C TUint32 UserFlags() const ; williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Sets the character format layer for the editor. Ownership of the williamr@2: * CCharFormatLayer is transferred. williamr@2: * williamr@2: * @param aCharFormatLayer Pointer to the character format layer object. williamr@2: */ williamr@2: IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer); williamr@2: williamr@2: /** williamr@2: * Sets the paragraph format layer for the editor. Ownership of the williamr@2: * CParaFormatLayer is transferred. williamr@2: * williamr@2: * @param aParaFormatLayer Pointer to the paragraph format layer object. williamr@2: */ williamr@2: IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer); williamr@2: williamr@2: williamr@2: public: // Skins support williamr@2: williamr@2: /** williamr@2: * Sets within in the editor an externally owned Skins background control williamr@2: * context. This background control context will then be used by the editor williamr@2: * to draw background. williamr@2: * williamr@2: * If this API is not called, then the editor IS skin enabled, (that is williamr@2: * @c CEikEdwins are skin enabled by default) but it will try to find a williamr@2: * control context with which to perform background drawing from the williamr@2: * Control Environment, via the Object Provider. williamr@2: * williamr@2: * Setting this control context to NULL will have the effect of turning off williamr@2: * background skinning. williamr@2: * williamr@2: * @param aContext Control context to store. Not owned. Can be NULL. williamr@2: */ williamr@2: IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* williamr@2: aContext ); williamr@2: williamr@2: /** williamr@2: * Access to Skins background control context that is potentially being williamr@2: * used by the Editor. williamr@2: * williamr@2: * This API will first check to see if an control context has been set by williamr@2: * API, and if so, return that. If the background control context has been williamr@2: * set to NULL by API, then it will return NULL. If the background control williamr@2: * context has never been set by API, then this returns the control context williamr@2: * (if one exists) that the object obtains from Object Provider. williamr@2: * williamr@2: * @return Pointer to control context potentially in williamr@2: * use, or NULL. williamr@2: */ williamr@2: MAknsControlContext* SkinBackgroundControlContext() const; williamr@2: williamr@2: /** williamr@2: * Access to disposition of the editor to perform Skinning. This does not williamr@2: * take into account whether the application is skin enabled or whether the williamr@2: * environment is providing a background control context. It is only a williamr@2: * function of whether editor's (default) disposition to skin has been williamr@2: * countered by calls on the editor API. williamr@2: * williamr@2: * @return @c EFalse if SetSkinBackgroundControlContextL has been williamr@2: * called with NULL in its most recent call. williamr@2: */ williamr@2: TBool SkinEnabled() const; williamr@2: williamr@2: /** williamr@2: * Stores the alignment value for an editor. williamr@2: * williamr@2: * @param aAlignment Editor alignment to be stored - must be supplied as williamr@2: * one of the values in Avkon editor alignment enum i.e.: williamr@2: * EAknEditorAlignCenter, williamr@2: * EAknEditorAlignLeft, williamr@2: * EAknEditorAlignRight, williamr@2: * EAknEditorAlignBidi williamr@2: */ williamr@2: IMPORT_C void SetAlignment(TInt aAlignment); williamr@2: williamr@2: public: // Pictograph support williamr@2: williamr@2: /** williamr@2: * Redraws text view. Used for pictograph animations. williamr@2: */ williamr@2: void DrawTextView() const; williamr@2: williamr@2: /** williamr@2: * Sets the callback, which the editor calls after having redrawn itself williamr@2: * for animated pictographs. @c CEikCaptionedControl uses it to draw the williamr@2: * highlight frame on top of the editor. williamr@2: * williamr@2: * @since S60 2.6 williamr@2: * @param aCallBack The callback. williamr@2: */ williamr@2: IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack ); williamr@2: williamr@2: /** williamr@2: * Returns pictograph animation callback. If it is not set, the function williamr@2: * pointer is NULL. williamr@2: * williamr@2: * @return Pictograph animation callback williamr@2: */ williamr@2: const TCallBack& PictographAnimationCallBack() const; williamr@2: williamr@2: /** williamr@2: * This method sets the upper limit of full document formatting. williamr@2: * williamr@2: * At construction, the mode is full document formatting, where the text williamr@2: * formatter processes the whole document to determine its layout. williamr@2: * williamr@2: * When the text content is set, or when user input causes the length of williamr@2: * text to exceed this value, the formatting mode switches to "Band" williamr@2: * formatting, where the text formatter attempts to format as little as williamr@2: * possible - optimally just the visible screen. williamr@2: * williamr@2: * A lower limit is calculated from the passed-in value, by the subtraction williamr@2: * of a constant. When the text becomes smaller than this lower limit, the williamr@2: * formatting switches to full document formatting. williamr@2: * williamr@2: * Internally-imposed limits prevent the client setting too small a value williamr@2: * for proper operation of the text formatting. williamr@2: * williamr@2: * If this method is not called, the upper and lower limts are set to a williamr@2: * large default values. williamr@2: * williamr@2: * Access to the actual limits is available via the methods williamr@2: * @c UpperFullFormattingLength() and @c LowerPartialFormattingLength(). williamr@2: * williamr@2: * @since 3.0 williamr@2: * @param aUpperFullFormattingLimit The upper limit of full document williamr@2: * formatting. williamr@2: */ williamr@2: IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit ); williamr@2: williamr@2: /** williamr@2: * Can be called to inhibit redrawing of the editor when NotifyNewFormatL() williamr@2: * is called. williamr@2: * williamr@2: * @param aEnabled If ETrue, inhibit redrawing when notified of williamr@2: * new format from now on. williamr@2: */ williamr@2: IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled ); williamr@2: williamr@2: /** williamr@2: * Can be called to inhibit formatting of the editor. Care is required to ensure that williamr@2: * the necessary reformatting is carried out later on if this API is used. williamr@2: * williamr@2: * Note: When called with EFalse, it does not automatically trigger reformatting. williamr@2: * williamr@2: * @since 3.1 williamr@2: * @param aSuppressed If ETrue, inhibit formatting from now on, if EFalse, williamr@2: * re-enable formatting from now on. williamr@2: */ williamr@2: IMPORT_C void SetSuppressFormatting( TBool aSuppressed ); williamr@2: williamr@2: #ifdef FF_AVKON_EMOTION_ICON_ENABLED williamr@2: public: williamr@2: void EnableSmileySupportL( TBool aEnableSmiley ); williamr@2: TBool IsSmileyEnabled() const; williamr@2: void DrawSmileyInTextL( CBitmapContext& aGc, CFont& aFont, williamr@2: const TDesC& aText, TPoint& aPt ); williamr@2: void ConvertVisibleTextForSmileyL( TBool aTextToCode ); williamr@2: void HandleScrollForSmileyL(); williamr@2: TBool AdjustCursorForSmileyL( TInt aOldCursor, TCursorSelection& aSelect ); williamr@2: williamr@2: private: williamr@2: void ConvertTextForSmileyL( TCursorSelection aSelect, williamr@2: TBool aTextToCode, TBool aRedraw = ETrue ); williamr@2: void TrimText( TDes& aText ); williamr@2: TCursorSelection GetVisibleTextRangeL(); williamr@2: HBufC* ExtractTextLC( TCursorSelection aSelect ); williamr@2: void ExtendedRangeForSmiley( TCursorSelection& aSelect ); williamr@2: void ConvertSmileyForDeleteL( TInt aDocPos, TBool aBackSpace ); williamr@2: void ConvertSmileyForDeleteL( const TCursorSelection &aSelect ); williamr@2: #endif williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Specifies the end points of the editable area. williamr@2: */ williamr@2: enum TEnd williamr@2: { williamr@2: /** The start of the editable area. */ williamr@2: EStart, williamr@2: williamr@2: /** The end of the editable area. */ williamr@2: EEnd williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Specifies the chunk size as either a word, or a paragraph. williamr@2: */ williamr@2: enum TChunkSize williamr@2: { williamr@2: /** A word. */ williamr@2: EChunkWord, williamr@2: williamr@2: /** A paragraph. */ williamr@2: EChunkPara williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Specifies the chunk size as either a word, or a paragraph. williamr@2: */ williamr@2: enum TEikEdwinFlags // Internal flags williamr@2: { williamr@2: /** Rich text editor used. */ williamr@2: ERichText =0x00000001, williamr@2: williamr@2: /** For double item dragging. */ williamr@2: EDragDouble =0x00000002, williamr@2: williamr@2: /** williamr@2: * If set, indicates the pointer being pressed inside the williamr@2: * editor rectangle. williamr@2: */ williamr@2: ELeftDownInViewRect =0x00000004, williamr@2: williamr@2: /** Used to calculate initial width. */ williamr@2: ENumericCharacters =0x00000008, williamr@2: williamr@2: /** Edwin has one line and is not resizable. */ williamr@2: EHasOneLineOnly =0x00000010, williamr@2: williamr@2: /** williamr@2: * Custom formatter is installed to find and format phone numbers williamr@2: * (@c CEikRichTextEditor only). williamr@2: */ williamr@2: EPhoneNumberGrouping = 0x00000020, williamr@2: ESuppressNotifyDraw = 0x00000040, williamr@2: ESuppressFormatting = 0x00000080 // Suppresses calls to formatting williamr@2: }; williamr@2: williamr@2: protected: // from MEditObserver williamr@2: williamr@2: /** williamr@2: * From @c MEditObserver. williamr@2: * williamr@2: * Observer function called by the @c CRichText object when the object is williamr@2: * edited to give notification of changes to its text buffer. In this way, williamr@2: * the control knows how the text object has changed and can reformat and williamr@2: * redraw the text object appropriately. williamr@2: * williamr@2: * @param aStartEdit The start position of the edit. williamr@2: * @param aEditLength The number of characters added or, if negative, williamr@2: * deleted after this position. williamr@2: */ williamr@2: IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Draws the visible text and the cursor for DrawL(), but does not draw williamr@2: * the border. The @c DrawL() function is trapped to handle problems due williamr@2: * to insufficient resources being available. williamr@2: * williamr@2: * @param aRect Rectangle in which to draw. williamr@2: */ williamr@2: IMPORT_C void TrappedDraw(const TRect& aRect) const; williamr@2: williamr@2: /** williamr@2: * Draws the visible text and the cursor. williamr@2: */ williamr@2: IMPORT_C void DrawContents(); williamr@2: williamr@2: /** williamr@2: * Completes the second-phase construction of a @c CEikEdwin object. This williamr@2: * protected function is called by @c ConstructL() and williamr@2: * @c ConstructFromResourceL() after the Edwin’s size, flags and text williamr@2: * limit have been set. Derived classes should call either this function williamr@2: * or @c CEikEdwin’s @c ConstructL() or @c ConstructFromResourceL() williamr@2: * functions during their construction before initialising their own williamr@2: * members. williamr@2: */ williamr@2: IMPORT_C void BaseConstructL(); williamr@2: williamr@2: /** williamr@2: * Formats all the text in the text view. Called by several functions, for williamr@2: * example by @c CEikEdwin::HandleTextChangedL() and williamr@2: * @c CEikEdwin::SetTextL(). williamr@2: */ williamr@2: IMPORT_C void FormatTextL(); williamr@2: williamr@2: /** williamr@2: * Deletes the text under the cursor selection, also cancelling the williamr@2: * selection. This function asks the user to confirm this action if williamr@2: * aPromptConfirmation is ETrue. williamr@2: * williamr@2: * @param[out] aChanged On return, @c ETrue if the text was changed. williamr@2: * @param[in] aIsBackSpace ETrue if this is in response to backspace being williamr@2: * pressed. Determines whether character formatting is preserved williamr@2: * or not. Default value is @c EFalse. williamr@2: * @param[in] aPromptConfirmation Optional. @c ETrue to ask the user to williamr@2: * confirm this action. Default value is @c ETrue. williamr@2: * @return The cursor position in the text after deletion. williamr@2: */ williamr@2: IMPORT_C TInt DeleteHighlightL(TBool& aChanged, williamr@2: TBool aIsBackSpace=EFalse, williamr@2: TBool aPromptConfirmation=ETrue); williamr@2: williamr@2: /** williamr@2: * Confirms whether the deletion of the user’s selection is required. williamr@2: * williamr@2: * If the user’s selection is less than @c KBlockDeleteWarningSize and does williamr@2: * not contain a picture, this function returns @c ETrue. williamr@2: * williamr@2: * If the user’s selection is greater than @c KBlockDeleteWarningSize or williamr@2: * contains a picture, this function asks the user to confirm deletion of williamr@2: * their selection and then returns the user’s response. williamr@2: * williamr@2: * @return @c ETrue. williamr@2: */ williamr@2: IMPORT_C TBool OkToDeleteSelectionL(); williamr@2: williamr@2: /** williamr@2: * Deletes the cursor’s selection. If no selection is made, this function williamr@2: * deletes only one character. The argument @c aIsBackSpace determines williamr@2: * whether to preserve the character formatting or not. williamr@2: * williamr@2: * @param[out] aChanged On return, @c ETrue if the text was changed. williamr@2: * @param[in] aSelection The cursor selection describing the position to be williamr@2: * deleted. williamr@2: * @param[in] aIsBackSpace @c ETrue if this in response to backspace being williamr@2: * pressed. Determines whether character formatting is preserved williamr@2: * or not. williamr@2: * @param[in] aAllowUndo @c ETrue if the user is permitted to undo this williamr@2: * change. williamr@2: */ williamr@2: IMPORT_C void DeleteL(TBool& aChanged, williamr@2: const TCursorSelection& aSelection, williamr@2: TBool aIsBackSpace=EFalse, williamr@2: TBool aAllowUndo=ETrue); williamr@2: williamr@2: /** williamr@2: * Handles errors that occur when handling a change in Edwin’s size. Calls williamr@2: * @c CEikonEnv::NotifyIdleErrorWhileRedrawing(). williamr@2: */ williamr@2: IMPORT_C void TrappedSizeChanged(); williamr@2: williamr@2: /** williamr@2: * Handles a change in Edwin’s size. This function accounts for text wrap williamr@2: * settings and whether the Edwin is ready to be redrawn and also calls williamr@2: * functions to reformat text and to update the Edwin’s scroll bars. williamr@2: */ williamr@2: IMPORT_C void HandleSizeChangedL(); williamr@2: williamr@2: /** williamr@2: * Cancels the selection and any FEP composition text. This function then williamr@2: * repositions the cursor at the specified end of the currently selected williamr@2: * text. williamr@2: * williamr@2: * @param aEndOfSelectionToLeaveCursor The end of the current selection at williamr@2: * which the cursor is repositioned. williamr@2: */ williamr@2: IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor); williamr@2: williamr@2: /** williamr@2: * Moves the cursor to the beginning of the next word or paragraph. This williamr@2: * function cancels any front end processing transaction currently in williamr@2: * progress for the Edwin. williamr@2: * williamr@2: * @param aSelect If @c ETrue the chunk is selected, otherwise @c EFalse. williamr@2: * @param aChunkSize The chunk size, this can be either a word or a williamr@2: * paragraph. See @c TChunkSize enum. williamr@2: * @param aEndScanningTowards Which direction to scan towards, the start williamr@2: * or the end of the document. williamr@2: */ williamr@2: IMPORT_C void MoveCursorToChunkStartL(TBool aSelect, williamr@2: TChunkSize aChunkSize, williamr@2: TEnd aEndScanningTowards); williamr@2: williamr@2: /** williamr@2: * Cancels the insertion of a character format. This can be used for rich williamr@2: * text only. williamr@2: */ williamr@2: IMPORT_C void CancelInsertCharFormat(); williamr@2: williamr@2: /** williamr@2: * Copies the contents of the cursor selection onto the clipboard. williamr@2: */ williamr@2: IMPORT_C void PlaceDataOnClipboardL(); williamr@2: williamr@2: /** williamr@2: * Reports an Edwin event of the specified type. The Edwin event is passed williamr@2: * first to the Edwin observer and then to the list of observers, even if williamr@2: * the first Edwin observer is not set. If the Edwin has a custom drawer, williamr@2: * and the event is of type @c EEventFormatChanged, the event is passed to williamr@2: * the custom drawer. If the Edwin has an observer the event is passed to williamr@2: * that observer. If no observer is set for the Edwin, this function passes williamr@2: * the event to each observer in the observer list. williamr@2: * williamr@2: * @param aEventType The type of event to report. williamr@2: */ williamr@2: IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType); williamr@2: williamr@2: /** williamr@2: * Sets margin widths and line cursor width. williamr@2: */ williamr@2: IMPORT_C void SetLineCursorDetailsL(); williamr@2: williamr@2: /** williamr@2: * Replaces the current Edwin text. williamr@2: * williamr@2: * @param aInText Text with which the current text is replaced. williamr@2: * @param aOutText On return, the replaced text. williamr@2: */ williamr@2: IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText, williamr@2: CGlobalText& aOutText); williamr@2: williamr@2: /** williamr@2: * Displays an information message to indicate that the specified text williamr@2: * could not be found. The information message is constructed from williamr@2: * @c R_EIK_TBUF_CANNOT_FIND_TEXT. williamr@2: * williamr@2: * @param aFindText The text that could not be found. williamr@2: */ williamr@2: IMPORT_C void DisplayFindTextNotFound(TDes& aFindText); williamr@2: williamr@2: /** williamr@2: * Not implemented. williamr@2: * williamr@2: * @param aStartPos Not used. williamr@2: * @param aLength Not used. williamr@2: */ williamr@2: IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength); williamr@2: williamr@2: /** williamr@2: * Creates a new @c CLafEdwinCustomDrawBase instance. williamr@2: * williamr@2: * @return Pointer to new custom @c CLafEdwinCustomDrawBase object. williamr@2: */ williamr@2: IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL(); williamr@2: williamr@2: // Avkon editor extensions williamr@2: /** williamr@2: * Used in @c ConstructFromResourceL(). Sets Avkon editor properties. williamr@2: * williamr@2: * @param aReader A reader positioned for reading from an EDWIN resource. williamr@2: */ williamr@2: IMPORT_C void ReadAknResourceL(TResourceReader& aReader); williamr@2: williamr@2: protected: // Internal to Symbian williamr@2: williamr@2: /** williamr@2: * Creates new text layout. williamr@2: * williamr@2: * @param aLayDoc Pointer to the @c MLayDoc implementation that is the williamr@2: * source of the text and formatting information. williamr@2: */ williamr@2: IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc); williamr@2: williamr@2: /** williamr@2: * Creates new instance of @c CGlobalText and text layout based on it. williamr@2: * williamr@2: * @param aParaFormatLayer Paragraph format layer pointer for williamr@2: * @c CGlobalText constructor. williamr@2: * @param aCharFormatLayer Character format layer pointer for williamr@2: * @c CGlobalText constructor. williamr@2: */ williamr@2: IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer, williamr@2: CCharFormatLayer* aCharFormatLayer); williamr@2: williamr@2: /** williamr@2: * Checks that is Edwin's extension created. If not, it will be created. williamr@2: * williamr@2: * @leave KErrNoMemory If the Edwin FEP support pointer is NULL. williamr@2: */ williamr@2: IMPORT_C void CheckEdwinExtensionL(); williamr@2: williamr@2: /** williamr@2: * Gets Edwin's extension. williamr@2: * williamr@2: * @return Pointer to Edwin's extension. williamr@2: */ williamr@2: IMPORT_C CEikEdwinExtension* EdwinExtension(); williamr@2: williamr@2: private: williamr@2: williamr@2: enum williamr@2: { // internal flags williamr@2: EWysiwygOn =0x00000010, williamr@2: EUnderOneScreenFormattedText =0x00000020, williamr@2: EPictureDelimits =0x00000040, williamr@2: EPunctuationDelimits =0x00000080, williamr@2: EPasteFromIrStore =0x00000100, williamr@2: ELockScrollBarState =0x00000200, williamr@2: EOnReformatting =0x00000400 williamr@2: }; williamr@2: williamr@2: private: // from CCoeControl williamr@2: williamr@2: IMPORT_C void SizeChanged(); williamr@2: IMPORT_C TInt CountComponentControls() const; williamr@2: IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; williamr@2: IMPORT_C void Reserved_2(); williamr@2: williamr@2: private: williamr@2: williamr@2: IMPORT_C virtual void Reserved_3(); williamr@2: IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL(); williamr@2: IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc); williamr@2: void SetVirtualCursorStateL(TBool aIsFocused) const; williamr@2: void SetHeightForNumOfLinesL(); williamr@2: void ApplyAutoSelectionL(); williamr@2: void SetScrollBarsL(); williamr@2: void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const; williamr@2: void RetrieveDataFromClipboardL(); williamr@2: void SetCursorVisibilityL(TBool aEmphasis); williamr@2: TBool OwnsScrollBars() const; williamr@2: void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const; williamr@2: void UpdateHorizScrollBarThumb(); williamr@2: void UpdateVertScrollBarThumbL(); williamr@2: void DoSetUndoBufferL(const TCursorSelection& aSelection); williamr@2: void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict); williamr@2: void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced); williamr@2: void DeleteExtraParasL(TInt aStartPos,TInt aLength); williamr@2: TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength); williamr@2: TBool IsValidChar(TInt aChar) const; williamr@2: TInt CalcMinimumHeightFromNumOfLinesL() const; williamr@2: void CheckEdwinHeight(); williamr@2: TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const; williamr@2: void SetEdwinHeight(TInt aHeight); williamr@2: void DoCreateCustomDrawL(); williamr@2: void SetCursorSizeAndType(); williamr@2: TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); williamr@2: void DoCcpuCanPasteL() const; williamr@2: void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent); williamr@2: void CheckIfEdwinIsResizable(); williamr@2: void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const; williamr@2: HBufC* GetAllowedCharsLC() const; williamr@2: TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const; williamr@2: williamr@2: TInt CursorWidth() const; williamr@2: TFontSpec CursorFontSpec() const; williamr@2: williamr@2: void BuildEdwinFepSupport(); williamr@2: void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer); williamr@2: void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer); williamr@2: void UpdateCache(TInt aId); williamr@2: void DrawBackgroundAroundTextView( williamr@2: CWindowGc& gc, williamr@2: const TRect& aOuterRect, williamr@2: const TRect& aInnerRect, williamr@2: const TRgb& aBackgroundColor ) const; williamr@2: TInt CurrentAlignment() const; williamr@2: void DoAlignment(); williamr@2: void NewParagraphL(); williamr@2: TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode); williamr@2: void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength ); williamr@2: TRect AdjustedViewRect() const; williamr@2: void SetVKBStatus(); williamr@2: void ScrollViewToCursorLineL(); williamr@2: void PerformRecordedOperationL(); williamr@2: void ScrollIfAtTopOrBottom(); williamr@2: williamr@2: private: williamr@2: williamr@2: void DrawFirstLineTextL() const; williamr@2: CAknEdwinDrawingModifier* AknEdwinDrawingModifier(); williamr@2: TBool EditorSupportsNeutralProtection() const; williamr@2: williamr@2: /** williamr@2: * Main routine for neutral protection. This routine returns a boolean stating if there is a williamr@2: * requirement for protection, but also returns the text that should replace the to-be-deleted text. williamr@2: * williamr@2: * @param aPosOfLosEndOfDelete index of the first character deleted williamr@2: * @param aLengthToDelete length the text to be deleted williamr@2: * @param aNewText neutral protection characters to replace the delete williamr@2: * @param aForwardProtectionNeeded EFalse if only reverse protection needed; data valid only if williamr@2: * method does not return EFalse. williamr@2: * @return EFalse iff no deletion is to be performed williamr@2: */ williamr@2: TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded ); williamr@2: williamr@2: /** williamr@2: * Returns whether the character is strongly directional williamr@2: * williamr@2: * @param aChar character to be examined williamr@2: * @param aRightToLeft This is valid upon return only if EFalse is not returned. williamr@2: * Value is EFalse if the strong directionality is Left-to-right williamr@2: * @return EFalse if the character is not strongly directional. williamr@2: */ williamr@2: TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if the character at aPos is neutral williamr@2: * williamr@2: * @param aPos index in editor; must be a valid index williamr@2: * @return EFalse iff the character is not neutral williamr@2: */ williamr@2: TBool CharIsNeutral( TInt aPos ) const; williamr@2: williamr@2: /** williamr@2: * Looks through the passed descriptor, looking for a strongly directional character. williamr@2: * Direction of search can be set. Search starts at the begining if searching forward; williamr@2: * starts at the end if searching backwards. williamr@2: * williamr@2: * Search is carried out until a strong character is found or the end (or beginning) williamr@2: * of the descriptor has been reached. williamr@2: * williamr@2: * @param aText Descriptor to search. williamr@2: * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer williamr@2: * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL williamr@2: * williamr@2: * @return EFalse if no strong character was found. williamr@2: */ williamr@2: TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const; williamr@2: williamr@2: /** williamr@2: * Looks through the editor's text starting at character aPos, looking for a williamr@2: * strongly directional character. Direction of search can be set. williamr@2: * Search is carried out until a strong character is found or the end (or beginning) williamr@2: * of the editor text has been reached. williamr@2: * williamr@2: * @param aPos First character to look at williamr@2: * @param aForward If EFalse, then search is backward (decreasing index) in logical buffer williamr@2: * @param aIsRightToLeft Set to ETrue on return if first strong character found is RTL williamr@2: * williamr@2: * @return EFalse if no strong character was found. williamr@2: */ williamr@2: TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const; williamr@2: williamr@2: /** williamr@2: * Routine to perform the operation of replacing a selection with new text. williamr@2: * This is intended for internal use. williamr@2: * williamr@2: * The current selection, if non-zero length is deleted, and replace with aNewText if non-zero length williamr@2: * iTextView must be set. williamr@2: * williamr@2: * @param aNewText Replacement text. May be zero length. williamr@2: * @param aCursorPosInNewText This is the position, relative to the beginning of the newtext, williamr@2: * that you want the cursor to be at when the operation is complete williamr@2: * @param aFormatHasChanged Set this to ETrue if you want the reformatting to start at williamr@2: * the beginning of the paragraph. EFalse if just to reformat the line. williamr@2: * This variable may also be set by the call to DeleteHighlight that this williamr@2: * code executes, so it may be set to ETrue upon return, even if EFalse was williamr@2: * passed. williamr@2: */ williamr@2: void ReplaceSelectionWithTextL( const TDesC& aNewText, williamr@2: TInt aCursorPosInNewText, williamr@2: TBool& aFormatHasChanged ); williamr@2: williamr@2: /** williamr@2: * Returns EFalse iff ( phone number had only numeric input modes AND the keymap is a phone number williamr@2: * type keymap ). williamr@2: * Phone number type keymaps are: williamr@2: * EAknEditorStandardNumberModeKeymap williamr@2: * EAknEditorFixedDiallingNumberModeKeymap williamr@2: * williamr@2: * @return EFalse if the phone number will only contain a pure phone number williamr@2: */ williamr@2: TBool IsPurePhoneNumberEditor() const; williamr@2: williamr@2: /** williamr@2: * Standard check on upper and lower formatting thresholds versus current textview formatting mode. williamr@2: * williamr@2: * @return EFalse iff the formatting mode does not need changing williamr@2: */ williamr@2: TBool NeedToChangeFormattingModeL() const; williamr@2: williamr@2: /** williamr@2: * When Band formatting is started, this should be called to update the cached williamr@2: * metrics used for the scroll bar calculations. williamr@2: */ williamr@2: void CalculateLineMetricsForBandFormattingL(); williamr@2: williamr@2: protected: // from MObjectProvider williamr@2: williamr@2: /** williamr@2: * From @c MObjectProvider. williamr@2: * williamr@2: * Retrieves an object of the same type as that encapsulated in @c aId. williamr@2: * williamr@2: * This function is used to allow controls to ask their owners for access williamr@2: * to other objects that they own. williamr@2: * williamr@2: * Other than in the case where NULL is returned, the object returned must williamr@2: * be of the same object type - that is, the @c ETypeId member of the williamr@2: * object pointed to by the pointer returned by this function must be equal williamr@2: * to the @c iUid member of @c aId. williamr@2: * williamr@2: * @param aId An encapsulated object type ID. williamr@2: * @return Encapsulates the pointer to the object provided. Note that the williamr@2: * encapsulated pointer may be NULL. williamr@2: */ williamr@2: IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); williamr@2: williamr@2: public: // new since 3.0 williamr@2: williamr@2: /** williamr@2: * Sets skin id for text. williamr@2: * williamr@2: * @param aAknSkinIdForTextColor The skin id. williamr@2: */ williamr@2: IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor); williamr@2: williamr@2: /** williamr@2: * Sets highlight style. williamr@2: * williamr@2: * @param aStyle The highlight style. williamr@2: */ williamr@2: IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle); williamr@2: williamr@2: // for custom drawer, not exported williamr@2: /** williamr@2: * Gets skin id. williamr@2: * williamr@2: * @return The skin id. williamr@2: */ williamr@2: TInt SkinColorId() const; williamr@2: williamr@2: /** williamr@2: * Gets highlight style. williamr@2: * williamr@2: * @return The highlight style. williamr@2: */ williamr@2: TAknsHighlightStyle HighlightStyle() const; williamr@2: williamr@2: /** williamr@2: * Called to determine the background color to draw. It is not to be used if skinning is williamr@2: * being used to draw the background. williamr@2: * williamr@2: * This API can be used two ways: williamr@2: * williamr@2: * i) If the caller has a default color to offer (to be used as williamr@2: * a fallback if SetBackgroundColorL has not been called), then he should use the williamr@2: * Input/Output parameter aConditionalColor, and ignore the return value. The output williamr@2: * parameter will only be over-written by the set background color if SetBackgroundColorL williamr@2: * has been called. williamr@2: * williamr@2: * ii) If the caller does not have a default color to offer, then he should pass in a dummy williamr@2: * input parameter and use the return value. williamr@2: * williamr@2: * @param aConditionalColor Output parameter. Returns a color set by williamr@2: * SetBackgroundColorL. It is unchanged if williamr@2: * background color has not been set by SetBackgroundColorL williamr@2: * @return TRgb for the color to be used for background. williamr@2: */ williamr@2: TRgb EditorBackgroundColor(TRgb& aConditionalColor) const; williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Edwin user flags. williamr@2: */ williamr@2: TUint32 iEdwinUserFlags; williamr@2: williamr@2: /** williamr@2: * Internal Edwin flags. williamr@2: */ williamr@2: TUint32 iEdwinInternalFlags; williamr@2: williamr@2: /** williamr@2: * Edwin's text content. williamr@2: */ williamr@2: CPlainText* iText; williamr@2: williamr@2: protected: // Internal to Symbian williamr@2: williamr@2: /** williamr@2: * Edwin's text view. williamr@2: */ williamr@2: CTextView* iTextView; williamr@2: williamr@2: /** williamr@2: * Edwin's text layout. williamr@2: */ williamr@2: CTextLayout* iLayout; williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Maximum length ot the edwin. williamr@2: */ williamr@2: TInt iTextLimit; williamr@2: williamr@2: /** williamr@2: * Number of lines in Edwin. williamr@2: */ williamr@2: TInt iNumberOfLines; williamr@2: williamr@2: /** williamr@2: * Current zoom factor. williamr@2: */ williamr@2: MGraphicsDeviceMap* iZoomFactor; williamr@2: williamr@2: /** williamr@2: * Cursor position. williamr@2: */ williamr@2: TInt iLastPointerDocPos; williamr@2: williamr@2: /** williamr@2: * Edwin's margins. williamr@2: */ williamr@2: TMargins8 iMargins; williamr@2: williamr@2: private: williamr@2: williamr@2: friend class CEikEdwinFepSupport; williamr@2: friend class CEikEdwinExtension; williamr@2: // added this class to allow additional data members without breaking BC williamr@2: CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar williamr@2: CEikScrollBarFrame* iSBFrame; williamr@2: MEikEdwinObserver* iEdwinObserver; williamr@2: CArrayPtr* iObserverArray; williamr@2: CEikEdwinFepSupport* iEdwinFepSupport; williamr@2: CUndoBuffer* iUndoStore; williamr@2: TInt iAvgLinesInViewRect; williamr@2: TInt iAvgCharsPerLine; williamr@2: TInt iRightWrapGutter; williamr@2: TInt iLayoutWidth; williamr@2: MEikEdwinSizeObserver* iEdwinSizeObserver; williamr@2: TInt iMinimumHeight; williamr@2: TInt iMaximumHeight; williamr@2: /* williamr@2: iMaximumHeightInLines williamr@2: --------------------- williamr@2: This is simply a holder for the number, used to simplify some Avkon LAF requirements. williamr@2: The viewable region of an edwin is actually measured in pixels, However, if certain LAF williamr@2: requirements are enforced (that the view region has to be smaller than the number of williamr@2: lines viewable * the baseline separation (in pixels)) some undesired scrolling effects williamr@2: occur. williamr@2: williamr@2: williamr@2: That is to say, by simply setting iMaximumHeightInLines, this will not affect williamr@2: the actual maximum height of the edwin. To do this, you must set the iMaximumHeight williamr@2: williamr@2: One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. williamr@2: That method uses iMaximumHeightInLines along with the baseline separation, to set williamr@2: the iMaximumHeight. williamr@2: williamr@2: The general formula is very simple, to remove unneeded scrolling. williamr@2: iMaximumHeight=baselineSeparation*iMaximumNumberOfLines williamr@2: williamr@2: If you cannot allocate sufficient space to the edwin, to permit so much viewable region williamr@2: then the method AlterViewRect can be called on the TextView() component. This will introduce williamr@2: a clipping rectangle, which allows blank space required by the edwin layout component williamr@2: to not be shown. williamr@2: */ williamr@2: TInt iMaximumHeightInLines; williamr@2: CLafEdwinCustomDrawBase* iCustomDrawer; williamr@2: TInt iLastPointerAnchorPos; williamr@2: CAknCcpuSupport* iCcpuSupport; williamr@2: CCharFormatLayer* iCharFormatLayer; williamr@2: CParaFormatLayer* iParaFormatLayer; williamr@2: TInt iSpare_1; williamr@2: TInt iSpare_2; williamr@2: }; williamr@2: williamr@2: williamr@2: inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL() williamr@2: { return CreateScrollBarFrameL(ETrue);} williamr@2: inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame() williamr@2: { return ((CEikScrollBarFrame* const)iSBFrame); } williamr@2: inline TInt CEikEdwin::AvgLinesInViewRect() const williamr@2: { return iAvgLinesInViewRect; } williamr@2: inline TInt CEikEdwin::AvgCharsPerLine() const williamr@2: { return iAvgCharsPerLine;} williamr@2: inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines) williamr@2: { iAvgLinesInViewRect=aAvgLines; } williamr@2: inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars) williamr@2: { iAvgCharsPerLine=aAvgChars; } williamr@2: williamr@2: inline void CEikEdwin::SetMaxLength(TInt aLength ) williamr@2: { SetTextLimit(aLength); } williamr@2: inline TInt CEikEdwin::MaxLength() const williamr@2: { return iTextLimit; } williamr@2: williamr@2: #endif