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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #ifndef __APGICNFL_H__
18 #define __APGICNFL_H__
27 class CPersistentStore;
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() */
41 class CApaMaskedBitmap : public CFbsBitmap
44 IMPORT_C static CApaMaskedBitmap* NewLC();
45 IMPORT_C static CApaMaskedBitmap* NewL(const CApaMaskedBitmap* aSourceIcon);
47 IMPORT_C CFbsBitmap* Mask() const;
48 IMPORT_C void InternalizeL(RReadStream& aStream); //lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
49 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;//lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
51 IMPORT_C ~CApaMaskedBitmap();
52 void SetRomBitmapL(TUint8* aRomPointer); //lint !e1511 Member hides non-virtual member - CFbsBitmap not primary intended for derivation
53 IMPORT_C void SetMaskBitmap(CFbsBitmap* aMask);
61 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
65 class CApaResourceFileWriterBase : public CBase
72 void WriteBufferL(const TDesC8& aBuffer);
73 void WriteCompressedUnicodeRunL(TInt aNumberOfBytesWhenUncompressed, const TDesC8& aTextAsCompressedUnicode);
74 void WriteInCompressedUnicodeFormatL(TInt aNumberOfBytesWhenUncompressed, const TDesC8& aData, TBool aInCompressedUnicodeRun);
75 TInt NumberOfBytesWhenUncompressed() const;
76 inline TBool CompressedUnicodeFormat() const {return (iBufferSinkForCompressedUnicodeFormat!=NULL);}
78 MDataSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat);
79 void FlushL(TBool aFinalFlush);
80 void Reset(TInt& aNumberOfBytesWhenUncompressed);
82 void WriteRunLengthL(TInt aRunLength);
86 EFlag_InCompressedUnicodeRun =0x00000001
89 // new virtual functions
90 virtual void DoWriteBufferL(const TDesC8& aBuffer)=0;
92 TInt iNumberOfBytesWhenUncompressed;
94 RBufferSink* iBufferSinkForCompressedUnicodeFormat; // does not own what it points to
96 class RBufferSink : public MDataSink
99 RBufferSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat);
102 void FlushAndGetAndResetL(TInt& aNumberOfBytesWhenUncompressed, RBuf8& aBuffer);
105 virtual void DoWriteBufferL(const TDesC8& aBuffer);
110 CApaResourceFileWriterBase();
111 void DoGenerateFileContentsL(RBuf8& aBuffer, TUid aUid2, TUid aUid3) const;
112 void WriteUidTypeL(MDataSink& aDataSink, TUid aUid2, TUid aUid3) const;
113 void WriteTextL(MDataSink& aDataSink, const TDesC& aText) const;
114 void WriteText8L(MDataSink& aDataSink, const TDesC8& aText8) const;
115 void WriteUint8L(MDataSink& aDataSink, TUint aUint8) const;
116 void WriteLittleEndianUint16L(MDataSink& aDataSink, TUint aUint16) const;
117 void WriteLittleEndianUint32L(MDataSink& aDataSink, TUint aUint32) const;
118 void WriteBufferL(MDataSink& aDataSink, const TDesC8& aBuffer) const;
120 static HBufC8* AsCompressedUnicodeLC(const TDesC& aUncompressedUnicode);
121 void MainResourceInCompiledFormatLC(TInt& aMainResourceSizeInBytesWhenUncompressed, RBuf8& aBuffer, TBool aCompressedUnicodeFormat) const;
123 // new virtual functions
124 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const=0;
125 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const=0;
129 Used to support the registration of non-native applications.
131 The task of this class is to generate the resource files expected by the Apparc server. Applications
132 that register other applications can use functions of this class to customise the generated resource files.
137 class CApaRegistrationResourceFileWriter : public CApaResourceFileWriterBase
140 IMPORT_C static CApaRegistrationResourceFileWriter* NewL(TUid aAppUid, const TDesC& aAppFile, TUint aAttributes);
141 IMPORT_C virtual ~CApaRegistrationResourceFileWriter();
143 void GenerateFileContentsL(RBuf8& aBuffer) const;
144 void SetLocalisableResourceFileL(const TDesC& aLocalisableResourceFile);
145 IMPORT_C void SetAppIsHiddenL(TBool aAppIsHidden);
146 IMPORT_C void SetEmbeddabilityL(TApaAppCapability::TEmbeddability aEmbeddability);
147 IMPORT_C void SetSupportsNewFileL(TBool aSupportsNewFile);
148 IMPORT_C void SetLaunchInBackgroundL(TBool aLaunchInBackground);
149 IMPORT_C void SetGroupNameL(const TDesC& aGroupName);
150 IMPORT_C void SetDefaultScreenNumberL(TInt aDefaultScreenNumber);
151 IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
152 IMPORT_C void AddDataTypeL(TInt aPriority, const TDesC8& aType);
153 IMPORT_C void AddFileOwnershipInfoL(const TDesC& aFileName);
154 // Not needing to be supported for the foreseeable future:
155 // IMPORT_C void AddServiceInfoL(TUid aServiceUid, const TDesC8* aOpaqueData);
156 // IMPORT_C void AddServiceInfoDataTypeL(TUid aServiceUid, TInt aPriority, const TDesC8& aType);
158 struct SDataType // DATATYPE
163 struct SFileOwnershipInfo // FILE_OWNERSHIP_INFO
168 CApaRegistrationResourceFileWriter(TUid aAppUid, TUint aAttributes);
169 void ConstructL(const TDesC& aAppFile);
170 void WriteDataTypeL(MDataSink& aDataSink, const SDataType& aDataType) const;
171 void WriteFileOwnershipInfoL(MDataSink& aDataSink, const SFileOwnershipInfo& aFileOwnershipInfo) const;
172 // from CApaResourceFileWriterBase
173 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const;
174 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const;
179 HBufC* iLocalisableResourceFile;
181 TApaAppCapability::TEmbeddability iEmbeddability;
182 TBool iSupportsNewFile;
183 TBool iLaunchInBackground;
185 TInt iDefaultScreenNumber;
187 RArray<SDataType> iDataTypeList;
188 RArray<SFileOwnershipInfo> iFileOwnershipList;
194 class CApaLocalisableResourceFileWriter : public CApaResourceFileWriterBase
197 IMPORT_C static CApaLocalisableResourceFileWriter* NewL(const TDesC& aShortCaption, const TDesC& aCaption, TInt aNumberOfIcons, const TDesC& aGroupName);
198 IMPORT_C virtual ~CApaLocalisableResourceFileWriter();
199 void GenerateFileContentsL(RBuf8& aBuffer) const;
200 void SetIconFileL(const TDesC& aIconFile);
201 // Not needing to be supported for the foreseeable future:
202 // IMPORT_C void AddViewDataL(TUid aViewUid, TInt aScreenMode, const TDesC& aCaption, TInt aNumberOfIcons, const TDesC& aIconFile);
204 struct SCaptionAndIconInfo // CAPTION_AND_ICON_INFO
211 CApaLocalisableResourceFileWriter(TInt aNumberOfIcons);
212 void ConstructL(const TDesC& aShortCaption, const TDesC& aCaption, const TDesC& aGroupName);
213 void WriteCaptionAndIconInfoL(MDataSink& aDataSink, const SCaptionAndIconInfo& aCaptionAndIcon) const;
214 // from CApaResourceFileWriterBase
215 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const;
216 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const;
218 HBufC* iShortCaption;
219 SCaptionAndIconInfo iCaptionAndIcon;
223 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS