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.
     1 /*
     2 * Copyright (c) 2006-2009 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: 
    15 * TestLayout.h test jig for CTmTextLayout
    16 *
    17 */
    18 
    19 
    20 #include "TAGMA.H"
    21 
    22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    23 #include "TAGMA_INTERNAL.H"
    24 #endif
    25 
    26 class CRichText;
    27 class CTestGraphicsDevice;
    28 
    29 typedef void TransliterationFn(const TDesC&, TDes&);
    30 
    31 class CETextSource : public CBase, public MTmSource
    32 	{
    33 public:
    34 	CETextSource(const CRichText& aRichText, MGraphicsDeviceMap* aDeviceMap);
    35 	MGraphicsDeviceMap& FormatDevice() const { return *iDeviceMap; }
    36 	MGraphicsDeviceMap& InterpretDevice() const { return *iDeviceMap; }
    37 	TInt DocumentLength() const;
    38 	void GetText(TInt aPos, TPtrC& aText, TTmCharFormat& aFormat) const;
    39 	void GetParagraphFormatL(TInt aPos, RTmParFormat& aFormat) const;
    40 	TInt ParagraphStart(TInt aPos) const;
    41 	CPicture* PictureL(TInt aPos) const;
    42 
    43 private:
    44 	const CRichText* iRichText;
    45 	MGraphicsDeviceMap* iDeviceMap;
    46 	};
    47 
    48 class CTestTmTextLayout : public CBase
    49 	{
    50 public:
    51 	static CTestTmTextLayout* NewLC(const CRichText& aText, TInt aWrapWidth);
    52 	static CTestTmTextLayout* NewLC(const TDesC& aText, TInt aWrapWidth,
    53 		TransliterationFn* aTransliterate);
    54 	~CTestTmTextLayout();
    55 	MTmSource& Source() { return *iSource; }
    56 	const MTmSource& Source() const { return *iSource; }
    57 	CTmTextLayout& Layout() { return *iLayout; }
    58 	const CTmTextLayout& Layout() const { return *iLayout; }
    59 	CTestGraphicsDevice& Device() const { return *iDevice; }
    60 	void FormatL(const TTmReformatParam& aIn, TTmReformatResult& aOut);
    61 	// Function to test the API: CTmTextLayout::FindAdjacentChunks()
    62 	void TestAdjacentChunks();
    63 private:
    64 	void ConstructL(const CRichText& aText, TInt aWrapWidth);
    65 
    66 private:
    67 	CTmTextLayout* iLayout;
    68 	TTmFormatParam iFormatParam;
    69 	CETextSource* iSource;
    70 	CTestGraphicsDevice* iDevice;
    71 	CRichText* iRichText;
    72 	CParaFormatLayer* iParagraphFormatLayer;
    73 	CCharFormatLayer* iCharacterFormatLayer;
    74 	};