Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
28 // The following two classes are for internal use only
49 TBool AppendLineL(TPageLine aLine);
50 void FlushL(TInt aEndDocPos);
51 void SetPageHeight(TInt aPageHeight);
52 void SetArray(CArrayFix<TInt>* aCharsPerPage);
56 void InsertPageBreakL();
57 void SetPotentialBreakPoint(TInt aDocPos);
58 void CheckTallLineL(TPageLine& aLine);
60 CArrayFix<TInt>* iPageList; // This is created and destroyed by the application running the paginator.
68 TBool iFirstLine; // Used to prevent page break being inserted at top of document.
72 An abstract class which must be mixed with application calling the active object.
73 It specifies the protocol for a pagination observer. A
74 pagination observer may be used when paginating a document in the background
75 (using CTextPaginator::PaginateCompleteDocumentL()). It notifies the client
76 on page completion, document completion, and on errors.
78 The observer is set up using the function CTextPaginator::SetObserver().
82 class MPaginateObserver
86 /** Notifies the client on completion of document pagination. */
87 virtual void NotifyCompletion()=0;
89 /** Notifies the client when a leave is trapped or when the pagination is cancelled.
90 Implements error handling.
91 @param anErrorCode Error code - indicates the type of error. */
92 virtual void NotifyError(TInt anErrorCode)=0;
94 /** Called by the paginator when each page has been completed.
95 @param aCurrentPageNum The number of the page. */
96 virtual void NotifyPageCompletion(TInt aCurrentPageNum)=0;
102 Paginates a document.
104 Sets the page dimensions, the printer device and the source document to paginate.
105 Uses a page list, which is an array of characters-per-page values.
107 There are two ways of paginating a document; either in the background using
108 an active object or by incrementally adding text to the document and repeatedly
109 notifying the CTextPaginator object to paginate the added text. If an active
110 object is used, the client may be notified on completion of pages, on trapped
111 leaves and on completion of the pagination by an optional pagination observer.
115 class CTextPaginator : public CActive
118 // 2 phase ctor: automatically adds self to active scheduler
119 IMPORT_C static CTextPaginator* NewL(CPrinterDevice* aPrinterDevice,CArrayFix<TInt>* aCharsPerPage,TInt aPriority);
120 IMPORT_C ~CTextPaginator();
121 IMPORT_C void SetDocumentL(MLayDoc* aLayDoc); // Must call before anything else
122 IMPORT_C void SetPrinterDevice(CPrinterDevice* aPrinterDevice);
123 IMPORT_C void SetPageSpecInTwips(const TPageSpec& aPageSpec); // Physical size of page.
124 IMPORT_C void SetPageMarginsInTwips(const TMargins& aPageMargins); // Default are all zero.
125 IMPORT_C void SetTextMarginWidthsInTwips(TInt aLabelMarginWidth,TInt aGutterMarginWidth); // label margins (if any)
126 // Called to initiate paginating a document using active object
127 IMPORT_C void SetObserver(MPaginateObserver* aObserver);
128 IMPORT_C void PaginateCompleteDocumentL();
129 // Called to paginate incrementally, without active object
130 IMPORT_C TInt AppendTextL(TInt& aCumulativeDocPos); // returns number of page breaks so far
131 IMPORT_C TInt PaginationCompletedL(); // called at end of incremental pagination - returns total number of page breaks
135 EFPaginateCompleteDocument,
136 EFPaginateIncrementally
140 EPageLineArrayGranularity=10,
141 EPageListArrayGranularity=5
145 EFMaximumNumberLinesInBlock=20
148 CTextPaginator(TInt aPriority);
149 void RunL(); // Active scheduler is friend - can access
150 void DoCancel(); // Called by CActive::Cancel()
151 void ConstructL(CPrinterDevice* aPrinterDevice,CArrayFix<TInt>* aCharsPerPage);
152 void SetLayoutDimensions();
153 void SetOrReplaceDocumentL(MLayDoc* aLayDoc);
154 TRect TextRectInTwips() const;
155 TSize TextSizeInPixels() const;
156 void TrapPaginateParagraphL();
157 void PaginateParagraphL();
158 void PageCompleted();
160 void ResetPaginator();
161 void CopyTempPageListL(); // Copies temporary page list to real one.
162 void LeaveL(TInt aErr);
165 MPaginateObserver* iObserver;
166 CPrinterDevice* iPrinterDevice;
167 TLinePaginator iPaginator;
168 CTextLayout* iLayout;
169 CArrayFix<TInt>* iPageList;
170 CArrayFixFlat<TInt>* iTempPageList;
171 CArrayFixFlat<TPageLine>* iPageLineArray;
172 TSize iPageSizeInTwips;
173 TMargins iPageMarginsInTwips;
174 TInt iGutterMarginWidthInTwips; // Gap between labels and text proper - in twips
175 TInt iLabelMarginWidthInTwips;
176 TInt iDocPos; // Within the laydoc
177 TBool iPageBreakChar;