sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * TestLayout.h test jig for CTmTextLayout sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "TAGMA.H" sl@0: sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include "TAGMA_INTERNAL.H" sl@0: #endif sl@0: sl@0: class CRichText; sl@0: class CTestGraphicsDevice; sl@0: sl@0: typedef void TransliterationFn(const TDesC&, TDes&); sl@0: sl@0: class CETextSource : public CBase, public MTmSource sl@0: { sl@0: public: sl@0: CETextSource(const CRichText& aRichText, MGraphicsDeviceMap* aDeviceMap); sl@0: MGraphicsDeviceMap& FormatDevice() const { return *iDeviceMap; } sl@0: MGraphicsDeviceMap& InterpretDevice() const { return *iDeviceMap; } sl@0: TInt DocumentLength() const; sl@0: void GetText(TInt aPos, TPtrC& aText, TTmCharFormat& aFormat) const; sl@0: void GetParagraphFormatL(TInt aPos, RTmParFormat& aFormat) const; sl@0: TInt ParagraphStart(TInt aPos) const; sl@0: CPicture* PictureL(TInt aPos) const; sl@0: sl@0: private: sl@0: const CRichText* iRichText; sl@0: MGraphicsDeviceMap* iDeviceMap; sl@0: }; sl@0: sl@0: class CTestTmTextLayout : public CBase sl@0: { sl@0: public: sl@0: static CTestTmTextLayout* NewLC(const CRichText& aText, TInt aWrapWidth); sl@0: static CTestTmTextLayout* NewLC(const TDesC& aText, TInt aWrapWidth, sl@0: TransliterationFn* aTransliterate); sl@0: ~CTestTmTextLayout(); sl@0: MTmSource& Source() { return *iSource; } sl@0: const MTmSource& Source() const { return *iSource; } sl@0: CTmTextLayout& Layout() { return *iLayout; } sl@0: const CTmTextLayout& Layout() const { return *iLayout; } sl@0: CTestGraphicsDevice& Device() const { return *iDevice; } sl@0: void FormatL(const TTmReformatParam& aIn, TTmReformatResult& aOut); sl@0: // Function to test the API: CTmTextLayout::FindAdjacentChunks() sl@0: void TestAdjacentChunks(); sl@0: private: sl@0: void ConstructL(const CRichText& aText, TInt aWrapWidth); sl@0: sl@0: private: sl@0: CTmTextLayout* iLayout; sl@0: TTmFormatParam iFormatParam; sl@0: CETextSource* iSource; sl@0: CTestGraphicsDevice* iDevice; sl@0: CRichText* iRichText; sl@0: CParaFormatLayer* iParagraphFormatLayer; sl@0: CCharFormatLayer* iCharacterFormatLayer; sl@0: };