epoc32/include/txtfmstm.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // PRIVATE HEADER FILE CONTAINING IMPLEMENTATION SPECIFIC CLASSES
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __TXTFMSTM_H__
       
    19 #define __TXTFMSTM_H__
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <txtfrmat.h>
       
    23 
       
    24 // forward declarations
       
    25 class RReadStream;
       
    26 class RWriteStream;
       
    27 class TCharFormatX;
       
    28 class TCharFormatXMask;
       
    29 
       
    30 /**
       
    31 stores format attributes as bytecode
       
    32 @internalComponent
       
    33 */
       
    34 class RFormatStream
       
    35 	{
       
    36 public:
       
    37 	RFormatStream();
       
    38 	void CopyL(const RFormatStream& aSource);
       
    39 	void ExternalizeL(RWriteStream& aStream) const;
       
    40 	void InternalizeL(RReadStream& aStream);
       
    41 	void Reset();
       
    42 	const TUint8* Ptr(TInt& aSize) const;
       
    43 	void SetParaFormatL(const CParaFormat* aDesiredFormat,const TParaFormatMask& aDesiredMask,const CParaFormat* aCurrentFormat);
       
    44 	void SenseParaFormatL(CParaFormat* aParaFormat,TParaFormatMask& aMask,CParaFormat::TParaFormatGetMode aMode)const;
       
    45 	void SetCharFormatL(const TCharFormatX& aCharFormat,const TCharFormatXMask& aMask);
       
    46 	void SenseCharFormat(TCharFormatX& aCharFormat,TCharFormatXMask& aMask)const;
       
    47 	void Swap(RFormatStream& aStream);
       
    48 
       
    49 private:
       
    50 	void AllocL(TInt aSize);
       
    51 	TInt Length(TUint8*& aPtr,TTextFormatAttribute aType)const;
       
    52 	TInt DoCalcSizeParaFormat(const CParaFormat* aDesiredFormat,TParaFormatMask aMask,const CParaFormat* aCurrentFormat);
       
    53 	void DoSetParaFormat(const CParaFormat* aDesiredFormat,TParaFormatMask aMask,const CParaFormat* aCurrentFormat);
       
    54 	void RemoveRedundantCharFormat(TCharFormatMask& aMask,const TCharFormatX& aFormat,const TCharFormatX& aEffectiveFormat);
       
    55 	TInt DoCalcSizeCharFormat(const TCharFormatX& aCharFormat,const TCharFormatXMask& aMask);
       
    56 	void DoStoreCharFormat(const TCharFormatX& aCharFormat,TCharFormatXMask aMask);
       
    57 	TUint8* StoreBullet(TUint8* aPtr,const TBullet& aSource);
       
    58 	TUint8* StoreBorder(TUint8* aPtr,TTextFormatAttribute aType,const TParaBorder& aSource);
       
    59 	TUint8* StoreTab(TUint8* aPtr,const TTabStop& aSource);
       
    60 	TInt StoreTabs(TUint8*& aPtr,const CParaFormat* aDesiredFormat,const CParaFormat* aCurrentFormat,TBool aStoreData);
       
    61 	TInt MergeTabLists(TUint8*& aPtr,const CParaFormat* aDesiredFormat,TInt aDesiredTabCount,
       
    62 					   const CParaFormat* aCurrentFormat,TInt aCurrentTabCount,TBool aStoreData);
       
    63 	void StoreAllTabs(TUint8*& aPtr,const CParaFormat* aSource);
       
    64 	TUint8* Store(TUint8* aPtr,const TLogicalRgb& aRgb);
       
    65 	TUint8* Store(TUint8* aPtr,const TTypeface& aTypeface);
       
    66 	TUint8* ReadValue(TUint8* aPtr,TLogicalRgb& aRgb)const;
       
    67 	TUint8* ReadValue(TUint8* aPtr,TTypeface& aTypeface)const;
       
    68 	TUint8* ReadValue(TUint8* aPtr,TParaBorder& aBorder)const;
       
    69 	TUint8* ReadValue(TUint8* aPtr,TBullet& aBullet)const;
       
    70 	TUint8* ReadTabL(TUint8* aPtr,CParaFormat* aTarget)const;
       
    71 
       
    72 	TUint8* iBase;	// start of stored bytecode
       
    73 	TUint8* iEnd;	// end of stored bytecode
       
    74 
       
    75 	__DECLARE_TEST;
       
    76 private:
       
    77 	void TestInvariantL() const;
       
    78 	TBool DoInvariantCheck() const;
       
    79 	};
       
    80 
       
    81 #endif