eikedwin.h

Go to the documentation of this file.
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 #include <centralrepository.h>          // class CCenRepNotifyHandler;
00028 #include <cenrepnotifyhandler.h>        // class CRepository;
00029 
00030 class CGlobalText;
00031 class CParaFormatLayer;
00032 class CCharFormatLayer;
00033 class MLayDoc;
00034 class CEikEdwinFepSupport;
00035 class CLafEdwinCustomDrawBase;
00036 class CClipboard;
00037 class CAknEdwinFormAccessor;
00038 class CAknEdwinState;
00039 class CAknInputPolicyManager;
00040 class CFormCursorModifier;
00041 class CTextView;
00042 class MAknsControlContext;
00043 class CAknEdwinDrawingModifier;
00044 class CAknEdwinFormExtendedInterfaceProvider;
00045 class CAknPhoneNumberInlineTextSource;
00046 class CAknNoMatchesIndicatorInlineTextSource;
00047 class CAknInlineTextSource;
00048 class CAknPictographInterface;
00049 class CAknExtendedInputCapabilities;
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, MCenRepNotifyHandlerCallback
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         
00298         void SetSuppressBackgroundDrawing( TBool aSuppress );
00299         
00303         TBool IsBackgroundDrawingSuppressed() const;
00304 
00310         TInt ClearDirection() const;
00311 
00312     public: // from MCenRepNotifyHandlerCallback
00313         void HandleNotifyInt(TUint32 aId, TInt aNewValue);
00314 
00315     private:
00316 
00317         CEikEdwinExtension();
00318         void ConstructL(CEikEdwin* aEdwin);
00319 
00320     private:
00321 
00322         enum TFlagIndices
00323             {
00324             ESkinBackgroundControlContextHasBeenSetIndex = 0,
00325             ESuppressBackgroundDrawing
00326             };
00327         class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack
00328             {
00329             private: // From MAknPictographAnimatorCallBack
00330                 void DrawPictographArea();
00331             };        
00332         
00333         private:
00334 
00335                 CIdle* iSetScrollBar;
00336                 TAvkonEditorCustomWrap iTextWrapper;
00337                 CAknEdwinFormAccessor* iFormAccessor;
00338         CFormCursorModifier* iFormCursorModifier;
00339         MAknsControlContext* iSkinBackgroundControlContext;
00340         TBitFlags iFlags;
00341         TInt iAlignment;
00342         TCallBack iPictoCallBack;       
00343         CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned
00344         CAknInlineTextSource* iPhoneNumberFormatter;                 // Not owned
00345         CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter;   // Not owned
00346         TAknEdwinPictographDrawer iPictographDrawer;
00347         CAknPictographInterface* iPictographInterface;
00348         // For clear direction.
00349         CRepository* iCenRep;                           // Owned
00350         CCenRepNotifyHandler* iCenRepNotifyHandler;     // Owned
00351         TInt iClearDirection;                           // Value of ClearDirection
00352      public:
00353 
00354         TInt iSkinIdForText;
00355         TAknsHighlightStyle iSkinHighlightStyle;
00356         SAknRgb iEditorBackgroundColor;
00357         TInt iUpperFullFormattingLength;
00358         CAknExtendedInputCapabilities* iExtendedInputCapabilities;
00359         TRect iTextLinesRect;
00360         TRect iScrollRect;
00361                 };
00362 
00363 public:
00364 
00373     enum TFlags
00374         { // user flags
00376         EZeroEnumValue                  =0x00000000, 
00377 
00381         EKeepDocument                   =0x00000001,
00382 
00387         ESegmentedStorage               =0x00000002,
00388 
00393         EWidthInPixels                  =0x00000004,
00394 
00400         ENoAutoSelection                =0x00000008,
00401 
00406         EJustAutoCurEnd                 =0x00000010,
00407 
00411         ENoWrap                                 =0x00000020,
00412 
00416         ELineCursor                             =0x00000040, 
00417 
00421         ENoHorizScrolling               =0x00000080, 
00422 
00429         EInclusiveSizeFixed             =0x00000100, 
00430 
00435         EUserSuppliedText               =0x00000200,
00436 
00440         EOwnsWindow                             =0x00000400,
00441 
00445         EDisplayOnly                    =0x00000800,
00446 
00450         EAlwaysShowSelection    =0x00001000,
00451 
00456         EReadOnly                               =0x00002000,
00457 
00463         EAllowPictures                  =0x00004000,
00464 
00468         EAllowUndo                              =0x00008000,
00469 
00473         ENoLineOrParaBreaks             =0x00010000,
00474 
00478         EOnlyASCIIChars                 =0x00020000,
00479 
00483         EResizable                              =0x00040000,
00484 
00488         EIgnoreVirtualCursor    =0x00080000,
00489 
00493         ENoCustomDraw                   =0x01000000,
00494 
00498         EAvkonEditor                    =0x02000000,
00499 
00503         EAvkonDisableCursor             =0x04000000,
00504 
00508         EAvkonNotEditable               =0x08000000, 
00509 
00513         EEdwinAlternativeWrapping = 0x10000000,
00514         
00518          EAvkonTabsEnabled = 0x20000000, 
00519         };
00520 
00524     enum TClipboardFunc
00525                 {
00527                 ENoClipboard,
00528 
00530                 ECut,
00531 
00533                 ECopy,
00534 
00536                 EPaste
00537                 };
00538 
00543         enum TFindFlags
00544                 {
00546                 EFindDirectionUp        =0x01,
00547 
00549                 EFindWholeWord          =0x02,
00550 
00552                 EFindCaseSensitive      =0x04,
00553 
00555                 EFindAgain                      =0x08,
00556 
00558                 ENoBusyMessage          =0x10,
00559 
00561                 EReadOnlyFile           =0x20 // New for CKon
00562                 };
00563 
00569         enum TSetContent
00570                 {
00572                 EUseText,
00573 
00575                 ECopyText
00576                 };
00577 
00584         enum TOwnershipType
00585                 {
00587                 EOwnsText,
00588 
00590                 EDoesNotOwnText
00591                 };
00592 
00593     // order of hotkeys defined in resource file.  Not all applicable to plain 
00594     // text editors
00601         enum TEdwinHotKeys 
00602                 {
00604                 EHotKeyCut,
00605 
00607                 EHotKeyCopy,
00608 
00610                 EHotKeyPaste,
00611 
00613                 EHotKeyUndo,
00614 
00616         EHotKeyFind,
00617 
00619                 EHotKeyInsertChar,
00620 
00622                 EHotKeyBold,
00623 
00625                 EHotKeyItalic,
00626 
00628                 EHotKeyUnderline,
00629 
00631                 EHotKeyFont,
00632 
00634                 EHotKeyInsertObject,
00635 
00637                 EHotKeyEditObject,
00638 
00640                 EHotKeyFormatObject
00641                 };
00642 
00643 public: // construction and destruction
00644 
00651     IMPORT_C ~CEikEdwin();
00652 
00659         IMPORT_C CEikEdwin();
00660 
00670         IMPORT_C CEikEdwin(const TGulBorder& aBorder);
00671     
00686         IMPORT_C void ConstructL(TInt aEdwinFlags=0,
00687                              TInt aWidthInChars=0,
00688                              TInt aTextLimit=0,
00689                              TInt aNumberOfLines=0);
00690         
00697     IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver);
00698         
00706     IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);
00707         
00714     IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);
00715         
00719     IMPORT_C void SetContainerWindowL();
00720         
00730     IMPORT_C void SetDocumentContentL(CGlobalText& aText,
00731                         TSetContent aContent=CEikEdwin::ECopyText);
00732 
00733 public: // from CCoeControl
00734     
00745     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
00746                                          TEventCode aType);
00747         
00755     IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00756         
00764     IMPORT_C void ActivateL();
00765         
00774     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00775         
00783     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00784         
00793     IMPORT_C TSize MinimumSize();
00794         
00802     IMPORT_C void Draw(const TRect& aRect) const;
00803         
00811     IMPORT_C void SetDimmed(TBool aDimmed);
00812         
00822     IMPORT_C void SetContainerWindowL(const CCoeControl& aParent);
00823         
00833     IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& 
00834                      aColorUseList) const; // not available before Release 005u
00835         
00836     // not available before Release 005u    
00845     IMPORT_C virtual void HandleResourceChange(TInt aType);
00846     
00860     IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00861     
00872     IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& 
00873                                         aInputCapabilities); 
00874 
00883     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00884 
00885 private:
00886 
00890     IMPORT_C void* ExtensionInterface( TUid aInterface );
00891 
00892 public: // from MEikScrollBarObserver
00893 
00902         IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, 
00903                                      TEikScrollEvent aEventType); 
00904 
00905 public: // from CTextView::MObserver
00906         
00915     IMPORT_C void OnReformatL(const CTextView* aTextView);
00916 
00917 public:
00918     
00924         IMPORT_C TInt TextLength() const;
00925 
00931         IMPORT_C TInt CursorPos() const;
00932 
00939         IMPORT_C TInt SelectionLength() const;
00940 
00947         IMPORT_C TCursorSelection Selection() const;
00948 
00953         IMPORT_C void ClearSelectionL();
00954 
00963         IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos);
00964 
00975         IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect);
00976 
00980         IMPORT_C void SelectAllL();
00981 
00994         IMPORT_C void CalculateWidth(TInt aWidthInChars);
00995 
01003         IMPORT_C void GetText(TDes& aDes) const;
01004         
01010     IMPORT_C HBufC* GetTextInHBufL() const;
01011 
01019         IMPORT_C void SetTextL(const TDesC* aDes);
01020 
01027         IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
01028 
01036         IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType);
01037 
01041         IMPORT_C void UpdateAllFieldsL();
01042         
01050     IMPORT_C void UpdateCurrentFieldL();
01051         
01057     IMPORT_C TInt CountWords();
01058 
01067     IMPORT_C void InsertFromTextFileL(const TFileName &aFileName,
01068                     const CPlainText::TTextOrganisation 
01069                     aTextOrganisation=CPlainText::EOrganiseByLine);
01070 
01077     IMPORT_C static TInt IdleL(TAny *aPtr);
01078 
01085     IMPORT_C CPlainText* Text() const;
01086 
01087     // this is particularly important for when the front-end processor is 
01088     // inline-editing a CEikEdwin
01102     IMPORT_C void CancelFepTransaction(); 
01103     
01109     IMPORT_C void HandleTextChangedL();
01110         
01118     IMPORT_C TInt LayoutWidth() const;
01119 
01123         IMPORT_C void NotifyNewDocumentL();
01124 
01128         IMPORT_C void NotifyNewFormatL();
01129         
01139     IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);
01140         
01153     IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);
01154         
01160     IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel);
01161 
01170         IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel);
01171 
01179         IMPORT_C void GetFindText(TDes* aFindText);
01180 
01184         IMPORT_C void UpdateScrollBarsL();
01185 
01192         IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL();
01193 
01199         inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();
01200     
01206         inline CEikScrollBarFrame* ScrollBarFrame();
01207     
01214         IMPORT_C void SetWordWrapL(TBool aWrapIsOn);
01215         
01221     IMPORT_C virtual TInt LineCursorWidth() const;
01222         
01228     IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor);
01229         
01235     IMPORT_C void SetBackgroundColorL(TRgb aBackground);
01236         
01243     IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth,
01244                                    MGraphicsDeviceMap* aDevice);
01245         
01250     IMPORT_C void SetWysiwygModeOff();
01251         
01258     IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); 
01259         
01263     IMPORT_C void SendDataOverIrL();
01264         
01270     IMPORT_C void ReceiveDataOverIrL();
01271         
01288         IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse);
01289 
01312     IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat );
01313 
01320     IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore);
01321         
01330     IMPORT_C void PasteFromStoreL(CStreamStore& aStore, 
01331                                   CStreamDictionary& aDict);
01332         
01339     IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict);
01340         
01346     IMPORT_C void SetBorderViewMargins(TMargins8 aMargins);
01347         
01351     IMPORT_C void ForceScrollBarUpdateL();
01352         
01362     IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner);
01363         
01370     IMPORT_C void SetTextLimit(TInt aLimit);
01371         
01377     IMPORT_C void RunCharMapDialogL();
01378         
01384     IMPORT_C TMargins8 Margins() const;
01385         
01395     IMPORT_C TInt UpperFullFormattingLength() const;
01396         
01410     IMPORT_C TInt LowerPartialFormattingLength() const;
01411         
01419     IMPORT_C void SetReadOnly(TBool aReadOnly);
01420         
01427     IMPORT_C TBool IsReadOnly() const;
01428         
01434     IMPORT_C void CheckNotReadOnlyL();
01435         
01442     IMPORT_C void SetAllowPictures(TBool aAllow);
01443         
01452     IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength);
01453         
01461     IMPORT_C void SetRightWrapGutter(TInt aGap);
01462         
01467     IMPORT_C void UndoL();
01468         
01472     IMPORT_C void ClearUndo();
01473         
01480     IMPORT_C void SetAllowUndo(TBool aAllow);
01481         
01488     IMPORT_C TBool SupportsUndo() const;
01489         
01497     IMPORT_C TBool CanUndo() const;
01498         
01508     IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation);
01509         
01518     IMPORT_C void GetWordInfo(TInt aCurrentPos,
01519                               TInt& aStartPos,
01520                               TInt& aLength) const;
01521         
01531     IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement,
01532                               TBool aSelect);
01533         
01540     IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement);
01541         
01551     IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength);
01552         
01559     IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly);
01560         
01566     IMPORT_C TBool OnlyASCIIChars() const;
01567         
01573     inline TInt AvgLinesInViewRect() const;
01574         
01580     inline TInt AvgCharsPerLine() const;
01581         
01587     inline void SetAvgLinesInViewRect(TInt aAvgLines);
01588         
01594     inline void SetAvgCharsPerLine(TInt aAvgChars);
01595         
01601     IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* 
01602                                             aEdwinSizeObserver);
01603         
01609     IMPORT_C TInt MinimumHeight() const;
01610 
01620         IMPORT_C TInt MaximumHeight() const;
01621     
01626         IMPORT_C void SetMinimumHeight(TInt aHeight);
01627 
01638         IMPORT_C void SetMaximumHeight(TInt aHeight);
01639 
01640 public: // new utility methods
01641 
01650         IMPORT_C void InsertDeleteCharsL(TInt aInsertPos,
01651                                      const TDesC& aText,
01652                                      const TCursorSelection& aDelete);
01653         
01659     IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility 
01660                                                 aVisibility);
01661         
01667     IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
01668 
01669 public: // new Avkon wrap interface
01670 
01676         IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn);
01677 
01678 public: // Avkon editor extensions
01679 
01689     IMPORT_C void SetAknEditorCase(TInt aCase);
01690 
01700     IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes);
01701 
01716     IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap 
01717                                             aNumericKeymap);
01718 
01727     IMPORT_C void SetAknEditorInputMode(TInt aInputMode);
01728 
01736     IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes);
01737 
01743     IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId);
01744 
01752     IMPORT_C void SetAknEditorFlags(TInt aFlags);
01753 
01760     IMPORT_C void EnableCcpuSupportL(TBool aSupport);
01761 
01772     IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode);
01773 
01780     IMPORT_C TInt AknEditorCurrentInputMode();
01781 
01792     IMPORT_C void SetAknEditorCurrentCase(TInt aCase);
01793 
01801     IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage);
01802 
01807     IMPORT_C void NotifyEditorStateObserverOfStateChangeL();
01808 
01819     IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
01820     
01826     IMPORT_C TBool IsBackgroundDrawingSuppressed() const;
01827     
01835     IMPORT_C void SetTextLinesRect( const TRect& aRect );
01836     
01840         IMPORT_C void SetScrollRect( const TRect & aRect );
01841 
01849     IMPORT_C TRect GetTextLinesRect() const;
01850     
01851 public:
01852 
01853     // These methods have been added for use with Avkon to set maximum 
01854     // editor heights.
01860         IMPORT_C void SetMaximumHeightInLines(TInt aLines);
01861 
01867         IMPORT_C TInt MaximumHeightInLines() const;
01868 
01869 public: // From MEikCcpuEditor
01870 
01876         IMPORT_C TBool CcpuIsFocused() const;
01877 
01883         IMPORT_C TBool CcpuCanCut() const;
01884 
01888         IMPORT_C void CcpuCutL();
01889         
01895     IMPORT_C TBool CcpuCanCopy() const;
01896 
01900         IMPORT_C void CcpuCopyL();
01901         
01907     IMPORT_C TBool CcpuCanPaste() const;
01908 
01912         IMPORT_C void CcpuPasteL();
01913         
01919     IMPORT_C TBool CcpuCanUndo() const;
01920 
01925         IMPORT_C void CcpuUndoL();
01926         
01932     IMPORT_C TInt AknEdwinFlags() const;
01933  
01934 
01935 public: // Internal to Symbian
01936         
01937     // the following methods are deprecated and will be removed in a future 
01938     // release
01942         IMPORT_C void CreateTextViewL();
01943 
01949         IMPORT_C CTextView* TextView() const;
01950 
01956         IMPORT_C CTextLayout* TextLayout() const;
01957 
01964         IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection);
01965 
01971     IMPORT_C void SetUndoableText(const TCursorSelection& aSelection);
01972 
01978         CAknEdwinState* EditorState() const;
01979 
01985         inline void SetMaxLength(TInt aLength);
01986 
01992         inline TInt MaxLength() const;
01993 
01994 public:
01995 
01996         // added to get access to user flags without a get/set for every different
01997     // flag.
02004         IMPORT_C void AddFlagToUserFlags(TUint32 aFlag);
02005         
02012     IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag);
02013 
02020         IMPORT_C TUint32 UserFlags() const ;
02021 
02022 public:
02023 
02029         IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer);
02030         
02036     IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer);
02037 
02038 
02039 public: // Skins support
02040 
02056     IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* 
02057                                                     aContext );
02058 
02072     MAknsControlContext* SkinBackgroundControlContext() const;
02073 
02084     TBool SkinEnabled() const;
02085 
02096         IMPORT_C void SetAlignment(TInt aAlignment);
02097 
02098 public: // Pictograph support
02099 
02103     void DrawTextView() const;
02104 
02113     IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack );
02114 
02121     const TCallBack& PictographAnimationCallBack() const;
02122 
02151     IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit );
02152     
02160         IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled );    
02161 
02172     IMPORT_C void SetSuppressFormatting( TBool aSuppressed );
02173             
02174 protected:
02175 
02179         enum TEnd
02180                 {
02182                 EStart,
02183 
02185                 EEnd   
02186                 };
02187 
02191         enum TChunkSize
02192                 {
02194                 EChunkWord,
02195 
02197                 EChunkPara
02198                 };
02199 
02203         enum TEikEdwinFlags // Internal flags
02204                 { 
02206                 ERichText           =0x00000001,
02207                 
02209         EDragDouble                     =0x00000002,
02210                 
02215         ELeftDownInViewRect =0x00000004,
02216                 
02218         ENumericCharacters      =0x00000008, 
02219                 
02221         EHasOneLineOnly     =0x00000010,  
02222         
02227         EPhoneNumberGrouping = 0x00000020,
02228                 ESuppressNotifyDraw  = 0x00000040,
02229                 ESuppressFormatting  = 0x00000080 // Suppresses calls to formatting
02230         };
02231 
02232 protected: // from MEditObserver
02233     
02246         IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength);
02247 
02248 protected:
02249     
02257         IMPORT_C void TrappedDraw(const TRect& aRect) const;
02258     
02262         IMPORT_C void DrawContents();
02263         
02273     IMPORT_C void BaseConstructL();
02274         
02280     IMPORT_C void FormatTextL();
02281         
02295     IMPORT_C TInt DeleteHighlightL(TBool& aChanged, 
02296                                    TBool aIsBackSpace=EFalse,
02297                                    TBool aPromptConfirmation=ETrue);
02298         
02311     IMPORT_C TBool OkToDeleteSelectionL();
02312         
02327     IMPORT_C void DeleteL(TBool& aChanged,
02328                           const TCursorSelection& aSelection,
02329                           TBool aIsBackSpace=EFalse,
02330                           TBool aAllowUndo=ETrue);
02331         
02336     IMPORT_C void TrappedSizeChanged();
02337         
02343     IMPORT_C void HandleSizeChangedL();
02344         
02353     IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);
02354         
02366     IMPORT_C void MoveCursorToChunkStartL(TBool aSelect,
02367                                           TChunkSize aChunkSize,
02368                                           TEnd aEndScanningTowards);
02369         
02374     IMPORT_C void CancelInsertCharFormat();
02375         
02379     IMPORT_C void PlaceDataOnClipboardL();
02380         
02392     IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);
02393         
02397     IMPORT_C void SetLineCursorDetailsL();
02398         
02405     IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText,
02406                                                CGlobalText& aOutText);
02407         
02415     IMPORT_C void DisplayFindTextNotFound(TDes& aFindText);
02416         
02423     IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength);
02424         
02430     IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
02431         
02432     // Avkon editor extensions
02438     IMPORT_C void ReadAknResourceL(TResourceReader& aReader);
02439 
02440 protected: // Internal to Symbian
02441 
02448         IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc);
02449         
02458     IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer,
02459                                        CCharFormatLayer* aCharFormatLayer);
02460         
02466     IMPORT_C void CheckEdwinExtensionL();
02467         
02473     IMPORT_C CEikEdwinExtension* EdwinExtension();
02474 
02475 private:
02476 
02477         enum
02478                 { // internal flags
02479                 EWysiwygOn                                              =0x00000010,
02480                 EUnderOneScreenFormattedText    =0x00000020,
02481                 EPictureDelimits                                =0x00000040,
02482                 EPunctuationDelimits                    =0x00000080,
02483                 EPasteFromIrStore                               =0x00000100,
02484                 ELockScrollBarState                             =0x00000200,
02485                 EOnReformatting                                 =0x00000400
02486                 };
02487 
02488 private: // from CCoeControl
02489 
02490         IMPORT_C void SizeChanged();
02491         IMPORT_C TInt CountComponentControls() const;
02492         IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
02493         IMPORT_C void Reserved_2();
02494 
02495 private:
02496 
02497         IMPORT_C virtual void Reserved_3();
02498         IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL();
02499         IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc);
02500         void SetVirtualCursorStateL(TBool aIsFocused) const;
02501         void SetHeightForNumOfLinesL();
02502         void ApplyAutoSelectionL();
02503         void SetScrollBarsL();
02504         void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const;
02505         void RetrieveDataFromClipboardL();
02506         void SetCursorVisibilityL(TBool aEmphasis);
02507         TBool OwnsScrollBars() const;
02508         void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
02509         void UpdateHorizScrollBarThumb();
02510         void UpdateVertScrollBarThumbL();
02511         void DoSetUndoBufferL(const TCursorSelection& aSelection);
02512         void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict);
02513         void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced);
02514         void DeleteExtraParasL(TInt aStartPos,TInt aLength);
02515         TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength);
02516         TBool IsValidChar(TInt aChar) const;
02517         TInt CalcMinimumHeightFromNumOfLinesL() const;
02518         void CheckEdwinHeight();
02519         TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const;
02520         void SetEdwinHeight(TInt aHeight);
02521         void DoCreateCustomDrawL();
02522         void SetCursorSizeAndType();
02523         TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
02524         void DoCcpuCanPasteL() const;
02525         void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent);
02526         void CheckIfEdwinIsResizable();
02527         void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const;
02528         HBufC* GetAllowedCharsLC() const;
02529         TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const;
02530 
02531         TInt CursorWidth() const;
02532         TFontSpec CursorFontSpec() const;
02533 
02534         void BuildEdwinFepSupport();
02535         void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer);
02536         void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer);
02537     void UpdateCache(TInt aId);
02538         void DrawBackgroundAroundTextView( 
02539                 CWindowGc& gc, 
02540                 const TRect& aOuterRect, 
02541                 const TRect& aInnerRect, 
02542                 const TRgb& aBackgroundColor  ) const;
02543         TInt CurrentAlignment() const;
02544         void DoAlignment();
02545         void NewParagraphL();
02546     TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode);
02547     void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength );
02548 
02549 private:
02550 
02551         void DrawFirstLineTextL() const;
02552     CAknEdwinDrawingModifier* AknEdwinDrawingModifier();
02553     TBool EditorSupportsNeutralProtection() const;
02554 
02566     TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded );
02567 
02576     TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const;
02577 
02584     TBool CharIsNeutral( TInt aPos ) const;
02585 
02600     TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const;
02601 
02614     TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const;
02615 
02632     void ReplaceSelectionWithTextL( const TDesC& aNewText, 
02633                                     TInt aCursorPosInNewText,
02634                                     TBool& aFormatHasChanged );
02635 
02645     TBool IsPurePhoneNumberEditor() const;
02646 
02652     TBool NeedToChangeFormattingModeL() const;          
02653     
02658     void CalculateLineMetricsForBandFormattingL();
02659 
02660 protected:      // from MObjectProvider
02661 
02679         IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
02680         
02681 public: // new since 3.0
02682 
02688     IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor);
02689 
02695     IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle);
02696     
02697     // for custom drawer, not exported
02703     TInt SkinColorId() const;
02704 
02710     TAknsHighlightStyle HighlightStyle() const;
02711     
02732     TRgb EditorBackgroundColor(TRgb& aConditionalColor) const;
02733                 
02734         
02735 protected:
02736 
02740         TUint32 iEdwinUserFlags;
02741 
02745         TUint32 iEdwinInternalFlags;
02746 
02750         CPlainText* iText;
02751 
02752 protected: // Internal to Symbian
02753 
02757         CTextView* iTextView;
02758 
02762         CTextLayout* iLayout;
02763 
02764 protected:
02765 
02769         TInt iTextLimit;
02770     
02774         TInt iNumberOfLines;
02775         
02779     MGraphicsDeviceMap* iZoomFactor;
02780         
02784     TInt iLastPointerDocPos;
02785         
02789     TMargins8 iMargins;
02790 
02791 private:
02792 
02793         friend class CEikEdwinFepSupport;
02794         friend class CEikEdwinExtension;
02795         // added this class to allow additional data members without breaking BC
02796         CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar
02797         CEikScrollBarFrame* iSBFrame;
02798         MEikEdwinObserver* iEdwinObserver;
02799         CArrayPtr<MEikEdwinObserver>* iObserverArray;
02800         CEikEdwinFepSupport* iEdwinFepSupport;
02801         CUndoBuffer* iUndoStore;
02802         TInt iAvgLinesInViewRect;
02803         TInt iAvgCharsPerLine;
02804         TInt iRightWrapGutter;
02805         TInt iLayoutWidth;
02806         MEikEdwinSizeObserver* iEdwinSizeObserver;
02807         TInt iMinimumHeight;
02808         TInt iMaximumHeight;
02809 /* 
02810 iMaximumHeightInLines
02811 ---------------------
02812 This is simply a holder for the number, used to simplify some Avkon LAF requirements.
02813 The viewable region of an edwin is actually measured in pixels, However, if certain LAF
02814 requirements are enforced (that the view region has to be smaller than the number of 
02815 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects
02816 occur.
02817 
02818 
02819 That is to say, by simply setting iMaximumHeightInLines, this will not affect
02820 the actual maximum height of the edwin.  To do this, you must set the iMaximumHeight
02821 
02822 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. 
02823 That method uses iMaximumHeightInLines along with the baseline separation, to set 
02824 the iMaximumHeight.
02825 
02826 The general formula is very simple, to remove unneeded scrolling.
02827 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines
02828 
02829 If you cannot allocate sufficient space to the edwin, to permit so much viewable region
02830 then the method AlterViewRect can be called on the TextView() component.  This will introduce
02831 a clipping rectangle, which allows blank space required by the edwin layout component
02832 to not be shown.
02833 */
02834         TInt iMaximumHeightInLines; 
02835         CLafEdwinCustomDrawBase* iCustomDrawer;
02836         TInt iLastPointerAnchorPos;
02837         CAknCcpuSupport* iCcpuSupport;
02838         CCharFormatLayer* iCharFormatLayer;
02839         CParaFormatLayer* iParaFormatLayer;
02840         TInt iSpare_1;
02841         TInt iSpare_2;
02842         };
02843 
02844 
02845 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL()
02846         { return CreateScrollBarFrameL(ETrue);}
02847 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame()
02848         { return ((CEikScrollBarFrame* const)iSBFrame); }
02849 inline TInt CEikEdwin::AvgLinesInViewRect() const
02850         { return iAvgLinesInViewRect; }
02851 inline TInt CEikEdwin::AvgCharsPerLine() const
02852         { return iAvgCharsPerLine;}
02853 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines)
02854         { iAvgLinesInViewRect=aAvgLines; }
02855 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars)
02856         { iAvgCharsPerLine=aAvgChars; }
02857 
02858 inline void CEikEdwin::SetMaxLength(TInt aLength ) 
02859         { SetTextLimit(aLength); }
02860 inline TInt CEikEdwin::MaxLength() const 
02861         { return iTextLimit; }
02862 
02863 #endif

Copyright © Nokia Corporation 2001-2008
Back to top