|
1 /* |
|
2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPRINTJOBMANAGER_H |
|
20 #define CPRINTJOBMANAGER_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 |
|
25 #include "mprintjob.h" |
|
26 #include "mprintjobstatus.h" |
|
27 |
|
28 class MPrintJobObserver; |
|
29 class CImagePrint; |
|
30 class CImagePrintEngine; |
|
31 class CRealFactory; |
|
32 |
|
33 /** |
|
34 * |
|
35 * Print job manager - handels the creation of print jobs and the |
|
36 * printing process |
|
37 * |
|
38 */ |
|
39 class CPrintJobManager |
|
40 : public CBase, |
|
41 public MPrintJob, |
|
42 public MPrintJobStatus |
|
43 { |
|
44 public: // Construction and destruction |
|
45 |
|
46 /** |
|
47 * Two phase constructor |
|
48 * |
|
49 * @param aFactory Factory class |
|
50 * @param aDLLEngine DLL engine |
|
51 * |
|
52 * @return Initialized instance |
|
53 */ |
|
54 static CPrintJobManager* NewL( CRealFactory* aFactory, |
|
55 CImagePrintEngine* aDLLEngine ); |
|
56 static CPrintJobManager* NewLC( CRealFactory* aFactory, |
|
57 CImagePrintEngine* aDLLEngine ); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 virtual ~CPrintJobManager(); |
|
63 |
|
64 private: // Construction and destruction |
|
65 |
|
66 /** |
|
67 * Constuctor |
|
68 * |
|
69 * @param aFactory Factory class |
|
70 * @param aDLLEngine DLL engine |
|
71 */ |
|
72 CPrintJobManager( CRealFactory* aFactory, |
|
73 CImagePrintEngine* aDLLEngine ); |
|
74 |
|
75 /** |
|
76 * 2nd phase constructor |
|
77 */ |
|
78 void ConstructL(); |
|
79 |
|
80 public: // Methods derived from MPrintJob |
|
81 |
|
82 void PrintL( MPrintJobObserver* aObserver ); |
|
83 void CancelL(); |
|
84 void GetPrintJobL( RPointerArray<TDesC>& aImages ); |
|
85 |
|
86 public: // Methods derived from MPrintJobStatus |
|
87 |
|
88 void PrintJobProgress( TInt aStatus, TInt aPercentCompletion, |
|
89 TInt aJobStateCode ); |
|
90 void PrintJobError( TInt aError, TInt aErrorStringCode ); |
|
91 void PrinterStatus( TInt aError, TInt aErrorStringCode ); |
|
92 |
|
93 public: // New methods |
|
94 |
|
95 /** |
|
96 * Creates the print job but does not submit it |
|
97 * |
|
98 * @param aPrinterId The ID of the printer which will be used |
|
99 */ |
|
100 TInt CreatePrintJobL( TInt aPrinterId ); |
|
101 |
|
102 /** |
|
103 * Returns if the printing has been activated |
|
104 * |
|
105 * @return state of printing |
|
106 */ |
|
107 TBool IsPrinting() const; |
|
108 |
|
109 private: // Enumeration |
|
110 |
|
111 // Print progress status |
|
112 enum TPrintProgressStatus |
|
113 { |
|
114 EActive, |
|
115 ECompleted |
|
116 }; |
|
117 |
|
118 private: // Data |
|
119 |
|
120 // Instance of the factory class |
|
121 CRealFactory* iFactory; |
|
122 |
|
123 // Main class of this DLL |
|
124 CImagePrintEngine* iDLLEngine; |
|
125 |
|
126 // Print job observer |
|
127 MPrintJobObserver* iObserver; |
|
128 |
|
129 // Synchronous wait system for cancellation |
|
130 CActiveSchedulerWait iWait; |
|
131 |
|
132 // Status flags |
|
133 TBool iPrintingOnGoing; |
|
134 TBool iCancelling; |
|
135 |
|
136 // Chosen printer |
|
137 TInt iPrinterUid; |
|
138 |
|
139 // Images from current job |
|
140 RPointerArray<HBufC> iImages; |
|
141 }; |
|
142 |
|
143 #endif // CPRINTJOBMANAGER_H |
|
144 |
|
145 // End of File |