emailuis/uicomponents/inc/fstextviewervisualizerdata.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Storage class for visuals belonging to visualizer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSTEXTVIEWERVISUALIZERDATA_H
       
    20 #define C_FSTEXTVIEWERVISUALIZERDATA_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 #include <biditext.h>
       
    28 
       
    29 class CAlfVisual;
       
    30 class TAlfRealRect;
       
    31 class CAlfLayout;
       
    32 class CAlfAnchorLayout;
       
    33 class CAlfTextVisual;
       
    34 class CAlfControl;
       
    35 class CAlfBorderBrush;
       
    36 class CFsTextParser;
       
    37 class CFsTextViewerSelectsManager;
       
    38 class CFsTextViewerCoordinator;
       
    39 class CFsTextParser;
       
    40 
       
    41 class TKeyArrayPtr : public TKeyArrayFix
       
    42     {
       
    43     public:
       
    44         inline TKeyArrayPtr(TInt aOffset, TKeyCmpText aType) 
       
    45             :TKeyArrayFix(aOffset, aType) {}
       
    46         inline TKeyArrayPtr(TInt aOffset, TKeyCmpText aType, TInt aLength)
       
    47             :TKeyArrayFix(aOffset, aType, aLength) {}
       
    48         inline TKeyArrayPtr(TInt aOffset, TKeyCmpNumeric aType) 
       
    49             :TKeyArrayFix(aOffset, aType) {}
       
    50         virtual TAny* At(TInt aIndex) const;
       
    51     };
       
    52 
       
    53 class TFsVisRange
       
    54     {
       
    55     public:
       
    56         TInt iStart;
       
    57         TInt iEnd;
       
    58     };
       
    59 
       
    60 class TFsRangedVisual
       
    61     {
       
    62     public:
       
    63         CAlfVisual* iVisual;
       
    64         CAlfLayout* iLayout;
       
    65         TRect iRect;
       
    66         TBool iIsActive;
       
    67         TBool iIsText;
       
    68         TBool iEmbed;
       
    69         TBool iHotspot;
       
    70         TBool iIsVisible;
       
    71         TBool iSmiley;
       
    72         TBool iMoved;
       
    73         TBidiText::TDirectionality iDirection;
       
    74         TInt iStart;
       
    75         TInt iEnd;
       
    76         TInt iHotspotType;
       
    77         TInt iId;
       
    78         TInt iTextStyleId;
       
    79         TInt iLineNumber;
       
    80         TRgb iTextColor;
       
    81     };
       
    82 
       
    83 class TFsPartBgVisual
       
    84     {
       
    85     public:
       
    86         TInt iStart;
       
    87         TInt iEnd;
       
    88         CAlfVisual* iVisual;
       
    89         TRect iRect;
       
    90     };
       
    91 
       
    92 class TFsCursorPos
       
    93     {
       
    94     public: 
       
    95         TInt iVisual;
       
    96         TInt iOffset;
       
    97     };
       
    98 
       
    99 class CFsTextViewerVisualizerData : public CBase
       
   100     {
       
   101     public:
       
   102         static CFsTextViewerVisualizerData* NewL( 
       
   103                 CAlfControl* aControl, 
       
   104                 CFsTextParser* aParser, 
       
   105                 CFsTextViewerSelectsManager* aSelector );
       
   106         ~CFsTextViewerVisualizerData();
       
   107 
       
   108     public:
       
   109         void AppendVisualL( TFsRangedVisual aVisual );
       
   110         void AppendVisualL( TFsRangedVisual* aVisual );
       
   111         void AppendVisualL( CAlfVisual* aVisual, TFsVisRange aRange );
       
   112         void AppendLayoutL( CAlfVisual* aVisual, TFsVisRange aRange );
       
   113         void AppendBgL( TFsPartBgVisual aBg );
       
   114         TBool RemoveBg( CAlfVisual* aVisual );
       
   115         void ResetBgArray();
       
   116         void InsertVisualL( 
       
   117                 TInt aIndex, 
       
   118                 CAlfVisual* aVisual, 
       
   119                 TFsVisRange aRange );
       
   120         void PopVisual();
       
   121         void RemoveVisual( TInt aIndex );
       
   122         void DisableVisual( TInt aIndex, TBool aStatus = ETrue );
       
   123         void DisableVisual( CAlfVisual* aVisual, TBool aStatus = ETrue );
       
   124         void EnableVisual( TInt aIndex, TBool aStatus = ETrue );
       
   125         void EnableVisual( CAlfVisual* aVisual, TBool aStatus = ETrue );
       
   126         CAlfVisual* GetVisual( TInt aIndex );
       
   127         TInt GetVisLength( TInt aIndex );
       
   128         TInt GetVisStartOffset( TInt aIndex );
       
   129         TInt GetVisEndOffset( TInt aIndex );
       
   130         TInt GetLayEndOffset( TInt aIndex );
       
   131         TFsVisRange GetVisOffsets( TInt aIndex );
       
   132         TInt Count();
       
   133         TInt Find( CAlfVisual* aVisual );
       
   134         TInt FindLayout( CAlfVisual* aVisual );
       
   135         TInt Find( TInt aOffset );
       
   136         TBool MoveToNextCharL();
       
   137         TBool MoveToPrevCharL();
       
   138         TInt FindPrevChar();
       
   139         TRect GetCursorRectL();
       
   140         TInt GetCursorCharOffset();
       
   141         void SetCursorCharOffset( TInt aOffset );
       
   142         void Sort();
       
   143         TInt RestoreL( TFsRangedVisual* aVisual );
       
   144         void ScrollAllL( TInt aTrans, TInt aTime, CAlfLayout* aRootLayout );
       
   145         TInt GetTextStyle( CAlfTextVisual* aVisual );
       
   146         void DimAllHotspotsL();
       
   147         void RefreshSelectsL();
       
   148         TRect GetVisualPos( TInt aCharIndex );
       
   149         TFsRangedVisual* GetVisualAtIndex( TInt aIndex );
       
   150         void ScrollFromCharL( TInt aCharIndex, TInt aTrans, TInt aTime, CAlfLayout* aRootLayout ); //<cmail> leaving
       
   151         void SetScreenHeight( TInt aScreenHeight );
       
   152         TFsRangedVisual* GetVisualWithChar( TInt aCharIndex );
       
   153         TFsRangedVisual* GetFirstVisible();
       
   154         TFsRangedVisual* GetLastVisible();
       
   155         TFsRangedVisual* GetRangedVisual( CAlfVisual* aVisual );
       
   156         void UpdateLinesNumbers();
       
   157         TInt GetTotalLines();
       
   158         TInt RemoveFromLineL( 
       
   159                 TInt aLineNumber, 
       
   160                 CFsTextViewerCoordinator* aHelper );
       
   161         TInt GetFirstCharInLine( TInt aLineNumber );
       
   162         //<cmail>
       
   163         TInt GetCharLineNumber( TInt aCharNumber );
       
   164         //</cmail>
       
   165         void SetParser( CFsTextParser* aParser );
       
   166         void FindAndHighlightHotspotL( TInt aLine );
       
   167         TInt GetCursorLine();
       
   168         void ReloadPicturesL( TInt aLine );
       
   169         TInt GetTotalHeight();
       
   170         void HideActionButtonFromCurrentHighlightedHotspot();
       
   171         void ShowActionButtonForCurrentHighlightedHotspotL();
       
   172         void HideAll();
       
   173         void RestoreVisibleL();
       
   174         void RegisterHotspotsL();
       
   175         void SetStatusLineLayout( CAlfAnchorLayout* aLayout );
       
   176         TInt GetLineOffset( TInt aLine );
       
   177 
       
   178     public:
       
   179         enum TFsScrollDirection
       
   180             {
       
   181             EFsScrollDown = 1,
       
   182             EFsScrollUp
       
   183             };
       
   184 
       
   185     private: 
       
   186         void ConstructL();
       
   187         CFsTextViewerVisualizerData( 
       
   188                 CAlfControl* iControl, 
       
   189                 CFsTextParser* aParser, 
       
   190                 CFsTextViewerSelectsManager* aSelector );
       
   191 		// <cmail> needed anymore ?
       
   192         //void DoScrollFromCharL( TInt aCharIndex, TInt aTrans, TInt aTime, TRect aVisibleArea );
       
   193 		// </cmail>
       
   194 
       
   195     private:
       
   196         RPointerArray<TFsRangedVisual> iVisArray;
       
   197         RArray<TFsRangedVisual> iLayoutArray;
       
   198         RArray<TFsPartBgVisual> iBgArray;
       
   199         CAlfAnchorLayout* iStatusLineLayout;
       
   200         TFsCursorPos iPosition;
       
   201         TInt iCurrentChar;
       
   202         TInt iPrevChar;
       
   203         TInt iLength;
       
   204         CAlfControl* iControl;
       
   205         CFsTextParser* iParser;
       
   206         CFsTextViewerSelectsManager* iSelector;
       
   207         TInt iScreenOffset;
       
   208         TInt iTopBorder;
       
   209         TInt iBottomBorder;
       
   210         TInt iScreenHeight;
       
   211         TInt iVisualAmount;
       
   212         TFsScrollDirection iScrollDirection;        
       
   213         CAlfBorderBrush* iDebugBrush;
       
   214     };
       
   215 
       
   216 #endif //C_FSTEXTVIEWERVISUALIZERDATA_H