|
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: Contains the CPrintJob class definition and the PJS enum. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPRINTJOB_H |
|
20 #define CPRINTJOB_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "cxhtmlfilecomposer.h" |
|
25 #include "crsbtdevice.h" |
|
26 |
|
27 #define KMaxIdLength 10 |
|
28 |
|
29 |
|
30 class TPrintSetting |
|
31 { |
|
32 public: |
|
33 TInt iCapability; |
|
34 TInt iValue; |
|
35 }; |
|
36 |
|
37 NONSHARABLE_CLASS( CPrintJob ): public CBase |
|
38 { |
|
39 public: |
|
40 /// Possible states of a print job. |
|
41 enum TJobState |
|
42 { |
|
43 EStateNone, |
|
44 EStateCreated, |
|
45 EStateSubmitted, |
|
46 EStateSending, |
|
47 EStatePrinting, |
|
48 EStateCancel |
|
49 }; |
|
50 |
|
51 public: |
|
52 /* |
|
53 * @function NewL |
|
54 * @description Constructs the CPrintJob object. |
|
55 * NOTE: The ownership of aFileFactory does not change here! |
|
56 * @param aPrinter Selected printer for the job |
|
57 * @param aImages Array of images to be printed |
|
58 * @param aFileFactory Pointer to XHTML-print file factory |
|
59 * @param aUserName User name got from central repository |
|
60 */ |
|
61 static CPrintJob* NewL(CRsBtDevice* aDevice, RArray<TFileName>& aImages, const TDesC8& aUserName); |
|
62 |
|
63 /* |
|
64 * @function Destructor |
|
65 * @description Destroys the object and frees the memory allocated by this object |
|
66 */ |
|
67 ~CPrintJob(); |
|
68 |
|
69 /* |
|
70 * @function SetJobId |
|
71 * @description Initializes the job id |
|
72 * @param TDesC& aId |
|
73 */ |
|
74 void SetJobId(const TInt aId); |
|
75 |
|
76 /* |
|
77 * @function JobId |
|
78 * @description Returns the job id as TInt |
|
79 * @return Job id |
|
80 */ |
|
81 TInt JobId(); |
|
82 |
|
83 /* |
|
84 * @function GetJobName |
|
85 * @description Returns the file path |
|
86 * @param TDes8& |
|
87 */ |
|
88 void GetJobName(TDes8& aJobName); |
|
89 |
|
90 /* |
|
91 * @function ImageCount |
|
92 * @description Returns the number of images in job. |
|
93 * @return TInt |
|
94 */ |
|
95 TInt ImageCount(); |
|
96 |
|
97 /* |
|
98 * @function Images |
|
99 * @description Returns job's images as CImageInfo |
|
100 * @param RArray<CImageInfo> Output parameter |
|
101 */ |
|
102 void Images(RArray<CImageInfo>& aImages); |
|
103 |
|
104 /* |
|
105 * @function PrinterId |
|
106 * @description Returns the printer id |
|
107 * @param TInt |
|
108 */ |
|
109 TInt PrinterId(); |
|
110 |
|
111 /* |
|
112 * @function Device |
|
113 * @description Returns the printer id |
|
114 * @param TInt |
|
115 */ |
|
116 CRsBtDevice* Device(); |
|
117 |
|
118 /* |
|
119 * @function GetUserName |
|
120 * @description Returns the user name |
|
121 * @param TPtrC8& |
|
122 */ |
|
123 void GetUserName(TPtrC8& aDocFormat); |
|
124 |
|
125 /* |
|
126 * @function SetNumsOfCopies |
|
127 * @description Sets the number of copies for certain image. |
|
128 * @param TInt aCapabilityId |
|
129 * @param TInt aValue |
|
130 * @return TInt System wide error code |
|
131 */ |
|
132 TInt SetNumsOfCopies( const RArray<TInt>& aNumsOfCopies); |
|
133 |
|
134 /* |
|
135 * @function XhtmlPrintFile |
|
136 * @description Returns the file path of generated XHTML-Print file |
|
137 * @param TDes8& |
|
138 */ |
|
139 void GetPrintFileL(TDes8& aPrintFile); |
|
140 |
|
141 /* |
|
142 * @function Sheets |
|
143 * @description Returns the total number of sheets the job requires |
|
144 * @return TInt |
|
145 */ |
|
146 TInt Sheets(); |
|
147 |
|
148 /* |
|
149 * @function JobState |
|
150 * @description Returns the job state |
|
151 * @return TJobState |
|
152 */ |
|
153 TJobState JobState(); |
|
154 |
|
155 /* |
|
156 * @function UpdateJobState |
|
157 * @description Updates the job state |
|
158 */ |
|
159 void UpdateJobState(const TJobState aState); |
|
160 |
|
161 /* |
|
162 * @function GetPrintSetting |
|
163 * @description Gets print settings |
|
164 */ |
|
165 TInt GetPrintSetting(TInt aCapabilityID, TInt& aValue); |
|
166 TInt SetPrintSetting(TInt aCapabilityID, TInt aValue); |
|
167 |
|
168 |
|
169 protected: |
|
170 /* |
|
171 * @function ConstructL |
|
172 * @description Construction's second phase |
|
173 * @param aPriner Selected printer for the job |
|
174 * @param aImages Array of images to be printed |
|
175 */ |
|
176 void ConstructL(RArray<TFileName>& aImages, const TDesC8& aUserName); |
|
177 |
|
178 private: |
|
179 |
|
180 /* |
|
181 * @function CPrintJob |
|
182 * @description C++ constructor |
|
183 * @param aPrinterId Id of the printer to be used for this job. |
|
184 * |
|
185 */ |
|
186 CPrintJob(CRsBtDevice* aDevice); |
|
187 |
|
188 private: |
|
189 |
|
190 //@var iJobId Id for printing job received from printer control point |
|
191 TInt iJobId; |
|
192 |
|
193 //@var iDeviceId Defines the printer to be used. |
|
194 TInt iDeviceId; |
|
195 |
|
196 CRsBtDevice* iDevice; |
|
197 |
|
198 //@var iUserName Name of the user |
|
199 TFileName8 iUserName; |
|
200 |
|
201 //@var iImages Job's images |
|
202 RArray<CImageInfo> iImages; |
|
203 |
|
204 //@var iSheets Number of sheets to print |
|
205 TInt iSheets; |
|
206 |
|
207 TJobState iJobState; |
|
208 |
|
209 }; |
|
210 |
|
211 #endif // CPRINTJOB_H |
|
212 |
|
213 // End of File |