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