os/textandloc/textrendering/textformatting/test/src/TestLayout.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
* TestLayout.h test jig for CTmTextLayout
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#include "TAGMA.H"
sl@0
    21
sl@0
    22
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    23
#include "TAGMA_INTERNAL.H"
sl@0
    24
#endif
sl@0
    25
sl@0
    26
class CRichText;
sl@0
    27
class CTestGraphicsDevice;
sl@0
    28
sl@0
    29
typedef void TransliterationFn(const TDesC&, TDes&);
sl@0
    30
sl@0
    31
class CETextSource : public CBase, public MTmSource
sl@0
    32
	{
sl@0
    33
public:
sl@0
    34
	CETextSource(const CRichText& aRichText, MGraphicsDeviceMap* aDeviceMap);
sl@0
    35
	MGraphicsDeviceMap& FormatDevice() const { return *iDeviceMap; }
sl@0
    36
	MGraphicsDeviceMap& InterpretDevice() const { return *iDeviceMap; }
sl@0
    37
	TInt DocumentLength() const;
sl@0
    38
	void GetText(TInt aPos, TPtrC& aText, TTmCharFormat& aFormat) const;
sl@0
    39
	void GetParagraphFormatL(TInt aPos, RTmParFormat& aFormat) const;
sl@0
    40
	TInt ParagraphStart(TInt aPos) const;
sl@0
    41
	CPicture* PictureL(TInt aPos) const;
sl@0
    42
sl@0
    43
private:
sl@0
    44
	const CRichText* iRichText;
sl@0
    45
	MGraphicsDeviceMap* iDeviceMap;
sl@0
    46
	};
sl@0
    47
sl@0
    48
class CTestTmTextLayout : public CBase
sl@0
    49
	{
sl@0
    50
public:
sl@0
    51
	static CTestTmTextLayout* NewLC(const CRichText& aText, TInt aWrapWidth);
sl@0
    52
	static CTestTmTextLayout* NewLC(const TDesC& aText, TInt aWrapWidth,
sl@0
    53
		TransliterationFn* aTransliterate);
sl@0
    54
	~CTestTmTextLayout();
sl@0
    55
	MTmSource& Source() { return *iSource; }
sl@0
    56
	const MTmSource& Source() const { return *iSource; }
sl@0
    57
	CTmTextLayout& Layout() { return *iLayout; }
sl@0
    58
	const CTmTextLayout& Layout() const { return *iLayout; }
sl@0
    59
	CTestGraphicsDevice& Device() const { return *iDevice; }
sl@0
    60
	void FormatL(const TTmReformatParam& aIn, TTmReformatResult& aOut);
sl@0
    61
	// Function to test the API: CTmTextLayout::FindAdjacentChunks()
sl@0
    62
	void TestAdjacentChunks();
sl@0
    63
private:
sl@0
    64
	void ConstructL(const CRichText& aText, TInt aWrapWidth);
sl@0
    65
sl@0
    66
private:
sl@0
    67
	CTmTextLayout* iLayout;
sl@0
    68
	TTmFormatParam iFormatParam;
sl@0
    69
	CETextSource* iSource;
sl@0
    70
	CTestGraphicsDevice* iDevice;
sl@0
    71
	CRichText* iRichText;
sl@0
    72
	CParaFormatLayer* iParagraphFormatLayer;
sl@0
    73
	CCharFormatLayer* iCharacterFormatLayer;
sl@0
    74
	};