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