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