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 #ifndef __APGICNFL_H__
17 #define __APGICNFL_H__
26 class CPersistentStore;
30 class CApaMaskedBitmap : public CFbsBitmap
31 /** An application icon.
33 This is a bitmap and a mask, managed by the Font and Bitmap server.
35 An object of this type is passed to RApaLsSession::GetAppIcon() to fetch a
36 suitable application icon.
40 @see RApaLsSession::GetAppIcon() */
43 IMPORT_C static CApaMaskedBitmap* NewLC();
44 IMPORT_C static CApaMaskedBitmap* NewL(const CApaMaskedBitmap* aSourceIcon);
46 IMPORT_C CFbsBitmap* Mask() const;
47 IMPORT_C void InternalizeL(RReadStream& aStream); //lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
48 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;//lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
50 IMPORT_C ~CApaMaskedBitmap();
51 void SetRomBitmapL(TUint8* aRomPointer); //lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
52 IMPORT_C void SetMaskBitmap(CFbsBitmap* aMask);
63 class CApaResourceFileWriterBase : public CBase
70 void WriteBufferL(const TDesC8& aBuffer);
71 void WriteCompressedUnicodeRunL(TInt aNumberOfBytesWhenUncompressed, const TDesC8& aTextAsCompressedUnicode);
72 void WriteInCompressedUnicodeFormatL(TInt aNumberOfBytesWhenUncompressed, const TDesC8& aData, TBool aInCompressedUnicodeRun);
73 TInt NumberOfBytesWhenUncompressed() const;
74 inline TBool CompressedUnicodeFormat() const {return (iBufferSinkForCompressedUnicodeFormat!=NULL);}
76 MDataSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat);
77 void FlushL(TBool aFinalFlush);
78 void Reset(TInt& aNumberOfBytesWhenUncompressed);
80 void WriteRunLengthL(TInt aRunLength);
84 EFlag_InCompressedUnicodeRun =0x00000001
87 // new virtual functions
88 virtual void DoWriteBufferL(const TDesC8& aBuffer)=0;
90 TInt iNumberOfBytesWhenUncompressed;
92 RBufferSink* iBufferSinkForCompressedUnicodeFormat; // does not own what it points to
94 class RBufferSink : public MDataSink
97 RBufferSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat);
100 void FlushAndGetAndResetL(TInt& aNumberOfBytesWhenUncompressed, RBuf8& aBuffer);
103 virtual void DoWriteBufferL(const TDesC8& aBuffer);
108 CApaResourceFileWriterBase();
109 void DoGenerateFileContentsL(RBuf8& aBuffer, TUid aUid2, TUid aUid3) const;
110 void WriteUidTypeL(MDataSink& aDataSink, TUid aUid2, TUid aUid3) const;
111 void WriteTextL(MDataSink& aDataSink, const TDesC& aText) const;
112 void WriteText8L(MDataSink& aDataSink, const TDesC8& aText8) const;
113 void WriteUint8L(MDataSink& aDataSink, TUint aUint8) const;
114 void WriteLittleEndianUint16L(MDataSink& aDataSink, TUint aUint16) const;
115 void WriteLittleEndianUint32L(MDataSink& aDataSink, TUint aUint32) const;
116 void WriteBufferL(MDataSink& aDataSink, const TDesC8& aBuffer) const;
118 static HBufC8* AsCompressedUnicodeLC(const TDesC& aUncompressedUnicode);
119 void MainResourceInCompiledFormatLC(TInt& aMainResourceSizeInBytesWhenUncompressed, RBuf8& aBuffer, TBool aCompressedUnicodeFormat) const;
121 // new virtual functions
122 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const=0;
123 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const=0;
127 Used to support the registration of non-native applications.
129 The task of this class is to generate the resource files expected by the Apparc server. Applications
130 that register other applications can use functions of this class to customise the generated resource files.
135 class CApaRegistrationResourceFileWriter : public CApaResourceFileWriterBase
138 IMPORT_C static CApaRegistrationResourceFileWriter* NewL(TUid aAppUid, const TDesC& aAppFile, TUint aAttributes);
139 IMPORT_C virtual ~CApaRegistrationResourceFileWriter();
141 void GenerateFileContentsL(RBuf8& aBuffer) const;
142 void SetLocalisableResourceFileL(const TDesC& aLocalisableResourceFile);
143 IMPORT_C void SetAppIsHiddenL(TBool aAppIsHidden);
144 IMPORT_C void SetEmbeddabilityL(TApaAppCapability::TEmbeddability aEmbeddability);
145 IMPORT_C void SetSupportsNewFileL(TBool aSupportsNewFile);
146 IMPORT_C void SetLaunchInBackgroundL(TBool aLaunchInBackground);
147 IMPORT_C void SetGroupNameL(const TDesC& aGroupName);
148 IMPORT_C void SetDefaultScreenNumberL(TInt aDefaultScreenNumber);
149 IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
150 IMPORT_C void AddDataTypeL(TInt aPriority, const TDesC8& aType);
151 IMPORT_C void AddFileOwnershipInfoL(const TDesC& aFileName);
152 // Not needing to be supported for the foreseeable future:
153 // IMPORT_C void AddServiceInfoL(TUid aServiceUid, const TDesC8* aOpaqueData);
154 // IMPORT_C void AddServiceInfoDataTypeL(TUid aServiceUid, TInt aPriority, const TDesC8& aType);
156 struct SDataType // DATATYPE
161 struct SFileOwnershipInfo // FILE_OWNERSHIP_INFO
166 CApaRegistrationResourceFileWriter(TUid aAppUid, TUint aAttributes);
167 void ConstructL(const TDesC& aAppFile);
168 void WriteDataTypeL(MDataSink& aDataSink, const SDataType& aDataType) const;
169 void WriteFileOwnershipInfoL(MDataSink& aDataSink, const SFileOwnershipInfo& aFileOwnershipInfo) const;
170 // from CApaResourceFileWriterBase
171 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const;
172 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const;
177 HBufC* iLocalisableResourceFile;
179 TApaAppCapability::TEmbeddability iEmbeddability;
180 TBool iSupportsNewFile;
181 TBool iLaunchInBackground;
183 TInt iDefaultScreenNumber;
185 RArray<SDataType> iDataTypeList;
186 RArray<SFileOwnershipInfo> iFileOwnershipList;
192 class CApaLocalisableResourceFileWriter : public CApaResourceFileWriterBase
195 IMPORT_C static CApaLocalisableResourceFileWriter* NewL(const TDesC& aShortCaption, const TDesC& aCaption, TInt aNumberOfIcons, const TDesC& aGroupName);
196 IMPORT_C virtual ~CApaLocalisableResourceFileWriter();
197 void GenerateFileContentsL(RBuf8& aBuffer) const;
198 void SetIconFileL(const TDesC& aIconFile);
199 // Not needing to be supported for the foreseeable future:
200 // IMPORT_C void AddViewDataL(TUid aViewUid, TInt aScreenMode, const TDesC& aCaption, TInt aNumberOfIcons, const TDesC& aIconFile);
202 struct SCaptionAndIconInfo // CAPTION_AND_ICON_INFO
209 CApaLocalisableResourceFileWriter(TInt aNumberOfIcons);
210 void ConstructL(const TDesC& aShortCaption, const TDesC& aCaption, const TDesC& aGroupName);
211 void WriteCaptionAndIconInfoL(MDataSink& aDataSink, const SCaptionAndIconInfo& aCaptionAndIcon) const;
212 // from CApaResourceFileWriterBase
213 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const;
214 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const;
216 HBufC* iShortCaption;
217 SCaptionAndIconInfo iCaptionAndIcon;
221 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
223 class CApaAppInfoFileWriter;
228 const TUid KUidInterimFormatFileForJavaMIDletInstaller={0x10208182};
233 class ForJavaMIDletInstaller
236 IMPORT_C static void CheckInterimFormatFileNotCorruptL(RFile& aInterimFormatFile);
237 IMPORT_C static void GetJavaMIDletInfoL(RFs& aFs, const TDesC& aFileName,TUint32& aJavaMIDletInfo_AmsAuthId,TUint32& aJavaMIDletInfo_MIDlet);
238 IMPORT_C static CApaAppInfoFileWriter* NewInterimFormatFileWriterLC(RFs& aFs,const TDesC& aFileName,TUid aApplicationUid,TUint32 aJavaMIDletInfo_AmsAuthId,TInt aJavaMIDletInfo_MIDlet);
241 #endif // UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER
243 #if (((defined(SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1) || !defined(SYMBIAN_HIDE_UI_FRAMEWORKS_V1)) && !defined(SYMBIAN_REMOVE_UI_FRAMEWORKS_V1)) || defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER))
245 #if !defined(IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER)
246 // we're compiling a source file that doesn't define IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER, so give it it's default "value" of "IMPORT_C"
247 #define IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER IMPORT_C
255 #define KUidAppInfoFile KUidAppInfoFile16
257 #define KUidAppInfoFile KUidAppInfoFile8
264 const TUid KUidAppInfoFile8={268435562};
270 const TUid KUidAppInfoFile16={0x10003A38};
275 const TUid KUidAppInfoFileVersion2={0x101fb032};
281 // The order here is important, only ever APPEND to the list
284 EAifVersionAddsDataType,
285 EAifVersionAddsViewData,
286 EAifVersionAddsFileOwnershipInfo
287 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
288 ,EAifVersionAddsJavaMIDletInfo
292 class CApaAIFCaption : public CBase
294 // Represents a caption in an AIF during reading and writing of the file.
302 void ConstructL(TLanguage aLanguage,const TDesC& aCaption);
303 static CApaAIFCaption* NewLC(TLanguage aLanguage,const TDesC& aCaption);
304 void InternalizeL(RReadStream& aStream);
305 void ExternalizeL(RWriteStream& aStream) const;
306 TLanguage Language() const;
307 TApaAppCaption Caption() const;
313 class CApaAIFViewData : public CBase
315 // Represents the data associated with an application view described in an AIF
316 // during reading and writing of the file.
317 // implementation class
323 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TApaAppCaption CaptionL(TLanguage aLanguage) const;
324 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER CApaMaskedBitmap* IconByIndexL(TInt aIndex) const;
325 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TInt NumberOfIcons() const;
326 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TUid ViewUid() const;
327 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TInt ScreenMode() const;
330 static CApaAIFViewData* NewLC();
331 static CApaAIFViewData* NewLC(const CApaAIFViewData& aSourceData);
332 void InternalizeL(RReadStream& aStream);
333 void ExternalizeL(RWriteStream& aStream) const;
334 void SetScreenMode(TInt aScreenMode);
335 void AddCaptionL(TLanguage aLanguage,const TDesC& aCaption);
336 void AddIconL(CApaMaskedBitmap& aIcon);
337 void AddIconIndexL(TInt aIndex);
338 void SetViewUid(TUid aUid);
339 void LoadIconsL(const TDesC& aFileName, TUint aMbmOffset);
343 void ConstructL(const CApaAIFViewData& aSourceData);
346 CArrayPtr<CApaMaskedBitmap>* iIconArray;
347 CArrayPtr<CApaAIFCaption>* iCaptionArray;
349 CArrayFixFlat<TInt>* iIconIndexArray; // used for AIF version 2 format
352 class CApaAppInfoFile : public CBase
357 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
358 friend class ForJavaMIDletInstaller;
364 CApaAppInfoFile(RFs& aFs);
371 void InternalizeL(RReadStream& aStream); // internalizes the header info only
372 void ExternalizeL(RWriteStream& aStream) const; // externalizes the header info only
374 TSwizzle<HBufC> iCaption;
380 void InternalizeL(RReadStream& aStream); // internalizes the header info only
381 void ExternalizeL(RWriteStream& aStream) const; // externalizes the header info only
383 TSwizzle<CApaMaskedBitmap> iIcon; // Used for old AIF format Internalize
384 TInt iIconSideInPixels;
385 TSwizzle<CFbsBitmap> iIconMain; // Used for new AIF format
386 TSwizzle<CFbsBitmap> iIconMask; // Used for new AIF format
388 class TDataTypeHeader
392 void InternalizeL(RReadStream& aStream); // internalizes the header info only
393 void ExternalizeL(RWriteStream& aStream) const; // externalizes the header info only
395 TSwizzle<TDataType> iDataType;
396 TDataTypePriority iPriority;
398 class TViewDataHeader
401 void InternalizeL(RReadStream& aStream); // internalizes the header info only
402 void ExternalizeL(RWriteStream& aStream) const; // externalizes the header info only
404 TSwizzle<CApaAIFViewData> iViewData;
406 class TFileOwnershipInfoHeader
409 void InternalizeL(RReadStream& aStream); // internalizes the header info only
410 void ExternalizeL(RWriteStream& aStream) const; // externalizes the header info only
412 TSwizzle<HBufC> iOwnedFileName;
416 CPersistentStore* iStore;
417 CArrayFix<TCaptionHeader>* iCaptionHeaderArray;
418 CArrayFix<TIconHeader>* iIconHeaderArray;
419 CArrayFix<TDataTypeHeader>* iDataTypeHeaderArray;
420 CArrayFix<TViewDataHeader>* iViewDataHeaderArray;
421 CArrayFix<TFileOwnershipInfoHeader>* iFileOwnershipInfoHeaderArray;
422 TApaAppCapability iCapability;
425 class CApaAppInfoFileReader : public CApaAppInfoFile
428 Aif files contain information about an application, including its icons and
431 An application can get a reader for its own aif file by calling CEikApplication::OpenAppInfoFileLC().
436 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
437 friend class ForJavaMIDletInstaller;
440 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static CApaAppInfoFileReader* NewLC(RFs& aFs, const TDesC& aFileName,TUid aApplicationUid=KNullUid);
441 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static CApaAppInfoFileReader* NewL(RFs& aFs, const TDesC& aFileName,TUid aApplicationUid=KNullUid);
443 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void Capability(TDes8& aInfo) const;
444 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TApaAppCaption CaptionL(TLanguage aLanguage);
446 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER CApaMaskedBitmap* CreateMaskedBitmapL(TInt aIconSideInPixels); // If there are no bitmaps in the file this method leaves with KErrNotFound
447 // Not available until ER6
448 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER CApaMaskedBitmap* CreateMaskedBitmapByIndexLC(TInt aIndex); // If there are no bitmaps in the file this method leaves with KErrNotFound
449 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER TInt NumberOfBitmaps() const;
451 // Not available till ER5
452 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void DataTypesSupportedL(CArrayFix<TDataTypeWithPriority>& aTypeList) const;
455 // Not available till ER6.1
456 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void GetViewsL(CArrayPtr<CApaAIFViewData>& aViewList) const;
457 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void GetOwnedFilesL(CDesCArray& aOwnedFilesList) const;
461 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static void StretchDrawL(CFbsBitmap* aSource,CFbsBitmap* aTarget,TSize aSizeInPixels);
463 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER ~CApaAppInfoFileReader();
465 static void GetAifFileNameL(const TDesC& aFullName,TDes& aAifName);
467 CApaAppInfoFileReader(RFs& aFs);
468 void InternalizeL(RReadStream& aStream);
469 void ConstructL(const TDesC& aFileName,TUid aUid);
470 void LoadAifFileVersionTwoL(const TDesC& aFileName, TUid aMostDerivedUid);
471 void AddIconHeadersL(const TDesC& aFileName, TInt32 aFileOffset, TInt aNumIcons);
473 HBufC* iDefaultCaption;
477 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
478 TUint32 iJavaMIDletInfo_AmsAuthId;
479 TInt iJavaMIDletInfo_MIDlet;
483 class CApaAppInfoFileWriter : public CApaAppInfoFile
487 This class writes application information, including icons and captions into the aif file.
492 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
493 friend class ForJavaMIDletInstaller;
496 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static CApaAppInfoFileWriter* NewLC(RFs& aFs, const TDesC& aFileName,TUid aApplicationUid);
498 IMPORT_C TInt SetCapability(const TDesC8& aInfo);
499 IMPORT_C void AddCaptionL(TLanguage aLanguage,const TDesC& aCaption);
500 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddIconL(const TDesC& aIconFileName);
501 IMPORT_C void AddIconL(CApaMaskedBitmap& aIcon);
503 // Not available till ER5
504 IMPORT_C void AddDataTypeL(const TDataTypeWithPriority& aTypePriority);
507 // Not available till ER6.1
508 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddViewL(TUid aViewUid);
509 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddViewL(TUid aViewUid,TInt aScreenMode);
510 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddViewCaptionL(TLanguage aLanguage,const TDesC& aCaption,TUid aViewUid);
511 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddViewIconL(CApaMaskedBitmap& aIcon,TUid aViewUid);
512 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void StoreViewL(TUid aViewId);
513 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void AddOwnedFileL(const TDesC& aOwnedFileName);
516 IMPORT_C void StoreL();
518 IMPORT_C ~CApaAppInfoFileWriter();
520 CApaAppInfoFileWriter(RFs& aFs);
521 void ExternalizeL(RWriteStream& aStream) const;
522 void ConstructL(const TDesC& aFileName,TUid aUid
523 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
524 ,TUid aMiddleUid=KUidAppInfoFile,TUint32 aJavaMIDletInfo_AmsAuthId=0,TInt aJavaMIDletInfo_MIDlet=0
529 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
530 TUint32 iJavaMIDletInfo_AmsAuthId;
531 TInt iJavaMIDletInfo_MIDlet;
535 class CApaAppCaptionFileReader : public CBase
541 CApaAppCaptionFileReader(RFs& aFs,const TDesC& iAppFileName);
542 void GetCaptionsL(TApaAppCaption& aCaption,TApaAppCaption& aShortCaption);
545 TFileName iCaptionFileName;
548 class AppInfoFileUtils
549 // Internal utilities providing helper functions for non-ROM localisation
554 public: // For internal use only
555 IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static void GetAifFileName(const RFs& aFs,TDes& aAifName);
557 static void GetAifFileNameL(const RFs& aFs,const TDesC& aFullName,TDes& aAifName);
559 #endif // #if (defined(SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1) || !defined(SYMBIAN_HIDE_UI_FRAMEWORKS_V1)) && !defined(SYMBIAN_REMOVE_UI_FRAMEWORKS_V1)