15
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "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".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Kanrikogaku Kenkyusho, Ltd. - Initial contribution
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* {Description of the file}
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// Protection against nested includes
|
|
20 |
#ifndef __DIRECTPRINTENGINE_H__
|
|
21 |
#define __DIRECTPRINTENGINE_H__
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <prninf.h> // MPrintProcessObserver
|
|
26 |
#include <prnsetup.h> // CPrintSetup
|
|
27 |
#include <fldbltin.h> // MFieldNumPagesInfo
|
|
28 |
#include <gdi.h> // CPrinterModelList
|
|
29 |
#include <AknProgressDialog.h> // CAknProgressDialog
|
|
30 |
#include <EIKPROGI.H>
|
|
31 |
#include <xmlengdocument.h> // RXmlEngDocument
|
|
32 |
#include "DirectPrintEngineObserver.h"
|
|
33 |
#include "directprintband.h"
|
|
34 |
|
|
35 |
// CLASS DECLARATION
|
|
36 |
class CDirectPrintModel;
|
|
37 |
|
|
38 |
class CDirectPrintEngine : public CBase,
|
|
39 |
public MPrintProcessObserver,
|
|
40 |
public MFieldNumPagesInfo,
|
|
41 |
public MProgressDialogCallback
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
// Constructors and destructor
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Two-phased constructor.
|
|
48 |
*/
|
|
49 |
static CDirectPrintEngine* NewL(CDirectPrintModel& aModel);
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Two-phased constructor.
|
|
53 |
*/
|
|
54 |
static CDirectPrintEngine* NewLC(CDirectPrintModel& aModel);
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Destructor.
|
|
58 |
*/
|
|
59 |
virtual ~CDirectPrintEngine();
|
|
60 |
|
|
61 |
// from MPrintProcessObserver
|
|
62 |
virtual void NotifyPrintStarted(TPrintParameters aPrintParams);
|
|
63 |
virtual void NotifyBandPrinted(TInt aPercent, TInt aCurrentPageNum, TInt aCurrentCopyNum);
|
|
64 |
virtual void NotifyPrintEnded(TInt aErrNum);
|
|
65 |
|
|
66 |
// from MFieldNumPagesInfo
|
|
67 |
virtual TInt UpdateFieldNumPages()const;
|
|
68 |
|
|
69 |
// from MProgressDialogCallback
|
|
70 |
/**
|
|
71 |
* DialogDismissedL
|
|
72 |
* Called when/if the dialog has been dismissed.
|
|
73 |
* @param aButtonId
|
|
74 |
*/
|
|
75 |
void DialogDismissedL( TInt aButtonId );
|
|
76 |
|
|
77 |
// New functions
|
|
78 |
void SetObserver(MDirectPrintEngineObserver* aObserver);
|
|
79 |
|
|
80 |
TInt ModelCount();
|
|
81 |
void ModelName(TInt aIndex, TDes& aDes);
|
|
82 |
TUid ModelUid(TInt aIndex);
|
|
83 |
|
|
84 |
void SetUseModel(TInt aIndex);
|
|
85 |
|
|
86 |
void PrintL();
|
|
87 |
|
|
88 |
void StartPrintPreviewL();
|
|
89 |
void EndPrintPreview();
|
|
90 |
|
|
91 |
inline CPrintSetup* PrintSetup();
|
|
92 |
inline MPageRegionPrinter* PageRegionPrinter();
|
|
93 |
inline TInt PageCounter();
|
|
94 |
inline TInt MaxPageNum();
|
|
95 |
|
|
96 |
void SetParamL(RXmlEngDocument* aParam);
|
|
97 |
|
|
98 |
protected:
|
|
99 |
/**
|
|
100 |
* Constructor for performing 1st stage construction
|
|
101 |
*/
|
|
102 |
CDirectPrintEngine(CDirectPrintModel& aModel);
|
|
103 |
|
|
104 |
/**
|
|
105 |
* EPOC default constructor for performing 2nd stage construction
|
|
106 |
*/
|
|
107 |
void ConstructL();
|
|
108 |
|
|
109 |
private:
|
|
110 |
// New functions
|
|
111 |
void DoPrintL(CPrinterPort* aPort);
|
|
112 |
|
|
113 |
void StartPrintProgressNoteL();
|
|
114 |
void EndPrintProgressNoteL();
|
|
115 |
void UpdatePrintProgressNoteL(TInt aPage);
|
|
116 |
void SearchPluginFromFilenameL(const TDesC& aFileName);
|
|
117 |
void LoadPluginFromUidL(const TUid aUid);
|
|
118 |
|
|
119 |
static void CleanupBand( TAny* aData );
|
|
120 |
|
|
121 |
private:
|
|
122 |
// Observer
|
|
123 |
MDirectPrintEngineObserver* iObserver;
|
|
124 |
|
|
125 |
// Model object
|
|
126 |
CDirectPrintModel& iModel;
|
|
127 |
|
|
128 |
// File server session
|
|
129 |
RFs iFs;
|
|
130 |
// Member Variable for CPrintSetup
|
|
131 |
CPrintSetup* iPrintSetup;
|
|
132 |
|
|
133 |
// Member Variable for print model name
|
|
134 |
CPrinterModelList* iModelList;
|
|
135 |
|
|
136 |
// Member Variable for page counter
|
|
137 |
TInt iPageCounter;
|
|
138 |
|
|
139 |
// Member Variable for total page
|
|
140 |
TInt iMaxPageNum;
|
|
141 |
|
|
142 |
// Member Variable for total page
|
|
143 |
TInt iModelIndex;
|
|
144 |
|
|
145 |
CDirectPrintBand* iPrintBand;
|
|
146 |
//MPageRegionPrinter* iRegionPrinter;
|
|
147 |
|
|
148 |
/**
|
|
149 |
* iProgressDialog
|
|
150 |
* Owned
|
|
151 |
*/
|
|
152 |
CAknProgressDialog* iProgressDialog;
|
|
153 |
/**
|
|
154 |
* iProgressInfo
|
|
155 |
* Not owned by CAknExNoteContainer object.
|
|
156 |
*/
|
|
157 |
CEikProgressInfo* iProgressInfo;
|
|
158 |
|
|
159 |
HBufC* iProgressMessage;
|
|
160 |
|
|
161 |
//TBuf<255> iParam;
|
|
162 |
RXmlEngDocument* iParam;
|
|
163 |
|
|
164 |
// identifer returned by ECom
|
|
165 |
TUid iDtorIdKey;
|
|
166 |
|
|
167 |
// last error
|
|
168 |
TInt iLastError;
|
|
169 |
};
|
|
170 |
|
|
171 |
inline CPrintSetup* CDirectPrintEngine::PrintSetup()
|
|
172 |
{
|
|
173 |
return iPrintSetup;
|
|
174 |
}
|
|
175 |
|
|
176 |
inline MPageRegionPrinter* CDirectPrintEngine::PageRegionPrinter()
|
|
177 |
{
|
|
178 |
if (iPrintBand)
|
|
179 |
{
|
|
180 |
return iPrintBand->RegionPrinter();
|
|
181 |
}
|
|
182 |
return NULL;
|
|
183 |
}
|
|
184 |
|
|
185 |
inline TInt CDirectPrintEngine::PageCounter()
|
|
186 |
{
|
|
187 |
return iPageCounter;
|
|
188 |
}
|
|
189 |
|
|
190 |
inline TInt CDirectPrintEngine::MaxPageNum()
|
|
191 |
{
|
|
192 |
return iMaxPageNum;
|
|
193 |
}
|
|
194 |
|
|
195 |
|
|
196 |
#endif // __DIRECTPRINTENGINE_H__
|
|
197 |
// End of file
|