emailuis/uicomponents/inc/fstextviewerlayouter.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:28:57 +0100
branchRCL_3
changeset 25 3533d4323edc
parent 0 8466d47a6819
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Visual aligning class
*
*/


#ifndef C_FSTEXTVIEWERLAYOUTER_H
#define C_FSTEXTVIEWERLAYOUTER_H

//<cmail> removed __FS_ALFRED_SUPPORT flag
//#include <fsconfig.h>
//</cmail> removed __FS_ALFRED_SUPPORT flag
#include <e32base.h>
#include <biditext.h>

class CFsTextViewerCoordinator;
class MFsRichTextObject;
class CFsTextViewerVisualizerData;
class TFsRangedVisual;
class CWsScreenDevice;
class CAlfLayout;
class CFsRichText;
class CAlfEnv;
class CFsTextParser;
class CFsTextViewerVisualizer;

class CFsTextViewerLayouter : public CBase
    {
    public:
        static CFsTextViewerLayouter* NewL( CAlfEnv* aEnv );
        ~CFsTextViewerLayouter();
        
    public:
        TInt MeasureBidiTextBoundsWidth(
            const CFont& aFont,
            const TDesC& aText,
            CFont::TMeasureTextInput::TFlags aOrder);
        TSize CalculateSizeL( MFsRichTextObject* aObject );
        TInt FindMaxLengthL( MFsRichTextObject* aObject );
        TFsRangedVisual* PrepareRangedVisL( 
                        MFsRichTextObject* aObject,
                        CAlfLayout* aLayout );
        void SetDisplaySize( TSize aDisplaySize );
        TBool AppendObjectL( MFsRichTextObject* aObject, CAlfLayout* aLayout, CFsTextParser* aParser, TBool aRegisterSelects = ETrue );
        TBool InsertObjectL( MFsRichTextObject* aObject, CAlfLayout* aLayout, CFsTextParser* aParser, TBool aRegisterSelects = ETrue );
        void ConstructLineL( TInt aHeight = 1 );
        void SetMargins( const TInt aLeft, const TInt aRight );
        void SetHelper( CFsTextViewerCoordinator* aHelper );
        void SetNavigator( CFsTextViewerVisualizerData* aNavigator );
        TInt Lines();
        void EnableSmileys( TBool aEnable = ETrue );
        void SetPosition( TInt aLine, TInt aLineOffset );
        void ChangeDirection( TBidiText::TDirectionality aDirection );
        void SetDirection( TBidiText::TDirectionality aDirection );
        TBidiText::TDirectionality GetDirection();
        void JoinRangedVisuals( TFsRangedVisual* aFirst, TFsRangedVisual* aSecond );
        TInt GetCurrentLineOffset();
        void SetCurrentLineOffset( TInt aOffset );
        TBool IsNewLine();
        
    private:
        void ConstructL();
        CFsTextViewerLayouter( CAlfEnv* aEnv );
        
    private:
        TBool ReorderLineFromLeftL( MFsRichTextObject* aObject, CAlfLayout* aLayout, CFsTextParser* aParser, TSize aObjectSize, TBool aRegisterSelects = ETrue );
        TBool ReorderLineFromRightL( MFsRichTextObject* aObject, CAlfLayout* aLayout, CFsTextParser* aParser, TSize aObjectSize, TBool aRegisterSelects = ETrue );
        
    private:
        CFsTextViewerCoordinator* iHelper;
        CFsTextViewerVisualizerData* iNavigator;
        CWsScreenDevice* iScreenDev;
        CFsRichText* iCFsRichText;
        TBool iSmileyEnabled;
        TSize iDisplaySize;
        CAlfEnv* iEnv;
        RPointerArray<TFsRangedVisual> iCurrentLineArray;
        TInt iCurrentLineOffset;
        TInt iLineHeight;
        TInt iLastCol;
        TInt iLeftMargin;
        TInt iRightMargin;
        TInt iLines;
        TInt iLowestPicPosition;
        TBidiText::TDirectionality iMainDirection;
        TBool iNewLine;
        
    public:
        CFsTextViewerVisualizer* iVisualizer;
        CAlfControl* iControl;
    };

#endif //C_FSTEXTVIEWERLAYOUTER_H