|
1 /* |
|
2 * Copyright (c) 2002-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: Declares CUPPrintFactory class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CUPPRINTFACTORY_H |
|
20 #define CUPPRINTFACTORY_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <f32file.h> |
|
24 #include <upnpdevice.h> |
|
25 |
|
26 #include "cxhtmlfilecomposer.h" |
|
27 #include "cimageinfo.h" |
|
28 #include "printcapabilitycodes.h" |
|
29 #include "tprintcapability.h" |
|
30 #include "upconsts.h" |
|
31 |
|
32 /* |
|
33 * @class CUPPrintFactory |
|
34 * @description This class maps the printers between protocol client and |
|
35 * UPnP printer control point. |
|
36 */ |
|
37 NONSHARABLE_CLASS(CUPPrintFactory) : public CBase |
|
38 { |
|
39 public: |
|
40 /* |
|
41 * @function NewL |
|
42 * @description Constructs the object |
|
43 */ |
|
44 static CUPPrintFactory* NewL(); |
|
45 |
|
46 /* |
|
47 * @function Destructor |
|
48 * @description Destructor |
|
49 */ |
|
50 ~CUPPrintFactory(); |
|
51 |
|
52 /* |
|
53 * @function CreateXhtmlFileL |
|
54 * @description Creates XHTML-Print template folder for printing job. |
|
55 * @param aJobURIs Arrays of images' HTTP addresses to be printed |
|
56 * @param aLayout Defines the print layout |
|
57 * @param aPaperSize Paper size |
|
58 * @param aQuality Print quality |
|
59 * @param aXhtmlPrintFile Output parameter, which contains the filepath of created template file |
|
60 * @param TInt& Returns the number of pages to print |
|
61 */ |
|
62 void CreateXhtmlFileL(const RArray<CImageInfo>& aJobURIs, const TInt aLayout, |
|
63 const TInt aPaperSize, const TInt aQuality, |
|
64 TDes& aXhtmlPrintFile, TInt& aPageCount); |
|
65 |
|
66 /* |
|
67 * @function DeleteXhtmlFilesL |
|
68 * @description Deletes all XHTML-print files files |
|
69 */ |
|
70 void DeleteXhtmlFilesL(); |
|
71 |
|
72 /* |
|
73 * @function FileCount |
|
74 * @description Returns the number of the files printed at this session. |
|
75 * Number is same as in the latest filename. |
|
76 * @return TInt |
|
77 */ |
|
78 TInt FileCount(); |
|
79 |
|
80 /* |
|
81 * @function GetCapabilityIDs |
|
82 * @description Returns the capability IDs of supported capabilities |
|
83 * @param aCapabilityIDs Output parameter |
|
84 */ |
|
85 void GetCapabilityIDs(RArray<TInt>& aCapabilityIDs); |
|
86 |
|
87 /* |
|
88 * @function GetCapability |
|
89 * @description Returns the default value of a capability |
|
90 * @param aCapabilityID Id of the capability |
|
91 * @param aCapability Output parameter |
|
92 * @return System wide error code |
|
93 */ |
|
94 TInt GetCapability(const TInt aCapabilityID, TPrintCapability& aCapability); |
|
95 |
|
96 /* |
|
97 * @function GetPrintSetting |
|
98 * @description Returns the requested capability value. |
|
99 * If capability id is invalid KErrArgument is returned. |
|
100 * @param TInt aCapabilityID |
|
101 * @param TInt aValue |
|
102 * @return TInt Error code |
|
103 */ |
|
104 TInt GetPrintSetting(TInt aCapabilityID, TInt& aCapability); |
|
105 |
|
106 /* |
|
107 * @function SetPrintSetting |
|
108 * @description Changes the value of an existing print setting. |
|
109 * If setting is not supported KErrNotSupported is returned. |
|
110 * @param TInt aCapabilityId |
|
111 * @param TInt aValue |
|
112 * @return TInt System wide error code |
|
113 */ |
|
114 TInt SetPrintSetting(TInt aCapabilityID, TInt aValue); |
|
115 |
|
116 protected: |
|
117 |
|
118 |
|
119 private: |
|
120 /* |
|
121 * @function Constructor |
|
122 * @description C++ constructor |
|
123 */ |
|
124 CUPPrintFactory(); |
|
125 |
|
126 /* |
|
127 * @function ConstructL |
|
128 * @description Construction's second phase |
|
129 */ |
|
130 void ConstructL(); |
|
131 |
|
132 /* |
|
133 * @function InitCapabilities |
|
134 * @description Initializes the supported capabilities array |
|
135 */ |
|
136 void InitCapabilities(); |
|
137 |
|
138 /* |
|
139 * @function GetDefaultSettingsL |
|
140 * @description Reads default printing settings from the file. |
|
141 * @param TInt& returns layout value |
|
142 * @param TInt& returns size value |
|
143 * @param TInt& returns quality value |
|
144 */ |
|
145 void GetDefaultSettingsL(TInt& aLayout, TInt& aSize, TInt& aQuality); |
|
146 |
|
147 /* |
|
148 * @function SetDefaultSettingsL |
|
149 * @description Sets the currently stored default printing settings in file. |
|
150 */ |
|
151 void SetDefaultSettingsL(); |
|
152 |
|
153 private: |
|
154 //@var iFileCount Counter used in XHTML-print file naming |
|
155 TInt iFileCount; |
|
156 |
|
157 //@var iCapabilities Capabilities/ settings supported by XHTML-print file factory |
|
158 RArray<TPrintCapability> iCapabilities; |
|
159 |
|
160 //@var iFileSession File session for writing job settings in file. |
|
161 RFs iFileSession; |
|
162 }; |
|
163 |
|
164 #endif // CUPPRINTFACTORY_H |
|
165 |
|
166 // End of File |