os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandmaintainer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandmaintainer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,114 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-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 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef __BANDMAINTAINER_H
    1.23 +#define __BANDMAINTAINER_H
    1.24 +
    1.25 +#include <badesca.h>
    1.26 +#include <txtglobl.h>
    1.27 +#include <frmtview.h>
    1.28 +#include <txtfmlyr.h>
    1.29 +#include <txtrich.h>
    1.30 +#include <frmtlay.h>
    1.31 +
    1.32 +/**
    1.33 +@file
    1.34 +@internalComponent 
    1.35 +*/	
    1.36 +class CRichText;
    1.37 +class CRichControl;
    1.38 +class CTextView;
    1.39 +
    1.40 +/**
    1.41 +This class is responsible for maintaining two CTextView/CTextLayout objects.
    1.42 +It also provides a simplified version of the CTextView interface for handling
    1.43 +inserts, deletes and format changes.
    1.44 +The two CTextView/CTextLayout objects that are maintained are:
    1.45 +1) iViewUnderTest is the view/layout we are testing
    1.46 +2) iViewReference is the view/layout we testing against
    1.47 +The test view iViewUnderTest has band formatting enabled and is compared to the 
    1.48 +reference view iViewReference which does not have band formatting enabled. The reference
    1.49 +view formats all of its document again from scratch each time a change is made so that it
    1.50 +does not invoke any of the reformmating code being tested by the test view.
    1.51 +*/
    1.52 +class CBandMaintainer : public CBase
    1.53 +	{
    1.54 +public:
    1.55 +	IMPORT_C static CBandMaintainer* NewLC(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
    1.56 +	IMPORT_C ~CBandMaintainer();
    1.57 +	/**
    1.58 +	Scroll the test display (negative = downwards)
    1.59 +	@param aPixels The number of pixels to scroll; may be a positive or negative value. On return, contains 
    1.60 +	the number of pixels actually scrolled. Positive values move the text down, negative move it up. 
    1.61 +	*/
    1.62 +	IMPORT_C void ScrollDisplayPixelsL(TInt& aPixels);
    1.63 +	/**
    1.64 +	Update the view after a change to the document
    1.65 +	*/
    1.66 +	IMPORT_C void InitialiseViewL();
    1.67 +	/**
    1.68 +	Scroll both views in the direction and amount specified by the TCursorPosition::TMovementType parameter
    1.69 +	@param aMovement The direction and manner in which to scroll. On return set to the actual cursor movement.
    1.70 +	@return ETrue if the resulting scroll gave the same results for both test and reference views, EFalse otherwise.
    1.71 +	*/
    1.72 +	IMPORT_C TBool ScrollL(TCursorPosition::TMovementType& aMovement);
    1.73 +	/**
    1.74 +	Causes the view objects to be reformatted after a change to the text or paragraph formatting
    1.75 +	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    1.76 +	can be tested against a view which does not invoke the reformatting logic at all
    1.77 +	@param aSelection The start and new length of the changed block.
    1.78 +	*/
    1.79 +	IMPORT_C void HandleFormatChangeL(TCursorSelection aSelection);
    1.80 +	/**
    1.81 +	Reformats and redraws both views after a global change has been made to the layout.
    1.82 +	*/ 
    1.83 +	IMPORT_C void HandleGlobalChangeL();
    1.84 +	/**
    1.85 +	Reformats and redraws both views after a deleting a block of text.
    1.86 +	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    1.87 +	can be tested against a view which does not invoke the reformatting logic at all.
    1.88 +	@param aStartPos The start position of the delete to be performed
    1.89 +	@param aDeletedChars The amount of characters to be deleted
    1.90 +	*/
    1.91 +	IMPORT_C void HandleDeleteL(TInt aStartPos, TInt aDeletedChars);
    1.92 +	/**
    1.93 +	Reformats and redraws both views after a inserting a block of text.
    1.94 +	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    1.95 +	can be tested against a view which does not invoke the reformatting logic at all.
    1.96 +	@param aSelection The start and new length of the changed block.
    1.97 +	*/
    1.98 +	IMPORT_C void HandleInsertL(TCursorSelection aSelection);
    1.99 +//some accessors
   1.100 +	IMPORT_C CTextView& ViewUnderTest() const;
   1.101 +	IMPORT_C CTextView& ViewReference() const;
   1.102 +	IMPORT_C const CTextLayout& LayoutUnderTest() const;
   1.103 +	IMPORT_C const CTextLayout& LayoutReference() const;
   1.104 +	IMPORT_C const CTmTextLayout& TmLayoutUnderTest() const;
   1.105 +	IMPORT_C const CTmTextLayout& TmLayoutReference() const;
   1.106 +private:
   1.107 +	CBandMaintainer();
   1.108 +	void ConstructL(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
   1.109 +
   1.110 +	CRichControl* iReferenceControl;
   1.111 +	CRichControl* iTestControl;
   1.112 +	//does not own these 2
   1.113 +	CTextView* iViewUnderTest; // view/layout we are testing
   1.114 +	CTextView* iViewReference; // view/layout we testing against
   1.115 +	};
   1.116 +	
   1.117 +#endif