00001 // EIKEDWIN.H 00002 // 00003 // Copyright (c) 1997-1999 Symbian Ltd. All rights reserved. 00004 // 00005 00006 #if !defined(__EIKEDWIN_H__) 00007 #define __EIKEDWIN_H__ 00008 00009 #include <s32std.h> 00010 #include <gdi.h> 00011 #include <txtetext.h> 00012 #include <medobsrv.h> 00013 #include <gulutil.h> 00014 #include <fepbase.h> 00015 #include <frmvis.h> 00016 #include <frmtview.h> 00017 #include <uikon.hrh> 00018 #include <eikon.hrh> 00019 #include <eikbctrl.h> 00020 #include <eikedwob.h> 00021 #include <eiksbfrm.h> 00022 #include <eikccpu.h> 00023 #include <eiklay.h> 00024 #include <lafmain.h> 00025 #include <AknPictographDrawerInterface.h> 00026 #include <babitflags.h> 00027 00028 class CGlobalText; 00029 class CParaFormatLayer; 00030 class CCharFormatLayer; 00031 class MLayDoc; 00032 class CEikEdwinFepSupport; 00033 class CLafEdwinCustomDrawBase; 00034 class CClipboard; 00035 class CAknEdwinFormAccessor; 00036 class CAknEdwinState; 00037 class CAknInputPolicyManager; 00038 class CFormCursorModifier; 00039 class CTextView; 00040 class MAknsControlContext; 00041 class CAknEdwinDrawingModifier; 00042 class CAknEdwinFormExtendedInterfaceProvider; 00043 class CAknPhoneNumberInlineTextSource; 00044 class CAknNoMatchesIndicatorInlineTextSource; 00045 class CAknInlineTextSource; 00046 class CAknPictographInterface; 00047 #start_since SINCE_3_1_SDK 00048 class CAknExtendedInputCapabilities; 00049 #end_since SINCE_3_1_SDK 00050 00051 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin 00052 class CEikAvkonCustomDraw; 00053 00054 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin 00055 class CEikAvkonCustomDraw; 00056 00057 // For construction of Rich Text - based custom formatters 00058 class CRichText; 00059 00060 enum TReplaceOption 00061 { 00062 ENoReplace, 00063 EReplaceOnce, 00064 EReplaceAll, 00065 EReplaceSkip 00066 }; 00067 00074 struct SEdwinFindModel 00075 { 00077 TInt iFlags; // TEdwinFindFlags 00079 TBuf<EEikEdwinFindStringMaxLen> iText; 00081 TBuf<EEikEdwinFindStringMaxLen> iReplaceText; 00083 TReplaceOption iReplaceOption; 00084 }; 00085 00089 enum TAknsHighlightStyle 00090 { 00092 EEikEdwinHighlightNormal = 0, 00094 EEikEdwinHighlightLink 00095 }; 00096 00097 // inline utility to handle RGB values (set / unset) 00098 00099 class SAknRgb 00100 { 00101 // data (private) 00102 TRgb iValue; 00103 TBool iIsSet; 00104 public: // utilities 00105 SAknRgb():iIsSet(EFalse){} 00106 TRgb Value(){return iValue;} 00107 SAknRgb& operator=(TRgb aRgb) 00108 { 00109 iValue = aRgb; 00110 iIsSet = ETrue; 00111 return *this; 00112 } 00113 TBool IsSet(){return iIsSet;} 00114 }; 00115 00126 class CEikEdwin : public CEikBorderedControl, 00127 public MEikScrollBarObserver, 00128 public CTextView::MObserver, 00129 public MEditObserver, 00130 public MEikCcpuEditor 00131 { 00132 00133 private: 00134 00135 class CUndoBuffer; 00136 NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase 00137 { 00138 public: 00145 static CEikEdwinExtension* NewL(CEikEdwin* aEdwin); 00146 00150 ~CEikEdwinExtension(); 00151 00157 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const; 00158 00164 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor); 00165 00171 IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter); 00172 00178 IMPORT_C CIdle* ScrollBarSetter(); 00179 00185 IMPORT_C const TAvkonEditorCustomWrap& TextWrapper(); 00186 00187 // the following two methods are deprecated 00188 IMPORT_C CFormCursorModifier* FormCursorModifier() const; 00189 00195 void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext ); 00196 00203 MAknsControlContext* SkinBackgroundControlContext() const; 00204 00211 TBool SkinBackgroundControlContextHasBeenSet() const; 00212 00218 void SetAlignment(TInt aAlignment); 00219 00225 TInt CurrentAlignment() const; 00226 00230 void SetPictoCallBack( TCallBack& aCallBack ); 00231 00235 const TCallBack& PictoCallBack() const; 00236 00240 void CreateFormExtendedInterfaceProviderIfNeededL(); 00241 00245 CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const; 00246 00256 void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText); 00257 00266 void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout ); 00267 00277 void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText ); 00278 00286 CAknInlineTextSource* InlineTextSource() const; 00287 00293 CAknPictographInterface* PictographInterface() const; 00294 00295 #start_since SINCE_3_1_SDK 00296 00300 void SetSuppressBackgroundDrawing( TBool aSuppress ); 00301 #end_since SINCE_3_1_SDK 00302 00303 #start_since SINCE_3_1_SDK 00304 00308 TBool IsBackgroundDrawingSuppressed() const; 00309 #end_since SINCE_3_1_SDK 00310 00311 private: 00312 00313 CEikEdwinExtension(); 00314 void ConstructL(CEikEdwin* aEdwin); 00315 00316 private: 00317 00318 enum TFlagIndices 00319 { 00320 ESkinBackgroundControlContextHasBeenSetIndex = 0, 00321 ESuppressBackgroundDrawing 00322 }; 00323 class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack 00324 { 00325 private: // From MAknPictographAnimatorCallBack 00326 void DrawPictographArea(); 00327 }; 00328 00329 private: 00330 00331 CIdle* iSetScrollBar; 00332 TAvkonEditorCustomWrap iTextWrapper; 00333 CAknEdwinFormAccessor* iFormAccessor; 00334 CFormCursorModifier* iFormCursorModifier; 00335 MAknsControlContext* iSkinBackgroundControlContext; 00336 TBitFlags iFlags; 00337 TInt iAlignment; 00338 TCallBack iPictoCallBack; 00339 CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned 00340 CAknInlineTextSource* iPhoneNumberFormatter; // Not owned 00341 CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter; // Not owned 00342 TAknEdwinPictographDrawer iPictographDrawer; 00343 CAknPictographInterface* iPictographInterface; 00344 00345 public: 00346 00347 TInt iSkinIdForText; 00348 TAknsHighlightStyle iSkinHighlightStyle; 00349 SAknRgb iEditorBackgroundColor; 00350 TInt iUpperFullFormattingLength; 00351 #start_since SINCE_3_1_SDK 00352 00355 CAknExtendedInputCapabilities* iExtendedInputCapabilities; 00356 #end_since SINCE_3_1_SDK 00357 }; 00358 00359 public: 00360 00369 enum TFlags 00370 { // user flags 00372 EZeroEnumValue =0x00000000, 00373 00377 EKeepDocument =0x00000001, 00378 00383 ESegmentedStorage =0x00000002, 00384 00389 EWidthInPixels =0x00000004, 00390 00396 ENoAutoSelection =0x00000008, 00397 00402 EJustAutoCurEnd =0x00000010, 00403 00407 ENoWrap =0x00000020, 00408 00412 ELineCursor =0x00000040, 00413 00417 ENoHorizScrolling =0x00000080, 00418 00425 EInclusiveSizeFixed =0x00000100, 00426 00431 EUserSuppliedText =0x00000200, 00432 00436 EOwnsWindow =0x00000400, 00437 00441 EDisplayOnly =0x00000800, 00442 00446 EAlwaysShowSelection =0x00001000, 00447 00452 EReadOnly =0x00002000, 00453 00459 EAllowPictures =0x00004000, 00460 00464 EAllowUndo =0x00008000, 00465 00469 ENoLineOrParaBreaks =0x00010000, 00470 00474 EOnlyASCIIChars =0x00020000, 00475 00479 EResizable =0x00040000, 00480 00484 EIgnoreVirtualCursor =0x00080000, 00485 00489 ENoCustomDraw =0x01000000, 00490 00494 EAvkonEditor =0x02000000, 00495 00499 EAvkonDisableCursor =0x04000000, 00500 00504 EAvkonNotEditable =0x08000000, 00505 00509 EEdwinAlternativeWrapping = 0x10000000 00510 }; 00511 00515 enum TClipboardFunc 00516 { 00518 ENoClipboard, 00519 00521 ECut, 00522 00524 ECopy, 00525 00527 EPaste 00528 }; 00529 00534 enum TFindFlags 00535 { 00537 EFindDirectionUp =0x01, 00538 00540 EFindWholeWord =0x02, 00541 00543 EFindCaseSensitive =0x04, 00544 00546 EFindAgain =0x08, 00547 00549 ENoBusyMessage =0x10, 00550 00552 EReadOnlyFile =0x20 // New for CKon 00553 }; 00554 00560 enum TSetContent 00561 { 00563 EUseText, 00564 00566 ECopyText 00567 }; 00568 00575 enum TOwnershipType 00576 { 00578 EOwnsText, 00579 00581 EDoesNotOwnText 00582 }; 00583 00584 // order of hotkeys defined in resource file. Not all applicable to plain 00585 // text editors 00592 enum TEdwinHotKeys 00593 { 00595 EHotKeyCut, 00596 00598 EHotKeyCopy, 00599 00601 EHotKeyPaste, 00602 00604 EHotKeyUndo, 00605 00607 EHotKeyFind, 00608 00610 EHotKeyInsertChar, 00611 00613 EHotKeyBold, 00614 00616 EHotKeyItalic, 00617 00619 EHotKeyUnderline, 00620 00622 EHotKeyFont, 00623 00625 EHotKeyInsertObject, 00626 00628 EHotKeyEditObject, 00629 00631 EHotKeyFormatObject 00632 }; 00633 00634 public: // construction and destruction 00635 00642 IMPORT_C ~CEikEdwin(); 00643 00650 IMPORT_C CEikEdwin(); 00651 00661 IMPORT_C CEikEdwin(const TGulBorder& aBorder); 00662 00677 IMPORT_C void ConstructL(TInt aEdwinFlags=0, 00678 TInt aWidthInChars=0, 00679 TInt aTextLimit=0, 00680 TInt aNumberOfLines=0); 00681 00688 IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver); 00689 00697 IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver); 00698 00705 IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver); 00706 00710 IMPORT_C void SetContainerWindowL(); 00711 00721 IMPORT_C void SetDocumentContentL(CGlobalText& aText, 00722 TSetContent aContent=CEikEdwin::ECopyText); 00723 00724 public: // from CCoeControl 00725 00736 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 00737 TEventCode aType); 00738 00746 IMPORT_C void FocusChanged(TDrawNow aDrawNow); 00747 00755 IMPORT_C void ActivateL(); 00756 00765 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 00766 00774 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00775 00784 IMPORT_C TSize MinimumSize(); 00785 00793 IMPORT_C void Draw(const TRect& aRect) const; 00794 00802 IMPORT_C void SetDimmed(TBool aDimmed); 00803 00813 IMPORT_C void SetContainerWindowL(const CCoeControl& aParent); 00814 00824 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& 00825 aColorUseList) const; // not available before Release 005u 00826 00827 // not available before Release 005u 00836 IMPORT_C virtual void HandleResourceChange(TInt aType); 00837 00845 IMPORT_C TCoeInputCapabilities InputCapabilities() const; 00846 00857 IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& 00858 aInputCapabilities); 00859 00868 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; 00869 00870 private: 00871 00875 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00876 00877 public: // from MEikScrollBarObserver 00878 00887 IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, 00888 TEikScrollEvent aEventType); 00889 00890 public: // from CTextView::MObserver 00891 00900 IMPORT_C void OnReformatL(const CTextView* aTextView); 00901 00902 public: 00903 00909 IMPORT_C TInt TextLength() const; 00910 00916 IMPORT_C TInt CursorPos() const; 00917 00924 IMPORT_C TInt SelectionLength() const; 00925 00932 IMPORT_C TCursorSelection Selection() const; 00933 00938 IMPORT_C void ClearSelectionL(); 00939 00948 IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos); 00949 00960 IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect); 00961 00965 IMPORT_C void SelectAllL(); 00966 00979 IMPORT_C void CalculateWidth(TInt aWidthInChars); 00980 00988 IMPORT_C void GetText(TDes& aDes) const; 00989 00995 IMPORT_C HBufC* GetTextInHBufL() const; 00996 01004 IMPORT_C void SetTextL(const TDesC* aDes); 01005 01012 IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc); 01013 01021 IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType); 01022 01026 IMPORT_C void UpdateAllFieldsL(); 01027 01035 IMPORT_C void UpdateCurrentFieldL(); 01036 01042 IMPORT_C TInt CountWords(); 01043 01052 IMPORT_C void InsertFromTextFileL(const TFileName &aFileName, 01053 const CPlainText::TTextOrganisation 01054 aTextOrganisation=CPlainText::EOrganiseByLine); 01055 01062 IMPORT_C static TInt IdleL(TAny *aPtr); 01063 01070 IMPORT_C CPlainText* Text() const; 01071 01072 // this is particularly important for when the front-end processor is 01073 // inline-editing a CEikEdwin 01087 IMPORT_C void CancelFepTransaction(); 01088 01094 IMPORT_C void HandleTextChangedL(); 01095 01103 IMPORT_C TInt LayoutWidth() const; 01104 01108 IMPORT_C void NotifyNewDocumentL(); 01109 01113 IMPORT_C void NotifyNewFormatL(); 01114 01124 IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0); 01125 01138 IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags); 01139 01145 IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel); 01146 01155 IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel); 01156 01164 IMPORT_C void GetFindText(TDes* aFindText); 01165 01169 IMPORT_C void UpdateScrollBarsL(); 01170 01177 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(); 01178 01184 inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL(); 01185 01191 inline CEikScrollBarFrame* ScrollBarFrame(); 01192 01199 IMPORT_C void SetWordWrapL(TBool aWrapIsOn); 01200 01206 IMPORT_C virtual TInt LineCursorWidth() const; 01207 01213 IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor); 01214 01220 IMPORT_C void SetBackgroundColorL(TRgb aBackground); 01221 01228 IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth, 01229 MGraphicsDeviceMap* aDevice); 01230 01235 IMPORT_C void SetWysiwygModeOff(); 01236 01243 IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); 01244 01248 IMPORT_C void SendDataOverIrL(); 01249 01255 IMPORT_C void ReceiveDataOverIrL(); 01256 01273 IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse); 01274 01275 #start_since SINCE_3_1_SDK 01276 01299 IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat ); 01300 #end_since SINCE_3_1_SDK 01301 01308 IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore); 01309 01318 IMPORT_C void PasteFromStoreL(CStreamStore& aStore, 01319 CStreamDictionary& aDict); 01320 01327 IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict); 01328 01334 IMPORT_C void SetBorderViewMargins(TMargins8 aMargins); 01335 01339 IMPORT_C void ForceScrollBarUpdateL(); 01340 01350 IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner); 01351 01358 IMPORT_C void SetTextLimit(TInt aLimit); 01359 01365 IMPORT_C void RunCharMapDialogL(); 01366 01372 IMPORT_C TMargins8 Margins() const; 01373 01383 IMPORT_C TInt UpperFullFormattingLength() const; 01384 01398 IMPORT_C TInt LowerPartialFormattingLength() const; 01399 01407 IMPORT_C void SetReadOnly(TBool aReadOnly); 01408 01415 IMPORT_C TBool IsReadOnly() const; 01416 01422 IMPORT_C void CheckNotReadOnlyL(); 01423 01430 IMPORT_C void SetAllowPictures(TBool aAllow); 01431 01440 IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength); 01441 01449 IMPORT_C void SetRightWrapGutter(TInt aGap); 01450 01455 IMPORT_C void UndoL(); 01456 01460 IMPORT_C void ClearUndo(); 01461 01468 IMPORT_C void SetAllowUndo(TBool aAllow); 01469 01476 IMPORT_C TBool SupportsUndo() const; 01477 01485 IMPORT_C TBool CanUndo() const; 01486 01496 IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation); 01497 01506 IMPORT_C void GetWordInfo(TInt aCurrentPos, 01507 TInt& aStartPos, 01508 TInt& aLength) const; 01509 01519 IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement, 01520 TBool aSelect); 01521 01528 IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement); 01529 01539 IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength); 01540 01547 IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly); 01548 01554 IMPORT_C TBool OnlyASCIIChars() const; 01555 01561 inline TInt AvgLinesInViewRect() const; 01562 01568 inline TInt AvgCharsPerLine() const; 01569 01575 inline void SetAvgLinesInViewRect(TInt aAvgLines); 01576 01582 inline void SetAvgCharsPerLine(TInt aAvgChars); 01583 01589 IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* 01590 aEdwinSizeObserver); 01591 01597 IMPORT_C TInt MinimumHeight() const; 01598 01608 IMPORT_C TInt MaximumHeight() const; 01609 01614 IMPORT_C void SetMinimumHeight(TInt aHeight); 01615 01626 IMPORT_C void SetMaximumHeight(TInt aHeight); 01627 01628 public: // new utility methods 01629 01638 IMPORT_C void InsertDeleteCharsL(TInt aInsertPos, 01639 const TDesC& aText, 01640 const TCursorSelection& aDelete); 01641 01647 IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility 01648 aVisibility); 01649 01655 IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const; 01656 01657 public: // new Avkon wrap interface 01658 01664 IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn); 01665 01666 public: // Avkon editor extensions 01667 01677 IMPORT_C void SetAknEditorCase(TInt aCase); 01678 01688 IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes); 01689 01704 IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap 01705 aNumericKeymap); 01706 01715 IMPORT_C void SetAknEditorInputMode(TInt aInputMode); 01716 01724 IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes); 01725 01731 IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId); 01732 01740 IMPORT_C void SetAknEditorFlags(TInt aFlags); 01741 01748 IMPORT_C void EnableCcpuSupportL(TBool aSupport); 01749 01760 IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode); 01761 01768 IMPORT_C TInt AknEditorCurrentInputMode(); 01769 01780 IMPORT_C void SetAknEditorCurrentCase(TInt aCase); 01781 01789 IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage); 01790 01795 IMPORT_C void NotifyEditorStateObserverOfStateChangeL(); 01796 01797 #start_since SINCE_3_1_SDK 01798 01809 IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress ); 01810 #end_since SINCE_3_1_SDK 01811 01812 #start_since SINCE_3_1_SDK 01813 01819 IMPORT_C TBool IsBackgroundDrawingSuppressed() const; 01820 #end_since SINCE_3_1_SDK 01821 01822 #start_since SINCE_3_1_SDK 01823 01831 IMPORT_C void SetTextLinesRect( const TRect& aRect ); 01832 #end_since SINCE_3_1_SDK 01833 01834 #start_since SINCE_3_1_SDK 01835 01843 IMPORT_C TRect GetTextLinesRect() const; 01844 #end_since SINCE_3_1_SDK 01845 01846 public: 01847 01848 // These methods have been added for use with Avkon to set maximum 01849 // editor heights. 01855 IMPORT_C void SetMaximumHeightInLines(TInt aLines); 01856 01862 IMPORT_C TInt MaximumHeightInLines() const; 01863 01864 public: // From MEikCcpuEditor 01865 01871 IMPORT_C TBool CcpuIsFocused() const; 01872 01878 IMPORT_C TBool CcpuCanCut() const; 01879 01883 IMPORT_C void CcpuCutL(); 01884 01890 IMPORT_C TBool CcpuCanCopy() const; 01891 01895 IMPORT_C void CcpuCopyL(); 01896 01902 IMPORT_C TBool CcpuCanPaste() const; 01903 01907 IMPORT_C void CcpuPasteL(); 01908 01914 IMPORT_C TBool CcpuCanUndo() const; 01915 01920 IMPORT_C void CcpuUndoL(); 01921 01927 IMPORT_C TInt AknEdwinFlags() const; 01928 01929 01930 public: // Internal to Symbian 01931 01932 // the following methods are deprecated and will be removed in a future 01933 // release 01937 IMPORT_C void CreateTextViewL(); 01938 01944 IMPORT_C CTextView* TextView() const; 01945 01951 IMPORT_C CTextLayout* TextLayout() const; 01952 01959 IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection); 01960 01966 IMPORT_C void SetUndoableText(const TCursorSelection& aSelection); 01967 01973 CAknEdwinState* EditorState() const; 01974 01980 inline void SetMaxLength(TInt aLength); 01981 01987 inline TInt MaxLength() const; 01988 01989 public: 01990 01991 // added to get access to user flags without a get/set for every different 01992 // flag. 01999 IMPORT_C void AddFlagToUserFlags(TUint32 aFlag); 02000 02007 IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag); 02008 02015 IMPORT_C TUint32 UserFlags() const ; 02016 02017 public: 02018 02024 IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer); 02025 02031 IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer); 02032 02033 02034 public: // Skins support 02035 02051 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* 02052 aContext ); 02053 02067 MAknsControlContext* SkinBackgroundControlContext() const; 02068 02079 TBool SkinEnabled() const; 02080 02091 IMPORT_C void SetAlignment(TInt aAlignment); 02092 02093 public: // Pictograph support 02094 02098 void DrawTextView() const; 02099 02108 IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack ); 02109 02116 const TCallBack& PictographAnimationCallBack() const; 02117 02146 IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit ); 02147 02148 #start_since SINCE_3_1_SDK 02149 02157 IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled ); 02158 #end_since SINCE_3_1_SDK 02159 02160 #start_since SINCE_3_1_SDK 02161 02172 IMPORT_C void SetSuppressFormatting( TBool aSuppressed ); 02173 #end_since SINCE_3_1_SDK 02174 02175 protected: 02176 02180 enum TEnd 02181 { 02183 EStart, 02184 02186 EEnd 02187 }; 02188 02192 enum TChunkSize 02193 { 02195 EChunkWord, 02196 02198 EChunkPara 02199 }; 02200 02204 enum TEikEdwinFlags // Internal flags 02205 { 02207 ERichText =0x00000001, 02208 02210 EDragDouble =0x00000002, 02211 02216 ELeftDownInViewRect =0x00000004, 02217 02219 ENumericCharacters =0x00000008, 02220 02222 EHasOneLineOnly =0x00000010, 02223 02228 EPhoneNumberGrouping = 0x00000020 02229 #start_since SINCE_3_1_SDK 02230 ,ESuppressNotifyDraw = 0x00000040, 02231 ESuppressFormatting = 0x00000080 // Suppresses calls to formatting 02232 #end_since SINCE_3_1_SDK 02233 }; 02234 02235 protected: // from MEditObserver 02236 02249 IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength); 02250 02251 protected: 02252 02260 IMPORT_C void TrappedDraw(const TRect& aRect) const; 02261 02265 IMPORT_C void DrawContents(); 02266 02276 IMPORT_C void BaseConstructL(); 02277 02283 IMPORT_C void FormatTextL(); 02284 02298 IMPORT_C TInt DeleteHighlightL(TBool& aChanged, 02299 TBool aIsBackSpace=EFalse, 02300 TBool aPromptConfirmation=ETrue); 02301 02314 IMPORT_C TBool OkToDeleteSelectionL(); 02315 02330 IMPORT_C void DeleteL(TBool& aChanged, 02331 const TCursorSelection& aSelection, 02332 TBool aIsBackSpace=EFalse, 02333 TBool aAllowUndo=ETrue); 02334 02339 IMPORT_C void TrappedSizeChanged(); 02340 02346 IMPORT_C void HandleSizeChangedL(); 02347 02356 IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor); 02357 02369 IMPORT_C void MoveCursorToChunkStartL(TBool aSelect, 02370 TChunkSize aChunkSize, 02371 TEnd aEndScanningTowards); 02372 02377 IMPORT_C void CancelInsertCharFormat(); 02378 02382 IMPORT_C void PlaceDataOnClipboardL(); 02383 02395 IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType); 02396 02400 IMPORT_C void SetLineCursorDetailsL(); 02401 02408 IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText, 02409 CGlobalText& aOutText); 02410 02418 IMPORT_C void DisplayFindTextNotFound(TDes& aFindText); 02419 02426 IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength); 02427 02433 IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL(); 02434 02435 // Avkon editor extensions 02441 IMPORT_C void ReadAknResourceL(TResourceReader& aReader); 02442 02443 protected: // Internal to Symbian 02444 02451 IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc); 02452 02461 IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer, 02462 CCharFormatLayer* aCharFormatLayer); 02463 02469 IMPORT_C void CheckEdwinExtensionL(); 02470 02476 IMPORT_C CEikEdwinExtension* EdwinExtension(); 02477 02478 private: 02479 02480 enum 02481 { // internal flags 02482 EWysiwygOn =0x00000010, 02483 EUnderOneScreenFormattedText =0x00000020, 02484 EPictureDelimits =0x00000040, 02485 EPunctuationDelimits =0x00000080, 02486 EPasteFromIrStore =0x00000100, 02487 ELockScrollBarState =0x00000200, 02488 EOnReformatting =0x00000400 02489 }; 02490 02491 private: // from CCoeControl 02492 02493 IMPORT_C void SizeChanged(); 02494 IMPORT_C TInt CountComponentControls() const; 02495 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; 02496 IMPORT_C void Reserved_2(); 02497 02498 private: 02499 02500 IMPORT_C virtual void Reserved_3(); 02501 IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL(); 02502 IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc); 02503 void SetVirtualCursorStateL(TBool aIsFocused) const; 02504 void SetHeightForNumOfLinesL(); 02505 void ApplyAutoSelectionL(); 02506 void SetScrollBarsL(); 02507 void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const; 02508 void RetrieveDataFromClipboardL(); 02509 void SetCursorVisibilityL(TBool aEmphasis); 02510 TBool OwnsScrollBars() const; 02511 void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const; 02512 void UpdateHorizScrollBarThumb(); 02513 void UpdateVertScrollBarThumbL(); 02514 void DoSetUndoBufferL(const TCursorSelection& aSelection); 02515 void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict); 02516 void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced); 02517 void DeleteExtraParasL(TInt aStartPos,TInt aLength); 02518 TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength); 02519 TBool IsValidChar(TInt aChar) const; 02520 TInt CalcMinimumHeightFromNumOfLinesL() const; 02521 void CheckEdwinHeight(); 02522 TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const; 02523 void SetEdwinHeight(TInt aHeight); 02524 void DoCreateCustomDrawL(); 02525 void SetCursorSizeAndType(); 02526 TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); 02527 void DoCcpuCanPasteL() const; 02528 void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent); 02529 void CheckIfEdwinIsResizable(); 02530 void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const; 02531 HBufC* GetAllowedCharsLC() const; 02532 TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const; 02533 02534 TInt CursorWidth() const; 02535 TFontSpec CursorFontSpec() const; 02536 02537 void BuildEdwinFepSupport(); 02538 void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer); 02539 void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer); 02540 void UpdateCache(TInt aId); 02541 void DrawBackgroundAroundTextView( 02542 CWindowGc& gc, 02543 const TRect& aOuterRect, 02544 const TRect& aInnerRect, 02545 const TRgb& aBackgroundColor ) const; 02546 TInt CurrentAlignment() const; 02547 void DoAlignment(); 02548 void NewParagraphL(); 02549 TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode); 02550 02551 private: 02552 02553 void DrawFirstLineTextL() const; 02554 CAknEdwinDrawingModifier* AknEdwinDrawingModifier(); 02555 TBool EditorSupportsNeutralProtection() const; 02556 02568 TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded ); 02569 02578 TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const; 02579 02586 TBool CharIsNeutral( TInt aPos ) const; 02587 02602 TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const; 02603 02616 TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const; 02617 02634 void ReplaceSelectionWithTextL( const TDesC& aNewText, 02635 TInt aCursorPosInNewText, 02636 TBool& aFormatHasChanged ); 02637 02647 TBool IsPurePhoneNumberEditor() const; 02648 02654 TBool NeedToChangeFormattingModeL() const; 02655 02660 void CalculateLineMetricsForBandFormattingL(); 02661 02662 protected: // from MObjectProvider 02663 02681 IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId); 02682 02683 public: // new since 3.0 02684 02690 IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor); 02691 02697 IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle); 02698 02699 // for custom drawer, not exported 02705 TInt SkinColorId() const; 02706 02712 TAknsHighlightStyle HighlightStyle() const; 02713 02734 TRgb EditorBackgroundColor(TRgb& aConditionalColor) const; 02735 02736 02737 protected: 02738 02742 TUint32 iEdwinUserFlags; 02743 02747 TUint32 iEdwinInternalFlags; 02748 02752 CPlainText* iText; 02753 02754 protected: // Internal to Symbian 02755 02759 CTextView* iTextView; 02760 02764 CTextLayout* iLayout; 02765 02766 protected: 02767 02771 TInt iTextLimit; 02772 02776 TInt iNumberOfLines; 02777 02781 MGraphicsDeviceMap* iZoomFactor; 02782 02786 TInt iLastPointerDocPos; 02787 02791 TMargins8 iMargins; 02792 02793 private: 02794 02795 friend class CEikEdwinFepSupport; 02796 friend class CEikEdwinExtension; 02797 // added this class to allow additional data members without breaking BC 02798 CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar 02799 CEikScrollBarFrame* iSBFrame; 02800 MEikEdwinObserver* iEdwinObserver; 02801 CArrayPtr<MEikEdwinObserver>* iObserverArray; 02802 CEikEdwinFepSupport* iEdwinFepSupport; 02803 CUndoBuffer* iUndoStore; 02804 TInt iAvgLinesInViewRect; 02805 TInt iAvgCharsPerLine; 02806 TInt iRightWrapGutter; 02807 TInt iLayoutWidth; 02808 MEikEdwinSizeObserver* iEdwinSizeObserver; 02809 TInt iMinimumHeight; 02810 TInt iMaximumHeight; 02811 /* 02812 iMaximumHeightInLines 02813 --------------------- 02814 This is simply a holder for the number, used to simplify some Avkon LAF requirements. 02815 The viewable region of an edwin is actually measured in pixels, However, if certain LAF 02816 requirements are enforced (that the view region has to be smaller than the number of 02817 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects 02818 occur. 02819 02820 02821 That is to say, by simply setting iMaximumHeightInLines, this will not affect 02822 the actual maximum height of the edwin. To do this, you must set the iMaximumHeight 02823 02824 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. 02825 That method uses iMaximumHeightInLines along with the baseline separation, to set 02826 the iMaximumHeight. 02827 02828 The general formula is very simple, to remove unneeded scrolling. 02829 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines 02830 02831 If you cannot allocate sufficient space to the edwin, to permit so much viewable region 02832 then the method AlterViewRect can be called on the TextView() component. This will introduce 02833 a clipping rectangle, which allows blank space required by the edwin layout component 02834 to not be shown. 02835 */ 02836 TInt iMaximumHeightInLines; 02837 CLafEdwinCustomDrawBase* iCustomDrawer; 02838 TInt iLastPointerAnchorPos; 02839 CAknCcpuSupport* iCcpuSupport; 02840 CCharFormatLayer* iCharFormatLayer; 02841 CParaFormatLayer* iParaFormatLayer; 02842 TInt iSpare_1; 02843 TInt iSpare_2; 02844 }; 02845 02846 02847 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL() 02848 { return CreateScrollBarFrameL(ETrue);} 02849 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame() 02850 { return ((CEikScrollBarFrame* const)iSBFrame); } 02851 inline TInt CEikEdwin::AvgLinesInViewRect() const 02852 { return iAvgLinesInViewRect; } 02853 inline TInt CEikEdwin::AvgCharsPerLine() const 02854 { return iAvgCharsPerLine;} 02855 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines) 02856 { iAvgLinesInViewRect=aAvgLines; } 02857 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars) 02858 { iAvgCharsPerLine=aAvgChars; } 02859 02860 inline void CEikEdwin::SetMaxLength(TInt aLength ) 02861 { SetTextLimit(aLength); } 02862 inline TInt CEikEdwin::MaxLength() const 02863 { return iTextLimit; } 02864 02865 #endif