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 |
#if !defined(__CONARC_H__)
|
williamr@2
|
17 |
#define __CONARC_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__E32BASE_H__)
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#endif
|
williamr@2
|
22 |
#if !defined(__APMSTD_H__)
|
williamr@2
|
23 |
#include <apmstd.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
//
|
williamr@2
|
27 |
// base interface for converters
|
williamr@2
|
28 |
//
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
@publishedAll
|
williamr@2
|
32 |
@released
|
williamr@2
|
33 |
*/
|
williamr@2
|
34 |
const TInt KUidConverterToBase64=0x10000721;
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
@publishedAll
|
williamr@2
|
37 |
@released
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
const TInt KUidConverterFromBase64=0x100011C5;
|
williamr@2
|
40 |
/**
|
williamr@2
|
41 |
@publishedAll
|
williamr@2
|
42 |
@released
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
const TInt KUidPlainTextToQuotedPrintableConverter=0x10001826;
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
@publishedAll
|
williamr@2
|
47 |
@released
|
williamr@2
|
48 |
*/
|
williamr@2
|
49 |
const TInt KUidQuotedPrintableToPlainTextConverter=0x10001825;
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
@publishedAll
|
williamr@2
|
52 |
@released
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
const TInt KUidETextToPlainTextConverter=
|
williamr@2
|
55 |
#if defined(ETEXT_CONVERTER_UIDS_CORRECTED)
|
williamr@2
|
56 |
0x100040c8;
|
williamr@2
|
57 |
#else
|
williamr@2
|
58 |
0x100040c7;
|
williamr@2
|
59 |
#endif
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
@publishedAll
|
williamr@2
|
63 |
@released
|
williamr@2
|
64 |
*/
|
williamr@2
|
65 |
const TInt KUidPlainTextToETextConverter=
|
williamr@2
|
66 |
#if defined(ETEXT_CONVERTER_UIDS_CORRECTED)
|
williamr@2
|
67 |
0x100040c7;
|
williamr@2
|
68 |
#else
|
williamr@2
|
69 |
0x100040c8;
|
williamr@2
|
70 |
#endif
|
williamr@2
|
71 |
|
williamr@2
|
72 |
/**
|
williamr@2
|
73 |
@publishedAll
|
williamr@2
|
74 |
@released
|
williamr@2
|
75 |
*/
|
williamr@2
|
76 |
#ifdef _UNICODE
|
williamr@2
|
77 |
#define KUidConverterDll KUidConverterDll16
|
williamr@2
|
78 |
#else
|
williamr@2
|
79 |
#define KUidConverterDll KUidConverterDll8
|
williamr@2
|
80 |
#endif
|
williamr@2
|
81 |
|
williamr@2
|
82 |
/**
|
williamr@2
|
83 |
@internalComponent
|
williamr@2
|
84 |
@deprecated
|
williamr@2
|
85 |
*/
|
williamr@2
|
86 |
const TInt KUidConverterDllValue8=0x10000C61;
|
williamr@2
|
87 |
|
williamr@2
|
88 |
/**
|
williamr@2
|
89 |
@internalComponent
|
williamr@2
|
90 |
@deprecated
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
const TUid KUidConverterDll8={KUidConverterDllValue8};
|
williamr@2
|
93 |
|
williamr@2
|
94 |
/**
|
williamr@2
|
95 |
@internalComponent
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
const TInt KUidConverterInfoFileValue=0x10000C62;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
@publishedAll
|
williamr@2
|
101 |
@released
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
const TUid KUidConverterInfoFile={KUidConverterInfoFileValue};
|
williamr@2
|
104 |
|
williamr@2
|
105 |
/**
|
williamr@2
|
106 |
@internalComponent
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
const TInt KUidConverterInfoStreamValue=0x10000CD0;
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
@internalComponent
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
const TUid KUidConverterInfoStream={KUidConverterInfoStreamValue};
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
The UID2 of converter-type DLLs.
|
williamr@2
|
117 |
@publishedAll
|
williamr@2
|
118 |
@released
|
williamr@2
|
119 |
*/
|
williamr@2
|
120 |
const TUid KUidConverterDll16={0x10003A30};
|
williamr@2
|
121 |
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
The extension of converter information files.
|
williamr@2
|
124 |
@publishedAll
|
williamr@2
|
125 |
@released
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
_LIT(KConverterInfoFileExtension,".CNF");
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
The extension of converter DLLs.
|
williamr@2
|
130 |
@publishedAll
|
williamr@2
|
131 |
@released
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
_LIT(KConverterDllExtension,".CNV");
|
williamr@2
|
134 |
|
williamr@2
|
135 |
|
williamr@2
|
136 |
class MConverterUiObserver
|
williamr@2
|
137 |
/**
|
williamr@2
|
138 |
Interface implemented by the client of a conversion operation to observe conversion
|
williamr@2
|
139 |
progress.
|
williamr@2
|
140 |
|
williamr@2
|
141 |
@see CConverterBase2
|
williamr@2
|
142 |
@publishedAll
|
williamr@2
|
143 |
@released
|
williamr@2
|
144 |
*/
|
williamr@2
|
145 |
{
|
williamr@2
|
146 |
public:
|
williamr@2
|
147 |
/** Describes the result of a conversion operation. */
|
williamr@2
|
148 |
enum TResult
|
williamr@2
|
149 |
{
|
williamr@2
|
150 |
/** Conversion succeeded. */
|
williamr@2
|
151 |
ESuccess,
|
williamr@2
|
152 |
/** Conversion partially succeeded. */
|
williamr@2
|
153 |
EPartialSuccess,
|
williamr@2
|
154 |
/** Conversion failed. */
|
williamr@2
|
155 |
EFailure
|
williamr@2
|
156 |
};
|
williamr@2
|
157 |
/** Describes the actions that the converter should take. */
|
williamr@2
|
158 |
enum TAction
|
williamr@2
|
159 |
{
|
williamr@2
|
160 |
/** Keep already converted data. */
|
williamr@2
|
161 |
ERetain,
|
williamr@2
|
162 |
/** Delete converted data. */
|
williamr@2
|
163 |
ERemove,
|
williamr@2
|
164 |
/** Reconvert data. */
|
williamr@2
|
165 |
ERepeat
|
williamr@2
|
166 |
};
|
williamr@2
|
167 |
public:
|
williamr@2
|
168 |
/** Gets the maximum number of steps that the conversion operation can take.
|
williamr@2
|
169 |
|
williamr@2
|
170 |
The conversion may complete in less than this number of steps (for example
|
williamr@2
|
171 |
if an error occurs or the action is cancelled).
|
williamr@2
|
172 |
|
williamr@2
|
173 |
Each step is a call to CConverterBase2::DoConvert(), although during synchronous
|
williamr@2
|
174 |
conversions this is transparent to the client code.
|
williamr@2
|
175 |
|
williamr@2
|
176 |
@param aMax Maximum number of conversion steps.
|
williamr@2
|
177 |
@param aObject Index that identifies an embedded object when one is being converted. */
|
williamr@2
|
178 |
virtual void MaxSteps(TInt aMax, TInt aObject)=0;
|
williamr@2
|
179 |
/** Alerts the client to an error in conversion.
|
williamr@2
|
180 |
|
williamr@2
|
181 |
@param aResult A TResult value indicating the conversion state.
|
williamr@2
|
182 |
@param aObject Index that identifies an embedded object when one is being converted.
|
williamr@2
|
183 |
@return A TAction value that indicates what action the converter should take. */
|
williamr@2
|
184 |
virtual TInt Result(TInt aResult, TInt aObject)=0;
|
williamr@2
|
185 |
/** Queries the client for a password in order to access the data.
|
williamr@2
|
186 |
|
williamr@2
|
187 |
@param aClue Data with a meaning that is specific to each converter: it could for
|
williamr@2
|
188 |
example indicate where the password is stored.
|
williamr@2
|
189 |
@return The password entered. */
|
williamr@2
|
190 |
virtual HBufC* QueryPasswordL(const TDesC& aClue)=0;
|
williamr@2
|
191 |
IMPORT_C virtual void Reserved1_Conv_Obs();
|
williamr@2
|
192 |
};
|
williamr@2
|
193 |
|
williamr@2
|
194 |
|
williamr@2
|
195 |
class CConverterBase : public CBase
|
williamr@2
|
196 |
/** For Ecom Style Converters i.e.,for v9.1 and above CConverterBase2 should be used.
|
williamr@2
|
197 |
|
williamr@2
|
198 |
Polymorphic interface for converters from one data format to another.
|
williamr@2
|
199 |
|
williamr@2
|
200 |
Clients use this interface to access data converters. The implementator of
|
williamr@2
|
201 |
a data converter derives a class from this in which to implement the appropriate
|
williamr@2
|
202 |
conversion functionality.
|
williamr@2
|
203 |
|
williamr@2
|
204 |
The interface offers conversions between files, and between objects that support
|
williamr@2
|
205 |
the stream interfaces, e.g. stream stores.
|
williamr@2
|
206 |
|
williamr@2
|
207 |
There are two flavours of conversion methods:
|
williamr@2
|
208 |
|
williamr@2
|
209 |
the synchronous interfaces, ConvertL() and ConvertObjectL(), which perform
|
williamr@2
|
210 |
the specified conversion and then return
|
williamr@2
|
211 |
|
williamr@2
|
212 |
the asynchronous interfaces, ConvertAL() and ConvertObjectAL(), which initialise
|
williamr@2
|
213 |
the converter object, and allow the client code to call DoConvertL() a number
|
williamr@2
|
214 |
of times until the conversion is complete or abandoned.
|
williamr@2
|
215 |
|
williamr@2
|
216 |
@see CConverterBase2
|
williamr@2
|
217 |
@publishedAll
|
williamr@2
|
218 |
@released */
|
williamr@2
|
219 |
{
|
williamr@2
|
220 |
public:
|
williamr@2
|
221 |
/** Bitmask values that describe the capabilities of the converter. */
|
williamr@2
|
222 |
enum TCapability
|
williamr@2
|
223 |
{
|
williamr@2
|
224 |
/** The converter can convert files. */
|
williamr@2
|
225 |
EConvertsFiles=0x01,
|
williamr@2
|
226 |
/** The converter can convert stream objects. */
|
williamr@2
|
227 |
EConvertsObjects=0x02,
|
williamr@2
|
228 |
/** The converter can extract embedded objects. */
|
williamr@2
|
229 |
EConvertsExtract=0x04
|
williamr@2
|
230 |
};
|
williamr@2
|
231 |
public:
|
williamr@2
|
232 |
IMPORT_C virtual void ConvertL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // These default to calling the async versions in a loop
|
williamr@2
|
233 |
IMPORT_C virtual void ConvertObjectL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);
|
williamr@2
|
234 |
IMPORT_C virtual void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
|
williamr@2
|
235 |
IMPORT_C virtual void ConvertObjectAL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
|
williamr@2
|
236 |
IMPORT_C virtual TBool DoConvertL(); // these default to leaving with KErrNotSupported
|
williamr@2
|
237 |
/** Gets the converter's UID.
|
williamr@2
|
238 |
|
williamr@2
|
239 |
@return Converter's UID */
|
williamr@2
|
240 |
virtual TUid Uid() =0;
|
williamr@2
|
241 |
IMPORT_C virtual TInt Capabilities(); // defaults to "everything"
|
williamr@2
|
242 |
IMPORT_C virtual void CancelConvert(); // for any cleanup
|
williamr@2
|
243 |
IMPORT_C virtual CConverterBase* EmbeddedObjectL(TDataType& aType);
|
williamr@2
|
244 |
IMPORT_C virtual TBool GetEmbeddedFileName(TFileName& aFileName);
|
williamr@2
|
245 |
IMPORT_C virtual void ExtendedInterfaceL(TUid aInterfaceUid, CBase*& aInterface);
|
williamr@2
|
246 |
};
|
williamr@2
|
247 |
|
williamr@2
|
248 |
|
williamr@2
|
249 |
class CConverterLibrary : public CBase
|
williamr@2
|
250 |
/** A converter DLL's factory for individual CConverterBase-derived objects.
|
williamr@2
|
251 |
|
williamr@2
|
252 |
The implementor of a converter DLL should implement this class.
|
williamr@2
|
253 |
|
williamr@2
|
254 |
@publishedAll
|
williamr@2
|
255 |
@deprecated */
|
williamr@2
|
256 |
{
|
williamr@2
|
257 |
public:
|
williamr@2
|
258 |
/** Creates and returns an instance of the converter with the specified UID.
|
williamr@2
|
259 |
|
williamr@2
|
260 |
This class should not allocate any resources that are not returned to the
|
williamr@2
|
261 |
caller.
|
williamr@2
|
262 |
|
williamr@2
|
263 |
@param aUid UID of the converter to create
|
williamr@2
|
264 |
@return The specified converter. If the converter does not implement a converter
|
williamr@2
|
265 |
associated with the UID, then it should return NULL. */
|
williamr@2
|
266 |
virtual CConverterBase* Converter(TUid aUid)=0; // passes ownership
|
williamr@2
|
267 |
};
|
williamr@2
|
268 |
|
williamr@2
|
269 |
class CConverterBase2 : public CConverterBase
|
williamr@2
|
270 |
/** Base Class for Ecom Style Converters
|
williamr@2
|
271 |
The methods in CConverterBase2 are inherited from CConverterBase
|
williamr@2
|
272 |
|
williamr@2
|
273 |
There are two flavours of conversion methods:
|
williamr@2
|
274 |
|
williamr@2
|
275 |
the synchronous interfaces, ConvertL() and ConvertObjectL(), which perform
|
williamr@2
|
276 |
the specified conversion and then return
|
williamr@2
|
277 |
|
williamr@2
|
278 |
the asynchronous interfaces, ConvertAL() and ConvertObjectAL(), which initialise
|
williamr@2
|
279 |
the converter object, and allow the client code to call DoConvertL() a number
|
williamr@2
|
280 |
of times until the conversion is complete or abandoned.
|
williamr@2
|
281 |
|
williamr@2
|
282 |
@publishedAll
|
williamr@2
|
283 |
@released */
|
williamr@2
|
284 |
{
|
williamr@2
|
285 |
public:
|
williamr@2
|
286 |
static CConverterBase2* CreateConverterL(TUid aImplUid);
|
williamr@2
|
287 |
IMPORT_C virtual ~CConverterBase2();
|
williamr@2
|
288 |
IMPORT_C virtual void ConvertL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // These default to calling the async versions in a loop
|
williamr@2
|
289 |
IMPORT_C virtual void ConvertObjectL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);
|
williamr@2
|
290 |
IMPORT_C virtual void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
|
williamr@2
|
291 |
IMPORT_C virtual void ConvertObjectAL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
|
williamr@2
|
292 |
IMPORT_C virtual TBool DoConvertL(); // these default to leaving with KErrNotSupported
|
williamr@2
|
293 |
virtual TUid Uid()=0;
|
williamr@2
|
294 |
IMPORT_C virtual TInt Capabilities(); // defaults to "everything"
|
williamr@2
|
295 |
IMPORT_C virtual void CancelConvert(); // for any cleanup
|
williamr@2
|
296 |
IMPORT_C virtual CConverterBase* EmbeddedObjectL(TDataType& aType);
|
williamr@2
|
297 |
IMPORT_C virtual TBool GetEmbeddedFileName(TFileName& aFileName);
|
williamr@2
|
298 |
IMPORT_C virtual void ExtendedInterfaceL(TUid aInterfaceUid, CBase*& aInterface);
|
williamr@2
|
299 |
IMPORT_C virtual void Reserved_1();
|
williamr@2
|
300 |
IMPORT_C virtual void Reserved_2();
|
williamr@2
|
301 |
private:
|
williamr@2
|
302 |
TUid iDestructionKey;
|
williamr@2
|
303 |
TInt iSpare;
|
williamr@2
|
304 |
};
|
williamr@2
|
305 |
#endif
|