os/textandloc/textrendering/textformatting/test/src/TestLayout.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/textrendering/textformatting/test/src/TestLayout.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,74 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* TestLayout.h test jig for CTmTextLayout
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#include "TAGMA.H"
    1.24 +
    1.25 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.26 +#include "TAGMA_INTERNAL.H"
    1.27 +#endif
    1.28 +
    1.29 +class CRichText;
    1.30 +class CTestGraphicsDevice;
    1.31 +
    1.32 +typedef void TransliterationFn(const TDesC&, TDes&);
    1.33 +
    1.34 +class CETextSource : public CBase, public MTmSource
    1.35 +	{
    1.36 +public:
    1.37 +	CETextSource(const CRichText& aRichText, MGraphicsDeviceMap* aDeviceMap);
    1.38 +	MGraphicsDeviceMap& FormatDevice() const { return *iDeviceMap; }
    1.39 +	MGraphicsDeviceMap& InterpretDevice() const { return *iDeviceMap; }
    1.40 +	TInt DocumentLength() const;
    1.41 +	void GetText(TInt aPos, TPtrC& aText, TTmCharFormat& aFormat) const;
    1.42 +	void GetParagraphFormatL(TInt aPos, RTmParFormat& aFormat) const;
    1.43 +	TInt ParagraphStart(TInt aPos) const;
    1.44 +	CPicture* PictureL(TInt aPos) const;
    1.45 +
    1.46 +private:
    1.47 +	const CRichText* iRichText;
    1.48 +	MGraphicsDeviceMap* iDeviceMap;
    1.49 +	};
    1.50 +
    1.51 +class CTestTmTextLayout : public CBase
    1.52 +	{
    1.53 +public:
    1.54 +	static CTestTmTextLayout* NewLC(const CRichText& aText, TInt aWrapWidth);
    1.55 +	static CTestTmTextLayout* NewLC(const TDesC& aText, TInt aWrapWidth,
    1.56 +		TransliterationFn* aTransliterate);
    1.57 +	~CTestTmTextLayout();
    1.58 +	MTmSource& Source() { return *iSource; }
    1.59 +	const MTmSource& Source() const { return *iSource; }
    1.60 +	CTmTextLayout& Layout() { return *iLayout; }
    1.61 +	const CTmTextLayout& Layout() const { return *iLayout; }
    1.62 +	CTestGraphicsDevice& Device() const { return *iDevice; }
    1.63 +	void FormatL(const TTmReformatParam& aIn, TTmReformatResult& aOut);
    1.64 +	// Function to test the API: CTmTextLayout::FindAdjacentChunks()
    1.65 +	void TestAdjacentChunks();
    1.66 +private:
    1.67 +	void ConstructL(const CRichText& aText, TInt aWrapWidth);
    1.68 +
    1.69 +private:
    1.70 +	CTmTextLayout* iLayout;
    1.71 +	TTmFormatParam iFormatParam;
    1.72 +	CETextSource* iSource;
    1.73 +	CTestGraphicsDevice* iDevice;
    1.74 +	CRichText* iRichText;
    1.75 +	CParaFormatLayer* iParagraphFormatLayer;
    1.76 +	CCharFormatLayer* iCharacterFormatLayer;
    1.77 +	};