emailuis/uicomponents/inc/fstextviewervisualizer.h
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Visualizer class for TextViewer component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSTEXTVIEWERVISUALIZER_H
       
    20 #define C_FSTEXTVIEWERVISUALIZER_H
       
    21 
       
    22 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    23 //#include <fsconfig.h>
       
    24 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    25 #include <e32base.h>
       
    26 #include <gdi.h>
       
    27 
       
    28 #include <eikscrlb.h>  // TAknDoubleSpanScrollBarModel
       
    29 
       
    30 #include "fstextureobserver.h"
       
    31 #include "fsscrollbarset.h"
       
    32 
       
    33 class CAlfImageBrush;
       
    34 class CAlfTextVisual;
       
    35 class CAlfControl;
       
    36 class CAlfBorderBrush;
       
    37 class CAlfVisual;
       
    38 class CAlfLayout;
       
    39 class CAlfTexture;
       
    40 class CAlfImageVisual;
       
    41 class CFsAlfScrollbarLayout;
       
    42 class CAlfDeckLayout;
       
    43 class CAlfAnchorLayout;
       
    44 class CAlfGridLayout;
       
    45 class CAlfBrush;
       
    46 class CFsTextViewerControl;
       
    47 class CFsRichText;
       
    48 class CFsTextParser;
       
    49 class CFsTextViewerCoordinator;
       
    50 class MFsRichTextObject;
       
    51 class CFsTextStyleManager;
       
    52 class CFsTextViewerVisualizerData;
       
    53 class CFsTextViewerSelectsManager;
       
    54 class CFsTextViewerMarkFacility;
       
    55 class CFsSmileyDictionary;
       
    56 class CFsTextViewerSkinData;
       
    57 class CFsTextViewerLoader;
       
    58 class TFsRangedVisual;
       
    59 class CFsTextViewerWatermark;
       
    60 class CFsTextViewerVisualizerSettings;
       
    61 class CWsScreenDevice;
       
    62 class CFsTextureLoader;
       
    63 class MFsTextureObserver;
       
    64 class CFsTextViewerLayouter;
       
    65 
       
    66 enum TFsScrollDirection
       
    67     {
       
    68     EFsDirectionUp = 0,
       
    69     EFsDirectionDown,
       
    70     EFsDirectionLeft,
       
    71     EFsDirectionRight
       
    72     };
       
    73 
       
    74 class TFsTextureObserver 
       
    75     : public MFsTextureObserver
       
    76     {
       
    77     public: 
       
    78         void FsTextureEvent( const TFsTextureEvent& aEventType,
       
    79                              CFsTexture& aTexture 
       
    80                            );
       
    81     };
       
    82 
       
    83 class CFsTextViewerVisualizer : public CBase
       
    84     {
       
    85     public:
       
    86 	    // Enumerator "constants" which indicate usage of default values
       
    87         enum
       
    88             {
       
    89             EUseDefaultScrollOffset = -10000,
       
    90             EUseDefaultScrollTime = -1
       
    91             };
       
    92     
       
    93     public:
       
    94         static CFsTextViewerVisualizer* NewL( 
       
    95         CFsTextViewerControl& aControl, 
       
    96         CFsRichText* aRichText,
       
    97         CFsSmileyDictionary* aSmDict,
       
    98         CFsTextViewerVisualizerSettings* aSettings );
       
    99         ~CFsTextViewerVisualizer();
       
   100 
       
   101     public:
       
   102         void ScrollUpL( TInt aOffset = EUseDefaultScrollOffset, TInt aTime = EUseDefaultScrollTime );
       
   103         void ScrollDownL( TInt aOffset = EUseDefaultScrollOffset, TInt aTime = EUseDefaultScrollTime );
       
   104         void PageUpL( TInt aTime = EUseDefaultScrollTime );
       
   105         void PageDownL( TInt aTime = EUseDefaultScrollTime );
       
   106         TBool NextVisibleHotspotL( TBool& aChanged );
       
   107         TBool PrevVisibleHotspotL( TBool& aChanged );
       
   108         void MoveLeftL();
       
   109         void MoveRightL();
       
   110         void MoveDownL();
       
   111         void MoveUpL();
       
   112         void EnableMarkL( TBool aEnabled = ETrue );
       
   113         void SwitchMarkL();
       
   114         TBool MarkEnabled();
       
   115         CAlfLayout* ExpandL( TInt aId, TInt aStart, CAlfVisual* aVisual );
       
   116         void ExpandExistingL( 
       
   117                 CAlfLayout* aLayout, 
       
   118                 TSize aTargetSize, 
       
   119                 TInt aId );
       
   120         void CollapseL( CAlfLayout* aLayout, TInt aId );
       
   121         TSize LayoutVisualsL( CAlfLayout* aLayout, TInt aStart, TInt aEnd );
       
   122         CFsTextViewerVisualizerData* Navigator();
       
   123         CFsTextParser* Parser();
       
   124         void ClickedL();
       
   125         TBool IsHotspotHighlighted();
       
   126         TBool SmileysEnabled();
       
   127         void EnableSmileys( TBool aStatus = ETrue );
       
   128         void SetScrollOffsetInPx( TInt aPxOffset );
       
   129         void SetScrollOffsetInLines( TInt aLineOffset );
       
   130         void SetSmileySize( TSize aSize );
       
   131         void SetScrollDelay( TInt aDelay );
       
   132         void SetCursorDelay( TInt aDelay );
       
   133         void Reset();
       
   134         void ReloadL();
       
   135         void GetMarkedRange( TInt& aBegin, TInt& aEnd );
       
   136         void GetHotspotRangeL( TInt& aBegin, TInt& aEnd );
       
   137         TSize CalculateSizeL( MFsRichTextObject* aObject ); //to delete
       
   138         TInt CalculateWidthL( const TDesC& aText, TInt aTextStyleId ); //to delete
       
   139         void SetWatermarkL( CFsTextViewerWatermark* aWatermark );
       
   140         CAlfLayout* RootLayout();
       
   141         void SetBackgroundColorL( const TRgb& aColor );
       
   142         void SetBackgroundImageL( CAlfTexture& aTexture );
       
   143         void SetBackgroundOpacity();
       
   144         void RefreshPartBgsL();
       
   145         void RedrawPartBgsL();
       
   146         CAlfControl* Control();
       
   147         CAlfLayout* StackLayout();
       
   148         CAlfLayout* BackgroundLayout();
       
   149         void RemoveEndLinesL( TInt aLines );
       
   150         void ReplaceTextL( 
       
   151                 CFsRichText* aRichText, 
       
   152                 CFsSmileyDictionary* aSmDict = NULL );
       
   153         void FocusLineL( TInt aLine, TBool aShowAsFirstLine = EFalse );
       
   154         void UpdateDisplaySize();
       
   155         void ReloadPicturesL( TInt aLine );
       
   156         TBool GetVisibleFocusedHotspotLine( TInt& aLineNum ) const;
       
   157         // <cmail>
       
   158         void SetCurrentHotspotByOrderL( TInt aIndex, TBool aFocusLine = EFalse );
       
   159         // </cmail>
       
   160         void SetCurrentHotspotByCharL( TInt aIndex );
       
   161         CAlfLayout* GetStatusLayout();
       
   162         void UpdateStatusLayout();
       
   163         void RemoveStatusLayout();
       
   164         HBufC* GetCurrentHotspotTextL();
       
   165         // <cmail>
       
   166         TInt GetCurrentHotspotByOrder();
       
   167         // </cmail>
       
   168         CAknDoubleSpanScrollBar* GetScrollBar();
       
   169         void NotifyControlVisibilityChange( TBool aIsVisible );
       
   170 
       
   171         TInt GetTotalHeight();
       
   172         TInt GetViewTopPosition();
       
   173         TPoint GetViewCenterPosition();
       
   174 
       
   175     public:
       
   176         CFsTextViewerSkinData* iSkinData;
       
   177         CFsTextStyleManager* iTextStyleManager;
       
   178         CFsTextViewerVisualizerSettings* iSettings;
       
   179         
       
   180         // Size of the view's main pane (including content and scroll bar)
       
   181         TSize iDisplaySize;
       
   182         // Size of the actual text content area (without scroll bar)
       
   183         TSize iContentSize;
       
   184         
       
   185         TInt iFirstLine;
       
   186         TInt iTotalLines;
       
   187 
       
   188     private:
       
   189         void ConstructL( 
       
   190                 CFsTextViewerControl& aControl,
       
   191                 CFsRichText* aRichText,
       
   192                 CFsSmileyDictionary* aSmDict );
       
   193         CFsTextViewerVisualizer( 
       
   194                 CFsTextViewerVisualizerSettings* aSettings );
       
   195 
       
   196     private:
       
   197         void ConstructVisualsL( 
       
   198                 TBool aRefreshBg = ETrue );
       
   199         TFsRangedVisual PrepareRangedVisL( 
       
   200                 MFsRichTextObject* aObject, 
       
   201                 CAlfLayout* aLayout );
       
   202         void DrawCursorL( TInt aTime );
       
   203         void DrawMarkL( TInt aTime = 0 );
       
   204         void InitDefaultsL();
       
   205         void ConstructSelfL( CFsRichText* aRichText, 
       
   206                 CFsSmileyDictionary* aSmDict, TBool aNew = ETrue );
       
   207         TInt FindMaxLengthL( CAlfVisual* aVisual ); //to delete
       
   208         TInt FindMaxLengthL( MFsRichTextObject* aObject ); //to delete
       
   209         void UpdateScrollbarL();
       
   210         void SetColumnsL( TBool aShowScrollBar );
       
   211 
       
   212     private:
       
   213         CFsTextViewerControl* iControl;
       
   214         CAlfTextVisual* iText;
       
   215         CAlfBorderBrush* iBorder;
       
   216         CAlfAnchorLayout* iContentLayout;
       
   217         CAlfDeckLayout* iRootLayout;
       
   218         CAlfLayout* iMarkingLayout;
       
   219         CAlfLayout* iBackgroundLayout;
       
   220         CAlfGridLayout* iComponentLayout;
       
   221         CAlfEnv* iEnv;
       
   222         CAlfAnchorLayout* iStatusLineLayout;
       
   223         CFsTextParser* iParser;
       
   224         CFsTextViewerCoordinator* iHelper;
       
   225         TInt iScrollingOffset;
       
   226         CAlfVisual* iCursor;
       
   227         TInt iScrollingDelay;
       
   228         TInt iCursorDelay;
       
   229         TInt iTotalHeight;
       
   230         TInt iLineOffset;
       
   231 
       
   232 		/*
       
   233 		 * Scroll bar
       
   234 		 */
       
   235         CAknDoubleSpanScrollBar* iScrollbar;
       
   236         TAknDoubleSpanScrollBarModel iScrollbarModel;
       
   237         CAlfImageVisual* iDummyScrollbar;
       
   238         /**
       
   239          * Visibility of scrollbar
       
   240          */
       
   241         TFsScrollbarVisibility iScrollbarVisibility;
       
   242         TBool iScrollbarVisible;
       
   243         /**
       
   244          * Scrollbar position
       
   245          */
       
   246         TInt iScrollbarPos;
       
   247 
       
   248         TBool iMark;
       
   249         TBool iCursorEnabled;
       
   250         TBool iScrollByCursor;
       
   251         CFsRichText* iCFsRichText;
       
   252         CFsTextViewerVisualizerData* iNavigator;
       
   253         TBool iSmileyEnabled;
       
   254         TInt iExpandDelay;
       
   255         CFsTextViewerMarkFacility* iMarkFacility;
       
   256         CFsTextViewerSelectsManager* iSelector;
       
   257         CFsSmileyDictionary* iSmileyDict;
       
   258         CFsTextViewerWatermark* iWatermark;
       
   259         CAlfBrush* iBackgroundBrush;
       
   260         CAlfImageVisual* iWatermarkVisual;
       
   261         TBool iIsLayouted;
       
   262         TInt iRichTextLength;
       
   263         CWsScreenDevice* iScreenDev;
       
   264         CFsTextureLoader* iTextureLoader;
       
   265         TFsTextureObserver iFsTextureObserver;
       
   266         TAlfTimedValue iEffectiveOffset;
       
   267         CFsTextViewerLayouter* iLayouter;
       
   268     };
       
   269 
       
   270 #endif // C_FSTEXTVIEWERVISUALIZER_H
       
   271