|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // apgicnfl.h |
|
15 // |
|
16 |
|
17 #ifndef __APGICNFL_H__ |
|
18 #define __APGICNFL_H__ |
|
19 |
|
20 #include <apadef.h> |
|
21 #include <apaid.h> |
|
22 #include <bitdev.h> |
|
23 #include <apmstd.h> |
|
24 #include <badesca.h> |
|
25 |
|
26 class CFbsBitmap; |
|
27 class CPersistentStore; |
|
28 class RReadStream; |
|
29 class RWriteStream; |
|
30 |
|
31 /** An application icon. |
|
32 |
|
33 This is a bitmap and a mask, managed by the Font and Bitmap server. |
|
34 |
|
35 An object of this type is passed to RApaLsSession::GetAppIcon() to fetch a |
|
36 suitable application icon. |
|
37 |
|
38 @publishedAll |
|
39 @released |
|
40 @see RApaLsSession::GetAppIcon() */ |
|
41 class CApaMaskedBitmap : public CFbsBitmap |
|
42 { |
|
43 public: |
|
44 IMPORT_C static CApaMaskedBitmap* NewLC(); |
|
45 IMPORT_C static CApaMaskedBitmap* NewL(const CApaMaskedBitmap* aSourceIcon); |
|
46 // |
|
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 |
|
50 // |
|
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); |
|
54 private: |
|
55 CApaMaskedBitmap(); |
|
56 void ConstructL(); |
|
57 private: |
|
58 CFbsBitmap* iMask; |
|
59 }; |
|
60 |
|
61 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
62 /** |
|
63 @internalComponent |
|
64 */ |
|
65 class CApaResourceFileWriterBase : public CBase |
|
66 { |
|
67 protected: |
|
68 class RBufferSink; |
|
69 class MDataSink |
|
70 { |
|
71 public: |
|
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);} |
|
77 protected: |
|
78 MDataSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat); |
|
79 void FlushL(TBool aFinalFlush); |
|
80 void Reset(TInt& aNumberOfBytesWhenUncompressed); |
|
81 private: |
|
82 void WriteRunLengthL(TInt aRunLength); |
|
83 private: |
|
84 enum |
|
85 { |
|
86 EFlag_InCompressedUnicodeRun =0x00000001 |
|
87 }; |
|
88 private: |
|
89 // new virtual functions |
|
90 virtual void DoWriteBufferL(const TDesC8& aBuffer)=0; |
|
91 private: |
|
92 TInt iNumberOfBytesWhenUncompressed; |
|
93 TUint iFlags; |
|
94 RBufferSink* iBufferSinkForCompressedUnicodeFormat; // does not own what it points to |
|
95 }; |
|
96 class RBufferSink : public MDataSink |
|
97 { |
|
98 public: |
|
99 RBufferSink(RBufferSink* aBufferSinkForCompressedUnicodeFormat); |
|
100 void ConstructLC(); |
|
101 void Close(); |
|
102 void FlushAndGetAndResetL(TInt& aNumberOfBytesWhenUncompressed, RBuf8& aBuffer); |
|
103 private: |
|
104 // from MDataSink |
|
105 virtual void DoWriteBufferL(const TDesC8& aBuffer); |
|
106 private: |
|
107 RBuf8 iBuffer; |
|
108 }; |
|
109 protected: |
|
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; |
|
119 private: |
|
120 static HBufC8* AsCompressedUnicodeLC(const TDesC& aUncompressedUnicode); |
|
121 void MainResourceInCompiledFormatLC(TInt& aMainResourceSizeInBytesWhenUncompressed, RBuf8& aBuffer, TBool aCompressedUnicodeFormat) const; |
|
122 private: |
|
123 // new virtual functions |
|
124 virtual void MainResourceInCompiledFormatL(MDataSink& aDataSink) const=0; |
|
125 virtual const TDesC8* SecondResourceL(TBool& aSecondResourceInCompressedUnicodeFormat) const=0; |
|
126 }; |
|
127 |
|
128 /** |
|
129 Used to support the registration of non-native applications. |
|
130 |
|
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. |
|
133 |
|
134 @publishedPartner |
|
135 @released |
|
136 */ |
|
137 class CApaRegistrationResourceFileWriter : public CApaResourceFileWriterBase |
|
138 { |
|
139 public: |
|
140 IMPORT_C static CApaRegistrationResourceFileWriter* NewL(TUid aAppUid, const TDesC& aAppFile, TUint aAttributes); |
|
141 IMPORT_C virtual ~CApaRegistrationResourceFileWriter(); |
|
142 TUid AppUid() const; |
|
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); |
|
157 private: |
|
158 struct SDataType // DATATYPE |
|
159 { |
|
160 TInt iPriority; |
|
161 HBufC8* iType; |
|
162 }; |
|
163 struct SFileOwnershipInfo // FILE_OWNERSHIP_INFO |
|
164 { |
|
165 HBufC* iFileName; |
|
166 }; |
|
167 private: |
|
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; |
|
175 private: |
|
176 TUid iAppUid; |
|
177 HBufC* iAppFile; |
|
178 TUint iAttributes; |
|
179 HBufC* iLocalisableResourceFile; |
|
180 TBool iAppIsHidden; |
|
181 TApaAppCapability::TEmbeddability iEmbeddability; |
|
182 TBool iSupportsNewFile; |
|
183 TBool iLaunchInBackground; |
|
184 HBufC* iGroupName; |
|
185 TInt iDefaultScreenNumber; |
|
186 HBufC8* iOpaqueData; |
|
187 RArray<SDataType> iDataTypeList; |
|
188 RArray<SFileOwnershipInfo> iFileOwnershipList; |
|
189 }; |
|
190 |
|
191 /** |
|
192 @internalAll |
|
193 */ |
|
194 class CApaLocalisableResourceFileWriter : public CApaResourceFileWriterBase |
|
195 { |
|
196 public: |
|
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); |
|
203 private: |
|
204 struct SCaptionAndIconInfo // CAPTION_AND_ICON_INFO |
|
205 { |
|
206 HBufC* iCaption; |
|
207 TInt iNumberOfIcons; |
|
208 HBufC* iIconFile; |
|
209 }; |
|
210 private: |
|
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; |
|
217 private: |
|
218 HBufC* iShortCaption; |
|
219 SCaptionAndIconInfo iCaptionAndIcon; |
|
220 HBufC* iGroupName; |
|
221 }; |
|
222 |
|
223 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
224 |
|
225 #endif |
|
226 |