os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandtestactions.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-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
* TESTACTIONS.H
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#ifndef __TESTACTIONS_H
sl@0
    21
#define __TESTACTIONS_H
sl@0
    22
sl@0
    23
#include <e32std.h>
sl@0
    24
sl@0
    25
/**
sl@0
    26
@file
sl@0
    27
@internalComponent 
sl@0
    28
*/
sl@0
    29
class CRichText;
sl@0
    30
class CBandMaintainer;
sl@0
    31
class CBandValidator;
sl@0
    32
class CFbsScreenDevice;
sl@0
    33
sl@0
    34
/**
sl@0
    35
Base class for band test actions
sl@0
    36
This class is initialised with a CBandMaintainer, CBandValidator and a CRichText object.
sl@0
    37
These are used to perform the required action and then validate the test and reference view
sl@0
    38
*/
sl@0
    39
class TBandTestAction
sl@0
    40
	{
sl@0
    41
public:
sl@0
    42
	// result of a band test action
sl@0
    43
	enum TTestResult
sl@0
    44
		{
sl@0
    45
		ENotExecuted,
sl@0
    46
		EPassed,
sl@0
    47
		EFailed
sl@0
    48
		};
sl@0
    49
	/**
sl@0
    50
	Execute a test action.
sl@0
    51
	@param aDocPos The position in the document where the test action is to be performed
sl@0
    52
	@param aEditLength The length of the edit to be executed
sl@0
    53
	@return TTestResult The result of the band test action	
sl@0
    54
	*/
sl@0
    55
	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength) = 0;
sl@0
    56
protected:
sl@0
    57
	TBandTestAction(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator);
sl@0
    58
	CBandMaintainer& iTextViews;
sl@0
    59
	CRichText& iRichText;
sl@0
    60
	CBandValidator& iValidator;
sl@0
    61
	};
sl@0
    62
sl@0
    63
/**
sl@0
    64
Band test action used to carry out a delete
sl@0
    65
*/	
sl@0
    66
class TDeleteText : public TBandTestAction
sl@0
    67
	{
sl@0
    68
public:
sl@0
    69
	/**
sl@0
    70
	Constructor
sl@0
    71
	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
sl@0
    72
	@param aRichText The document which is represented by a CRichText object 	
sl@0
    73
	@param aValidator The CBandValidator which is used to compare the test and reference views
sl@0
    74
	*/
sl@0
    75
	IMPORT_C TDeleteText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator);
sl@0
    76
	/**
sl@0
    77
	Execute a delete.
sl@0
    78
	@param aDocPos The position in the document where the test action is to be performed
sl@0
    79
	@param aEditLength The length of the edit to be executed
sl@0
    80
	@return TTestResult The result of the band test action	
sl@0
    81
	*/
sl@0
    82
	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
sl@0
    83
	};
sl@0
    84
sl@0
    85
/**
sl@0
    86
Band test action used to carry out an insert
sl@0
    87
*/	
sl@0
    88
class TInsertText : public TBandTestAction
sl@0
    89
	{
sl@0
    90
public:
sl@0
    91
	/**
sl@0
    92
	Constructor
sl@0
    93
	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
sl@0
    94
	@param aRichText The document which is represented by a CRichText object 	
sl@0
    95
	@param aValidator The CBandValidator which is used to compare the test and reference views
sl@0
    96
	@param aTextToInsert The text to be inserted
sl@0
    97
	*/
sl@0
    98
	IMPORT_C TInsertText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, const TDesC& aTextToInsert);
sl@0
    99
	/**
sl@0
   100
	Execute an insert,
sl@0
   101
	@param aDocPos The position in the document where the test action is to be performed
sl@0
   102
	@param aEditLength Not Used
sl@0
   103
	@return TTestResult The result of the band test action	
sl@0
   104
	*/
sl@0
   105
	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
sl@0
   106
private:
sl@0
   107
	const TDesC& iTextToInsert;
sl@0
   108
	};
sl@0
   109
	
sl@0
   110
enum TReformatAction
sl@0
   111
	{
sl@0
   112
	EMakeBold,
sl@0
   113
	EIncreaseFontSize,
sl@0
   114
	EDecreaseFontSize,
sl@0
   115
	EChangeFont
sl@0
   116
	};
sl@0
   117
sl@0
   118
/**
sl@0
   119
Band test action used to carry out a reformat
sl@0
   120
*/
sl@0
   121
class TReformatText : public TBandTestAction
sl@0
   122
	{
sl@0
   123
public:
sl@0
   124
	/**
sl@0
   125
	Constructor
sl@0
   126
	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
sl@0
   127
	@param aRichText The document which is represented by a CRichText object 	
sl@0
   128
	@param aValidator The CBandValidator which is used to compare the test and reference views
sl@0
   129
	*/
sl@0
   130
	IMPORT_C TReformatText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, TReformatAction aReformatAction, CFbsScreenDevice& aDevice);
sl@0
   131
	/**
sl@0
   132
	Exectute a reformat
sl@0
   133
	@param aDocPos The position in the document where the test action is to be performed
sl@0
   134
	@param aEditLength The length of the edit to be executed
sl@0
   135
	@return TTestResult The result of the band test action	
sl@0
   136
	*/
sl@0
   137
	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
sl@0
   138
private:
sl@0
   139
	TInt iReformatAction;
sl@0
   140
	CFbsScreenDevice& iDevice;
sl@0
   141
	};
sl@0
   142
	
sl@0
   143
#endif