emailuis/uicomponents/inc/fsrichtext.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:  Data structure class for tree list component
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSRICHTEXT_H
       
    20 #define C_FSRICHTEXT_H
       
    21 
       
    22 #include <txtrich.h>
       
    23 
       
    24 class CRichText;
       
    25 class CFsTexture;
       
    26 
       
    27 class TRichTextExapandArea
       
    28     {   
       
    29     public:
       
    30     TInt iStartIndex;
       
    31     TInt iLength;
       
    32     TInt iCaptionLength;
       
    33     TBool iIsExpand;
       
    34     };
       
    35 
       
    36 class TRichTextHotSpotArea
       
    37     {
       
    38     public:
       
    39     TInt iOriginalStartIndex;
       
    40     TInt iStartIndex;
       
    41     TInt iLength;
       
    42     TInt iOriginalLength;
       
    43     TInt iId;
       
    44     };
       
    45 
       
    46 class TRichTextPictureArea
       
    47     {
       
    48     public:
       
    49     TInt iPictureIndex;
       
    50     TFileName iFileName;
       
    51     };
       
    52 
       
    53 class CMyPicture :public CPicture
       
    54     {
       
    55     public:  
       
    56         IMPORT_C CMyPicture( TSize aSize, CFbsBitmap& aBitmap );
       
    57         IMPORT_C CMyPicture( TSize aSize, CFbsBitmap& aBitmap, CFbsBitmap& aBitmapMask );
       
    58         
       
    59         IMPORT_C ~CMyPicture();
       
    60 
       
    61     public: 
       
    62         IMPORT_C void Draw( CGraphicsContext& aGc,
       
    63                            const TPoint& aTopLeft,
       
    64                            const TRect& aClipRect,
       
    65                            MGraphicsDeviceMap* aMap ) const;
       
    66         IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
       
    67         
       
    68         IMPORT_C void SetOriginalSizeInTwips( TSize aSize );
       
    69 
       
    70         IMPORT_C void GetOriginalSizeInTwips( TSize& aSize ) const;
       
    71 
       
    72         IMPORT_C CFbsBitmap* GetBitmap();
       
    73         
       
    74         IMPORT_C CFbsBitmap* GetBitmapMask();
       
    75        
       
    76 
       
    77     protected:    
       
    78 
       
    79         TSize iSizeInTwips; 
       
    80         CFbsBitmap* iBitmap; 
       
    81         CFbsBitmap* iBitmapMask; 
       
    82     };
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 class CFsRichText: public CRichText
       
    89     {
       
    90     public:
       
    91     
       
    92     IMPORT_C static CFsRichText* NewL(
       
    93             const CParaFormatLayer* aGlobalParaLayer, 
       
    94             const CCharFormatLayer* aGlobalCharLayer,
       
    95             TDocumentStorage aStorage = ESegmentedStorage,
       
    96             TInt aDefaultTextGranularity = EDefaultTextGranularity,
       
    97             TParaType aParaType = EMultiPara);
       
    98                                     
       
    99     IMPORT_C static CFsRichText* NewL(
       
   100             const CParaFormatLayer* aGlobalParaLayer, 
       
   101             const CCharFormatLayer* aGlobalCharLayer,
       
   102             const CStyleList& aStyleList,
       
   103             TDocumentStorage aStorage = ESegmentedStorage,
       
   104             TInt aDefaultTextGranularity = EDefaultTextGranularity,
       
   105             TParaType aParaType = EMultiPara);
       
   106                                     
       
   107     IMPORT_C static CFsRichText* NewL(
       
   108             const CStreamStore& aStore, 
       
   109             TStreamId aStreamId,
       
   110             const CParaFormatLayer* aGlobalParaLayer, 
       
   111             const CCharFormatLayer* aGlobalCharLayer,
       
   112             MTextFieldFactory* aFieldFactory = NULL,
       
   113             TDocumentStorage aStorage = ESegmentedStorage);
       
   114                                     
       
   115     IMPORT_C static CFsRichText* NewL(
       
   116             const CStreamStore& aStore, 
       
   117             TStreamId aStreamId,
       
   118             const CParaFormatLayer* aGlobalParaLayer, 
       
   119             const CCharFormatLayer * aGlobalCharLayer,
       
   120             MPictureFactory* aPictureFactory, 
       
   121             MRichTextStoreResolver* aStoreResolver,
       
   122             MTextFieldFactory* aFieldFactory = NULL,
       
   123             TDocumentStorage aStorage = ESegmentedStorage);
       
   124     
       
   125     IMPORT_C ~CFsRichText();
       
   126 
       
   127     IMPORT_C TBool SetExpandL(TInt aStartIndex, TInt aLength, TInt aCaptionLength);
       
   128     IMPORT_C TInt GetNumberOfExpandAreas();
       
   129     IMPORT_C TRichTextExapandArea GetExpandAreaL(TInt aIndex);
       
   130     
       
   131     IMPORT_C TBool SetHotSpotL(TInt aStartIndex, TInt aLength, TInt aId = 0);
       
   132     IMPORT_C TInt GetNumberOfHotSpotAreas();
       
   133     IMPORT_C TRichTextHotSpotArea GetHotSpotAreaL(TInt aIndex);
       
   134     
       
   135     IMPORT_C TBool SetPictureL(TFileName aFileName, TInt aIndex);
       
   136     IMPORT_C TInt GetNumberOfPicture();
       
   137     // <cmail>
       
   138     IMPORT_C TRichTextPictureArea GetPictureAreaL(TInt aIndex);
       
   139     // </cmail>
       
   140     
       
   141     IMPORT_C void Reset();
       
   142     
       
   143     
       
   144     private:
       
   145     
       
   146     CFsRichText(const CParaFormatLayer* aGlobalParaLayer, 
       
   147             const CCharFormatLayer* aGlobalCharLayer,
       
   148             CStyleList* aStyleList = NULL);
       
   149     
       
   150     private:
       
   151     RArray<TRichTextExapandArea> iExpandAreaArray;
       
   152     RArray<TRichTextHotSpotArea> iHotSpotAreaArray;
       
   153     RArray<TRichTextPictureArea> iPictureAreaArray;
       
   154     
       
   155     };
       
   156     
       
   157 #endif //C_FSRICHTEXT_H