1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/textformatting/test/src/TBitmapDoc.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,104 @@
1.4 +/*
1.5 +* Copyright (c) 2007-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 +* Needs the following libraries in the MMP:
1.19 +* euser.lib etext.lib fbscli.lib bitgdi.lib form.lib EFSRV.LIB imageconversion.lib ezip.lib
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +
1.25 +#include <e32base.h>
1.26 +#include <txtfrmat.h>
1.27 +#include <txtrich.h>
1.28 +#include <frmtview.h>
1.29 +#include <imageconversion.h>
1.30 +#include <zipfile.h>
1.31 +
1.32 +// Complete richtext document class that uses a file-based
1.33 +// bitmap instead of a screen device allowing the creation,
1.34 +// saving and comparing of what would normally be screen-shots
1.35 +class CTestBitmapFile : public CActive
1.36 + {
1.37 +public:
1.38 + // Construction
1.39 + // Optionally specify screen size and font/ fontsize
1.40 + IMPORT_C static CTestBitmapFile* NewLC(const TRect& aDisplayRect = TRect(0, 0, 252, 94),
1.41 + TCharFormat aCharFormat = TCharFormat(_L("NewTimes"),300));
1.42 + IMPORT_C ~CTestBitmapFile();
1.43 +
1.44 + // Load/save operations
1.45 + IMPORT_C TBool CompareL(const TDes8& aData);
1.46 + IMPORT_C void SaveFileL(const TDesC& aFileName);
1.47 +
1.48 + // Gets
1.49 + inline CRichText* DocModel() {return iDocModel;}
1.50 + inline CTextView* View() {return iView;}
1.51 + inline CTextLayout* Layout() {return iLayout;}
1.52 +
1.53 + IMPORT_C void AppendL(const TDesC&);
1.54 + IMPORT_C void AppendL(CPicture* aPic);
1.55 +
1.56 +private:
1.57 + // Construction
1.58 + CTestBitmapFile();
1.59 + void ConstructL();
1.60 +
1.61 + // Destruction
1.62 + void Delete(void*);
1.63 +
1.64 + // Active object interface
1.65 + void RunL();
1.66 + void DoCancel();
1.67 +
1.68 +private:
1.69 + CFbsBitmap* iBitmap;
1.70 + CImageEncoder* iSaveUtil;
1.71 + RFs iFs;
1.72 + TRect iDisplayRect;
1.73 + CFbsBitmapDevice* iDevice;
1.74 + CParaFormat* iParaFormat;
1.75 + TParaFormatMask iParaFormatMask;
1.76 + CParaFormatLayer* iParaFormatLayer;
1.77 + TCharFormat iCharFormat;
1.78 + TCharFormatMask iCharFormatMask;
1.79 + CCharFormatLayer* iCharFormatLayer;
1.80 + CRichText* iDocModel;
1.81 + CTextLayout* iLayout;
1.82 + CTextView* iView;
1.83 + };
1.84 +
1.85 +
1.86 +//Extracts zipped bitmap files into descriptors for convenient comparison
1.87 +class CTestBitmapZipFileExtractor : public CBase
1.88 + {
1.89 +public:
1.90 + // Construction
1.91 + IMPORT_C static CTestBitmapZipFileExtractor* NewLC(const TDesC& aZipFile);
1.92 + IMPORT_C ~CTestBitmapZipFileExtractor();
1.93 + // Bitmap file extractor and descriptor converter
1.94 + IMPORT_C TPtr8 BitmapFileL(const TDesC& aFilename);
1.95 +
1.96 +private:
1.97 + // Construction
1.98 + CTestBitmapZipFileExtractor();
1.99 + void ConstructL(const TDesC& aZipFile);
1.100 +
1.101 +private:
1.102 + RFs iFs;
1.103 + // Zip file object
1.104 + CZipFile* iZipFile;
1.105 + //temporary buffer for descriptor conversion
1.106 + HBufC8* iBuf;
1.107 + };