sl@0: /* sl@0: * Copyright (c) 2007-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: * Needs the following libraries in the MMP: sl@0: * euser.lib etext.lib fbscli.lib bitgdi.lib form.lib EFSRV.LIB imageconversion.lib ezip.lib sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // Complete richtext document class that uses a file-based sl@0: // bitmap instead of a screen device allowing the creation, sl@0: // saving and comparing of what would normally be screen-shots sl@0: class CTestBitmapFile : public CActive sl@0: { sl@0: public: sl@0: // Construction sl@0: // Optionally specify screen size and font/ fontsize sl@0: IMPORT_C static CTestBitmapFile* NewLC(const TRect& aDisplayRect = TRect(0, 0, 252, 94), sl@0: TCharFormat aCharFormat = TCharFormat(_L("NewTimes"),300)); sl@0: IMPORT_C ~CTestBitmapFile(); sl@0: sl@0: // Load/save operations sl@0: IMPORT_C TBool CompareL(const TDes8& aData); sl@0: IMPORT_C void SaveFileL(const TDesC& aFileName); sl@0: sl@0: // Gets sl@0: inline CRichText* DocModel() {return iDocModel;} sl@0: inline CTextView* View() {return iView;} sl@0: inline CTextLayout* Layout() {return iLayout;} sl@0: sl@0: IMPORT_C void AppendL(const TDesC&); sl@0: IMPORT_C void AppendL(CPicture* aPic); sl@0: sl@0: private: sl@0: // Construction sl@0: CTestBitmapFile(); sl@0: void ConstructL(); sl@0: sl@0: // Destruction sl@0: void Delete(void*); sl@0: sl@0: // Active object interface sl@0: void RunL(); sl@0: void DoCancel(); sl@0: sl@0: private: sl@0: CFbsBitmap* iBitmap; sl@0: CImageEncoder* iSaveUtil; sl@0: RFs iFs; sl@0: TRect iDisplayRect; sl@0: CFbsBitmapDevice* iDevice; sl@0: CParaFormat* iParaFormat; sl@0: TParaFormatMask iParaFormatMask; sl@0: CParaFormatLayer* iParaFormatLayer; sl@0: TCharFormat iCharFormat; sl@0: TCharFormatMask iCharFormatMask; sl@0: CCharFormatLayer* iCharFormatLayer; sl@0: CRichText* iDocModel; sl@0: CTextLayout* iLayout; sl@0: CTextView* iView; sl@0: }; sl@0: sl@0: sl@0: //Extracts zipped bitmap files into descriptors for convenient comparison sl@0: class CTestBitmapZipFileExtractor : public CBase sl@0: { sl@0: public: sl@0: // Construction sl@0: IMPORT_C static CTestBitmapZipFileExtractor* NewLC(const TDesC& aZipFile); sl@0: IMPORT_C ~CTestBitmapZipFileExtractor(); sl@0: // Bitmap file extractor and descriptor converter sl@0: IMPORT_C TPtr8 BitmapFileL(const TDesC& aFilename); sl@0: sl@0: private: sl@0: // Construction sl@0: CTestBitmapZipFileExtractor(); sl@0: void ConstructL(const TDesC& aZipFile); sl@0: sl@0: private: sl@0: RFs iFs; sl@0: // Zip file object sl@0: CZipFile* iZipFile; sl@0: //temporary buffer for descriptor conversion sl@0: HBufC8* iBuf; sl@0: };