os/textandloc/textrendering/textformatting/test/src/TBitmapDoc.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2007-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
* Needs the following libraries in the MMP:
sl@0
    16
* euser.lib etext.lib fbscli.lib bitgdi.lib form.lib EFSRV.LIB imageconversion.lib ezip.lib
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
sl@0
    22
#include <e32base.h>
sl@0
    23
#include <txtfrmat.h>
sl@0
    24
#include <txtrich.h>
sl@0
    25
#include <frmtview.h>
sl@0
    26
#include <imageconversion.h>
sl@0
    27
#include <zipfile.h>
sl@0
    28
sl@0
    29
// Complete richtext document class that uses a file-based
sl@0
    30
// bitmap instead of a screen device allowing the creation,
sl@0
    31
// saving and comparing of what would normally be screen-shots
sl@0
    32
class CTestBitmapFile : public CActive
sl@0
    33
	{
sl@0
    34
public:
sl@0
    35
	// Construction
sl@0
    36
	// Optionally specify screen size and font/ fontsize
sl@0
    37
	IMPORT_C static CTestBitmapFile* NewLC(const TRect& aDisplayRect = TRect(0, 0, 252, 94),
sl@0
    38
		TCharFormat aCharFormat = TCharFormat(_L("NewTimes"),300));
sl@0
    39
	IMPORT_C ~CTestBitmapFile();
sl@0
    40
sl@0
    41
	// Load/save operations
sl@0
    42
	IMPORT_C TBool CompareL(const TDes8& aData);
sl@0
    43
	IMPORT_C void SaveFileL(const TDesC& aFileName);
sl@0
    44
    
sl@0
    45
	// Gets
sl@0
    46
	inline CRichText* DocModel() {return iDocModel;}
sl@0
    47
	inline CTextView* View() {return iView;}
sl@0
    48
	inline CTextLayout* Layout() {return iLayout;}
sl@0
    49
	
sl@0
    50
	IMPORT_C void AppendL(const TDesC&);
sl@0
    51
	IMPORT_C void AppendL(CPicture* aPic);
sl@0
    52
sl@0
    53
private:
sl@0
    54
	// Construction
sl@0
    55
	CTestBitmapFile();
sl@0
    56
	void ConstructL();
sl@0
    57
    
sl@0
    58
	// Destruction
sl@0
    59
	void Delete(void*);
sl@0
    60
sl@0
    61
	// Active object interface
sl@0
    62
	void RunL(); 
sl@0
    63
	void DoCancel();
sl@0
    64
sl@0
    65
private:
sl@0
    66
	CFbsBitmap* iBitmap; 
sl@0
    67
	CImageEncoder* iSaveUtil;
sl@0
    68
	RFs iFs;
sl@0
    69
	TRect iDisplayRect;
sl@0
    70
	CFbsBitmapDevice* iDevice;
sl@0
    71
	CParaFormat* iParaFormat;
sl@0
    72
 	TParaFormatMask iParaFormatMask;
sl@0
    73
	CParaFormatLayer* iParaFormatLayer;
sl@0
    74
	TCharFormat iCharFormat;
sl@0
    75
	TCharFormatMask iCharFormatMask;
sl@0
    76
	CCharFormatLayer* iCharFormatLayer;
sl@0
    77
	CRichText* iDocModel;
sl@0
    78
	CTextLayout* iLayout;
sl@0
    79
	CTextView* iView;
sl@0
    80
	};
sl@0
    81
sl@0
    82
sl@0
    83
//Extracts zipped bitmap files into descriptors for convenient comparison
sl@0
    84
class CTestBitmapZipFileExtractor : public CBase
sl@0
    85
	{
sl@0
    86
public:
sl@0
    87
    // Construction
sl@0
    88
    IMPORT_C static CTestBitmapZipFileExtractor* NewLC(const TDesC& aZipFile);
sl@0
    89
    IMPORT_C ~CTestBitmapZipFileExtractor();
sl@0
    90
	// Bitmap file extractor and descriptor converter
sl@0
    91
    IMPORT_C TPtr8 BitmapFileL(const TDesC& aFilename);
sl@0
    92
sl@0
    93
private:
sl@0
    94
    // Construction
sl@0
    95
    CTestBitmapZipFileExtractor();
sl@0
    96
    void ConstructL(const TDesC& aZipFile);
sl@0
    97
sl@0
    98
private:
sl@0
    99
	RFs iFs;
sl@0
   100
	// Zip file object
sl@0
   101
	CZipFile* iZipFile;
sl@0
   102
	//temporary buffer for descriptor conversion
sl@0
   103
	HBufC8* iBuf;
sl@0
   104
	};