1.1 --- a/epoc32/include/frmpage.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,181 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __FRMPAGE_H__
1.20 -#define __FRMPAGE_H__
1.21 -
1.22 -#include <e32std.h>
1.23 -#include <e32base.h>
1.24 -#include <gdi.h>
1.25 -
1.26 -class MLayDoc;
1.27 -class CTextLayout;
1.28 -class CParaFormat;
1.29 -
1.30 -//
1.31 -// The following two classes are for internal use only
1.32 -//
1.33 -
1.34 -/**
1.35 -@internalComponent
1.36 -*/
1.37 -struct TPageLine
1.38 - {
1.39 - TInt iDocPos;
1.40 - TInt iLineHeight;
1.41 - TBool iKeepWithNext;
1.42 - TBool iStartNewPage;
1.43 - };
1.44 -
1.45 -/**
1.46 -@internalComponent
1.47 -*/
1.48 -class TLinePaginator
1.49 - {
1.50 -public:
1.51 - TLinePaginator();
1.52 - TBool AppendLineL(TPageLine aLine);
1.53 - void FlushL(TInt aEndDocPos);
1.54 - void SetPageHeight(TInt aPageHeight);
1.55 - void SetArray(CArrayFix<TInt>* aCharsPerPage);
1.56 - void Reset();
1.57 -private:
1.58 - void ResetArray();
1.59 - void InsertPageBreakL();
1.60 - void SetPotentialBreakPoint(TInt aDocPos);
1.61 - void CheckTallLineL(TPageLine& aLine);
1.62 -private:
1.63 - CArrayFix<TInt>* iPageList; // This is created and destroyed by the application running the paginator.
1.64 - TInt iDocPos;
1.65 - TBool iKeepWithPrev;
1.66 - TInt iPageHeight;
1.67 - TInt iHeightRem;
1.68 - TBool iBreakOnPage;
1.69 - TInt iPrevPageBreak;
1.70 - TInt iHeightLines;
1.71 - TBool iFirstLine; // Used to prevent page break being inserted at top of document.
1.72 - };
1.73 -
1.74 -/**
1.75 -An abstract class which must be mixed with application calling the active object.
1.76 -It specifies the protocol for a pagination observer. A
1.77 -pagination observer may be used when paginating a document in the background
1.78 -(using CTextPaginator::PaginateCompleteDocumentL()). It notifies the client
1.79 -on page completion, document completion, and on errors.
1.80 -
1.81 -The observer is set up using the function CTextPaginator::SetObserver().
1.82 -@publishedAll
1.83 -@released
1.84 -*/
1.85 -class MPaginateObserver
1.86 - {
1.87 -public:
1.88 -
1.89 - /** Notifies the client on completion of document pagination. */
1.90 - virtual void NotifyCompletion()=0;
1.91 -
1.92 - /** Notifies the client when a leave is trapped or when the pagination is cancelled.
1.93 - Implements error handling.
1.94 - @param anErrorCode Error code - indicates the type of error. */
1.95 - virtual void NotifyError(TInt anErrorCode)=0;
1.96 -
1.97 - /** Called by the paginator when each page has been completed.
1.98 - @param aCurrentPageNum The number of the page. */
1.99 - virtual void NotifyPageCompletion(TInt aCurrentPageNum)=0;
1.100 - };
1.101 -
1.102 -
1.103 -
1.104 -/**
1.105 -Paginates a document.
1.106 -
1.107 -Sets the page dimensions, the printer device and the source document to paginate.
1.108 -Uses a page list, which is an array of characters-per-page values.
1.109 -
1.110 -There are two ways of paginating a document; either in the background using
1.111 -an active object or by incrementally adding text to the document and repeatedly
1.112 -notifying the CTextPaginator object to paginate the added text. If an active
1.113 -object is used, the client may be notified on completion of pages, on trapped
1.114 -leaves and on completion of the pagination by an optional pagination observer.
1.115 -@publishedAll
1.116 -@released
1.117 -*/
1.118 -class CTextPaginator : public CActive
1.119 - {
1.120 -public:
1.121 -// 2 phase ctor: automatically adds self to active scheduler
1.122 - IMPORT_C static CTextPaginator* NewL(CPrinterDevice* aPrinterDevice,CArrayFix<TInt>* aCharsPerPage,TInt aPriority);
1.123 - IMPORT_C ~CTextPaginator();
1.124 - IMPORT_C void SetDocumentL(MLayDoc* aLayDoc); // Must call before anything else
1.125 - IMPORT_C void SetPrinterDevice(CPrinterDevice* aPrinterDevice);
1.126 - IMPORT_C void SetPageSpecInTwips(const TPageSpec& aPageSpec); // Physical size of page.
1.127 - IMPORT_C void SetPageMarginsInTwips(const TMargins& aPageMargins); // Default are all zero.
1.128 - IMPORT_C void SetTextMarginWidthsInTwips(TInt aLabelMarginWidth,TInt aGutterMarginWidth); // label margins (if any)
1.129 -// Called to initiate paginating a document using active object
1.130 - IMPORT_C void SetObserver(MPaginateObserver* aObserver);
1.131 - IMPORT_C void PaginateCompleteDocumentL();
1.132 -// Called to paginate incrementally, without active object
1.133 - IMPORT_C TInt AppendTextL(TInt& aCumulativeDocPos); // returns number of page breaks so far
1.134 - IMPORT_C TInt PaginationCompletedL(); // called at end of incremental pagination - returns total number of page breaks
1.135 -private:
1.136 - enum TPaginateMode
1.137 - {
1.138 - EFPaginateCompleteDocument,
1.139 - EFPaginateIncrementally
1.140 - };
1.141 - enum
1.142 - {
1.143 - EPageLineArrayGranularity=10,
1.144 - EPageListArrayGranularity=5
1.145 - };
1.146 - enum
1.147 - {
1.148 - EFMaximumNumberLinesInBlock=20
1.149 - };
1.150 -private:
1.151 - CTextPaginator(TInt aPriority);
1.152 - void RunL(); // Active scheduler is friend - can access
1.153 - void DoCancel(); // Called by CActive::Cancel()
1.154 - void ConstructL(CPrinterDevice* aPrinterDevice,CArrayFix<TInt>* aCharsPerPage);
1.155 - void SetLayoutDimensions();
1.156 - void SetOrReplaceDocumentL(MLayDoc* aLayDoc);
1.157 - TRect TextRectInTwips() const;
1.158 - TSize TextSizeInPixels() const;
1.159 - void TrapPaginateParagraphL();
1.160 - void PaginateParagraphL();
1.161 - void PageCompleted();
1.162 - void Reque();
1.163 - void ResetPaginator();
1.164 - void CopyTempPageListL(); // Copies temporary page list to real one.
1.165 - void LeaveL(TInt aErr);
1.166 -private:
1.167 - MLayDoc* iLayDoc;
1.168 - MPaginateObserver* iObserver;
1.169 - CPrinterDevice* iPrinterDevice;
1.170 - TLinePaginator iPaginator;
1.171 - CTextLayout* iLayout;
1.172 - CArrayFix<TInt>* iPageList;
1.173 - CArrayFixFlat<TInt>* iTempPageList;
1.174 - CArrayFixFlat<TPageLine>* iPageLineArray;
1.175 - TSize iPageSizeInTwips;
1.176 - TMargins iPageMarginsInTwips;
1.177 - TInt iGutterMarginWidthInTwips; // Gap between labels and text proper - in twips
1.178 - TInt iLabelMarginWidthInTwips;
1.179 - TInt iDocPos; // Within the laydoc
1.180 - TBool iPageBreakChar;
1.181 - TPaginateMode iMode;
1.182 - };
1.183 -
1.184 -#endif