48 iDomDocument = ChspsDomDocument::NewL(); |
48 iDomDocument = ChspsDomDocument::NewL(); |
49 iResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity ); |
49 iResourceList = new( ELeave ) CArrayPtrSeg<ChspsResource>( KPathListGranularity ); |
50 } |
50 } |
51 |
51 |
52 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
|
53 // ChspsODT::CopyODTDataL() |
|
54 // Helper to ODT cloning. Prevents duplicate code in two clone methods. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void ChspsODT::CopyODTDataL( const ChspsODT& aSource, ChspsODT& aTarget ) |
|
58 { |
|
59 // Properties. |
|
60 aTarget.SetFamily( aSource.Family() ); |
|
61 aTarget.SetConfigurationType( aSource.ConfigurationType() ); |
|
62 aTarget.SetRootUid( aSource.RootUid() ); |
|
63 aTarget.SetProviderUid( aSource.ProviderUid() ); |
|
64 aTarget.SetThemeUid( aSource.ThemeUid() ); |
|
65 aTarget.SetProviderNameL( aSource.ProviderName() ); |
|
66 aTarget.SetThemeFullNameL( aSource.ThemeFullName() ); |
|
67 aTarget.SetThemeShortNameL( aSource.ThemeShortName() ); |
|
68 aTarget.SetThemeVersionL( aSource.ThemeVersion() ); |
|
69 aTarget.SetPackageVersionL( aSource.PackageVersion() ); |
|
70 aTarget.SetDescriptionL( aSource.Description() ); |
|
71 aTarget.SetLogoFileL( aSource.LogoFile() ); |
|
72 aTarget.SetPreviewFileL( aSource.PreviewFile() ); |
|
73 aTarget.SetMultiInstance( aSource.MultiInstance() ); |
|
74 aTarget.SetOdtLanguage( aSource.OdtLanguage() ); |
|
75 aTarget.SetFlags( aSource.Flags() ); |
|
76 |
|
77 // Resources. |
|
78 aTarget.DeleteAllResources(); |
|
79 TInt resourceCount = aSource.ResourceCount(); |
|
80 for ( TInt index = 0; index < resourceCount ; index++ ) |
|
81 { |
|
82 ChspsResource* resource = ( aSource.ResourceL( index ) ).CloneL(); |
|
83 CleanupStack::PushL( resource ); |
|
84 aTarget.AddResourceL( resource ); |
|
85 CleanupStack::Pop( resource ); |
|
86 resource = NULL; |
|
87 } |
|
88 |
|
89 // DOM tree. |
|
90 aTarget.CopyDomDocumentL( aSource.DomDocument() ); |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
53 // ChspsODT::NewL |
94 // ChspsODT::NewL |
54 // Two-phased constructor. |
95 // Two-phased constructor. |
55 // ----------------------------------------------------------------------------- |
96 // ----------------------------------------------------------------------------- |
56 // |
97 // |
57 EXPORT_C ChspsODT* ChspsODT::NewL() |
98 EXPORT_C ChspsODT* ChspsODT::NewL() |
392 iResourceList->Delete( aIndex ); |
436 iResourceList->Delete( aIndex ); |
393 } |
437 } |
394 } |
438 } |
395 |
439 |
396 // ----------------------------------------------------------------------------- |
440 // ----------------------------------------------------------------------------- |
|
441 // ChspsODT::DeleteResourceListL |
|
442 // Deletes all resources from the ODT. |
|
443 // (other items were commented in a header). |
|
444 // ----------------------------------------------------------------------------- |
|
445 EXPORT_C void ChspsODT::DeleteAllResources() |
|
446 { |
|
447 iResourceList->ResetAndDestroy(); |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
397 // ChspsODT::ResourceL |
451 // ChspsODT::ResourceL |
398 // Get the resource by the index |
452 // Get the resource by the index |
399 // (other items were commented in a header). |
453 // (other items were commented in a header). |
400 // ----------------------------------------------------------------------------- |
454 // ----------------------------------------------------------------------------- |
401 EXPORT_C ChspsResource& ChspsODT::ResourceL( TInt aIndex ) const |
455 EXPORT_C ChspsResource& ChspsODT::ResourceL( TInt aIndex ) const |
687 // |
740 // |
688 EXPORT_C ChspsDomDocument& ChspsODT::DomDocument() const |
741 EXPORT_C ChspsDomDocument& ChspsODT::DomDocument() const |
689 { |
742 { |
690 return *iDomDocument; |
743 return *iDomDocument; |
691 } |
744 } |
692 |
745 |
693 // ----------------------------------------------------------------------------- |
746 // ----------------------------------------------------------------------------- |
694 // ChspsODT::CloneL() |
747 // ChspsODT::CloneL() |
695 // Makes a clone of this ODT and returns pointer to it |
748 // Makes a clone of this ODT and returns pointer to it |
696 // (other items were commented in a header). |
749 // (other items were commented in a header). |
697 // ----------------------------------------------------------------------------- |
750 // ----------------------------------------------------------------------------- |
698 // |
751 // |
699 EXPORT_C ChspsODT* ChspsODT::CloneL() |
752 EXPORT_C ChspsODT* ChspsODT::CloneL() const |
700 { |
753 { |
701 ChspsODT* clone = new (ELeave) ChspsODT; |
754 ChspsODT* clone = ChspsODT::NewL(); |
702 CleanupStack::PushL( clone ); |
755 CleanupStack::PushL( clone ); |
703 clone->ConstructL(); |
756 ChspsODT::CopyODTDataL( *this, *clone ); |
704 clone->SetConfigurationType( iConfigurationType ); |
757 CleanupStack::Pop( clone ); |
705 clone->SetRootUid( iRootUid ); |
|
706 clone->SetProviderUid( iProviderUid ); |
|
707 clone->SetThemeUid( iThemeUid ); |
|
708 if( iProviderName ) |
|
709 { |
|
710 clone->SetProviderNameL( *iProviderName ); |
|
711 } |
|
712 if( iThemeFullName ) |
|
713 { |
|
714 clone->SetThemeFullNameL( *iThemeFullName ); |
|
715 } |
|
716 if( iThemeShortName ) |
|
717 { |
|
718 clone->SetThemeShortNameL( *iThemeShortName ); |
|
719 } |
|
720 if( iThemeVersion ) |
|
721 { |
|
722 clone->SetThemeVersionL( *iThemeVersion ); |
|
723 } |
|
724 if( iPackageVersion ) |
|
725 { |
|
726 clone->SetPackageVersionL( *iPackageVersion ); |
|
727 } |
|
728 if( iDescription ) |
|
729 { |
|
730 clone->SetDescriptionL( *iDescription ); |
|
731 } |
|
732 clone->SetOdtLanguage( iLanguage ); |
|
733 clone->SetFlags( iFlags ); |
|
734 |
|
735 TInt resourceCount = iResourceList->Count(); |
|
736 |
|
737 for ( TInt index = 0; index < resourceCount ; index++ ) |
|
738 { |
|
739 ChspsResource& resource = ResourceL( index ); |
|
740 clone->AddResourceL( resource.CloneL() ); |
|
741 } |
|
742 |
|
743 CleanupStack::Pop( clone ); |
|
744 return clone; |
758 return clone; |
745 } |
759 } |
746 |
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // Copies data from an exisiting ODT |
|
763 // ----------------------------------------------------------------------------- |
|
764 EXPORT_C void ChspsODT::CloneL( ChspsODT& aODT ) |
|
765 { |
|
766 ChspsODT::CopyODTDataL( aODT, *this ); |
|
767 } |
|
768 |
747 // ----------------------------------------------------------------------------- |
769 // ----------------------------------------------------------------------------- |
748 // ChspsODT::CopyDomDocumentL() |
770 // ChspsODT::CopyDomDocumentL() |
749 // Clones the aDom and sets it as this ChspsODT's DomDocument |
771 // Clones the aDom and sets it as this ChspsODT's DomDocument |
750 // (other items were commented in a header). |
772 // (other items were commented in a header). |
751 // ----------------------------------------------------------------------------- |
773 // ----------------------------------------------------------------------------- |