localisation/apparchitecture/inc/APGICNFL.H
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
equal deleted inserted replaced
56:aa99f2208aad 57:b8d18c84f71c
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
       
    14 // apgicnfl.h
    14 //
    15 //
    15 
    16 
    16 #ifndef __APGICNFL_H__
    17 #ifndef __APGICNFL_H__
    17 #define __APGICNFL_H__
    18 #define __APGICNFL_H__
    18 
    19 
    25 class CFbsBitmap;
    26 class CFbsBitmap;
    26 class CPersistentStore;
    27 class CPersistentStore;
    27 class RReadStream;
    28 class RReadStream;
    28 class RWriteStream;
    29 class RWriteStream;
    29 
    30 
    30 class CApaMaskedBitmap : public CFbsBitmap
       
    31 /** An application icon.
    31 /** An application icon.
    32 
    32 
    33 This is a bitmap and a mask, managed by the Font and Bitmap server.
    33 This is a bitmap and a mask, managed by the Font and Bitmap server.
    34 
    34 
    35 An object of this type is passed to RApaLsSession::GetAppIcon() to fetch a 
    35 An object of this type is passed to RApaLsSession::GetAppIcon() to fetch a 
    36 suitable application icon.
    36 suitable application icon.
    37 
    37 
    38 @publishedAll
    38 @publishedAll
    39 @released
    39 @released
    40 @see RApaLsSession::GetAppIcon() */
    40 @see RApaLsSession::GetAppIcon() */
       
    41 class CApaMaskedBitmap : public CFbsBitmap
    41 	{
    42 	{
    42 public:
    43 public:
    43 	IMPORT_C static CApaMaskedBitmap* NewLC();
    44 	IMPORT_C static CApaMaskedBitmap* NewLC();
    44 	IMPORT_C static CApaMaskedBitmap* NewL(const CApaMaskedBitmap* aSourceIcon);
    45 	IMPORT_C static CApaMaskedBitmap* NewL(const CApaMaskedBitmap* aSourceIcon);
    45 	//
    46 	//
    55 	void ConstructL();
    56 	void ConstructL();
    56 private:
    57 private:
    57 	CFbsBitmap* iMask;
    58 	CFbsBitmap* iMask;
    58 	};
    59 	};
    59 
    60 
       
    61 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    60 /**
    62 /**
    61 @internalComponent
    63 @internalComponent
    62 */
    64 */
    63 class CApaResourceFileWriterBase : public CBase
    65 class CApaResourceFileWriterBase : public CBase
    64 	{
    66 	{
   216 	HBufC* iShortCaption;
   218 	HBufC* iShortCaption;
   217 	SCaptionAndIconInfo iCaptionAndIcon;
   219 	SCaptionAndIconInfo iCaptionAndIcon;
   218 	HBufC* iGroupName;
   220 	HBufC* iGroupName;
   219 	};
   221 	};
   220 
   222 
   221 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
   223 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
   222 
   224 
   223 class CApaAppInfoFileWriter;
       
   224 
       
   225 /**
       
   226 @internalAll
       
   227 */
       
   228 const TUid KUidInterimFormatFileForJavaMIDletInstaller={0x10208182};
       
   229 
       
   230 /**
       
   231 @internalAll
       
   232 */
       
   233 class ForJavaMIDletInstaller
       
   234 	{
       
   235 public:
       
   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);
       
   239 	};
       
   240 
       
   241 #endif // UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER
       
   242 
       
   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))
       
   244 
       
   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
       
   248 #endif
   225 #endif
   249 
   226 
   250 /**
       
   251 @publishedAll
       
   252 @deprecated
       
   253 */
       
   254 #ifdef _UNICODE
       
   255 #define KUidAppInfoFile KUidAppInfoFile16
       
   256 #else
       
   257 #define KUidAppInfoFile KUidAppInfoFile8
       
   258 #endif
       
   259 
       
   260 /**
       
   261 @publishedAll
       
   262 @deprecated
       
   263 */
       
   264 const TUid KUidAppInfoFile8={268435562};
       
   265 
       
   266 /**
       
   267 @publishedAll
       
   268 @deprecated
       
   269 */
       
   270 const TUid KUidAppInfoFile16={0x10003A38};
       
   271 
       
   272 /**
       
   273 @internalComponent
       
   274 */
       
   275 const TUid KUidAppInfoFileVersion2={0x101fb032};
       
   276 
       
   277 /**
       
   278 @internalComponent
       
   279 */
       
   280 enum TAifVersion
       
   281 // The order here is important, only ever APPEND to the list
       
   282 	{
       
   283 	EAifVersionOriginal,
       
   284 	EAifVersionAddsDataType,
       
   285 	EAifVersionAddsViewData,
       
   286 	EAifVersionAddsFileOwnershipInfo
       
   287 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   288 	,EAifVersionAddsJavaMIDletInfo
       
   289 #endif
       
   290 	};
       
   291 
       
   292 class CApaAIFCaption : public CBase
       
   293 //
       
   294 // Represents a caption in an AIF during reading and writing of the file.
       
   295 /**
       
   296 @internalComponent
       
   297 */
       
   298 	{
       
   299 public:
       
   300 	~CApaAIFCaption();
       
   301 	CApaAIFCaption();
       
   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;
       
   308 public:
       
   309 	HBufC* iCaption;
       
   310 	TLanguage iLanguage;
       
   311 	};
       
   312 
       
   313 class CApaAIFViewData : public CBase
       
   314 //
       
   315 // Represents the data associated with an application view described in an AIF
       
   316 // during reading and writing of the file.
       
   317 // implementation class
       
   318 /**
       
   319 @internalComponent
       
   320 */
       
   321 	{
       
   322 public:
       
   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;
       
   328 public:
       
   329 	~CApaAIFViewData();
       
   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);
       
   340 private:
       
   341 	CApaAIFViewData();
       
   342 	void ConstructL();
       
   343 	void ConstructL(const CApaAIFViewData& aSourceData);
       
   344 private:
       
   345 	TInt iScreenMode;
       
   346 	CArrayPtr<CApaMaskedBitmap>* iIconArray;
       
   347 	CArrayPtr<CApaAIFCaption>* iCaptionArray;
       
   348 	TUid iViewUid;
       
   349 	CArrayFixFlat<TInt>* iIconIndexArray;		// used for AIF version 2 format
       
   350 	};
       
   351 
       
   352 class CApaAppInfoFile : public CBase
       
   353 /**
       
   354 @internalComponent
       
   355 */
       
   356 	{
       
   357 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   358 	friend class ForJavaMIDletInstaller;
       
   359 #endif
       
   360 public:
       
   361 	~CApaAppInfoFile();
       
   362 	//
       
   363 protected:
       
   364 	CApaAppInfoFile(RFs& aFs);
       
   365 	void ConstructL();
       
   366 protected:
       
   367 
       
   368 	class TCaptionHeader
       
   369 		{
       
   370 	public:
       
   371 		void InternalizeL(RReadStream& aStream);			// internalizes the header info only
       
   372 		void ExternalizeL(RWriteStream& aStream) const;		// externalizes the header info only
       
   373 	public:
       
   374 		TSwizzle<HBufC> iCaption;
       
   375 		TLanguage iLanguage;
       
   376 		};
       
   377 	class TIconHeader
       
   378 		{
       
   379 	public:
       
   380 		void InternalizeL(RReadStream& aStream);			// internalizes the header info only
       
   381 		void ExternalizeL(RWriteStream& aStream) const;		// externalizes the header info only
       
   382 	public:
       
   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
       
   387 		};
       
   388 	class TDataTypeHeader
       
   389 		{
       
   390 	public:
       
   391 		// header info only
       
   392 		void InternalizeL(RReadStream& aStream); 			// internalizes the header info only
       
   393 		void ExternalizeL(RWriteStream& aStream) const;		// externalizes the header info only
       
   394 	public:
       
   395 		TSwizzle<TDataType> iDataType;
       
   396 		TDataTypePriority iPriority;
       
   397 		};
       
   398 	class TViewDataHeader
       
   399 		{
       
   400 	public:
       
   401 		void InternalizeL(RReadStream& aStream);			// internalizes the header info only
       
   402 		void ExternalizeL(RWriteStream& aStream) const;		// externalizes the header info only
       
   403 	public:
       
   404 		TSwizzle<CApaAIFViewData> iViewData;
       
   405 		};
       
   406 	class TFileOwnershipInfoHeader
       
   407 		{
       
   408 	public:
       
   409 		void InternalizeL(RReadStream& aStream);			// internalizes the header info only
       
   410 		void ExternalizeL(RWriteStream& aStream) const;		// externalizes the header info only
       
   411 	public:
       
   412 		TSwizzle<HBufC> iOwnedFileName;
       
   413 		};
       
   414 protected:
       
   415 	RFs& iFs;
       
   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;
       
   423 	};
       
   424 
       
   425 class CApaAppInfoFileReader : public CApaAppInfoFile
       
   426 /** Aif file reader.
       
   427 
       
   428 Aif files contain information about an application, including its icons and 
       
   429 captions.
       
   430 
       
   431 An application can get a reader for its own aif file by calling CEikApplication::OpenAppInfoFileLC(). 
       
   432 
       
   433 @publishedAll
       
   434 @deprecated */
       
   435 	{
       
   436 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   437 	friend class ForJavaMIDletInstaller;
       
   438 #endif
       
   439 public:
       
   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);
       
   442 	//
       
   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);
       
   445 	
       
   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;
       
   450 
       
   451 	// Not available till ER5
       
   452 	IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER void DataTypesSupportedL(CArrayFix<TDataTypeWithPriority>& aTypeList) const;
       
   453 	//
       
   454 
       
   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;
       
   458 	//	
       
   459 
       
   460 	// utility function
       
   461 	IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static void StretchDrawL(CFbsBitmap* aSource,CFbsBitmap* aTarget,TSize aSizeInPixels);
       
   462 	//
       
   463 	IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER ~CApaAppInfoFileReader();
       
   464 public:
       
   465 	static void GetAifFileNameL(const TDesC& aFullName,TDes& aAifName);
       
   466 private:
       
   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);
       
   472 private:
       
   473 	HBufC* iDefaultCaption;
       
   474 	TUint8* iRomPointer;
       
   475 	TInt iMbmOffset;
       
   476 	HBufC* iAifFileName;
       
   477 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   478 	TUint32 iJavaMIDletInfo_AmsAuthId;
       
   479 	TInt iJavaMIDletInfo_MIDlet;
       
   480 #endif
       
   481 	};
       
   482 
       
   483 class CApaAppInfoFileWriter : public CApaAppInfoFile
       
   484 /**
       
   485 Aif file writer.
       
   486 
       
   487 This class writes application information, including icons and captions into the aif file.
       
   488 
       
   489 @publishedAll
       
   490 @deprecated */
       
   491 	{
       
   492 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   493 	friend class ForJavaMIDletInstaller;
       
   494 #endif
       
   495 public:
       
   496 	IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static CApaAppInfoFileWriter* NewLC(RFs& aFs, const TDesC& aFileName,TUid aApplicationUid);
       
   497 	//
       
   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);
       
   502 	
       
   503 	// Not available till ER5
       
   504 	IMPORT_C void AddDataTypeL(const TDataTypeWithPriority& aTypePriority);
       
   505 	//
       
   506 
       
   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);
       
   514 	//
       
   515 	
       
   516 	IMPORT_C void StoreL();
       
   517 	//
       
   518 	IMPORT_C ~CApaAppInfoFileWriter();
       
   519 private:
       
   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
       
   525 #endif
       
   526 					);
       
   527 private:
       
   528 	CStoreMap* iMap;
       
   529 #if defined(UI_FRAMEWORKS_V1_REMNANT_FOR_JAVA_MIDLET_INSTALLER)
       
   530 	TUint32 iJavaMIDletInfo_AmsAuthId;
       
   531 	TInt iJavaMIDletInfo_MIDlet;
       
   532 #endif
       
   533 	};
       
   534 
       
   535 class CApaAppCaptionFileReader : public CBase
       
   536 /**
       
   537 @internalComponent
       
   538 */
       
   539 	{
       
   540 public:
       
   541 	CApaAppCaptionFileReader(RFs& aFs,const TDesC& iAppFileName);
       
   542 	void GetCaptionsL(TApaAppCaption& aCaption,TApaAppCaption& aShortCaption);
       
   543 private:	
       
   544 	RFs& iFs;
       
   545 	TFileName iCaptionFileName;
       
   546 	};
       
   547 
       
   548 class AppInfoFileUtils
       
   549 // Internal utilities providing helper functions for non-ROM localisation
       
   550 /**
       
   551 @internalComponent
       
   552 */
       
   553 	{
       
   554 public: // For internal use only
       
   555 	IMPORT_C_NOT_NEEDED_FOR_JAVA_MIDLET_INSTALLER static void GetAifFileName(const RFs& aFs,TDes& aAifName);
       
   556 public:
       
   557 	static void GetAifFileNameL(const RFs& aFs,const TDesC& aFullName,TDes& aAifName);
       
   558 	};
       
   559 #endif // #if (defined(SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1) || !defined(SYMBIAN_HIDE_UI_FRAMEWORKS_V1)) && !defined(SYMBIAN_REMOVE_UI_FRAMEWORKS_V1)
       
   560 
       
   561 #endif