1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__CONARC_H__)
19 #if !defined(__E32BASE_H__)
22 #if !defined(__APMSTD_H__)
27 // base interface for converters
34 const TInt KUidConverterToBase64=0x10000721;
39 const TInt KUidConverterFromBase64=0x100011C5;
44 const TInt KUidPlainTextToQuotedPrintableConverter=0x10001826;
49 const TInt KUidQuotedPrintableToPlainTextConverter=0x10001825;
54 const TInt KUidETextToPlainTextConverter=
55 #if defined(ETEXT_CONVERTER_UIDS_CORRECTED)
65 const TInt KUidPlainTextToETextConverter=
66 #if defined(ETEXT_CONVERTER_UIDS_CORRECTED)
77 #define KUidConverterDll KUidConverterDll16
79 #define KUidConverterDll KUidConverterDll8
86 const TInt KUidConverterDllValue8=0x10000C61;
92 const TUid KUidConverterDll8={KUidConverterDllValue8};
97 const TInt KUidConverterInfoFileValue=0x10000C62;
103 const TUid KUidConverterInfoFile={KUidConverterInfoFileValue};
108 const TInt KUidConverterInfoStreamValue=0x10000CD0;
113 const TUid KUidConverterInfoStream={KUidConverterInfoStreamValue};
116 The UID2 of converter-type DLLs.
120 const TUid KUidConverterDll16={0x10003A30};
123 The extension of converter information files.
127 _LIT(KConverterInfoFileExtension,".CNF");
129 The extension of converter DLLs.
133 _LIT(KConverterDllExtension,".CNV");
136 class MConverterUiObserver
138 Interface implemented by the client of a conversion operation to observe conversion
147 /** Describes the result of a conversion operation. */
150 /** Conversion succeeded. */
152 /** Conversion partially succeeded. */
154 /** Conversion failed. */
157 /** Describes the actions that the converter should take. */
160 /** Keep already converted data. */
162 /** Delete converted data. */
164 /** Reconvert data. */
168 /** Gets the maximum number of steps that the conversion operation can take.
170 The conversion may complete in less than this number of steps (for example
171 if an error occurs or the action is cancelled).
173 Each step is a call to CConverterBase2::DoConvert(), although during synchronous
174 conversions this is transparent to the client code.
176 @param aMax Maximum number of conversion steps.
177 @param aObject Index that identifies an embedded object when one is being converted. */
178 virtual void MaxSteps(TInt aMax, TInt aObject)=0;
179 /** Alerts the client to an error in conversion.
181 @param aResult A TResult value indicating the conversion state.
182 @param aObject Index that identifies an embedded object when one is being converted.
183 @return A TAction value that indicates what action the converter should take. */
184 virtual TInt Result(TInt aResult, TInt aObject)=0;
185 /** Queries the client for a password in order to access the data.
187 @param aClue Data with a meaning that is specific to each converter: it could for
188 example indicate where the password is stored.
189 @return The password entered. */
190 virtual HBufC* QueryPasswordL(const TDesC& aClue)=0;
191 IMPORT_C virtual void Reserved1_Conv_Obs();
195 class CConverterBase : public CBase
196 /** For Ecom Style Converters i.e.,for v9.1 and above CConverterBase2 should be used.
198 Polymorphic interface for converters from one data format to another.
200 Clients use this interface to access data converters. The implementator of
201 a data converter derives a class from this in which to implement the appropriate
202 conversion functionality.
204 The interface offers conversions between files, and between objects that support
205 the stream interfaces, e.g. stream stores.
207 There are two flavours of conversion methods:
209 the synchronous interfaces, ConvertL() and ConvertObjectL(), which perform
210 the specified conversion and then return
212 the asynchronous interfaces, ConvertAL() and ConvertObjectAL(), which initialise
213 the converter object, and allow the client code to call DoConvertL() a number
214 of times until the conversion is complete or abandoned.
221 /** Bitmask values that describe the capabilities of the converter. */
224 /** The converter can convert files. */
226 /** The converter can convert stream objects. */
227 EConvertsObjects=0x02,
228 /** The converter can extract embedded objects. */
229 EConvertsExtract=0x04
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
233 IMPORT_C virtual void ConvertObjectL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);
234 IMPORT_C virtual void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
235 IMPORT_C virtual void ConvertObjectAL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
236 IMPORT_C virtual TBool DoConvertL(); // these default to leaving with KErrNotSupported
237 /** Gets the converter's UID.
239 @return Converter's UID */
240 virtual TUid Uid() =0;
241 IMPORT_C virtual TInt Capabilities(); // defaults to "everything"
242 IMPORT_C virtual void CancelConvert(); // for any cleanup
243 IMPORT_C virtual CConverterBase* EmbeddedObjectL(TDataType& aType);
244 IMPORT_C virtual TBool GetEmbeddedFileName(TFileName& aFileName);
245 IMPORT_C virtual void ExtendedInterfaceL(TUid aInterfaceUid, CBase*& aInterface);
249 class CConverterLibrary : public CBase
250 /** A converter DLL's factory for individual CConverterBase-derived objects.
252 The implementor of a converter DLL should implement this class.
258 /** Creates and returns an instance of the converter with the specified UID.
260 This class should not allocate any resources that are not returned to the
263 @param aUid UID of the converter to create
264 @return The specified converter. If the converter does not implement a converter
265 associated with the UID, then it should return NULL. */
266 virtual CConverterBase* Converter(TUid aUid)=0; // passes ownership
269 class CConverterBase2 : public CConverterBase
270 /** Base Class for Ecom Style Converters
271 The methods in CConverterBase2 are inherited from CConverterBase
273 There are two flavours of conversion methods:
275 the synchronous interfaces, ConvertL() and ConvertObjectL(), which perform
276 the specified conversion and then return
278 the asynchronous interfaces, ConvertAL() and ConvertObjectAL(), which initialise
279 the converter object, and allow the client code to call DoConvertL() a number
280 of times until the conversion is complete or abandoned.
286 static CConverterBase2* CreateConverterL(TUid aImplUid);
287 IMPORT_C virtual ~CConverterBase2();
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
289 IMPORT_C virtual void ConvertObjectL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL);
290 IMPORT_C virtual void ConvertAL(const TFileName& aSourceFile, const TFileName& aTargetFile, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
291 IMPORT_C virtual void ConvertObjectAL(RReadStream& aReadStream, RWriteStream& aWriteStream, MConverterUiObserver* aObserver=NULL); // these default to leaving with KErrNotSupported
292 IMPORT_C virtual TBool DoConvertL(); // these default to leaving with KErrNotSupported
293 virtual TUid Uid()=0;
294 IMPORT_C virtual TInt Capabilities(); // defaults to "everything"
295 IMPORT_C virtual void CancelConvert(); // for any cleanup
296 IMPORT_C virtual CConverterBase* EmbeddedObjectL(TDataType& aType);
297 IMPORT_C virtual TBool GetEmbeddedFileName(TFileName& aFileName);
298 IMPORT_C virtual void ExtendedInterfaceL(TUid aInterfaceUid, CBase*& aInterface);
299 IMPORT_C virtual void Reserved_1();
300 IMPORT_C virtual void Reserved_2();
302 TUid iDestructionKey;