sl@0: /* sl@0: * Copyright (c) 2006-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: * TESTACTIONS.H sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef __TESTACTIONS_H sl@0: #define __TESTACTIONS_H sl@0: sl@0: #include sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: class CRichText; sl@0: class CBandMaintainer; sl@0: class CBandValidator; sl@0: class CFbsScreenDevice; sl@0: sl@0: /** sl@0: Base class for band test actions sl@0: This class is initialised with a CBandMaintainer, CBandValidator and a CRichText object. sl@0: These are used to perform the required action and then validate the test and reference view sl@0: */ sl@0: class TBandTestAction sl@0: { sl@0: public: sl@0: // result of a band test action sl@0: enum TTestResult sl@0: { sl@0: ENotExecuted, sl@0: EPassed, sl@0: EFailed sl@0: }; sl@0: /** sl@0: Execute a test action. sl@0: @param aDocPos The position in the document where the test action is to be performed sl@0: @param aEditLength The length of the edit to be executed sl@0: @return TTestResult The result of the band test action sl@0: */ sl@0: IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength) = 0; sl@0: protected: sl@0: TBandTestAction(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator); sl@0: CBandMaintainer& iTextViews; sl@0: CRichText& iRichText; sl@0: CBandValidator& iValidator; sl@0: }; sl@0: sl@0: /** sl@0: Band test action used to carry out a delete sl@0: */ sl@0: class TDeleteText : public TBandTestAction sl@0: { sl@0: public: sl@0: /** sl@0: Constructor sl@0: @param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects sl@0: @param aRichText The document which is represented by a CRichText object sl@0: @param aValidator The CBandValidator which is used to compare the test and reference views sl@0: */ sl@0: IMPORT_C TDeleteText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator); sl@0: /** sl@0: Execute a delete. sl@0: @param aDocPos The position in the document where the test action is to be performed sl@0: @param aEditLength The length of the edit to be executed sl@0: @return TTestResult The result of the band test action sl@0: */ sl@0: IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength); sl@0: }; sl@0: sl@0: /** sl@0: Band test action used to carry out an insert sl@0: */ sl@0: class TInsertText : public TBandTestAction sl@0: { sl@0: public: sl@0: /** sl@0: Constructor sl@0: @param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects sl@0: @param aRichText The document which is represented by a CRichText object sl@0: @param aValidator The CBandValidator which is used to compare the test and reference views sl@0: @param aTextToInsert The text to be inserted sl@0: */ sl@0: IMPORT_C TInsertText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, const TDesC& aTextToInsert); sl@0: /** sl@0: Execute an insert, sl@0: @param aDocPos The position in the document where the test action is to be performed sl@0: @param aEditLength Not Used sl@0: @return TTestResult The result of the band test action sl@0: */ sl@0: IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength); sl@0: private: sl@0: const TDesC& iTextToInsert; sl@0: }; sl@0: sl@0: enum TReformatAction sl@0: { sl@0: EMakeBold, sl@0: EIncreaseFontSize, sl@0: EDecreaseFontSize, sl@0: EChangeFont sl@0: }; sl@0: sl@0: /** sl@0: Band test action used to carry out a reformat sl@0: */ sl@0: class TReformatText : public TBandTestAction sl@0: { sl@0: public: sl@0: /** sl@0: Constructor sl@0: @param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects sl@0: @param aRichText The document which is represented by a CRichText object sl@0: @param aValidator The CBandValidator which is used to compare the test and reference views sl@0: */ sl@0: IMPORT_C TReformatText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, TReformatAction aReformatAction, CFbsScreenDevice& aDevice); sl@0: /** sl@0: Exectute a reformat sl@0: @param aDocPos The position in the document where the test action is to be performed sl@0: @param aEditLength The length of the edit to be executed sl@0: @return TTestResult The result of the band test action sl@0: */ sl@0: IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength); sl@0: private: sl@0: TInt iReformatAction; sl@0: CFbsScreenDevice& iDevice; sl@0: }; sl@0: sl@0: #endif