os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandmaintainer.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 *
    16 */
    17 
    18 
    19 #ifndef __BANDMAINTAINER_H
    20 #define __BANDMAINTAINER_H
    21 
    22 #include <badesca.h>
    23 #include <txtglobl.h>
    24 #include <frmtview.h>
    25 #include <txtfmlyr.h>
    26 #include <txtrich.h>
    27 #include <frmtlay.h>
    28 
    29 /**
    30 @file
    31 @internalComponent 
    32 */	
    33 class CRichText;
    34 class CRichControl;
    35 class CTextView;
    36 
    37 /**
    38 This class is responsible for maintaining two CTextView/CTextLayout objects.
    39 It also provides a simplified version of the CTextView interface for handling
    40 inserts, deletes and format changes.
    41 The two CTextView/CTextLayout objects that are maintained are:
    42 1) iViewUnderTest is the view/layout we are testing
    43 2) iViewReference is the view/layout we testing against
    44 The test view iViewUnderTest has band formatting enabled and is compared to the 
    45 reference view iViewReference which does not have band formatting enabled. The reference
    46 view formats all of its document again from scratch each time a change is made so that it
    47 does not invoke any of the reformmating code being tested by the test view.
    48 */
    49 class CBandMaintainer : public CBase
    50 	{
    51 public:
    52 	IMPORT_C static CBandMaintainer* NewLC(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
    53 	IMPORT_C ~CBandMaintainer();
    54 	/**
    55 	Scroll the test display (negative = downwards)
    56 	@param aPixels The number of pixels to scroll; may be a positive or negative value. On return, contains 
    57 	the number of pixels actually scrolled. Positive values move the text down, negative move it up. 
    58 	*/
    59 	IMPORT_C void ScrollDisplayPixelsL(TInt& aPixels);
    60 	/**
    61 	Update the view after a change to the document
    62 	*/
    63 	IMPORT_C void InitialiseViewL();
    64 	/**
    65 	Scroll both views in the direction and amount specified by the TCursorPosition::TMovementType parameter
    66 	@param aMovement The direction and manner in which to scroll. On return set to the actual cursor movement.
    67 	@return ETrue if the resulting scroll gave the same results for both test and reference views, EFalse otherwise.
    68 	*/
    69 	IMPORT_C TBool ScrollL(TCursorPosition::TMovementType& aMovement);
    70 	/**
    71 	Causes the view objects to be reformatted after a change to the text or paragraph formatting
    72 	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    73 	can be tested against a view which does not invoke the reformatting logic at all
    74 	@param aSelection The start and new length of the changed block.
    75 	*/
    76 	IMPORT_C void HandleFormatChangeL(TCursorSelection aSelection);
    77 	/**
    78 	Reformats and redraws both views after a global change has been made to the layout.
    79 	*/ 
    80 	IMPORT_C void HandleGlobalChangeL();
    81 	/**
    82 	Reformats and redraws both views after a deleting a block of text.
    83 	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    84 	can be tested against a view which does not invoke the reformatting logic at all.
    85 	@param aStartPos The start position of the delete to be performed
    86 	@param aDeletedChars The amount of characters to be deleted
    87 	*/
    88 	IMPORT_C void HandleDeleteL(TInt aStartPos, TInt aDeletedChars);
    89 	/**
    90 	Reformats and redraws both views after a inserting a block of text.
    91 	The reference view formats the whole document again using CTextView::FormatTextL, so the test view 
    92 	can be tested against a view which does not invoke the reformatting logic at all.
    93 	@param aSelection The start and new length of the changed block.
    94 	*/
    95 	IMPORT_C void HandleInsertL(TCursorSelection aSelection);
    96 //some accessors
    97 	IMPORT_C CTextView& ViewUnderTest() const;
    98 	IMPORT_C CTextView& ViewReference() const;
    99 	IMPORT_C const CTextLayout& LayoutUnderTest() const;
   100 	IMPORT_C const CTextLayout& LayoutReference() const;
   101 	IMPORT_C const CTmTextLayout& TmLayoutUnderTest() const;
   102 	IMPORT_C const CTmTextLayout& TmLayoutReference() const;
   103 private:
   104 	CBandMaintainer();
   105 	void ConstructL(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
   106 
   107 	CRichControl* iReferenceControl;
   108 	CRichControl* iTestControl;
   109 	//does not own these 2
   110 	CTextView* iViewUnderTest; // view/layout we are testing
   111 	CTextView* iViewReference; // view/layout we testing against
   112 	};
   113 	
   114 #endif