os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandtestdocument.h
Update contrib.
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 __BANDTESTDOCUMENT_H
20 #define __BANDTESTDOCUMENT_H
30 class CBandMaintainer;
32 class TBandTestAction;
35 This class represents a specification for a document and a view.
37 - The document content is represented by a descriptor array in which each descriptor is a paragraph.
39 - The view is represented simply by the TInt aTopOfBand argument, which tells us how
40 many paragraphs to lose from the top of the band. So if it is zero, then we just initialise
41 the doc and don't scroll at all; if it is 1 we scroll down until 1 paragraph is removed from
42 the top of the band, and so on. Currently it's basically only ever set to 1 or 0, and is thus
43 used as a boolean "top_of_doc!=top_of_band"
45 Having initialised one of these objects with the document content and view, you can set up
46 the CRichText and associated text views by calling SetupDocumentL. This will clear any text
47 that exists in the richtext, re-create it according to the specification for the document
48 contents and set up the view according to the view specification.
53 IMPORT_C TDocumentSpec(const MDesCArray& aTextContents, TInt aTopOfBand);
54 IMPORT_C void SetupDocumentL(CRichText& aRichText, CBandMaintainer& aMaintainer);
56 const MDesCArray& iContents;
61 Given an array of lines in aLines, this function will first retrieve a subset of the lines thought to be
62 of particular interest to the reformatting algorithm.
64 In general, for each paragraph in the lines supplied, lines of interest are:
68 - the penultimate line
71 - at least 2 lines from the middle
74 - if the paragraph contains 6 lines or fewer, we take them all, giving us the 4 special cases,
75 and two lines from the middle
76 - otherwise, we take the 4 special cases, and a couple from the middle
78 It then retrieves the start, middle and end-1 positions from each line, and put them, in order, in aPositions
80 IMPORT_C void PositionsToTestL(const RArray<TTmLineInfo>& aLines, RArray<TInt>& aPositions);
84 - a document specification aDocumentSpec
86 - an array of positions aPositions
88 This function will iteratively execute the action at each position supplied.
89 For each position N it will iteratively execute the action as follows:
90 - at N, with a length of 1
91 - at N, with a length of ((N+1)-N) +1
92 - at N, with a length of ((N+2)-N) +1
94 So if the positions are 1, 5 and 10, it will execute actions as follows:
102 It will reset the document and view each time.
104 IMPORT_C void ExecuteTestL(CRichText& aRichText, CBandMaintainer& aMaintainer,
105 TBandTestAction& aAction, TDocumentSpec& aDocumentSpec, RArray<TInt>& aPositions);
109 - a document specification aDocumentSpec
110 - a string to insert aTextToInsert
111 - an array of positions aPositions
113 This function will initialise the document and view, then iteratively insert the string
116 It will reset the document and view each time.
118 IMPORT_C void InsertTextL(CRichText& aRichText, CBandMaintainer& aMaintainer,
119 CBandValidator& aValidator, TDocumentSpec& aDocumentSpec, const TDesC& aTextToInsert, RArray<TInt>& aPositions);
122 Given a text layout aLayout, this function will retrieve all the visible lines and
123 place them in aVisibleLines.
125 IMPORT_C void GetVisibleLinesL(const CTextLayout& aLayout, RArray<TTmLineInfo>& aVisibleLines);
128 Given a text layout aTmLayout, this function will retrieve all the lines constituting the
129 formatted band and place them in aLinesInBand
131 IMPORT_C void GetLinesInBandL(const CTmTextLayout& aTmLayout, RArray<TTmLineInfo>& aLinesInBand);