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 class CAknPointerEventSuppressor;
00051 
00052 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
00053 class CEikAvkonCustomDraw;
00054 
00055 // Forward declaration of now removed (Series 60 2.0) custom drawer class for CEikEdwin
00056 class CEikAvkonCustomDraw;
00057 
00058 // For construction of Rich Text - based custom formatters
00059 class CRichText;
00060 
00061 enum TReplaceOption
00062         {
00063         ENoReplace,
00064         EReplaceOnce,
00065         EReplaceAll,
00066         EReplaceSkip
00067         };
00068 
00075 struct SEdwinFindModel
00076         {
00078         TInt iFlags; // TEdwinFindFlags
00080         TBuf<EEikEdwinFindStringMaxLen> iText;
00082         TBuf<EEikEdwinFindStringMaxLen> iReplaceText;
00084         TReplaceOption iReplaceOption;
00085         };
00086 
00090 enum TAknsHighlightStyle
00091     {
00093     EEikEdwinHighlightNormal = 0,
00095     EEikEdwinHighlightLink
00096     };
00097 
00098 // inline utility to handle RGB values (set / unset)      
00099 
00100 class SAknRgb
00101     {
00102 // data (private)    
00103     TRgb iValue;
00104     TBool iIsSet;
00105 public: // utilities   
00106     SAknRgb():iIsSet(EFalse){}
00107     TRgb Value(){return iValue;}
00108     SAknRgb& operator=(TRgb aRgb)
00109         {
00110         iValue = aRgb;
00111         iIsSet = ETrue;
00112         return *this;
00113         }
00114     TBool IsSet(){return iIsSet;}
00115     };    
00116 
00127 class CEikEdwin : public CEikBorderedControl, 
00128                   public MEikScrollBarObserver, 
00129                   public CTextView::MObserver, 
00130                   public MEditObserver, 
00131                   public MEikCcpuEditor
00132         {
00133 
00134 private:
00135 
00136     class CUndoBuffer;
00137     NONSHARABLE_CLASS(CEikEdwinExtension) : public CBase, MCenRepNotifyHandlerCallback
00138         {
00139     public:
00146                 static CEikEdwinExtension* NewL(CEikEdwin* aEdwin);
00147                 
00151                 ~CEikEdwinExtension();
00152                 
00158                 IMPORT_C CAknEdwinFormAccessor* FormAccessor() const;
00159                 
00165                 IMPORT_C void SetFormAccessor(CAknEdwinFormAccessor* aFormAccessor);
00166                 
00172                 IMPORT_C void SetScrollBarSetter(CIdle* aScrollBarSetter);
00173                 
00179                 IMPORT_C CIdle* ScrollBarSetter();
00180                 
00186                 IMPORT_C const TAvkonEditorCustomWrap& TextWrapper();
00187 
00188                 // the following two methods are deprecated
00189         IMPORT_C CFormCursorModifier* FormCursorModifier() const;
00190         
00196         void SetSkinBackgroundControlContext( MAknsControlContext* aBackgroundControlContext );
00197         
00204         MAknsControlContext* SkinBackgroundControlContext() const;
00205         
00212         TBool SkinBackgroundControlContextHasBeenSet() const;
00213 
00219         void SetAlignment(TInt aAlignment);
00220 
00226         TInt CurrentAlignment() const;
00227 
00231         void SetPictoCallBack( TCallBack& aCallBack );
00232 
00236         const TCallBack& PictoCallBack() const;
00237 
00241         void CreateFormExtendedInterfaceProviderIfNeededL();
00242 
00246         CAknEdwinFormExtendedInterfaceProvider* FormExtendedInferfaceProvider() const;
00247 
00257         void CreatePurePhoneNumberFormatterL( CTextLayout& aTextLayout, const CPlainText& aText);
00258 
00267         void CreateNoMatchesIndicatorFormatterL( CTextLayout& aTextLayout );
00268 
00278         void CreateRichTextPhoneNumberFormatterL( CTextLayout& aTextLayout, const CRichText& aText );
00279 
00287         CAknInlineTextSource* InlineTextSource() const;
00288 
00294         CAknPictographInterface* PictographInterface() const;
00295         
00299         void SetSuppressBackgroundDrawing( TBool aSuppress );
00300         
00304         TBool IsBackgroundDrawingSuppressed() const;
00305 
00311         TInt ClearDirection() const;
00312 
00313     public: // from MCenRepNotifyHandlerCallback
00314         void HandleNotifyInt(TUint32 aId, TInt aNewValue);
00315 
00316     private:
00317 
00318         CEikEdwinExtension();
00319         void ConstructL(CEikEdwin* aEdwin);
00320 
00321     private:
00322 
00323         enum TFlagIndices
00324             {
00325             ESkinBackgroundControlContextHasBeenSetIndex = 0,
00326             ESuppressBackgroundDrawing
00327             };
00328         class TAknEdwinPictographDrawer : public MAknPictographAnimatorCallBack
00329             {
00330             private: // From MAknPictographAnimatorCallBack
00331                 void DrawPictographArea();
00332             };        
00333         
00334         private:
00335 
00336                 CIdle* iSetScrollBar;
00337                 TAvkonEditorCustomWrap iTextWrapper;
00338                 CAknEdwinFormAccessor* iFormAccessor;
00339         CFormCursorModifier* iFormCursorModifier;
00340         MAknsControlContext* iSkinBackgroundControlContext;
00341         TBitFlags iFlags;
00342         TInt iAlignment;
00343         TCallBack iPictoCallBack;       
00344         CAknEdwinFormExtendedInterfaceProvider* iFormExtendedInterfaceProvider; // Owned
00345         CAknInlineTextSource* iPhoneNumberFormatter;                 // Not owned
00346         CAknNoMatchesIndicatorInlineTextSource* iNoMatchesIndicatorFormatter;   // Not owned
00347         TAknEdwinPictographDrawer iPictographDrawer;
00348         CAknPictographInterface* iPictographInterface;
00349         // For clear direction.
00350         CRepository* iCenRep;                           // Owned
00351         CCenRepNotifyHandler* iCenRepNotifyHandler;     // Owned
00352         TInt iClearDirection;                           // Value of ClearDirection
00353      public:
00354 
00355         TInt iSkinIdForText;
00356         TAknsHighlightStyle iSkinHighlightStyle;
00357         SAknRgb iEditorBackgroundColor;
00358         TInt iUpperFullFormattingLength;
00359         CAknExtendedInputCapabilities* iExtendedInputCapabilities;
00360         TRect iTextLinesRect;
00361         TRect iScrollRect;
00362         TInt iTempCursorPos;
00363         TInt iTempAnchorPos;
00364         TInt iTempSelect;
00365         CAknPointerEventSuppressor* iPtSuppressor;
00366         TBool iDragging;
00367         TInt iRecordCursor;
00368         TBool iRecordScroll;
00374         TBool* iDestroyedPtr;
00375         enum TDrawState
00376             {
00377             ENotDraw = 0,
00378             EDrawn,
00379             EDrawing
00380             };
00381         TInt iDrawInvoked;
00382         TInt iThumbPos;        
00383                 };
00384 
00385 public:
00386 
00395     enum TFlags
00396         { // user flags
00398         EZeroEnumValue                  =0x00000000, 
00399 
00403         EKeepDocument                   =0x00000001,
00404 
00409         ESegmentedStorage               =0x00000002,
00410 
00415         EWidthInPixels                  =0x00000004,
00416 
00422         ENoAutoSelection                =0x00000008,
00423 
00428         EJustAutoCurEnd                 =0x00000010,
00429 
00433         ENoWrap                                 =0x00000020,
00434 
00438         ELineCursor                             =0x00000040, 
00439 
00443         ENoHorizScrolling               =0x00000080, 
00444 
00451         EInclusiveSizeFixed             =0x00000100, 
00452 
00457         EUserSuppliedText               =0x00000200,
00458 
00462         EOwnsWindow                             =0x00000400,
00463 
00467         EDisplayOnly                    =0x00000800,
00468 
00472         EAlwaysShowSelection    =0x00001000,
00473 
00478         EReadOnly                               =0x00002000,
00479 
00485         EAllowPictures                  =0x00004000,
00486 
00490         EAllowUndo                              =0x00008000,
00491 
00495         ENoLineOrParaBreaks             =0x00010000,
00496 
00500         EOnlyASCIIChars                 =0x00020000,
00501 
00505         EResizable                              =0x00040000,
00506 
00510         EIgnoreVirtualCursor    =0x00080000,
00511 
00515         ENoCustomDraw                   =0x01000000,
00516 
00520         EAvkonEditor                    =0x02000000,
00521 
00525         EAvkonDisableCursor             =0x04000000,
00526 
00530         EAvkonNotEditable               =0x08000000, 
00531 
00535         EEdwinAlternativeWrapping = 0x10000000,
00536         
00540         EAvkonTabsEnabled = 0x20000000,
00541         
00545         EAvkonDisableVKB = 0x40000000
00546         };
00547 
00551     enum TClipboardFunc
00552                 {
00554                 ENoClipboard,
00555 
00557                 ECut,
00558 
00560                 ECopy,
00561 
00563                 EPaste
00564                 };
00565 
00570         enum TFindFlags
00571                 {
00573                 EFindDirectionUp        =0x01,
00574 
00576                 EFindWholeWord          =0x02,
00577 
00579                 EFindCaseSensitive      =0x04,
00580 
00582                 EFindAgain                      =0x08,
00583 
00585                 ENoBusyMessage          =0x10,
00586 
00588                 EReadOnlyFile           =0x20 // New for CKon
00589                 };
00590 
00596         enum TSetContent
00597                 {
00599                 EUseText,
00600 
00602                 ECopyText
00603                 };
00604 
00611         enum TOwnershipType
00612                 {
00614                 EOwnsText,
00615 
00617                 EDoesNotOwnText
00618                 };
00619 
00620     // order of hotkeys defined in resource file.  Not all applicable to plain 
00621     // text editors
00628         enum TEdwinHotKeys 
00629                 {
00631                 EHotKeyCut,
00632 
00634                 EHotKeyCopy,
00635 
00637                 EHotKeyPaste,
00638 
00640                 EHotKeyUndo,
00641 
00643         EHotKeyFind,
00644 
00646                 EHotKeyInsertChar,
00647 
00649                 EHotKeyBold,
00650 
00652                 EHotKeyItalic,
00653 
00655                 EHotKeyUnderline,
00656 
00658                 EHotKeyFont,
00659 
00661                 EHotKeyInsertObject,
00662 
00664                 EHotKeyEditObject,
00665 
00667                 EHotKeyFormatObject
00668                 };
00669 
00670 public: // construction and destruction
00671 
00678     IMPORT_C ~CEikEdwin();
00679 
00686         IMPORT_C CEikEdwin();
00687 
00697         IMPORT_C CEikEdwin(const TGulBorder& aBorder);
00698     
00713         IMPORT_C void ConstructL(TInt aEdwinFlags=0,
00714                              TInt aWidthInChars=0,
00715                              TInt aTextLimit=0,
00716                              TInt aNumberOfLines=0);
00717         
00724     IMPORT_C void SetEdwinObserver(MEikEdwinObserver* aEdwinObserver);
00725         
00733     IMPORT_C void AddEdwinObserverL(MEikEdwinObserver* aEdwinObserver);
00734         
00741     IMPORT_C void RemoveEdwinObserver(MEikEdwinObserver* aEdwinObserver);
00742         
00746     IMPORT_C void SetContainerWindowL();
00747         
00757     IMPORT_C void SetDocumentContentL(CGlobalText& aText,
00758                         TSetContent aContent=CEikEdwin::ECopyText);
00759 
00760 public: // from CCoeControl
00761     
00772     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
00773                                          TEventCode aType);
00774         
00782     IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00783         
00791     IMPORT_C void ActivateL();
00792         
00801     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00802         
00810     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00811         
00820     IMPORT_C TSize MinimumSize();
00821         
00829     IMPORT_C void Draw(const TRect& aRect) const;
00830         
00838     IMPORT_C void SetDimmed(TBool aDimmed);
00839         
00849     IMPORT_C void SetContainerWindowL(const CCoeControl& aParent);
00850         
00860     IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& 
00861                      aColorUseList) const; // not available before Release 005u
00862         
00863     // not available before Release 005u    
00872     IMPORT_C virtual void HandleResourceChange(TInt aType);
00873     
00887     IMPORT_C TCoeInputCapabilities InputCapabilities() const;
00888     
00899     IMPORT_C void SetInputCapabilitiesL(const TCoeInputCapabilities& 
00900                                         aInputCapabilities); 
00901 
00910     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00911 
00912 private:
00913 
00917     IMPORT_C void* ExtensionInterface( TUid aInterface );
00918 
00919 public: // from MEikScrollBarObserver
00920 
00929         IMPORT_C void HandleScrollEventL(CEikScrollBar* aScrollBar, 
00930                                      TEikScrollEvent aEventType); 
00931 
00932 public: // from CTextView::MObserver
00933         
00942     IMPORT_C void OnReformatL(const CTextView* aTextView);
00943 
00944 public:
00945     
00951         IMPORT_C TInt TextLength() const;
00952 
00958         IMPORT_C TInt CursorPos() const;
00959 
00966         IMPORT_C TInt SelectionLength() const;
00967 
00974         IMPORT_C TCursorSelection Selection() const;
00975 
00980         IMPORT_C void ClearSelectionL();
00981 
00990         IMPORT_C void SetSelectionL(TInt aCursorPos,TInt aAnchorPos);
00991 
01002         IMPORT_C void SetCursorPosL(TInt aCursorPos,TBool aSelect);
01003 
01007         IMPORT_C void SelectAllL();
01008 
01021         IMPORT_C void CalculateWidth(TInt aWidthInChars);
01022 
01030         IMPORT_C void GetText(TDes& aDes) const;
01031         
01037     IMPORT_C HBufC* GetTextInHBufL() const;
01038 
01046         IMPORT_C void SetTextL(const TDesC* aDes);
01047 
01054         IMPORT_C void ClipboardL(TClipboardFunc aClipboardFunc);
01055 
01063         IMPORT_C void InsertFieldL(CTextField* aField, TUid aFieldType);
01064 
01068         IMPORT_C void UpdateAllFieldsL();
01069         
01077     IMPORT_C void UpdateCurrentFieldL();
01078         
01084     IMPORT_C TInt CountWords();
01085 
01094     IMPORT_C void InsertFromTextFileL(const TFileName &aFileName,
01095                     const CPlainText::TTextOrganisation 
01096                     aTextOrganisation=CPlainText::EOrganiseByLine);
01097 
01104     IMPORT_C static TInt IdleL(TAny *aPtr);
01105 
01112     IMPORT_C CPlainText* Text() const;
01113 
01114     // this is particularly important for when the front-end processor is 
01115     // inline-editing a CEikEdwin
01129     IMPORT_C void CancelFepTransaction(); 
01130     
01136     IMPORT_C void HandleTextChangedL();
01137         
01145     IMPORT_C TInt LayoutWidth() const;
01146 
01150         IMPORT_C void NotifyNewDocumentL();
01151 
01155         IMPORT_C void NotifyNewFormatL();
01156         
01166     IMPORT_C TBool FindL(const TDesC* aFindText,TInt aFindFlags=0);
01167         
01180     IMPORT_C TInt FindTextL(const TDesC* aFindText,TInt aPos,TInt aFindFlags);
01181         
01187     IMPORT_C void ReplaceL(SEdwinFindModel* aFindModel);
01188 
01197         IMPORT_C void ReplaceAllL(SEdwinFindModel* aFindModel);
01198 
01206         IMPORT_C void GetFindText(TDes* aFindText);
01207 
01211         IMPORT_C void UpdateScrollBarsL();
01212 
01219         IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL();
01220 
01226         inline CEikScrollBarFrame* CreatePreAllocatedScrollBarFrameL();
01227     
01233         inline CEikScrollBarFrame* ScrollBarFrame();
01234     
01241         IMPORT_C void SetWordWrapL(TBool aWrapIsOn);
01242         
01248     IMPORT_C virtual TInt LineCursorWidth() const;
01249         
01255     IMPORT_C void SetZoomFactorL(TZoomFactor* aZoomFactor);
01256         
01262     IMPORT_C void SetBackgroundColorL(TRgb aBackground);
01263         
01270     IMPORT_C void SetWysiwygModeOn(TInt aLayoutWidth,
01271                                    MGraphicsDeviceMap* aDevice);
01272         
01277     IMPORT_C void SetWysiwygModeOff();
01278         
01285     IMPORT_C void UpdateLayoutWidth(TInt aLayoutWidth); 
01286         
01290     IMPORT_C void SendDataOverIrL();
01291         
01297     IMPORT_C void ReceiveDataOverIrL();
01298         
01315         IMPORT_C void SetAmountToFormatL(TBool aIsNewDoc=EFalse);
01316 
01339     IMPORT_C void SetAmountToFormatL( TBool aIsNewDoc, TBool aReFormat );
01340 
01347     IMPORT_C void SetPasteFromIrStore(TBool aPasteFromIrStore);
01348         
01357     IMPORT_C void PasteFromStoreL(CStreamStore& aStore, 
01358                                   CStreamDictionary& aDict);
01359         
01366     IMPORT_C void CopyToStoreL(CStreamStore& aStore, CStreamDictionary& aDict);
01367         
01373     IMPORT_C void SetBorderViewMargins(TMargins8 aMargins);
01374         
01378     IMPORT_C void ForceScrollBarUpdateL();
01379         
01389     IMPORT_C void SetDocumentOwnership(TOwnershipType aOwner);
01390         
01397     IMPORT_C void SetTextLimit(TInt aLimit);
01398         
01404     IMPORT_C void RunCharMapDialogL();
01405         
01411     IMPORT_C TMargins8 Margins() const;
01412         
01422     IMPORT_C TInt UpperFullFormattingLength() const;
01423         
01437     IMPORT_C TInt LowerPartialFormattingLength() const;
01438         
01446     IMPORT_C void SetReadOnly(TBool aReadOnly);
01447         
01454     IMPORT_C TBool IsReadOnly() const;
01455         
01461     IMPORT_C void CheckNotReadOnlyL();
01462         
01469     IMPORT_C void SetAllowPictures(TBool aAllow);
01470         
01479     IMPORT_C void CheckRemovePictures(TInt aStartPos,TInt aLength);
01480         
01488     IMPORT_C void SetRightWrapGutter(TInt aGap);
01489         
01494     IMPORT_C void UndoL();
01495         
01499     IMPORT_C void ClearUndo();
01500         
01507     IMPORT_C void SetAllowUndo(TBool aAllow);
01508         
01515     IMPORT_C TBool SupportsUndo() const;
01516         
01524     IMPORT_C TBool CanUndo() const;
01525         
01535     IMPORT_C void SetWordDelimiters(TBool aPicture,TBool aPunctuation);
01536         
01545     IMPORT_C void GetWordInfo(TInt aCurrentPos,
01546                               TInt& aStartPos,
01547                               TInt& aLength) const;
01548         
01558     IMPORT_C void MoveCursorL(TCursorPosition::TMovementType aMovement,
01559                               TBool aSelect);
01560         
01567     IMPORT_C void MoveDisplayL(TCursorPosition::TMovementType aMovement);
01568         
01578     IMPORT_C void CheckValidityOfChars(TInt aStartPos,TInt aLength);
01579         
01586     IMPORT_C void SetOnlyASCIIChars(TBool aASCIIOnly);
01587         
01593     IMPORT_C TBool OnlyASCIIChars() const;
01594         
01600     inline TInt AvgLinesInViewRect() const;
01601         
01607     inline TInt AvgCharsPerLine() const;
01608         
01614     inline void SetAvgLinesInViewRect(TInt aAvgLines);
01615         
01621     inline void SetAvgCharsPerLine(TInt aAvgChars);
01622         
01628     IMPORT_C void SetEdwinSizeObserver(MEikEdwinSizeObserver* 
01629                                             aEdwinSizeObserver);
01630         
01636     IMPORT_C TInt MinimumHeight() const;
01637 
01647         IMPORT_C TInt MaximumHeight() const;
01648     
01653         IMPORT_C void SetMinimumHeight(TInt aHeight);
01654 
01665         IMPORT_C void SetMaximumHeight(TInt aHeight);
01666 
01667 public: // new utility methods
01668 
01677         IMPORT_C void InsertDeleteCharsL(TInt aInsertPos,
01678                                      const TDesC& aText,
01679                                      const TCursorSelection& aDelete);
01680         
01686     IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility 
01687                                                 aVisibility);
01688         
01694     IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
01695 
01696 public: // new Avkon wrap interface
01697 
01703         IMPORT_C void SetAvkonWrap(TBool aAvkonWrapIsOn);
01704 
01705 public: // Avkon editor extensions
01706 
01716     IMPORT_C void SetAknEditorCase(TInt aCase);
01717 
01727     IMPORT_C void SetAknEditorPermittedCaseModes(TInt aPermittedCaseModes);
01728 
01743     IMPORT_C void SetAknEditorNumericKeymap(TAknEditorNumericKeymap 
01744                                             aNumericKeymap);
01745 
01754     IMPORT_C void SetAknEditorInputMode(TInt aInputMode);
01755 
01763     IMPORT_C void SetAknEditorAllowedInputModes(TInt aInputModes);
01764 
01770     IMPORT_C void SetAknEditorSpecialCharacterTable(TInt aSCTResId);
01771 
01779     IMPORT_C void SetAknEditorFlags(TInt aFlags);
01780 
01787     IMPORT_C void EnableCcpuSupportL(TBool aSupport);
01788 
01799     IMPORT_C void SetAknEditorCurrentInputMode(TInt aInputMode);
01800 
01807     IMPORT_C TInt AknEditorCurrentInputMode();
01808 
01819     IMPORT_C void SetAknEditorCurrentCase(TInt aCase);
01820 
01828     IMPORT_C void SetAknEditorLocalLanguage(TLanguage aLanguage);
01829 
01834     IMPORT_C void NotifyEditorStateObserverOfStateChangeL();
01835 
01846     IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
01847     
01853     IMPORT_C TBool IsBackgroundDrawingSuppressed() const;
01854     
01862     IMPORT_C void SetTextLinesRect( const TRect& aRect );
01863     
01867         IMPORT_C void SetScrollRect( const TRect & aRect );
01868 
01876     IMPORT_C TRect GetTextLinesRect() const;
01877     
01881     IMPORT_C void SetCursorVisible(TBool aVisible);
01882 public:
01883 
01884     // These methods have been added for use with Avkon to set maximum 
01885     // editor heights.
01891         IMPORT_C void SetMaximumHeightInLines(TInt aLines);
01892 
01898         IMPORT_C TInt MaximumHeightInLines() const;
01899 
01900 public: // From MEikCcpuEditor
01901 
01907         IMPORT_C TBool CcpuIsFocused() const;
01908 
01914         IMPORT_C TBool CcpuCanCut() const;
01915 
01919         IMPORT_C void CcpuCutL();
01920         
01926     IMPORT_C TBool CcpuCanCopy() const;
01927 
01931         IMPORT_C void CcpuCopyL();
01932         
01938     IMPORT_C TBool CcpuCanPaste() const;
01939 
01943         IMPORT_C void CcpuPasteL();
01944         
01950     IMPORT_C TBool CcpuCanUndo() const;
01951 
01956         IMPORT_C void CcpuUndoL();
01957         
01963     IMPORT_C TInt AknEdwinFlags() const;
01964  
01965 
01966 public: // Internal to Symbian
01967         
01968     // the following methods are deprecated and will be removed in a future 
01969     // release
01973         IMPORT_C void CreateTextViewL();
01974 
01980         IMPORT_C CTextView* TextView() const;
01981 
01987         IMPORT_C CTextLayout* TextLayout() const;
01988 
01995         IMPORT_C TBool SetUndoBufferL(const TCursorSelection& aSelection);
01996 
02002     IMPORT_C void SetUndoableText(const TCursorSelection& aSelection);
02003 
02009         CAknEdwinState* EditorState() const;
02010 
02016         inline void SetMaxLength(TInt aLength);
02017 
02023         inline TInt MaxLength() const;
02024 
02025 public:
02026 
02027         // added to get access to user flags without a get/set for every different
02028     // flag.
02035         IMPORT_C void AddFlagToUserFlags(TUint32 aFlag);
02036         
02043     IMPORT_C void RemoveFlagFromUserFlags(TUint32 aFlag);
02044 
02051         IMPORT_C TUint32 UserFlags() const ;
02052 
02053 public:
02054 
02061         IMPORT_C void SetCharFormatLayer(CCharFormatLayer* aCharFormatLayer);
02062         
02069     IMPORT_C void SetParaFormatLayer(CParaFormatLayer* aParaFormatLayer);
02070 
02071 
02072 public: // Skins support
02073 
02089     IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* 
02090                                                     aContext );
02091 
02105     MAknsControlContext* SkinBackgroundControlContext() const;
02106 
02117     TBool SkinEnabled() const;
02118 
02129         IMPORT_C void SetAlignment(TInt aAlignment);
02130 
02131 public: // Pictograph support
02132 
02136     void DrawTextView() const;
02137 
02146     IMPORT_C void SetPictographAnimationCallBack( TCallBack& aCallBack );
02147 
02154     const TCallBack& PictographAnimationCallBack() const;
02155 
02184     IMPORT_C void SetUpperFullFormattingLength( TInt aUpperFullFormattingLimit );
02185     
02193         IMPORT_C void SetSuppressNotifyDraw( TBool aEnabled );    
02194 
02205     IMPORT_C void SetSuppressFormatting( TBool aSuppressed );
02206             
02207 protected:
02208 
02212         enum TEnd
02213                 {
02215                 EStart,
02216 
02218                 EEnd   
02219                 };
02220 
02224         enum TChunkSize
02225                 {
02227                 EChunkWord,
02228 
02230                 EChunkPara
02231                 };
02232 
02236         enum TEikEdwinFlags // Internal flags
02237                 { 
02239                 ERichText           =0x00000001,
02240                 
02242         EDragDouble                     =0x00000002,
02243                 
02248         ELeftDownInViewRect =0x00000004,
02249                 
02251         ENumericCharacters      =0x00000008, 
02252                 
02254         EHasOneLineOnly     =0x00000010,  
02255         
02260         EPhoneNumberGrouping = 0x00000020,
02261                 ESuppressNotifyDraw  = 0x00000040,
02262                 ESuppressFormatting  = 0x00000080 // Suppresses calls to formatting
02263         };
02264 
02265 protected: // from MEditObserver
02266     
02279         IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength);
02280 
02281 protected:
02282     
02290         IMPORT_C void TrappedDraw(const TRect& aRect) const;
02291     
02295         IMPORT_C void DrawContents();
02296         
02306     IMPORT_C void BaseConstructL();
02307         
02313     IMPORT_C void FormatTextL();
02314         
02328     IMPORT_C TInt DeleteHighlightL(TBool& aChanged, 
02329                                    TBool aIsBackSpace=EFalse,
02330                                    TBool aPromptConfirmation=ETrue);
02331         
02344     IMPORT_C TBool OkToDeleteSelectionL();
02345         
02360     IMPORT_C void DeleteL(TBool& aChanged,
02361                           const TCursorSelection& aSelection,
02362                           TBool aIsBackSpace=EFalse,
02363                           TBool aAllowUndo=ETrue);
02364         
02369     IMPORT_C void TrappedSizeChanged();
02370         
02376     IMPORT_C void HandleSizeChangedL();
02377         
02386     IMPORT_C void CancelSelectionL(TEnd aEndOfSelectionToLeaveCursor);
02387         
02399     IMPORT_C void MoveCursorToChunkStartL(TBool aSelect,
02400                                           TChunkSize aChunkSize,
02401                                           TEnd aEndScanningTowards);
02402         
02407     IMPORT_C void CancelInsertCharFormat();
02408         
02412     IMPORT_C void PlaceDataOnClipboardL();
02413         
02425     IMPORT_C void ReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType);
02426         
02430     IMPORT_C void SetLineCursorDetailsL();
02431         
02438     IMPORT_C virtual void CopyDocumentContentL(CGlobalText& aInText,
02439                                                CGlobalText& aOutText);
02440         
02448     IMPORT_C void DisplayFindTextNotFound(TDes& aFindText);
02449         
02456     IMPORT_C virtual void HandleTextPastedL(TInt aStartPos,TInt& aLength);
02457         
02463     IMPORT_C virtual CLafEdwinCustomDrawBase* CreateCustomDrawL();
02464         
02465     // Avkon editor extensions
02471     IMPORT_C void ReadAknResourceL(TResourceReader& aReader);
02472 
02473 protected: // Internal to Symbian
02474 
02481         IMPORT_C void CreateLayoutL(MLayDoc* aLayDoc);
02482         
02491     IMPORT_C void CreateTextAndLayoutL(CParaFormatLayer* aParaFormatLayer,
02492                                        CCharFormatLayer* aCharFormatLayer);
02493         
02499     IMPORT_C void CheckEdwinExtensionL();
02500         
02506     IMPORT_C CEikEdwinExtension* EdwinExtension();
02507 
02508 private:
02509 
02510         enum
02511                 { // internal flags
02512                 EWysiwygOn                                              =0x00000010,
02513                 EUnderOneScreenFormattedText    =0x00000020,
02514                 EPictureDelimits                                =0x00000040,
02515                 EPunctuationDelimits                    =0x00000080,
02516                 EPasteFromIrStore                               =0x00000100,
02517                 ELockScrollBarState                             =0x00000200,
02518                 EOnReformatting                                 =0x00000400
02519                 };
02520 
02521 private: // from CCoeControl
02522 
02523         IMPORT_C void SizeChanged();
02524         IMPORT_C TInt CountComponentControls() const;
02525         IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
02526         IMPORT_C void Reserved_2();
02527 
02528 private:
02529 
02530         IMPORT_C virtual void Reserved_3();
02531         IMPORT_C virtual void NotifyInvalidOperationOnReadOnlyL();
02532         IMPORT_C CEikScrollBarFrame* CreateScrollBarFrameL(TBool aPreAlloc);
02533         void SetVirtualCursorStateL(TBool aIsFocused) const;
02534         void SetHeightForNumOfLinesL();
02535         void ApplyAutoSelectionL();
02536         void SetScrollBarsL();
02537         void SetVertScrollBarModelByCharactersL(TEikScrollBarModel& aVertModel) const;
02538         void RetrieveDataFromClipboardL();
02539         void SetCursorVisibilityL(TBool aEmphasis);
02540         TBool OwnsScrollBars() const;
02541         void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
02542         void UpdateHorizScrollBarThumb();
02543         void UpdateVertScrollBarThumbL();
02544         void DoSetUndoBufferL(const TCursorSelection& aSelection);
02545         void DoPasteFromStoreL(const CStreamStore& aStore,const CStreamDictionary& aDict);
02546         void DoReplaceAllL(SEdwinFindModel* aModel,TBool& aTextFound,TBool& aReplaced);
02547         void DeleteExtraParasL(TInt aStartPos,TInt aLength);
02548         TInt LocateChar(TChar aChar,TInt aStartPos,TInt aLength);
02549         TBool IsValidChar(TInt aChar) const;
02550         TInt CalcMinimumHeightFromNumOfLinesL() const;
02551         void CheckEdwinHeight();
02552         TBool IsNewHeightWithinMinimumAndMaximum(TInt aNewHeight) const;
02553         void SetEdwinHeight(TInt aHeight);
02554         void DoCreateCustomDrawL();
02555         void SetCursorSizeAndType();
02556         TKeyResponse DoOfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
02557         void DoCcpuCanPasteL() const;
02558         void DoReportEventL(MCoeControlObserver::TCoeEvent aEvent);
02559         void CheckIfEdwinIsResizable();
02560         void SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32 aKeyRepeatRate) const;
02561         HBufC* GetAllowedCharsLC() const;
02562         TInt CheckAllowedCharsL(const TDesC& aChars, CClipboard& aClipboard, TBool aRichText) const;
02563 
02564         TInt CursorWidth() const;
02565         TFontSpec CursorFontSpec() const;
02566 
02567         void BuildEdwinFepSupport();
02568         void MakeCharFormatLayerMatchL(CCharFormatLayer* aCharFormatLayer);
02569         void MakeParaFormatLayerMatchL(CParaFormatLayer* aParaFormatLayer);
02570     void UpdateCache(TInt aId);
02571         void DrawBackgroundAroundTextView( 
02572                 CWindowGc& gc, 
02573                 const TRect& aOuterRect, 
02574                 const TRect& aInnerRect, 
02575                 const TRgb& aBackgroundColor  ) const;
02576         TInt CurrentAlignment() const;
02577         void DoAlignment();
02578         void NewParagraphL();
02579     TKeyResponse ScrollReadOnlyNoCursorDisplayL(TUint aKeyCode);
02580     void ReplaceParaDelimitersL( TInt aStartPos, TInt aLength );
02581     TRect AdjustedViewRect() const;
02582     void SetVKBStatus();
02583     void ScrollViewToCursorLineL();
02584     void PerformRecordedOperationL();
02585     void ScrollIfAtTopOrBottom();
02586 
02587 private:
02588 
02589         void DrawFirstLineTextL() const;
02590     CAknEdwinDrawingModifier* AknEdwinDrawingModifier();
02591     TBool EditorSupportsNeutralProtection() const;
02592 
02604     TBool NeedsNeutralProtection( TInt aPosOfLowEndOfDelete, TInt aLengthToDelete, TDes& aNewText, TBool& aForwardProtectionNeeded );
02605 
02614     TBool GetStrongDirectionality(TChar aChar, TBool& aRightToLeft ) const;
02615 
02622     TBool CharIsNeutral( TInt aPos ) const;
02623 
02638     TBool GetExposedDirectionOfTextInDescriptor( const TDesC& aText, TBool aForward, TBool& aIsRightToLeft ) const;
02639 
02652     TBool GetExposedDirectionOfText( TInt aPos, TBool aForward, TBool& aIsRightToLeft ) const;
02653 
02670     void ReplaceSelectionWithTextL( const TDesC& aNewText, 
02671                                     TInt aCursorPosInNewText,
02672                                     TBool& aFormatHasChanged );
02673 
02683     TBool IsPurePhoneNumberEditor() const;
02684 
02690     TBool NeedToChangeFormattingModeL() const;          
02691     
02696     void CalculateLineMetricsForBandFormattingL();
02697 
02698 protected:      // from MObjectProvider
02699 
02717         IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
02718         
02719 public: // new since 3.0
02720 
02726     IMPORT_C void SetTextSkinColorIdL(TInt aAknSkinIdForTextColor);
02727 
02733     IMPORT_C void SetHighlightStyleL(TAknsHighlightStyle aStyle);
02734     
02735     // for custom drawer, not exported
02741     TInt SkinColorId() const;
02742 
02748     TAknsHighlightStyle HighlightStyle() const;
02749     
02770     TRgb EditorBackgroundColor(TRgb& aConditionalColor) const;
02771         
02772 protected:
02773 
02777         TUint32 iEdwinUserFlags;
02778 
02782         TUint32 iEdwinInternalFlags;
02783 
02787         CPlainText* iText;
02788 
02789 protected: // Internal to Symbian
02790 
02794         CTextView* iTextView;
02795 
02799         CTextLayout* iLayout;
02800 
02801 protected:
02802 
02806         TInt iTextLimit;
02807     
02811         TInt iNumberOfLines;
02812         
02816     MGraphicsDeviceMap* iZoomFactor;
02817         
02821     TInt iLastPointerDocPos;
02822         
02826     TMargins8 iMargins;
02827 
02828 private:
02829 
02830         friend class CEikEdwinFepSupport;
02831         friend class CEikEdwinExtension;
02832         // added this class to allow additional data members without breaking BC
02833         CEikEdwinExtension* iEdwinExtension; // replaced iSetScrollBar
02834         CEikScrollBarFrame* iSBFrame;
02835         MEikEdwinObserver* iEdwinObserver;
02836         CArrayPtr<MEikEdwinObserver>* iObserverArray;
02837         CEikEdwinFepSupport* iEdwinFepSupport;
02838         CUndoBuffer* iUndoStore;
02839         TInt iAvgLinesInViewRect;
02840         TInt iAvgCharsPerLine;
02841         TInt iRightWrapGutter;
02842         TInt iLayoutWidth;
02843         MEikEdwinSizeObserver* iEdwinSizeObserver;
02844         TInt iMinimumHeight;
02845         TInt iMaximumHeight;
02846 /* 
02847 iMaximumHeightInLines
02848 ---------------------
02849 This is simply a holder for the number, used to simplify some Avkon LAF requirements.
02850 The viewable region of an edwin is actually measured in pixels, However, if certain LAF
02851 requirements are enforced (that the view region has to be smaller than the number of 
02852 lines viewable * the baseline separation (in pixels)) some undesired scrolling effects
02853 occur.
02854 
02855 
02856 That is to say, by simply setting iMaximumHeightInLines, this will not affect
02857 the actual maximum height of the edwin.  To do this, you must set the iMaximumHeight
02858 
02859 One of the use cases of this member variable is for AknLayoutUtils::LayoutEdwin. 
02860 That method uses iMaximumHeightInLines along with the baseline separation, to set 
02861 the iMaximumHeight.
02862 
02863 The general formula is very simple, to remove unneeded scrolling.
02864 iMaximumHeight=baselineSeparation*iMaximumNumberOfLines
02865 
02866 If you cannot allocate sufficient space to the edwin, to permit so much viewable region
02867 then the method AlterViewRect can be called on the TextView() component.  This will introduce
02868 a clipping rectangle, which allows blank space required by the edwin layout component
02869 to not be shown.
02870 */
02871         TInt iMaximumHeightInLines; 
02872         CLafEdwinCustomDrawBase* iCustomDrawer;
02873         TInt iLastPointerAnchorPos;
02874         CAknCcpuSupport* iCcpuSupport;
02875         CCharFormatLayer* iCharFormatLayer;
02876         CParaFormatLayer* iParaFormatLayer;
02877         TInt iSpare_1;
02878         TInt iSpare_2;
02879         };
02880 
02881 
02882 inline CEikScrollBarFrame* CEikEdwin::CreatePreAllocatedScrollBarFrameL()
02883         { return CreateScrollBarFrameL(ETrue);}
02884 inline CEikScrollBarFrame* CEikEdwin::ScrollBarFrame()
02885         { return ((CEikScrollBarFrame* const)iSBFrame); }
02886 inline TInt CEikEdwin::AvgLinesInViewRect() const
02887         { return iAvgLinesInViewRect; }
02888 inline TInt CEikEdwin::AvgCharsPerLine() const
02889         { return iAvgCharsPerLine;}
02890 inline void CEikEdwin::SetAvgLinesInViewRect(TInt aAvgLines)
02891         { iAvgLinesInViewRect=aAvgLines; }
02892 inline void CEikEdwin::SetAvgCharsPerLine(TInt aAvgChars)
02893         { iAvgCharsPerLine=aAvgChars; }
02894 
02895 inline void CEikEdwin::SetMaxLength(TInt aLength ) 
02896         { SetTextLimit(aLength); }
02897 inline TInt CEikEdwin::MaxLength() const 
02898         { return iTextLimit; }
02899 
02900 #endif

Copyright © Nokia Corporation 2001-2007
Back to top