114
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Class represents an Object Description Tree of Xuikon.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "hspsodt.h"
|
|
19 |
#include <s32strm.h>
|
|
20 |
#include <s32mem.h>
|
|
21 |
#include "hspsthememanagement.h"
|
|
22 |
#include "hspsdomdocument.h"
|
|
23 |
#include "hspsresource.h"
|
|
24 |
|
|
25 |
// ODT version number
|
|
26 |
_LIT( KHpspOdtVersion, "3.0" );
|
|
27 |
|
|
28 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// ChspsODT::ChspsODT
|
|
32 |
// C++ default constructor can NOT contain any code, that
|
|
33 |
// might leave.
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
ChspsODT::ChspsODT()
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
// ChspsODT::ConstructL
|
|
42 |
// Symbian 2nd phase constructor can leave.
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
void ChspsODT::ConstructL()
|
|
46 |
{
|
|
47 |
iDomDocument = ChspsDomDocument::NewL();
|
|
48 |
iResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity );
|
|
49 |
}
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// ChspsODT::CopyODTDataL()
|
|
53 |
// Helper to ODT cloning. Prevents duplicate code in two clone methods.
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
void ChspsODT::CopyODTDataL( const ChspsODT& aSource, ChspsODT& aTarget )
|
|
57 |
{
|
|
58 |
// Properties.
|
|
59 |
aTarget.SetFamily( aSource.Family() );
|
|
60 |
aTarget.SetConfigurationType( aSource.ConfigurationType() );
|
|
61 |
aTarget.SetRootUid( aSource.RootUid() );
|
|
62 |
aTarget.SetProviderUid( aSource.ProviderUid() );
|
|
63 |
aTarget.SetThemeUid( aSource.ThemeUid() );
|
|
64 |
aTarget.SetProviderNameL( aSource.ProviderName() );
|
|
65 |
aTarget.SetThemeFullNameL( aSource.ThemeFullName() );
|
|
66 |
aTarget.SetThemeShortNameL( aSource.ThemeShortName() );
|
|
67 |
aTarget.SetThemeVersionL( aSource.ThemeVersion() );
|
|
68 |
aTarget.SetDescriptionL( aSource.Description() );
|
|
69 |
aTarget.SetLogoFileL( aSource.LogoFile() );
|
|
70 |
aTarget.SetPreviewFileL( aSource.PreviewFile() );
|
|
71 |
aTarget.SetMultiInstance( aSource.MultiInstance() );
|
|
72 |
aTarget.SetOdtLanguage( aSource.OdtLanguage() );
|
|
73 |
aTarget.SetFlags( aSource.Flags() );
|
|
74 |
|
|
75 |
// Resources.
|
|
76 |
aTarget.DeleteAllResources();
|
|
77 |
TInt resourceCount = aSource.ResourceCount();
|
|
78 |
for ( TInt index = 0; index < resourceCount ; index++ )
|
|
79 |
{
|
|
80 |
ChspsResource* resource = ( aSource.ResourceL( index ) ).CloneL();
|
|
81 |
CleanupStack::PushL( resource );
|
|
82 |
aTarget.AddResourceL( resource );
|
|
83 |
CleanupStack::Pop( resource );
|
|
84 |
resource = NULL;
|
|
85 |
}
|
|
86 |
|
|
87 |
// DOM tree.
|
|
88 |
aTarget.CopyDomDocumentL( aSource.DomDocument() );
|
|
89 |
}
|
|
90 |
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
// ChspsODT::NewL
|
|
93 |
// Two-phased constructor.
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
EXPORT_C ChspsODT* ChspsODT::NewL()
|
|
97 |
{
|
|
98 |
ChspsODT* self = new( ELeave ) ChspsODT;
|
|
99 |
CleanupStack::PushL( self );
|
|
100 |
self->ConstructL();
|
|
101 |
CleanupStack::Pop( self );
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
// ChspsODT::NewLC
|
|
107 |
// Two-phased constructor.
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
EXPORT_C ChspsODT* ChspsODT::NewLC( const TDesC8& aStreamData )
|
|
111 |
{
|
|
112 |
ChspsODT* data = ChspsODT::NewL();
|
|
113 |
CleanupStack::PushL( data );
|
|
114 |
RDesReadStream stream( aStreamData );
|
|
115 |
CleanupClosePushL( stream );
|
|
116 |
data->InternalizeL( stream );
|
|
117 |
CleanupStack::PopAndDestroy( &stream );
|
|
118 |
return data;
|
|
119 |
}
|
|
120 |
|
|
121 |
// Destructor
|
|
122 |
ChspsODT::~ChspsODT()
|
|
123 |
{
|
|
124 |
delete iDescription;
|
|
125 |
delete iLogoFile;
|
|
126 |
delete iPreviewFile;
|
|
127 |
delete iProviderName;
|
|
128 |
delete iThemeFullName;
|
|
129 |
delete iThemeShortName;
|
|
130 |
delete iThemeVersion;
|
|
131 |
// clean up the array
|
|
132 |
if( iResourceList )
|
|
133 |
{
|
|
134 |
iResourceList->ResetAndDestroy();
|
|
135 |
delete iResourceList;
|
|
136 |
}
|
|
137 |
delete iDomDocument;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
// ChspsODT::MarshalHeaderL
|
|
143 |
// Marshals the ODT header into descriptor
|
|
144 |
// (other items were commented in a header).
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
EXPORT_C HBufC8* ChspsODT::MarshalHeaderL() const
|
|
147 |
{
|
|
148 |
HBufC8* buf = HBufC8::NewLC( HeaderSize() );
|
|
149 |
TPtr8 ptr = buf->Des();
|
|
150 |
RDesWriteStream stream( ptr );
|
|
151 |
stream.PushL();
|
|
152 |
ExternalizeHeaderL( stream );
|
|
153 |
stream.Pop();
|
|
154 |
stream.Close();
|
|
155 |
CleanupStack::Pop( buf );
|
|
156 |
|
|
157 |
return buf;
|
|
158 |
}
|
|
159 |
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
// ChspsODT::UnMarshalHeaderLC
|
|
162 |
// Unmarshals the ODT header from descriptor stream
|
|
163 |
// (other items were commented in a header).
|
|
164 |
// -----------------------------------------------------------------------------
|
|
165 |
EXPORT_C ChspsODT* ChspsODT::UnMarshalHeaderLC( const TDesC8& aStreamData )
|
|
166 |
{
|
|
167 |
ChspsODT* data = ChspsODT::NewL();
|
|
168 |
CleanupStack::PushL( data );
|
|
169 |
RDesReadStream stream( aStreamData );
|
|
170 |
CleanupClosePushL( stream );
|
|
171 |
data->InternalizeHeaderL( stream );
|
|
172 |
CleanupStack::PopAndDestroy( &stream );
|
|
173 |
|
|
174 |
return data;
|
|
175 |
}
|
|
176 |
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
// ChspsODT::UnMarshalHeaderL
|
|
179 |
// Unmarshals the ODT header from descriptor stream
|
|
180 |
// (other items were commented in a header).
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
EXPORT_C void ChspsODT::UnMarshalHeaderL( const TDesC8& aStreamData )
|
|
183 |
{
|
|
184 |
RDesReadStream stream( aStreamData );
|
|
185 |
CleanupClosePushL( stream );
|
|
186 |
InternalizeHeaderL( stream );
|
|
187 |
CleanupStack::PopAndDestroy( &stream );
|
|
188 |
}
|
|
189 |
|
|
190 |
// -----------------------------------------------------------------------------
|
|
191 |
// ChspsODT::ExternalizeL
|
|
192 |
// Externalizes the ODT
|
|
193 |
// (other items were commented in a header).
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
EXPORT_C void ChspsODT::ExternalizeL( RWriteStream& aStream ) const
|
|
196 |
{
|
|
197 |
ExternalizeHeaderL( aStream );
|
|
198 |
ExternalizeResourceListL( aStream );
|
|
199 |
aStream << *iDomDocument;
|
|
200 |
}
|
|
201 |
|
|
202 |
// -----------------------------------------------------------------------------
|
|
203 |
// ChspsODT::InternalizeL
|
|
204 |
// Internalizes the ODT
|
|
205 |
// (other items were commented in a header).
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
EXPORT_C void ChspsODT::InternalizeL( RReadStream& aStream )
|
|
208 |
{
|
|
209 |
InternalizeHeaderL( aStream );
|
|
210 |
InternalizeResourceListL( aStream );
|
|
211 |
|
|
212 |
delete iDomDocument;
|
|
213 |
iDomDocument = NULL;
|
|
214 |
iDomDocument = ChspsDomDocument::NewL( aStream );
|
|
215 |
}
|
|
216 |
|
|
217 |
// -----------------------------------------------------------------------------
|
|
218 |
// ChspsODT::ExternalizeHeaderL
|
|
219 |
// Externalizes the ODT header
|
|
220 |
// (other items were commented in a header).
|
|
221 |
// -----------------------------------------------------------------------------
|
|
222 |
void ChspsODT::ExternalizeHeaderL( RWriteStream& aStream ) const
|
|
223 |
{
|
|
224 |
aStream.WriteInt32L( KHpspOdtVersion().Length() );
|
|
225 |
aStream << KHpspOdtVersion();
|
|
226 |
|
|
227 |
aStream.WriteUint32L( iThemeUid );
|
|
228 |
|
|
229 |
const TDesC& providerName = ProviderName();
|
|
230 |
aStream.WriteInt32L( providerName.Length() );
|
|
231 |
if( providerName.Length() > 0 )
|
|
232 |
{
|
|
233 |
aStream << providerName;
|
|
234 |
}
|
|
235 |
|
|
236 |
const TDesC& themeFullName = ThemeFullName();
|
|
237 |
aStream.WriteInt32L( themeFullName.Length() );
|
|
238 |
if( themeFullName.Length() > 0 )
|
|
239 |
{
|
|
240 |
aStream << themeFullName;
|
|
241 |
}
|
|
242 |
|
|
243 |
const TDesC& themeShortName = ThemeShortName();
|
|
244 |
aStream.WriteInt32L( themeShortName.Length() );
|
|
245 |
if( themeShortName.Length() > 0 )
|
|
246 |
{
|
|
247 |
aStream << themeShortName;
|
|
248 |
}
|
|
249 |
|
|
250 |
const TDesC& themeVersion = ThemeVersion();
|
|
251 |
aStream.WriteInt32L( themeVersion.Length() );
|
|
252 |
if( themeVersion.Length() > 0 )
|
|
253 |
{
|
|
254 |
aStream << themeVersion;
|
|
255 |
}
|
|
256 |
|
|
257 |
const TDesC& description = Description();
|
|
258 |
aStream.WriteInt32L( description.Length() );
|
|
259 |
if( description.Length() > 0 )
|
|
260 |
{
|
|
261 |
aStream << description;
|
|
262 |
}
|
|
263 |
|
|
264 |
const TDesC& logoFile = LogoFile();
|
|
265 |
aStream.WriteInt32L( logoFile.Length() );
|
|
266 |
if( logoFile.Length() > 0 )
|
|
267 |
{
|
|
268 |
aStream << logoFile;
|
|
269 |
}
|
|
270 |
|
|
271 |
const TDesC& previewFile = PreviewFile();
|
|
272 |
aStream.WriteInt32L( previewFile.Length() );
|
|
273 |
if( previewFile.Length() > 0 )
|
|
274 |
{
|
|
275 |
aStream << previewFile;
|
|
276 |
}
|
|
277 |
|
|
278 |
aStream.WriteUint32L( iFamilyMask );
|
|
279 |
aStream.WriteUint32L( iConfigurationType );
|
|
280 |
aStream.WriteUint32L( iRootUid );
|
|
281 |
aStream.WriteUint32L( iProviderUid );
|
|
282 |
aStream.WriteUint32L( iFlags );
|
|
283 |
|
|
284 |
aStream.WriteInt32L( iLanguage );
|
|
285 |
aStream.WriteInt32L( iMultiInstance );
|
|
286 |
}
|
|
287 |
|
|
288 |
|
|
289 |
// -----------------------------------------------------------------------------
|
|
290 |
// ChspsODT::HeaderSize
|
|
291 |
// Calculate header size in bytes.
|
|
292 |
// (other items were commented in a header).
|
|
293 |
// -----------------------------------------------------------------------------
|
|
294 |
TInt ChspsODT::HeaderSize() const
|
|
295 |
{
|
|
296 |
TInt size = sizeof( TInt32 );
|
|
297 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
298 |
size += KHpspOdtVersion().Size();
|
|
299 |
|
|
300 |
size += sizeof( TUint32 ); // iThemeUid
|
|
301 |
|
|
302 |
size += sizeof( TInt32 );
|
|
303 |
if( ProviderName().Length() > 0 )
|
|
304 |
{
|
|
305 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
306 |
size += ProviderName().Size();
|
|
307 |
}
|
|
308 |
|
|
309 |
size += sizeof( TInt32 );
|
|
310 |
if( ThemeFullName().Length() > 0 )
|
|
311 |
{
|
|
312 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
313 |
size += ThemeFullName().Size();
|
|
314 |
}
|
|
315 |
|
|
316 |
size += sizeof( TInt32 );
|
|
317 |
if( ThemeShortName().Length() > 0 )
|
|
318 |
{
|
|
319 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
320 |
size += ThemeShortName().Size();
|
|
321 |
}
|
|
322 |
|
|
323 |
size += sizeof( TInt32 );
|
|
324 |
if( ThemeVersion().Length() > 0 )
|
|
325 |
{
|
|
326 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
327 |
size += ThemeVersion().Size();
|
|
328 |
}
|
|
329 |
|
|
330 |
size += sizeof( TInt32 );
|
|
331 |
if( Description().Length() > 0 )
|
|
332 |
{
|
|
333 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
334 |
size += Description().Size();
|
|
335 |
}
|
|
336 |
|
|
337 |
size += sizeof( TInt32 );
|
|
338 |
if( LogoFile().Length() > 0 )
|
|
339 |
{
|
|
340 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
341 |
size += LogoFile().Size();
|
|
342 |
}
|
|
343 |
|
|
344 |
size += sizeof( TInt32 );
|
|
345 |
if( PreviewFile().Length() > 0 )
|
|
346 |
{
|
|
347 |
size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
|
|
348 |
size += PreviewFile().Size();
|
|
349 |
}
|
|
350 |
|
|
351 |
size += sizeof( TUint32 ) * 5; // iFamilyMask, iConfigurationType,
|
|
352 |
// iRootUid, iProviderUid, iFlags
|
|
353 |
|
|
354 |
size += sizeof( TInt32 ) * 2; // iLanguage, iMultiInstance
|
|
355 |
|
|
356 |
return size;
|
|
357 |
}
|
|
358 |
|
|
359 |
// -----------------------------------------------------------------------------
|
|
360 |
// ChspsODT::InternalizeHeaderL
|
|
361 |
// Internalizes the ODT header
|
|
362 |
// (other items were commented in a header).
|
|
363 |
// -----------------------------------------------------------------------------
|
|
364 |
EXPORT_C void ChspsODT::InternalizeHeaderL( RReadStream& aStream )
|
|
365 |
{
|
|
366 |
TInt len = aStream.ReadInt32L();
|
|
367 |
HBufC* odtVersion = NULL;
|
|
368 |
if ( len > 0 )
|
|
369 |
{
|
|
370 |
odtVersion = HBufC::NewL( aStream, len );
|
|
371 |
}
|
|
372 |
CleanupStack::PushL( odtVersion );
|
|
373 |
// ODT version check.
|
|
374 |
if ( KHpspOdtVersion() != *odtVersion )
|
|
375 |
{
|
|
376 |
User::Leave( KErrNotSupported );
|
|
377 |
}
|
|
378 |
CleanupStack::PopAndDestroy( odtVersion );
|
|
379 |
|
|
380 |
iThemeUid = aStream.ReadUint32L();
|
|
381 |
|
|
382 |
delete iProviderName;
|
|
383 |
iProviderName = NULL;
|
|
384 |
len = aStream.ReadInt32L();
|
|
385 |
if( len > 0 )
|
|
386 |
{
|
|
387 |
iProviderName = HBufC::NewL( aStream, len );
|
|
388 |
}
|
|
389 |
|
|
390 |
delete iThemeFullName;
|
|
391 |
iThemeFullName = NULL;
|
|
392 |
len = aStream.ReadInt32L();
|
|
393 |
if( len > 0 )
|
|
394 |
{
|
|
395 |
iThemeFullName = HBufC::NewL( aStream, len );
|
|
396 |
}
|
|
397 |
|
|
398 |
delete iThemeShortName;
|
|
399 |
iThemeShortName = NULL;
|
|
400 |
len = aStream.ReadInt32L();
|
|
401 |
if( len > 0 )
|
|
402 |
{
|
|
403 |
iThemeShortName = HBufC::NewL( aStream, len );
|
|
404 |
}
|
|
405 |
|
|
406 |
delete iThemeVersion;
|
|
407 |
iThemeVersion = NULL;
|
|
408 |
len = aStream.ReadInt32L();
|
|
409 |
if( len > 0 )
|
|
410 |
{
|
|
411 |
iThemeVersion = HBufC::NewL( aStream, len );
|
|
412 |
}
|
|
413 |
|
|
414 |
delete iDescription;
|
|
415 |
iDescription = NULL;
|
|
416 |
len = aStream.ReadInt32L();
|
|
417 |
if( len > 0 )
|
|
418 |
{
|
|
419 |
iDescription = HBufC::NewL( aStream, len );
|
|
420 |
}
|
|
421 |
|
|
422 |
delete iLogoFile;
|
|
423 |
iLogoFile = NULL;
|
|
424 |
len = aStream.ReadInt32L();
|
|
425 |
if( len > 0 )
|
|
426 |
{
|
|
427 |
iLogoFile = HBufC::NewL( aStream, len );
|
|
428 |
}
|
|
429 |
|
|
430 |
delete iPreviewFile;
|
|
431 |
iPreviewFile = NULL;
|
|
432 |
len = aStream.ReadInt32L();
|
|
433 |
if( len > 0 )
|
|
434 |
{
|
|
435 |
iPreviewFile = HBufC::NewL( aStream, len );
|
|
436 |
}
|
|
437 |
|
|
438 |
iFamilyMask = aStream.ReadUint32L();
|
|
439 |
iConfigurationType = aStream.ReadUint32L();
|
|
440 |
iRootUid = aStream.ReadUint32L();
|
|
441 |
iProviderUid = aStream.ReadUint32L();
|
|
442 |
iFlags = aStream.ReadUint32L();
|
|
443 |
|
|
444 |
iLanguage = aStream.ReadInt32L();
|
|
445 |
iMultiInstance = aStream.ReadInt32L();
|
|
446 |
}
|
|
447 |
|
|
448 |
// -----------------------------------------------------------------------------
|
|
449 |
// ChspsODT::AddResourceL
|
|
450 |
// Adds a resource into Resource List. Takes ownership.
|
|
451 |
// (other items were commented in a header).
|
|
452 |
// -----------------------------------------------------------------------------
|
|
453 |
EXPORT_C void ChspsODT::AddResourceL( ChspsResource* aResource )
|
|
454 |
{
|
|
455 |
const TInt resourceIndex = CheckResourceL( aResource );
|
|
456 |
if ( resourceIndex >= 0 )
|
|
457 |
{
|
|
458 |
ChspsResource* resource = iResourceList->At( resourceIndex );
|
|
459 |
delete resource;
|
|
460 |
resource = NULL;
|
|
461 |
iResourceList->Delete( resourceIndex );
|
|
462 |
}
|
|
463 |
iResourceList->AppendL( aResource );
|
|
464 |
}
|
|
465 |
|
|
466 |
// -----------------------------------------------------------------------------
|
|
467 |
// ChspsODT::CheckResourceL
|
|
468 |
// Check for duplicates
|
|
469 |
// -----------------------------------------------------------------------------
|
|
470 |
TInt ChspsODT::CheckResourceL( ChspsResource* aResource )
|
|
471 |
{
|
|
472 |
if ( !aResource )
|
|
473 |
{
|
|
474 |
User::Leave( KErrArgument );
|
|
475 |
}
|
|
476 |
|
|
477 |
for ( TInt index=0; index < ResourceCount(); index++ )
|
|
478 |
{
|
|
479 |
ChspsResource& r = ResourceL(index);
|
|
480 |
if ( r.ResourceId() == aResource->ResourceId()
|
|
481 |
&& r.FileName() == aResource->FileName() )
|
|
482 |
{
|
|
483 |
return index;
|
|
484 |
}
|
|
485 |
}
|
|
486 |
|
|
487 |
return KErrNotFound;
|
|
488 |
}
|
|
489 |
|
|
490 |
// -----------------------------------------------------------------------------
|
|
491 |
// ChspsODT::DeleteResourceL
|
|
492 |
// Deletes resource from the element array
|
|
493 |
// (other items were commented in a header).
|
|
494 |
// -----------------------------------------------------------------------------
|
|
495 |
EXPORT_C void ChspsODT::DeleteResourceL( TInt aIndex )
|
|
496 |
{
|
|
497 |
if ( aIndex < 0 || aIndex >= ResourceCount() )
|
|
498 |
{
|
|
499 |
User::Leave( KErrArgument );
|
|
500 |
}
|
|
501 |
|
|
502 |
ChspsResource* resource = iResourceList->At( aIndex );
|
|
503 |
if ( resource )
|
|
504 |
{
|
|
505 |
delete resource;
|
|
506 |
resource = NULL;
|
|
507 |
iResourceList->Delete( aIndex );
|
|
508 |
}
|
|
509 |
}
|
|
510 |
|
|
511 |
// -----------------------------------------------------------------------------
|
|
512 |
// ChspsODT::DeleteResourceListL
|
|
513 |
// Deletes all resources from the ODT.
|
|
514 |
// (other items were commented in a header).
|
|
515 |
// -----------------------------------------------------------------------------
|
|
516 |
EXPORT_C void ChspsODT::DeleteAllResources()
|
|
517 |
{
|
|
518 |
iResourceList->ResetAndDestroy();
|
|
519 |
}
|
|
520 |
|
|
521 |
// -----------------------------------------------------------------------------
|
|
522 |
// ChspsODT::ResourceL
|
|
523 |
// Get the resource by the index
|
|
524 |
// (other items were commented in a header).
|
|
525 |
// -----------------------------------------------------------------------------
|
|
526 |
EXPORT_C ChspsResource& ChspsODT::ResourceL( TInt aIndex ) const
|
|
527 |
{
|
|
528 |
if ( aIndex < 0 || aIndex >= ResourceCount() )
|
|
529 |
{
|
|
530 |
User::Leave( KErrArgument );
|
|
531 |
}
|
|
532 |
|
|
533 |
return ( *iResourceList->At(aIndex));
|
|
534 |
}
|
|
535 |
|
|
536 |
// -----------------------------------------------------------------------------
|
|
537 |
// ChspsODT::ElementCount
|
|
538 |
// Returns the amount of elements
|
|
539 |
// (other items were commented in a header).
|
|
540 |
// -----------------------------------------------------------------------------
|
|
541 |
EXPORT_C TInt ChspsODT::ResourceCount() const
|
|
542 |
{
|
|
543 |
return iResourceList->Count();
|
|
544 |
}
|
|
545 |
|
|
546 |
// -----------------------------------------------------------------------------
|
|
547 |
// ChspsODT::ExternalizeResourceListL
|
|
548 |
// (other items were commented in a header).
|
|
549 |
// -----------------------------------------------------------------------------
|
|
550 |
EXPORT_C void ChspsODT::ExternalizeResourceListL( RWriteStream& aStream ) const
|
|
551 |
{
|
|
552 |
// Stream out the resource list
|
|
553 |
TInt count = iResourceList->Count();
|
|
554 |
aStream.WriteInt32L(count);
|
|
555 |
ChspsResource* resource;
|
|
556 |
for (TInt i=0;i<count;i++)
|
|
557 |
{
|
|
558 |
resource = iResourceList->At(i);
|
|
559 |
resource->ExternalizeL(aStream);
|
|
560 |
}
|
|
561 |
}
|
|
562 |
|
|
563 |
// -----------------------------------------------------------------------------
|
|
564 |
// ChspsODT::InternalizeResourceListL
|
|
565 |
// (other items were commented in a header).
|
|
566 |
// -----------------------------------------------------------------------------
|
|
567 |
EXPORT_C void ChspsODT::InternalizeResourceListL( RReadStream& aStream )
|
|
568 |
{
|
|
569 |
// clean up the array
|
|
570 |
if( iResourceList )
|
|
571 |
{
|
|
572 |
iResourceList->ResetAndDestroy();
|
|
573 |
}
|
|
574 |
// stream in the resource list
|
|
575 |
TInt count = aStream.ReadInt32L();
|
|
576 |
for (TInt i=0;i<count;i++)
|
|
577 |
{
|
|
578 |
ChspsResource* resource = ChspsResource::NewL();
|
|
579 |
CleanupStack::PushL(resource);
|
|
580 |
resource->InternalizeL(aStream);
|
|
581 |
if ( iResourceList )
|
|
582 |
{
|
|
583 |
iResourceList->AppendL( resource );
|
|
584 |
}
|
|
585 |
CleanupStack::Pop( resource ); // now owned by array
|
|
586 |
resource = NULL;
|
|
587 |
}
|
|
588 |
}
|
|
589 |
|
|
590 |
// -----------------------------------------------------------------------------
|
|
591 |
// ChspsODT::SetRootUid
|
|
592 |
// Set RootUid
|
|
593 |
// (other items were commented in a header).
|
|
594 |
// -----------------------------------------------------------------------------
|
|
595 |
EXPORT_C void ChspsODT::SetRootUid( TInt aUid )
|
|
596 |
{
|
|
597 |
iRootUid = aUid;
|
|
598 |
}
|
|
599 |
|
|
600 |
// -----------------------------------------------------------------------------
|
|
601 |
// ChspsODT::RootUid
|
|
602 |
// Get RootUid
|
|
603 |
// (other items were commented in a header).
|
|
604 |
// -----------------------------------------------------------------------------
|
|
605 |
EXPORT_C TInt ChspsODT::RootUid() const
|
|
606 |
{
|
|
607 |
return iRootUid;
|
|
608 |
}
|
|
609 |
|
|
610 |
// -----------------------------------------------------------------------------
|
|
611 |
// ChspsODT::SetProviderUid
|
|
612 |
// Set ProviderUid
|
|
613 |
// (other items were commented in a header).
|
|
614 |
// -----------------------------------------------------------------------------
|
|
615 |
EXPORT_C void ChspsODT::SetProviderUid( TInt aUid )
|
|
616 |
{
|
|
617 |
iProviderUid = aUid;
|
|
618 |
}
|
|
619 |
|
|
620 |
// -----------------------------------------------------------------------------
|
|
621 |
// ChspsODT::ProviderUid
|
|
622 |
// Get ProviderUid
|
|
623 |
// (other items were commented in a header).
|
|
624 |
// -----------------------------------------------------------------------------
|
|
625 |
EXPORT_C TInt ChspsODT::ProviderUid() const
|
|
626 |
{
|
|
627 |
return iProviderUid;
|
|
628 |
}
|
|
629 |
|
|
630 |
// -----------------------------------------------------------------------------
|
|
631 |
// ChspsODT::SetThemeUid
|
|
632 |
// Set ThemeUid
|
|
633 |
// (other items were commented in a header).
|
|
634 |
// -----------------------------------------------------------------------------
|
|
635 |
EXPORT_C void ChspsODT::SetThemeUid( TInt aUid )
|
|
636 |
{
|
|
637 |
iThemeUid = aUid;
|
|
638 |
}
|
|
639 |
|
|
640 |
// -----------------------------------------------------------------------------
|
|
641 |
// ChspsODT::ThemeUid
|
|
642 |
// Get ThemeUid
|
|
643 |
// (other items were commented in a header).
|
|
644 |
// -----------------------------------------------------------------------------
|
|
645 |
EXPORT_C TInt ChspsODT::ThemeUid() const
|
|
646 |
{
|
|
647 |
return iThemeUid;
|
|
648 |
}
|
|
649 |
|
|
650 |
// -----------------------------------------------------------------------------
|
|
651 |
// ChspsODT::SetProviderNameL
|
|
652 |
// Set ProviderNameL
|
|
653 |
// (other items were commented in a header).
|
|
654 |
// -----------------------------------------------------------------------------
|
|
655 |
EXPORT_C void ChspsODT::SetProviderNameL( const TDesC& aName )
|
|
656 |
{
|
|
657 |
if( iProviderName )
|
|
658 |
{
|
|
659 |
delete iProviderName;
|
|
660 |
iProviderName = NULL;
|
|
661 |
}
|
|
662 |
|
|
663 |
if( aName.Length() != 0 )
|
|
664 |
{
|
|
665 |
iProviderName = aName.AllocL();
|
|
666 |
}
|
|
667 |
}
|
|
668 |
|
|
669 |
// -----------------------------------------------------------------------------
|
|
670 |
// ChspsODT::ProviderName
|
|
671 |
// Get ProviderName
|
|
672 |
// (other items were commented in a header).
|
|
673 |
// -----------------------------------------------------------------------------
|
|
674 |
EXPORT_C const TDesC& ChspsODT::ProviderName() const
|
|
675 |
{
|
|
676 |
if ( iProviderName )
|
|
677 |
{
|
|
678 |
return *iProviderName;
|
|
679 |
}
|
|
680 |
else
|
|
681 |
{
|
|
682 |
return KNullDesC;
|
|
683 |
}
|
|
684 |
}
|
|
685 |
|
|
686 |
// -----------------------------------------------------------------------------
|
|
687 |
// ChspsODT::SetThemeFullNameL
|
|
688 |
// Set ThemeFullNameL
|
|
689 |
// (other items were commented in a header).
|
|
690 |
// -----------------------------------------------------------------------------
|
|
691 |
EXPORT_C void ChspsODT::SetThemeFullNameL( const TDesC& aName )
|
|
692 |
{
|
|
693 |
if( iThemeFullName )
|
|
694 |
{
|
|
695 |
delete iThemeFullName;
|
|
696 |
iThemeFullName = NULL;
|
|
697 |
}
|
|
698 |
|
|
699 |
if( aName.Length() != 0 )
|
|
700 |
{
|
|
701 |
iThemeFullName = aName.AllocL();
|
|
702 |
}
|
|
703 |
}
|
|
704 |
|
|
705 |
// -----------------------------------------------------------------------------
|
|
706 |
// ChspsODT::ThemeFullName
|
|
707 |
// Get ThemeFullName
|
|
708 |
// (other items were commented in a header).
|
|
709 |
// -----------------------------------------------------------------------------
|
|
710 |
EXPORT_C const TDesC& ChspsODT::ThemeFullName() const
|
|
711 |
{
|
|
712 |
if ( iThemeFullName )
|
|
713 |
{
|
|
714 |
return *iThemeFullName;
|
|
715 |
}
|
|
716 |
else
|
|
717 |
{
|
|
718 |
return KNullDesC;
|
|
719 |
}
|
|
720 |
}
|
|
721 |
|
|
722 |
// -----------------------------------------------------------------------------
|
|
723 |
// ChspsODT::SetThemeShortNameL
|
|
724 |
// Set ThemeShortNameL
|
|
725 |
// (other items were commented in a header).
|
|
726 |
// -----------------------------------------------------------------------------
|
|
727 |
EXPORT_C void ChspsODT::SetThemeShortNameL( const TDesC& aName )
|
|
728 |
{
|
|
729 |
if( iThemeShortName )
|
|
730 |
{
|
|
731 |
delete iThemeShortName;
|
|
732 |
iThemeShortName = NULL;
|
|
733 |
}
|
|
734 |
|
|
735 |
if( aName.Length() != 0 )
|
|
736 |
{
|
|
737 |
iThemeShortName = aName.AllocL();
|
|
738 |
}
|
|
739 |
}
|
|
740 |
|
|
741 |
// -----------------------------------------------------------------------------
|
|
742 |
// ChspsODT::ThemeShortName
|
|
743 |
// Get ThemeShortName
|
|
744 |
// (other items were commented in a header).
|
|
745 |
// -----------------------------------------------------------------------------
|
|
746 |
EXPORT_C const TDesC& ChspsODT::ThemeShortName() const
|
|
747 |
{
|
|
748 |
if ( iThemeShortName )
|
|
749 |
{
|
|
750 |
return *iThemeShortName;
|
|
751 |
}
|
|
752 |
else
|
|
753 |
{
|
|
754 |
return KNullDesC;
|
|
755 |
}
|
|
756 |
}
|
|
757 |
|
|
758 |
// -----------------------------------------------------------------------------
|
|
759 |
// ChspsODT::SetThemeVersionL
|
|
760 |
// Set ThemeVersionL
|
|
761 |
// (other items were commented in a header).
|
|
762 |
// -----------------------------------------------------------------------------
|
|
763 |
EXPORT_C void ChspsODT::SetThemeVersionL( const TDesC& aVersion )
|
|
764 |
{
|
|
765 |
if( iThemeVersion )
|
|
766 |
{
|
|
767 |
delete iThemeVersion;
|
|
768 |
iThemeVersion = NULL;
|
|
769 |
}
|
|
770 |
|
|
771 |
if( aVersion.Length() != 0 )
|
|
772 |
{
|
|
773 |
iThemeVersion = aVersion.AllocL();
|
|
774 |
}
|
|
775 |
}
|
|
776 |
|
|
777 |
// -----------------------------------------------------------------------------
|
|
778 |
// ChspsODT::ThemeVersion
|
|
779 |
// Get ThemeVersion
|
|
780 |
// (other items were commented in a header).
|
|
781 |
// -----------------------------------------------------------------------------
|
|
782 |
EXPORT_C const TDesC& ChspsODT::ThemeVersion() const
|
|
783 |
{
|
|
784 |
if ( iThemeVersion )
|
|
785 |
{
|
|
786 |
return *iThemeVersion;
|
|
787 |
}
|
|
788 |
else
|
|
789 |
{
|
|
790 |
return KNullDesC;
|
|
791 |
}
|
|
792 |
}
|
|
793 |
|
|
794 |
// -----------------------------------------------------------------------------
|
|
795 |
// ChspsODT::SetOdtLanguage
|
|
796 |
// Set OdtLanguage
|
|
797 |
// (other items were commented in a header).
|
|
798 |
// -----------------------------------------------------------------------------
|
|
799 |
EXPORT_C void ChspsODT::SetOdtLanguage( TInt aLanguage )
|
|
800 |
{
|
|
801 |
iLanguage = aLanguage;
|
|
802 |
}
|
|
803 |
|
|
804 |
// -----------------------------------------------------------------------------
|
|
805 |
// ChspsODT::OdtLanguage
|
|
806 |
// Get OdtLanguage
|
|
807 |
// (other items were commented in a header).
|
|
808 |
// -----------------------------------------------------------------------------
|
|
809 |
EXPORT_C TInt ChspsODT::OdtLanguage() const
|
|
810 |
{
|
|
811 |
return iLanguage;
|
|
812 |
}
|
|
813 |
|
|
814 |
// -----------------------------------------------------------------------------
|
|
815 |
// ChspsODT::SetFlags
|
|
816 |
// Set Flags
|
|
817 |
// (other items were commented in a header).
|
|
818 |
// -----------------------------------------------------------------------------
|
|
819 |
EXPORT_C void ChspsODT::SetFlags( TUint aFlags )
|
|
820 |
{
|
|
821 |
iFlags = aFlags;
|
|
822 |
}
|
|
823 |
|
|
824 |
// -----------------------------------------------------------------------------
|
|
825 |
// ChspsODT::Flags
|
|
826 |
// Get Flags
|
|
827 |
// (other items were commented in a header).
|
|
828 |
// -----------------------------------------------------------------------------
|
|
829 |
EXPORT_C TUint ChspsODT::Flags() const
|
|
830 |
{
|
|
831 |
return iFlags;
|
|
832 |
}
|
|
833 |
|
|
834 |
// -----------------------------------------------------------------------------
|
|
835 |
// ChspsODT::DomDocument
|
|
836 |
// Get DomDocument
|
|
837 |
// (other items were commented in a header).
|
|
838 |
// -----------------------------------------------------------------------------
|
|
839 |
//
|
|
840 |
EXPORT_C ChspsDomDocument& ChspsODT::DomDocument() const
|
|
841 |
{
|
|
842 |
return *iDomDocument;
|
|
843 |
}
|
|
844 |
|
|
845 |
// -----------------------------------------------------------------------------
|
|
846 |
// ChspsODT::CloneL()
|
|
847 |
// Makes a clone of this ODT and returns pointer to it
|
|
848 |
// (other items were commented in a header).
|
|
849 |
// -----------------------------------------------------------------------------
|
|
850 |
//
|
|
851 |
EXPORT_C ChspsODT* ChspsODT::CloneL() const
|
|
852 |
{
|
|
853 |
ChspsODT* clone = ChspsODT::NewL();
|
|
854 |
CleanupStack::PushL( clone );
|
|
855 |
ChspsODT::CopyODTDataL( *this, *clone );
|
|
856 |
CleanupStack::Pop( clone );
|
|
857 |
return clone;
|
|
858 |
}
|
|
859 |
|
|
860 |
// -----------------------------------------------------------------------------
|
|
861 |
// Copies data from an exisiting ODT
|
|
862 |
// -----------------------------------------------------------------------------
|
|
863 |
EXPORT_C void ChspsODT::CloneL( ChspsODT& aODT )
|
|
864 |
{
|
|
865 |
ChspsODT::CopyODTDataL( aODT, *this );
|
|
866 |
}
|
|
867 |
|
|
868 |
// -----------------------------------------------------------------------------
|
|
869 |
// ChspsODT::CopyDomDocumentL()
|
|
870 |
// Clones the aDom and sets it as this ChspsODT's DomDocument
|
|
871 |
// (other items were commented in a header).
|
|
872 |
// -----------------------------------------------------------------------------
|
|
873 |
//
|
|
874 |
EXPORT_C void ChspsODT::CopyDomDocumentL( ChspsDomDocument& aDom )
|
|
875 |
{
|
|
876 |
delete iDomDocument;
|
|
877 |
iDomDocument = NULL;
|
|
878 |
iDomDocument = aDom.CloneL();
|
|
879 |
}
|
|
880 |
|
|
881 |
// -----------------------------------------------------------------------------
|
|
882 |
// ChspsODT::SetConfigurationType()
|
|
883 |
// -----------------------------------------------------------------------------
|
|
884 |
//
|
|
885 |
EXPORT_C void ChspsODT::SetConfigurationType( TUint aType )
|
|
886 |
{
|
|
887 |
iConfigurationType = aType;
|
|
888 |
}
|
|
889 |
|
|
890 |
// -----------------------------------------------------------------------------
|
|
891 |
// ChspsODT::ConfigurationType()
|
|
892 |
// -----------------------------------------------------------------------------
|
|
893 |
//
|
|
894 |
EXPORT_C TUint ChspsODT::ConfigurationType() const
|
|
895 |
{
|
|
896 |
return iConfigurationType;
|
|
897 |
}
|
|
898 |
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
// ChspsODT::SetFamily
|
|
901 |
// -----------------------------------------------------------------------------
|
|
902 |
EXPORT_C void ChspsODT::SetFamily( const TUint32 aFamilyMask )
|
|
903 |
{
|
|
904 |
iFamilyMask = aFamilyMask;
|
|
905 |
}
|
|
906 |
|
|
907 |
// -----------------------------------------------------------------------------
|
|
908 |
// ChspsODT::Family
|
|
909 |
// -----------------------------------------------------------------------------
|
|
910 |
EXPORT_C TUint32 ChspsODT::Family() const
|
|
911 |
{
|
|
912 |
return iFamilyMask;
|
|
913 |
}
|
|
914 |
|
|
915 |
// -----------------------------------------------------------------------------
|
|
916 |
// ChspsODT::SetMultiInstance
|
|
917 |
// Set MultiInstance
|
|
918 |
// (other items were commented in a header).
|
|
919 |
// -----------------------------------------------------------------------------
|
|
920 |
EXPORT_C void ChspsODT::SetMultiInstance( TInt aMultiInstance )
|
|
921 |
{
|
|
922 |
iMultiInstance = aMultiInstance;
|
|
923 |
}
|
|
924 |
|
|
925 |
// -----------------------------------------------------------------------------
|
|
926 |
// ChspsODT::MultiInstance
|
|
927 |
// Get MultiInstance
|
|
928 |
// (other items were commented in a header).
|
|
929 |
// -----------------------------------------------------------------------------
|
|
930 |
EXPORT_C TInt ChspsODT::MultiInstance() const
|
|
931 |
{
|
|
932 |
return iMultiInstance;
|
|
933 |
}
|
|
934 |
|
|
935 |
// -----------------------------------------------------------------------------
|
|
936 |
// ChspsODT::SetDescriptionL
|
|
937 |
// -----------------------------------------------------------------------------
|
|
938 |
EXPORT_C void ChspsODT::SetDescriptionL( const TDesC& aDesc )
|
|
939 |
{
|
|
940 |
if( iDescription )
|
|
941 |
{
|
|
942 |
delete iDescription;
|
|
943 |
iDescription = NULL;
|
|
944 |
}
|
|
945 |
|
|
946 |
if( aDesc.Length() != 0 )
|
|
947 |
{
|
|
948 |
iDescription = aDesc.AllocL();
|
|
949 |
}
|
|
950 |
}
|
|
951 |
|
|
952 |
// -----------------------------------------------------------------------------
|
|
953 |
// ChspsODT::Description
|
|
954 |
// -----------------------------------------------------------------------------
|
|
955 |
EXPORT_C const TDesC& ChspsODT::Description() const
|
|
956 |
{
|
|
957 |
if ( iDescription )
|
|
958 |
{
|
|
959 |
return *iDescription;
|
|
960 |
}
|
|
961 |
else
|
|
962 |
{
|
|
963 |
return KNullDesC;
|
|
964 |
}
|
|
965 |
}
|
|
966 |
|
|
967 |
// -----------------------------------------------------------------------------
|
|
968 |
// ChspsODT::SetLogoFileL
|
|
969 |
// -----------------------------------------------------------------------------
|
|
970 |
EXPORT_C void ChspsODT::SetLogoFileL( const TDesC& aPath )
|
|
971 |
{
|
|
972 |
if( iLogoFile )
|
|
973 |
{
|
|
974 |
delete iLogoFile;
|
|
975 |
iLogoFile = NULL;
|
|
976 |
}
|
|
977 |
|
|
978 |
if( aPath.Length() != 0 )
|
|
979 |
{
|
|
980 |
iLogoFile = aPath.AllocL();
|
|
981 |
}
|
|
982 |
}
|
|
983 |
|
|
984 |
// -----------------------------------------------------------------------------
|
|
985 |
// ChspsODT::LogoFile
|
|
986 |
// -----------------------------------------------------------------------------
|
|
987 |
EXPORT_C const TDesC& ChspsODT::LogoFile() const
|
|
988 |
{
|
|
989 |
if ( iLogoFile )
|
|
990 |
{
|
|
991 |
return *iLogoFile;
|
|
992 |
}
|
|
993 |
else
|
|
994 |
{
|
|
995 |
return KNullDesC;
|
|
996 |
}
|
|
997 |
}
|
|
998 |
|
|
999 |
// -----------------------------------------------------------------------------
|
|
1000 |
// ChspsODT::SetPreviewFileL
|
|
1001 |
// -----------------------------------------------------------------------------
|
|
1002 |
EXPORT_C void ChspsODT::SetPreviewFileL( const TDesC& aPath )
|
|
1003 |
{
|
|
1004 |
if( iPreviewFile )
|
|
1005 |
{
|
|
1006 |
delete iPreviewFile;
|
|
1007 |
iPreviewFile = NULL;
|
|
1008 |
}
|
|
1009 |
|
|
1010 |
if( aPath.Length() != 0 )
|
|
1011 |
{
|
|
1012 |
iPreviewFile = aPath.AllocL();
|
|
1013 |
}
|
|
1014 |
}
|
|
1015 |
|
|
1016 |
// -----------------------------------------------------------------------------
|
|
1017 |
// ChspsODT::PreviewFile
|
|
1018 |
// -----------------------------------------------------------------------------
|
|
1019 |
EXPORT_C const TDesC& ChspsODT::PreviewFile() const
|
|
1020 |
{
|
|
1021 |
if ( iPreviewFile )
|
|
1022 |
{
|
|
1023 |
return *iPreviewFile;
|
|
1024 |
}
|
|
1025 |
else
|
|
1026 |
{
|
|
1027 |
return KNullDesC;
|
|
1028 |
}
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
// End of File
|