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 __PRNSETUP_H__
|
williamr@2
|
17 |
#define __PRNSETUP_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(__E32BASE_H__)
|
williamr@2
|
23 |
#include <e32base.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
#if !defined(__FLDBLTIN_H__)
|
williamr@2
|
26 |
#include <fldbltin.h>
|
williamr@2
|
27 |
#endif
|
williamr@2
|
28 |
#if !defined(__PRNINF_H__)
|
williamr@2
|
29 |
#include <prninf.h>
|
williamr@2
|
30 |
#endif
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/** @publishedPartner */
|
williamr@2
|
33 |
const TInt KErrMorePages=4747; // Leave with this error code to print extra pages in PrintBandL
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/** @internalTechnology */
|
williamr@2
|
36 |
_LIT( KDefaultPrinterDriverPath, "\\resource\\printers\\" );
|
williamr@2
|
37 |
|
williamr@2
|
38 |
// Classes defined //
|
williamr@2
|
39 |
class CPrintSetup;
|
williamr@2
|
40 |
//
|
williamr@2
|
41 |
|
williamr@2
|
42 |
// Forward Reference
|
williamr@2
|
43 |
class CPreviewProcess;
|
williamr@2
|
44 |
class CPrintProcess;
|
williamr@2
|
45 |
class CPdrModelList;
|
williamr@2
|
46 |
class CPdrDevice;
|
williamr@2
|
47 |
class CHeaderFooter;
|
williamr@2
|
48 |
class TPageSpec;
|
williamr@2
|
49 |
class RReadStream;
|
williamr@2
|
50 |
class RWriteStream;
|
williamr@2
|
51 |
class MPageRegionPrinter;
|
williamr@2
|
52 |
class RFs;
|
williamr@2
|
53 |
class CPrinterDriver;
|
williamr@2
|
54 |
class CPrinterDriverUI;
|
williamr@2
|
55 |
//
|
williamr@2
|
56 |
|
williamr@2
|
57 |
class CPrintSetup : public CBase, private MFieldPageNumInfo
|
williamr@2
|
58 |
/** Print setup information.
|
williamr@2
|
59 |
|
williamr@2
|
60 |
This class stores the information needed to set up, start and stop a print
|
williamr@2
|
61 |
job. This includes the target printer device, the page margins and
|
williamr@2
|
62 |
the header and footer. The page specification, (page orientation and page
|
williamr@2
|
63 |
dimensions) can be set via the printer device.
|
williamr@2
|
64 |
|
williamr@2
|
65 |
Print setup information is associated with a document and is stored as part
|
williamr@2
|
66 |
of the persistent form of the document. Print parameters on the other hand,
|
williamr@2
|
67 |
(class TPrintParameters) are associated with a particular print request,
|
williamr@2
|
68 |
not with the document itself, so are not part of the print setup information.
|
williamr@2
|
69 |
|
williamr@2
|
70 |
@publishedAll
|
williamr@2
|
71 |
@released */
|
williamr@2
|
72 |
{
|
williamr@2
|
73 |
public:
|
williamr@2
|
74 |
IMPORT_C static CPrintSetup* NewL();
|
williamr@2
|
75 |
IMPORT_C virtual ~CPrintSetup();
|
williamr@2
|
76 |
//
|
williamr@2
|
77 |
// printer model selection/control functions
|
williamr@2
|
78 |
IMPORT_C void AddPrinterDriverDirL(const TDesC& aDriverDir);
|
williamr@2
|
79 |
IMPORT_C CPrinterModelList* ModelNameListL(RFs& aFs);
|
williamr@2
|
80 |
IMPORT_C void FreeModelList();
|
williamr@2
|
81 |
IMPORT_C void CreatePrinterDeviceL(TInt aModelIndex); // requires ModelList to exist
|
williamr@2
|
82 |
IMPORT_C void CreatePrinterDeviceL(TUid aModelUid,RFs& aFs);
|
williamr@2
|
83 |
IMPORT_C CPrinterDevice* PrinterDevice()const;
|
williamr@2
|
84 |
IMPORT_C CPrinterDriverUI* CreatePrinterDriverUIL(); // ownership is transfered to the caller
|
williamr@2
|
85 |
//
|
williamr@2
|
86 |
// print functions
|
williamr@2
|
87 |
IMPORT_C void EndPrint();
|
williamr@2
|
88 |
IMPORT_C TInt StartPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,
|
williamr@2
|
89 |
CPrinterPort* aPort,MPrintProcessObserver* anObserver);
|
williamr@2
|
90 |
IMPORT_C TInt StartPreviewPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,
|
williamr@2
|
91 |
MPrintProcessObserver* anObserver,CGraphicsDevice& aPreviewDev,const TRect& aHeaderRectInPixels,
|
williamr@2
|
92 |
const TRect& aFooterRectInPixels,TInt aNumBands);
|
williamr@2
|
93 |
//
|
williamr@2
|
94 |
// accessors
|
williamr@2
|
95 |
inline CHeaderFooter* Header()const;
|
williamr@2
|
96 |
inline CHeaderFooter* Footer()const;
|
williamr@2
|
97 |
//
|
williamr@2
|
98 |
// persistence
|
williamr@2
|
99 |
IMPORT_C TStreamId StoreL(CStreamStore& aStore)const;
|
williamr@2
|
100 |
IMPORT_C void RestoreL(const CStreamStore& aStore,TStreamId aStreamId,const MFieldFileNameInfo* aFileNameInfo=NULL,const MFieldNumPagesInfo* aNumPagesInfo=NULL,MPictureFactory* aFactory=NULL);
|
williamr@2
|
101 |
IMPORT_C void StoreComponentsL(CStreamStore& aStore,CStoreMap& aMap)const;
|
williamr@2
|
102 |
IMPORT_C void RestoreComponentsL(const CStreamStore& aStore,const MFieldFileNameInfo* aFileNameInfo=NULL,const MFieldNumPagesInfo* aNumPagesInfo=NULL,MPictureFactory* aFactory=NULL);
|
williamr@2
|
103 |
IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
|
williamr@2
|
104 |
IMPORT_C void InternalizeL(RReadStream& aStream);
|
williamr@2
|
105 |
//
|
williamr@2
|
106 |
private:
|
williamr@2
|
107 |
CPrintSetup();
|
williamr@2
|
108 |
void ConstructL();
|
williamr@2
|
109 |
void DoStartPrintL(const TPrintParameters& aPrintParams,MPageRegionPrinter& aBodyPrinter,MPrintProcessObserver* aObserver,CPrinterPort* aPort);
|
williamr@2
|
110 |
void InitializePrintingL(CGraphicsDevice* aPrinterDev,const TPrintParameters& aPrintParams,MPrintProcessObserver* aObserver);
|
williamr@2
|
111 |
void InitializePrintingL(const TPrintParameters& aPrintParams,MPrintProcessObserver* aObserver,
|
williamr@2
|
112 |
const TRect& aHeaderRectInPixels,const TRect& aFooterRectInPixels);
|
williamr@2
|
113 |
// from MFieldPageNumInfo
|
williamr@2
|
114 |
TInt UpdateFieldPageNum()const;
|
williamr@2
|
115 |
public:
|
williamr@2
|
116 |
// Info regarding print setup etc.
|
williamr@2
|
117 |
/** The header and footer offset and the width of the four margins.
|
williamr@2
|
118 |
|
williamr@2
|
119 |
All measurements are in twips.
|
williamr@2
|
120 |
|
williamr@2
|
121 |
@see TPageMargins */
|
williamr@2
|
122 |
TPageMargins iPageMarginsInTwips;
|
williamr@2
|
123 |
/** The number of the first page in the document.
|
williamr@2
|
124 |
|
williamr@2
|
125 |
This value is used for printing or displaying page numbering. Note that all
|
williamr@2
|
126 |
other page numbering is zero indexed, to preserve independence from user-defined
|
williamr@2
|
127 |
page numbering. */
|
williamr@2
|
128 |
TInt iNumOfFirstPage; // value to start page numbering at
|
williamr@2
|
129 |
private:
|
williamr@2
|
130 |
enum {
|
williamr@2
|
131 |
ENumberFirstPage = 0x0001,
|
williamr@2
|
132 |
};
|
williamr@2
|
133 |
private:
|
williamr@2
|
134 |
CHeaderFooter* iHeader;
|
williamr@2
|
135 |
CHeaderFooter* iFooter;
|
williamr@2
|
136 |
CPrinterDriver* iPrinterDriver; // the target printer driver
|
williamr@2
|
137 |
CPreviewProcess* iPrintProcess;
|
williamr@2
|
138 |
CPdrModelList* iModelList;
|
williamr@2
|
139 |
MPrintProcessObserver* iPrintObserver;
|
williamr@2
|
140 |
TPrintParameters iPrintParams; // not persisted
|
williamr@2
|
141 |
CArrayFixSeg<TFileName>* iDriverDirList;
|
williamr@2
|
142 |
};
|
williamr@2
|
143 |
|
williamr@2
|
144 |
|
williamr@2
|
145 |
//
|
williamr@2
|
146 |
// inlines
|
williamr@2
|
147 |
//
|
williamr@2
|
148 |
|
williamr@2
|
149 |
inline CHeaderFooter* CPrintSetup::Header()const
|
williamr@2
|
150 |
/** Gets the header.
|
williamr@2
|
151 |
|
williamr@2
|
152 |
The CPrintSetup object owns the header and footer. CPrintSetup implements
|
williamr@2
|
153 |
the MFieldPageNumInfo interface, which allows page numbering to be easily
|
williamr@2
|
154 |
added to fields.
|
williamr@2
|
155 |
|
williamr@2
|
156 |
@return The header. */
|
williamr@2
|
157 |
{ return iHeader; }
|
williamr@2
|
158 |
|
williamr@2
|
159 |
inline CHeaderFooter* CPrintSetup::Footer()const
|
williamr@2
|
160 |
/** Gets the footer.
|
williamr@2
|
161 |
|
williamr@2
|
162 |
@return The footer. */
|
williamr@2
|
163 |
{ return iFooter; }
|
williamr@2
|
164 |
|
williamr@2
|
165 |
|
williamr@2
|
166 |
|
williamr@2
|
167 |
|
williamr@2
|
168 |
#endif
|