williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __PRNINF_H__
|
williamr@2
|
17 |
#define __PRNINF_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__E32STD_H__)
|
williamr@2
|
20 |
#include <e32std.h>
|
williamr@2
|
21 |
#endif
|
williamr@2
|
22 |
#if !defined(__GDI_H__)
|
williamr@2
|
23 |
#include <gdi.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
#if !defined(__FLDBASE_H__)
|
williamr@2
|
26 |
#include <fldbase.h>
|
williamr@2
|
27 |
#endif
|
williamr@2
|
28 |
|
williamr@2
|
29 |
// Classes defined
|
williamr@2
|
30 |
//class TPageNumbers;
|
williamr@2
|
31 |
class CHeaderFooter;
|
williamr@2
|
32 |
class TPrintParameters;
|
williamr@2
|
33 |
class TPageMargins;
|
williamr@2
|
34 |
class MPrintProcessObserver;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// classes referenced
|
williamr@2
|
37 |
class RReadStream;
|
williamr@2
|
38 |
class RWriteStream;
|
williamr@2
|
39 |
class CRichText;
|
williamr@2
|
40 |
class CParaFormatLayer;
|
williamr@2
|
41 |
class CCharFormatLayer;
|
williamr@2
|
42 |
class MFieldFileNameInfo;
|
williamr@2
|
43 |
class MFieldPageNumInfo;
|
williamr@2
|
44 |
class MFieldNumPagesInfo;
|
williamr@2
|
45 |
//////////////////
|
williamr@2
|
46 |
|
williamr@2
|
47 |
|
williamr@2
|
48 |
class TPrintParameters
|
williamr@2
|
49 |
/** Print parameters.
|
williamr@2
|
50 |
|
williamr@2
|
51 |
This data is associated with a particular print request, not with the document
|
williamr@2
|
52 |
to be printed, so is separate from the print setup information.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
An object of this class is passed to CPrintSetup::StartPrintL() and to CPrintSetup::StartPreviewPrintL().
|
williamr@2
|
55 |
|
williamr@2
|
56 |
@see CPrintSetup
|
williamr@2
|
57 |
@publishedAll
|
williamr@2
|
58 |
@released */
|
williamr@2
|
59 |
{
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
IMPORT_C TPrintParameters(); // sets to 1,0,0
|
williamr@2
|
62 |
public:
|
williamr@2
|
63 |
/** The number of copies to print. */
|
williamr@2
|
64 |
TInt iNumCopies;
|
williamr@2
|
65 |
/** The first page to be printed.
|
williamr@2
|
66 |
|
williamr@2
|
67 |
This value should be less than or equal to iLastPage. Zero indicates the first page
|
williamr@2
|
68 |
in the document. */
|
williamr@2
|
69 |
TInt iFirstPage;
|
williamr@2
|
70 |
/** The last page to be printed.
|
williamr@2
|
71 |
|
williamr@2
|
72 |
This value should be greater than or equal to iFirstPage. Zero indicates the first
|
williamr@2
|
73 |
page in the document. */
|
williamr@2
|
74 |
TInt iLastPage;
|
williamr@2
|
75 |
};
|
williamr@2
|
76 |
|
williamr@2
|
77 |
class TPageMargins
|
williamr@2
|
78 |
/** Page margins.
|
williamr@2
|
79 |
|
williamr@2
|
80 |
Page margins are accessed via the public iPageMarginsInTwips member of class
|
williamr@2
|
81 |
CPrintSetup. A single margin settings object applies throughout a document,
|
williamr@2
|
82 |
so that gutter margins are not supported.
|
williamr@2
|
83 |
|
williamr@2
|
84 |
If the document contains headers and footers, they are located within the
|
williamr@2
|
85 |
top and bottom margins respectively.
|
williamr@2
|
86 |
|
williamr@2
|
87 |
@publishedAll
|
williamr@2
|
88 |
@released */
|
williamr@2
|
89 |
{
|
williamr@2
|
90 |
public:
|
williamr@2
|
91 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
williamr@2
|
92 |
IMPORT_C void ExternalizeL(RWriteStream& aStream)const;
|
williamr@2
|
93 |
public:
|
williamr@2
|
94 |
/** The distance between the top of the header and the top of the page in twips
|
williamr@2
|
95 |
or pixels.
|
williamr@2
|
96 |
|
williamr@2
|
97 |
This must be less than the height of the top margin to ensure that the header
|
williamr@2
|
98 |
is visible. */
|
williamr@2
|
99 |
TInt iHeaderOffset;
|
williamr@2
|
100 |
/** The distance between the top of the footer and the top of the bottom margin
|
williamr@2
|
101 |
in twips or pixels.
|
williamr@2
|
102 |
|
williamr@2
|
103 |
This must be less than the height of the bottom margin to ensure that the
|
williamr@2
|
104 |
footer is visible. */
|
williamr@2
|
105 |
TInt iFooterOffset;
|
williamr@2
|
106 |
/** The widths of each of the four margins in twips or pixels.
|
williamr@2
|
107 |
|
williamr@2
|
108 |
@see TMargins */
|
williamr@2
|
109 |
TMargins iMargins;
|
williamr@2
|
110 |
};
|
williamr@2
|
111 |
|
williamr@2
|
112 |
class CHeaderFooter : public CBase, private MTextFieldFactory
|
williamr@2
|
113 |
/** A document header or footer.
|
williamr@2
|
114 |
|
williamr@2
|
115 |
The header is located in the top page margin and the footer in the
|
williamr@2
|
116 |
bottom page margin. No more than one header or footer can exist in a document.
|
williamr@2
|
117 |
|
williamr@2
|
118 |
CHeaderFooter derives from MTextFieldFactory. This allows the insertion of
|
williamr@2
|
119 |
various fields, including page number, current date or time and filename.
|
williamr@2
|
120 |
|
williamr@2
|
121 |
Rich text manipulation and formatting functions can be accessed through
|
williamr@2
|
122 |
the rich text object which is owned by the header/footer.
|
williamr@2
|
123 |
|
williamr@2
|
124 |
The header and footer are retrieved using the CPrintSetup::Header() and Footer()
|
williamr@2
|
125 |
functions and they are stored and restored together with the rest of the print
|
williamr@2
|
126 |
setup information.
|
williamr@2
|
127 |
|
williamr@2
|
128 |
@publishedAll
|
williamr@2
|
129 |
@released */
|
williamr@2
|
130 |
{
|
williamr@2
|
131 |
public:
|
williamr@2
|
132 |
IMPORT_C static CHeaderFooter* NewL();
|
williamr@2
|
133 |
IMPORT_C virtual ~CHeaderFooter();
|
williamr@2
|
134 |
//
|
williamr@2
|
135 |
IMPORT_C void CreateTextL();
|
williamr@2
|
136 |
IMPORT_C void SetFirstPageToPrintTo(TInt aPageNum); // allows the first few pages of a doc not to have a header on them
|
williamr@2
|
137 |
inline TInt FirstPageToPrintTo()const; // relative to the first page being numbered 0
|
williamr@2
|
138 |
//
|
williamr@2
|
139 |
// persistence
|
williamr@2
|
140 |
IMPORT_C TStreamId StoreL(CStreamStore& aStore)const;
|
williamr@2
|
141 |
IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId,MPictureFactory* aFactory);
|
williamr@2
|
142 |
IMPORT_C void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap)const;
|
williamr@2
|
143 |
IMPORT_C void RestoreComponentsL(const CStreamStore& aStore,MPictureFactory* aFactory);
|
williamr@2
|
144 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
williamr@2
|
145 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
williamr@2
|
146 |
//
|
williamr@2
|
147 |
// text bits
|
williamr@2
|
148 |
IMPORT_C CRichText* Text()const;
|
williamr@2
|
149 |
IMPORT_C CParaFormatLayer* ParaFormat()const;
|
williamr@2
|
150 |
IMPORT_C CCharFormatLayer* CharFormat()const;
|
williamr@2
|
151 |
IMPORT_C void SetText(CRichText* aText); // takes ownership
|
williamr@2
|
152 |
IMPORT_C void SetParaFormat(CParaFormatLayer* aParaFormat); // takes ownership
|
williamr@2
|
153 |
IMPORT_C void SetCharFormat(CCharFormatLayer* aCharFormat); // takes ownership
|
williamr@2
|
154 |
//
|
williamr@2
|
155 |
// field bits
|
williamr@2
|
156 |
IMPORT_C void SetFileNameInfo(const MFieldFileNameInfo& aFileNameInfo); // call if you want headers/footers to support filename fields
|
williamr@2
|
157 |
IMPORT_C void SetNumPagesInfo(const MFieldNumPagesInfo& aNumPagesInfo); // call if you want headers/footers to support "total number of pages" fields
|
williamr@2
|
158 |
inline MFieldFileNameInfo* FileNameFieldInfo()const;
|
williamr@2
|
159 |
inline MFieldNumPagesInfo* NumPagesFieldInfo()const;
|
williamr@2
|
160 |
//
|
williamr@2
|
161 |
void SetPageNumInfo(const MFieldPageNumInfo& aPageNumInfo); // called by CPrintSetup
|
williamr@2
|
162 |
private:
|
williamr@2
|
163 |
CHeaderFooter();
|
williamr@2
|
164 |
void CreateFormatLayersL();
|
williamr@2
|
165 |
// from MTextFieldFactory
|
williamr@2
|
166 |
CTextField* NewFieldL(TUid aFieldType);
|
williamr@2
|
167 |
private:
|
williamr@2
|
168 |
TInt iFirstPageToPrintTo; // relative to the first page being numbered 0
|
williamr@2
|
169 |
MFieldFileNameInfo* iFileNameInfo;
|
williamr@2
|
170 |
MFieldPageNumInfo* iPageNumInfo;
|
williamr@2
|
171 |
MFieldNumPagesInfo* iNumPagesInfo;
|
williamr@2
|
172 |
CRichText* iText; // RichText Doc Handle
|
williamr@2
|
173 |
CParaFormatLayer* iParaLayer;
|
williamr@2
|
174 |
CCharFormatLayer* iCharLayer;
|
williamr@2
|
175 |
private:
|
williamr@2
|
176 |
enum { ETextExists = 0x0001 };
|
williamr@2
|
177 |
};
|
williamr@2
|
178 |
|
williamr@2
|
179 |
class MPrintProcessObserver
|
williamr@2
|
180 |
/** Print progress and status notification interface class.
|
williamr@2
|
181 |
|
williamr@2
|
182 |
The notification functions are called before, during and after a print or
|
williamr@2
|
183 |
print preview operation, to give notification of its progress.
|
williamr@2
|
184 |
|
williamr@2
|
185 |
The print process observer will often be the GUI's standard print progress
|
williamr@2
|
186 |
or print preview dialog.
|
williamr@2
|
187 |
|
williamr@2
|
188 |
An object of a class which implements this interface may be passed as a parameter
|
williamr@2
|
189 |
to CPrintSetup::StartPrintL(), or to CPrintSetup::StartPreviewPrintL().
|
williamr@2
|
190 |
|
williamr@2
|
191 |
@publishedAll
|
williamr@2
|
192 |
@released */
|
williamr@2
|
193 |
{
|
williamr@2
|
194 |
public:
|
williamr@2
|
195 |
/** Notifies that a print or print preview operation is about to begin.
|
williamr@2
|
196 |
|
williamr@2
|
197 |
It may be used to display information about the document to be printed. It
|
williamr@2
|
198 |
is called once, immediately before printing or print previewing begins.
|
williamr@2
|
199 |
|
williamr@2
|
200 |
When subclassing, add variables to store initialisation information as required.
|
williamr@2
|
201 |
|
williamr@2
|
202 |
@param aPrintParams The parameters for the print job. */
|
williamr@2
|
203 |
virtual void NotifyPrintStarted(TPrintParameters aPrintParams)=0;
|
williamr@2
|
204 |
/** Notifies that a band is about to be printed.
|
williamr@2
|
205 |
|
williamr@2
|
206 |
It may be used to display print progress information, including the current
|
williamr@2
|
207 |
page number. It is called immediately before each band is printed.
|
williamr@2
|
208 |
|
williamr@2
|
209 |
@param aPercentageOfPagePrinted The percentage of the page that has been printed.
|
williamr@2
|
210 |
@param aCurrentPageNum The number of the page currently being printed.
|
williamr@2
|
211 |
@param aCurrentCopyNum The number of the copy currently being printed (if multiple
|
williamr@2
|
212 |
copies are being printed). */
|
williamr@2
|
213 |
virtual void NotifyBandPrinted(TInt aPercentageOfPagePrinted, TInt aCurrentPageNum, TInt aCurrentCopyNum)=0;
|
williamr@2
|
214 |
/** Notifies that the print or print preview operation has completed.
|
williamr@2
|
215 |
|
williamr@2
|
216 |
It may be used to display information about how the operation completed, for
|
williamr@2
|
217 |
example any errors that occurred. It is called once, immediately after the
|
williamr@2
|
218 |
print job terminates.
|
williamr@2
|
219 |
|
williamr@2
|
220 |
@param anErrorCode KErrNone if the print job completed successfully, otherwise
|
williamr@2
|
221 |
another of the system-wide error codes. */
|
williamr@2
|
222 |
virtual void NotifyPrintEnded(TInt anErrorCode)=0;
|
williamr@2
|
223 |
//
|
williamr@2
|
224 |
};
|
williamr@2
|
225 |
|
williamr@2
|
226 |
|
williamr@2
|
227 |
//
|
williamr@2
|
228 |
// inlines
|
williamr@2
|
229 |
//
|
williamr@2
|
230 |
|
williamr@2
|
231 |
inline TInt CHeaderFooter::FirstPageToPrintTo()const
|
williamr@2
|
232 |
/** Gets the first page on which the header or footer is to be printed.
|
williamr@2
|
233 |
|
williamr@2
|
234 |
Page numbering begins at zero.
|
williamr@2
|
235 |
|
williamr@2
|
236 |
@return The number of the first page on which the header or footer is to be
|
williamr@2
|
237 |
printed. */
|
williamr@2
|
238 |
{ return iFirstPageToPrintTo; }
|
williamr@2
|
239 |
|
williamr@2
|
240 |
inline MFieldFileNameInfo* CHeaderFooter::FileNameFieldInfo()const
|
williamr@2
|
241 |
/** Gets the object which implements the MFieldFileNameInfo interface, as set by
|
williamr@2
|
242 |
SetFileNameInfo().
|
williamr@2
|
243 |
|
williamr@2
|
244 |
@return The object which implements the MFieldFileNameInfo interface. */
|
williamr@2
|
245 |
{ return iFileNameInfo; }
|
williamr@2
|
246 |
|
williamr@2
|
247 |
inline MFieldNumPagesInfo* CHeaderFooter::NumPagesFieldInfo()const
|
williamr@2
|
248 |
/** Gets the object which implements the MFieldNumPagesInfo interface, as set by
|
williamr@2
|
249 |
SetNumPagesInfo().
|
williamr@2
|
250 |
|
williamr@2
|
251 |
@return The object which implements the MFieldNumPagesInfo interface. */
|
williamr@2
|
252 |
{ return iNumPagesInfo; }
|
williamr@2
|
253 |
|
williamr@2
|
254 |
#endif
|