First public contribution.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef __BANDMAINTAINER_H
20 #define __BANDMAINTAINER_H
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.
49 class CBandMaintainer : public CBase
52 IMPORT_C static CBandMaintainer* NewLC(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
53 IMPORT_C ~CBandMaintainer();
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.
59 IMPORT_C void ScrollDisplayPixelsL(TInt& aPixels);
61 Update the view after a change to the document
63 IMPORT_C void InitialiseViewL();
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.
69 IMPORT_C TBool ScrollL(TCursorPosition::TMovementType& aMovement);
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.
76 IMPORT_C void HandleFormatChangeL(TCursorSelection aSelection);
78 Reformats and redraws both views after a global change has been made to the layout.
80 IMPORT_C void HandleGlobalChangeL();
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
88 IMPORT_C void HandleDeleteL(TInt aStartPos, TInt aDeletedChars);
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.
95 IMPORT_C void HandleInsertL(TCursorSelection aSelection);
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;
105 void ConstructL(CRichText& aRichText, TRect aDrawRect, TBool aDisplayTextBox);
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