menufw/menufwui/mmwidgets/src/mmtemplatelibrary.cpp
changeset 1 5315654608de
parent 0 f72a12da539e
child 23 7be2816dbabd
equal deleted inserted replaced
0:f72a12da539e 1:5315654608de
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    29 #include <AknDef.hrh>
    29 #include <AknDef.hrh>
    30 
    30 
    31 
    31 
    32 
    32 
    33 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    34 // 
    34 //
    35 // ---------------------------------------------------------------------------
    35 // ---------------------------------------------------------------------------
    36 //
    36 //
    37 TUint32 HBuf16Hash( HBufC8* const &  aBuf )
    37 TUint32 HBuf16Hash( HBufC8* const &  aBuf )
    38     {
    38     {
    39     return DefaultHash::Des8(*aBuf);
    39     return DefaultHash::Des8(*aBuf);
    49 
    49 
    50 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
    51 //
    51 //
    52 // ---------------------------------------------------------------------------
    52 // ---------------------------------------------------------------------------
    53 //:
    53 //:
    54 CMmTemplateLibrary::CMmTemplateLibrary() 
    54 CMmTemplateLibrary::CMmTemplateLibrary()
    55 	: iWidgetType(EWidgetTypeNone),
    55 	: iWidgetType(EWidgetTypeNone),
    56 	iTemplateSizesMap( &HBuf16Hash, &HBuf16Ident ), 
    56 	iTemplateSizesMap( &HBuf16Hash, &HBuf16Ident ),
    57 	iTemplateChildrenMap( &HBuf16Hash, &HBuf16Ident ),
    57 	iTemplateChildrenMap( &HBuf16Hash, &HBuf16Ident ),
    58 	iMoveIndicatorRectsMap( &HBuf16Hash, &HBuf16Ident )
    58 	iMoveIndicatorRectsMap( &HBuf16Hash, &HBuf16Ident )
    59 	{
    59 	{
    60 	// No implementation required
    60 	// No implementation required
    61 	}
    61 	}
    74 void CMmTemplateLibrary::CleanAndClearCache( )
    74 void CMmTemplateLibrary::CleanAndClearCache( )
    75     {
    75     {
    76 
    76 
    77 	THashMapIter<HBufC8*, TSize> iter( iTemplateSizesMap );
    77 	THashMapIter<HBufC8*, TSize> iter( iTemplateSizesMap );
    78 	while ( HBufC8* const * ptr = iter.NextKey() )
    78 	while ( HBufC8* const * ptr = iter.NextKey() )
    79 		{       
    79 		{
    80 		delete *ptr;
    80 		delete *ptr;
    81 		}    
    81 		}
    82 	iTemplateSizesMap.Close();
    82 	iTemplateSizesMap.Close();
    83 
    83 
    84 	THashMapIter<HBufC8*, RArray<TTemplateChild> > iter2( iTemplateChildrenMap );
    84 	THashMapIter<HBufC8*, RArray<TTemplateChild> > iter2( iTemplateChildrenMap );
    85 	while ( HBufC8* const * ptr = iter2.NextKey() )
    85 	while ( HBufC8* const * ptr = iter2.NextKey() )
    86 		{       
    86 		{
    87 		iter2.CurrentValue()->Close();
    87 		iter2.CurrentValue()->Close();
    88 		delete *ptr;
    88 		delete *ptr;
    89 		}    
    89 		}
    90 	iTemplateChildrenMap.Close();
    90 	iTemplateChildrenMap.Close();
    91     
    91 
    92 	THashMapIter<HBufC8*, TRect> iter4( iMoveIndicatorRectsMap );
    92 	THashMapIter<HBufC8*, TRect> iter4( iMoveIndicatorRectsMap );
    93 	while ( HBufC8* const * ptr = iter4.NextKey() )
    93 	while ( HBufC8* const * ptr = iter4.NextKey() )
    94 		{       
    94 		{
    95 		delete *ptr;
    95 		delete *ptr;
    96 		}    
    96 		}
    97 	iMoveIndicatorRectsMap.Close();
    97 	iMoveIndicatorRectsMap.Close();
    98     
    98 
    99     }
    99     }
   100 
   100 
   101 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
   102 //
   102 //
   103 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
   118     CMmTemplateLibrary* self = new( ELeave ) CMmTemplateLibrary();
   118     CMmTemplateLibrary* self = new( ELeave ) CMmTemplateLibrary();
   119     CleanupStack::PushL( self );
   119     CleanupStack::PushL( self );
   120     self->ConstructL();
   120     self->ConstructL();
   121     return self;
   121     return self;
   122     }
   122     }
   123 	
   123 
   124 // ---------------------------------------------------------------------------
   124 // ---------------------------------------------------------------------------
   125 //
   125 //
   126 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   127 //
   127 //
   128 void CMmTemplateLibrary::ConstructL()
   128 void CMmTemplateLibrary::ConstructL()
   132 
   132 
   133 // ---------------------------------------------------------------------------
   133 // ---------------------------------------------------------------------------
   134 //
   134 //
   135 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   136 //
   136 //
   137 TSize CMmTemplateLibrary::GetSize(  TMmWidgetType aWidgetType, const TDesC8& aTemplate, 
   137 TSize CMmTemplateLibrary::GetSize(  TMmWidgetType aWidgetType, const TDesC8& aTemplate,
   138 		TBool aLandscapeOrientation, TBool aHighlighted, TRect aParentRect )
   138 		TBool aLandscapeOrientation, TBool aHighlighted, TRect aParentRect )
   139 	{
   139 	{
   140 	TSize result;
   140 	TSize result;
   141 	GetSize(result, aWidgetType, aTemplate, aLandscapeOrientation, 
   141 	GetSize(result, aWidgetType, aTemplate, aLandscapeOrientation,
   142 			aHighlighted, aParentRect );
   142 			aHighlighted, aParentRect );
   143 	return result;	
   143 	return result;
   144 	}
   144 	}
   145 
   145 
   146 // ---------------------------------------------------------------------------
   146 // ---------------------------------------------------------------------------
   147 //
   147 //
   148 // ---------------------------------------------------------------------------
   148 // ---------------------------------------------------------------------------
   149 //
   149 //
   150 TInt CMmTemplateLibrary::GetSize(  TSize& aItemSize, 
   150 TInt CMmTemplateLibrary::GetSize(  TSize& aItemSize,
   151         TMmWidgetType aWidgetType, const TDesC8& aTemplate, 
   151         TMmWidgetType aWidgetType, const TDesC8& aTemplate,
   152         TBool aLandscapeOrientation, TBool aHighlighted, TRect aParentRect )
   152         TBool aLandscapeOrientation, TBool aHighlighted, TRect aParentRect )
   153     {
   153     {
   154     if ( KNullDesC8()== aTemplate || aParentRect == TRect(TPoint(0,0), TPoint(0,0))
   154     if ( KNullDesC8()== aTemplate || aParentRect == TRect(TPoint(0,0), TPoint(0,0))
   155     		|| !aTemplate.Compare( KEmpty8 ) )
   155     		|| !aTemplate.Compare( KEmpty8 ) )
   156         {
   156         {
   157         return KErrNotFound;
   157         return KErrNotFound;
   158         }
   158         }
   159     UpdateParentRect( aParentRect, aLandscapeOrientation );
   159     UpdateParentRect( aParentRect, aLandscapeOrientation );
   160 
   160 
   161     TInt err( KErrNone );
   161     TInt err( KErrNone );
   162     HBufC8* lookup_string = LookupText( aTemplate, aWidgetType, iZoom, 
   162     HBufC8* lookup_string = LookupText( aTemplate, aWidgetType,
   163         aLandscapeOrientation, aHighlighted );    
   163         aLandscapeOrientation, aHighlighted );
   164     	
   164 
   165     TSize* itemSize = iTemplateSizesMap.Find( lookup_string );
   165     TSize* itemSize = iTemplateSizesMap.Find( lookup_string );
   166     if ( !itemSize )
   166     if ( !itemSize )
   167         {
   167         {
   168         TRAP( err, LoadTemplateL( aWidgetType, aTemplate, aLandscapeOrientation ) );
   168         TRAP( err, LoadTemplateL( aWidgetType, aTemplate, aLandscapeOrientation ) );
   169         if ( err == KErrNone )
   169         if ( err == KErrNone )
   179     else
   179     else
   180         {
   180         {
   181         iWidgetType = aWidgetType;
   181         iWidgetType = aWidgetType;
   182         TSize layoutSize;
   182         TSize layoutSize;
   183         TInt err( KErrNone );
   183         TInt err( KErrNone );
   184         TRAP( err, layoutSize = GetLayoutSizeL( iWidgetType, aTemplate, 
   184         TRAP( err, layoutSize = GetLayoutSizeL( iWidgetType, aTemplate,
   185                 aLandscapeOrientation ) );
   185                 aLandscapeOrientation ) );
   186         if( err == KErrNone )
   186         if( err == KErrNone )
   187             {
   187             {
   188             AdjustItemSize( *itemSize, layoutSize, aLandscapeOrientation );
   188             AdjustItemSize( *itemSize, layoutSize, aLandscapeOrientation );
   189             }
   189             }
   190         aItemSize = *itemSize;
   190         aItemSize = *itemSize;
   191         }
   191         }
   192 	delete lookup_string;
   192 	delete lookup_string;
   193     
   193 
   194     return err;
   194     return err;
   195     }
   195     }
   196 
   196 
   197 // ---------------------------------------------------------------------------
   197 // ---------------------------------------------------------------------------
   198 //
   198 //
   199 // ---------------------------------------------------------------------------
   199 // ---------------------------------------------------------------------------
   200 //
   200 //
   201 TSize CMmTemplateLibrary::GetLayoutSizeL( TMmWidgetType aWidgetType, const TDesC8& aTemplate, 
   201 TSize CMmTemplateLibrary::GetLayoutSizeL( TMmWidgetType aWidgetType, const TDesC8& aTemplate,
   202 		TBool aLandscapeOrientation )
   202 		TBool aLandscapeOrientation )
   203 	{
   203 	{
   204 	if ( KNullDesC8()== aTemplate )
   204 	if ( KNullDesC8()== aTemplate )
   205 		{
   205 		{
   206 		User::Leave( -1 );
   206 		User::Leave( -1 );
   208 	TSize* layoutSize = NULL;
   208 	TSize* layoutSize = NULL;
   209 	switch ( aWidgetType )
   209 	switch ( aWidgetType )
   210 		{
   210 		{
   211 		case EGrid:
   211 		case EGrid:
   212 			{
   212 			{
   213 		    HBufC8* lookup_string = LookupLayoutText( aWidgetType, iZoom, 
   213 		    HBufC8* lookup_string = LookupLayoutText( aWidgetType,
   214                 aTemplate, aLandscapeOrientation );
   214                 aTemplate, aLandscapeOrientation );
   215 			CleanupStack::PushL( lookup_string );
   215 			CleanupStack::PushL( lookup_string );
   216 		    layoutSize = iTemplateSizesMap.Find( lookup_string );
   216 		    layoutSize = iTemplateSizesMap.Find( lookup_string );
   217 		    if (!layoutSize)
   217 		    if (!layoutSize)
   218 		        {
   218 		        {
   221 		        if( !layoutSize )
   221 		        if( !layoutSize )
   222 		            User::Panic( KMtlPanic, -1);
   222 		            User::Panic( KMtlPanic, -1);
   223 		        }
   223 		        }
   224 			CleanupStack::PopAndDestroy( lookup_string );
   224 			CleanupStack::PopAndDestroy( lookup_string );
   225 			}
   225 			}
   226 		
   226 
   227 			break;
   227 			break;
   228 		case EListbox:
   228 		case EListbox:
   229 			return TSize( MmListBox::KCols,0 );
   229 			return TSize( MmListBox::KCols,0 );
   230 		default:
   230 		default:
   231 			User::Panic( KMtlPanic, -1);
   231 			User::Panic( KMtlPanic, -1);
   240 TRect CMmTemplateLibrary::GetMoveIndicatorRect(TMmWidgetType aWidgetType,
   240 TRect CMmTemplateLibrary::GetMoveIndicatorRect(TMmWidgetType aWidgetType,
   241 		const TDesC8& aTemplate, TBool aLandscapeOrientation,
   241 		const TDesC8& aTemplate, TBool aLandscapeOrientation,
   242 		TBool aHighlighted)
   242 		TBool aHighlighted)
   243 	{
   243 	{
   244 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   244 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   245 	
   245 
   246 	HBufC8* lookup_string = LookupText(aTemplate, aWidgetType, iZoom, 
   246 	HBufC8* lookup_string = LookupText(aTemplate, aWidgetType,
   247         aLandscapeOrientation, aHighlighted );
   247         aLandscapeOrientation, aHighlighted );
   248 	HBufC8* lookup_indicator_string = LookupIndicatorText( *lookup_string );    
   248 	HBufC8* lookup_indicator_string = LookupIndicatorText( *lookup_string );
   249 
   249 
   250 	TRect* itemRect = iMoveIndicatorRectsMap.Find( lookup_indicator_string );
   250 	TRect* itemRect = iMoveIndicatorRectsMap.Find( lookup_indicator_string );
   251     if (!itemRect)
   251     if (!itemRect)
   252         {
   252         {
   253     	TSize itemSize;
   253     	TSize itemSize;
   261                 {
   261                 {
   262                 User::Panic( KMtlPanic, -1);
   262                 User::Panic( KMtlPanic, -1);
   263                 }
   263                 }
   264     	    }
   264     	    }
   265         }
   265         }
   266     
   266 
   267     delete lookup_indicator_string;
   267     delete lookup_indicator_string;
   268     delete lookup_string;
   268     delete lookup_string;
   269     return *itemRect;
   269     return *itemRect;
   270 	}
   270 	}
   271 
   271 
   277 		TTemplateChild>& aArray, const TDesC8& aTemplate,
   277 		TTemplateChild>& aArray, const TDesC8& aTemplate,
   278 		TBool aLandscapeOrientation, TBool aHighlighted, TBool aIsEditMode)
   278 		TBool aLandscapeOrientation, TBool aHighlighted, TBool aIsEditMode)
   279 	{
   279 	{
   280 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   280 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   281 
   281 
   282 	HBufC8* lookup_string = LookupText( aTemplate, aWidgetType, iZoom,
   282 	HBufC8* lookup_string = LookupText( aTemplate, aWidgetType,
   283         aLandscapeOrientation, aHighlighted );
   283         aLandscapeOrientation, aHighlighted );
   284 	CleanupStack::PushL( lookup_string );
   284 	CleanupStack::PushL( lookup_string );
   285     RArray<TTemplateChild>* children = iTemplateChildrenMap.Find( lookup_string );
   285     RArray<TTemplateChild>* children = iTemplateChildrenMap.Find( lookup_string );
   286     if ( !children )
   286     if ( !children )
   287         {
   287         {
   288         LoadTemplateL( aWidgetType, aTemplate, aLandscapeOrientation );
   288         LoadTemplateL( aWidgetType, aTemplate, aLandscapeOrientation );
   289         children = iTemplateChildrenMap.Find( lookup_string );
   289         children = iTemplateChildrenMap.Find( lookup_string );
   290         if (!children)
   290         if (!children)
   291         	{
   291         	{
   292             User::Panic( KMtlPanic, -1);    
   292             User::Panic( KMtlPanic, -1);
   293         	}    
   293         	}
   294         }
   294         }
   295     CleanupStack::PopAndDestroy( lookup_string );
   295     CleanupStack::PopAndDestroy( lookup_string );
   296     for (TInt i = 0; i < children->Count(); i++)
   296     for (TInt i = 0; i < children->Count(); i++)
   297     	aArray.AppendL((*children)[i]);
   297     	aArray.AppendL((*children)[i]);
   298     if ( aIsEditMode )
   298     if ( aIsEditMode )
   309 void CMmTemplateLibrary::GetMoveIndicatorChildrenL(TMmWidgetType aWidgetType,
   309 void CMmTemplateLibrary::GetMoveIndicatorChildrenL(TMmWidgetType aWidgetType,
   310 		RArray<TTemplateChild>& aArray, const TDesC8& aTemplate,
   310 		RArray<TTemplateChild>& aArray, const TDesC8& aTemplate,
   311 		TBool aLandscapeOrientation, TBool aHighlighted)
   311 		TBool aLandscapeOrientation, TBool aHighlighted)
   312 	{
   312 	{
   313 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   313 	ASSERT( KNullDesC8() != aTemplate && aTemplate.Compare( KEmpty8 ) );
   314 	
   314 
   315 	HBufC8* lookup_string = LookupText(aTemplate, aWidgetType, iZoom, 
   315 	HBufC8* lookup_string = LookupText(aTemplate, aWidgetType,
   316         aLandscapeOrientation, aHighlighted );
   316         aLandscapeOrientation, aHighlighted );
   317 	CleanupStack::PushL( lookup_string );
   317 	CleanupStack::PushL( lookup_string );
   318 	HBufC8* lookup_indicator_string = LookupIndicatorText( *lookup_string );    
   318 	HBufC8* lookup_indicator_string = LookupIndicatorText( *lookup_string );
   319 	CleanupStack::PushL( lookup_indicator_string );
   319 	CleanupStack::PushL( lookup_indicator_string );
   320 	
   320 
   321     RArray<TTemplateChild>* children = iTemplateChildrenMap.Find( lookup_indicator_string );
   321     RArray<TTemplateChild>* children = iTemplateChildrenMap.Find( lookup_indicator_string );
   322     if ( !children )
   322     if ( !children )
   323     	{
   323     	{
   324     	TSize itemSize;
   324     	TSize itemSize;
   325     	GetSize( itemSize, aWidgetType, aTemplate, aLandscapeOrientation, EFalse, GetParentRect( aLandscapeOrientation ) ); 
   325     	GetSize( itemSize, aWidgetType, aTemplate, aLandscapeOrientation, EFalse, GetParentRect( aLandscapeOrientation ) );
   326         SetupMoveIndicatorTemplateChildrenL( *lookup_indicator_string, itemSize );
   326         SetupMoveIndicatorTemplateChildrenL( *lookup_indicator_string, itemSize );
   327         children = iTemplateChildrenMap.Find( lookup_indicator_string );
   327         children = iTemplateChildrenMap.Find( lookup_indicator_string );
   328         if (!children)
   328         if (!children)
   329         	User::Panic( KMtlPanic, -1);
   329         	User::Panic( KMtlPanic, -1);
   330     	}
   330     	}
   331     
   331 
   332     CleanupStack::PopAndDestroy( lookup_indicator_string );
   332     CleanupStack::PopAndDestroy( lookup_indicator_string );
   333 	CleanupStack::PopAndDestroy( lookup_string );
   333 	CleanupStack::PopAndDestroy( lookup_string );
   334 	
   334 
   335     for (TInt i = 0; i < children->Count(); i++)
   335     for (TInt i = 0; i < children->Count(); i++)
   336     	{
   336     	{
   337     	aArray.AppendL((*children)[i]);
   337     	aArray.AppendL((*children)[i]);
   338     	}
   338     	}
   339 	}
   339 	}
   340 
   340 
   341 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   342 //
   342 //
   343 // ---------------------------------------------------------------------------
   343 // ---------------------------------------------------------------------------
   344 //
   344 //
   345 HBufC8* CMmTemplateLibrary::LookupText( const TDesC8& aTemplate, 
   345 HBufC8* CMmTemplateLibrary::LookupText( const TDesC8& aTemplate,
   346     TMmWidgetType aWidgetType, TAknUiZoom aZoom, TBool aLandscapeOrientation, 
   346     TMmWidgetType aWidgetType, TBool aLandscapeOrientation, TBool aHighlighted )
   347     TBool aHighlighted )
       
   348     {
   347     {
   349     HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   348     HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   350     if (lookup_string)
   349     if (lookup_string)
   351     	{
   350     	{
   352 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   351 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   364 		lookup_string_ptr.Append( KColon8 );
   363 		lookup_string_ptr.Append( KColon8 );
   365 		lookup_string_ptr.AppendNum( aLandscapeOrientation );
   364 		lookup_string_ptr.AppendNum( aLandscapeOrientation );
   366 		lookup_string_ptr.Append( KColon8 );
   365 		lookup_string_ptr.Append( KColon8 );
   367 		lookup_string_ptr.AppendNum( aHighlighted );
   366 		lookup_string_ptr.AppendNum( aHighlighted );
   368 		lookup_string_ptr.Append( KColon8 );
   367 		lookup_string_ptr.Append( KColon8 );
   369 		switch ( aZoom )
       
   370             {
       
   371             case EAknUiZoomLarge :
       
   372                 lookup_string_ptr.Append( KZoomLarge8 );
       
   373                 break;
       
   374             case EAknUiZoomSmall :
       
   375             	lookup_string_ptr.Append( KZoomSmall8 );
       
   376             	break; 
       
   377             default :
       
   378                 lookup_string_ptr.Append( KZoomNormal8 );
       
   379                 break;
       
   380             }
       
   381     	}
   368     	}
   382     return lookup_string;
   369     return lookup_string;
   383     }
   370     }
   384 
   371 
   385 // -----------------------------------------------------------------------------
   372 // -----------------------------------------------------------------------------
   386 //
   373 //
   387 // -----------------------------------------------------------------------------
   374 // -----------------------------------------------------------------------------
   388 //     
   375 //
   389 HBufC8* CMmTemplateLibrary::LookupLayoutText( TMmWidgetType aWidgetType,
   376 HBufC8* CMmTemplateLibrary::LookupLayoutText( TMmWidgetType aWidgetType,
   390     TAknUiZoom aZoom, const TDesC8& aTemplate, TBool aLandscapeOrientation )
   377         const TDesC8& aTemplate, TBool aLandscapeOrientation )
   391 	{
   378 	{
   392     HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   379     HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   393     if (lookup_string)
   380     if (lookup_string)
   394     	{
   381     	{
   395 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   382 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   401 			case EGrid:
   388 			case EGrid:
   402 				lookup_string_ptr.Append( KGrid8 );
   389 				lookup_string_ptr.Append( KGrid8 );
   403 				break;
   390 				break;
   404 			}
   391 			}
   405 		lookup_string_ptr.Append( KColon8 );
   392 		lookup_string_ptr.Append( KColon8 );
   406         switch ( aZoom )
       
   407             {
       
   408             case EAknUiZoomLarge:
       
   409                 lookup_string_ptr.Append( KZoomLarge8 );
       
   410                 break;
       
   411             case EAknUiZoomSmall :
       
   412             	lookup_string_ptr.Append( KZoomSmall8 );
       
   413                 break;
       
   414             default:
       
   415                 lookup_string_ptr.Append( KZoomNormal8 );
       
   416                 break;
       
   417             }
       
   418         lookup_string_ptr.Append( KColon8 );
   393         lookup_string_ptr.Append( KColon8 );
   419 		lookup_string_ptr.Append( aTemplate );
   394 		lookup_string_ptr.Append( aTemplate );
   420 		lookup_string_ptr.Append( KColon8 );
   395 		lookup_string_ptr.Append( KColon8 );
   421 		lookup_string_ptr.AppendNum( aLandscapeOrientation );
   396 		lookup_string_ptr.AppendNum( aLandscapeOrientation );
   422     	}
   397     	}
   424 	}
   399 	}
   425 
   400 
   426 // -----------------------------------------------------------------------------
   401 // -----------------------------------------------------------------------------
   427 //
   402 //
   428 // -----------------------------------------------------------------------------
   403 // -----------------------------------------------------------------------------
   429 //     
   404 //
   430 HBufC8* CMmTemplateLibrary::LookupIndicatorText( const TDesC8& aLookupText )
   405 HBufC8* CMmTemplateLibrary::LookupIndicatorText( const TDesC8& aLookupText )
   431 	{
   406 	{
   432 	HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   407 	HBufC8* lookup_string = HBufC8::New( MmTemplateContants::KTemplateChildTextLength );
   433 	if (lookup_string)
   408 	if (lookup_string)
   434 		{
   409 		{
   435 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   410 		TPtr8 lookup_string_ptr( lookup_string->Des() );
   436 		lookup_string_ptr.Append( KMI8 );
   411 		lookup_string_ptr.Append( KMI8 );
   437 		lookup_string_ptr.Append( KColon8 );
   412 		lookup_string_ptr.Append( KColon8 );
   438 		lookup_string_ptr.Append( aLookupText );
   413 		lookup_string_ptr.Append( aLookupText );
   439 		}
   414 		}
   440 	
   415 
   441 	return lookup_string;
   416 	return lookup_string;
   442 	}
   417 	}
   443 
   418 
   444 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   445 //
   420 //
   446 // -----------------------------------------------------------------------------
   421 // -----------------------------------------------------------------------------
   447 //     
   422 //
   448 void CMmTemplateLibrary::LoadTemplateL( TMmWidgetType aWidgetType, 
   423 void CMmTemplateLibrary::LoadTemplateL( TMmWidgetType aWidgetType,
   449 		const TDesC8& aTemplate, TBool aLandscapeOrientation )
   424 		const TDesC8& aTemplate, TBool aLandscapeOrientation )
   450 	{
   425 	{
   451 	iWidgetType = aWidgetType;
   426 	iWidgetType = aWidgetType;
   452 	DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL IN")); 
   427 	DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL IN"));
   453 	TMmTemplateType mmTemplateType;
   428 	TMmTemplateType mmTemplateType;
   454 	HBufC8* content = GetTemplateContentL( aTemplate, aWidgetType, mmTemplateType );
   429 	HBufC8* content = GetTemplateContentL( aTemplate, aWidgetType, mmTemplateType );
   455 	CleanupStack::PushL( content );
   430 	CleanupStack::PushL( content );
   456     RXmlEngDOMImplementation domImpl;
   431     RXmlEngDOMImplementation domImpl;
   457     CleanupClosePushL( domImpl );
   432     CleanupClosePushL( domImpl );
   458     RXmlEngDOMParser domParser;   
   433     RXmlEngDOMParser domParser;
   459     CleanupClosePushL( domParser );
   434     CleanupClosePushL( domParser );
   460     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL Opening domImpl"));
   435     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL Opening domImpl"));
   461     domImpl.OpenL();
   436     domImpl.OpenL();
   462     User::LeaveIfError( domParser.Open( domImpl ) );
   437     User::LeaveIfError( domParser.Open( domImpl ) );
   463     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL parsing content..."));
   438     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL parsing content..."));
   464     RXmlEngDocument xmlDoc = domParser.ParseL( *content );
   439     RXmlEngDocument xmlDoc = domParser.ParseL( *content );
   465     CleanupClosePushL( xmlDoc );
   440     CleanupClosePushL( xmlDoc );
   466     
   441 
   467     // first orientation
   442     // first orientation
   468     RXmlEngNodeList<TXmlEngElement> orientElements;
   443     RXmlEngNodeList<TXmlEngElement> orientElements;
   469     CleanupClosePushL( orientElements );
   444     CleanupClosePushL( orientElements );
   470     xmlDoc.DocumentElement().GetChildElements( orientElements );
   445     xmlDoc.DocumentElement().GetChildElements( orientElements );
   471     TXmlEngElement orientationElement;
   446     TXmlEngElement orientationElement;
   488             orientationElement.GetChildElements( elements );
   463             orientationElement.GetChildElements( elements );
   489             CleanupClosePushL( elements );
   464             CleanupClosePushL( elements );
   490             TXmlEngElement element;
   465             TXmlEngElement element;
   491             while ( elements.HasNext() )
   466             while ( elements.HasNext() )
   492                 {
   467                 {
   493                 element = elements.Next(); 
   468                 element = elements.Next();
   494             	DEBUG(("_Mm_:iMmTemplateType != EMmTemplateMoveIndicator"));
   469             	DEBUG(("_Mm_:iMmTemplateType != EMmTemplateMoveIndicator"));
   495             	if (element.AttributeValueL(KId8) == KHighlight8)
   470             	if (element.AttributeValueL(KId8) == KHighlight8)
   496                     {
   471                     {
   497                     DEBUG(("_Mm_:AttributeValueL - id == highlight"));
   472                     DEBUG(("_Mm_:AttributeValueL - id == highlight"));
   498                     ProcessElementL( mmTemplateType, element, aTemplate, landscapeOrientation, ETrue );
   473                     ProcessElementL( mmTemplateType, element, aTemplate, landscapeOrientation, ETrue );
   512                     }
   487                     }
   513                 }
   488                 }
   514             CleanupStack::PopAndDestroy( &elements );
   489             CleanupStack::PopAndDestroy( &elements );
   515             }
   490             }
   516         }
   491         }
   517     
   492 
   518     CleanupStack::PopAndDestroy( &orientElements );
   493     CleanupStack::PopAndDestroy( &orientElements );
   519     CleanupStack::PopAndDestroy( &xmlDoc );
   494     CleanupStack::PopAndDestroy( &xmlDoc );
   520     CleanupStack::PopAndDestroy( &domParser );
   495     CleanupStack::PopAndDestroy( &domParser );
   521     CleanupStack::PopAndDestroy( &domImpl );
   496     CleanupStack::PopAndDestroy( &domImpl );
   522     CleanupStack::PopAndDestroy(content);
   497     CleanupStack::PopAndDestroy(content);
   523     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL OUT")); 
   498     DEBUG(("_Mm_:CMmTemplateLibrary::LoadTemplateL OUT"));
   524     }
   499     }
   525 
   500 
   526 // -----------------------------------------------------------------------------
   501 // -----------------------------------------------------------------------------
   527 //
   502 //
   528 // -----------------------------------------------------------------------------
   503 // -----------------------------------------------------------------------------
   529 //     
   504 //
   530 void CMmTemplateLibrary::ProcessElementL(TMmTemplateType aMmTemplateType, 
   505 void CMmTemplateLibrary::ProcessElementL(TMmTemplateType aMmTemplateType,
   531 										 TXmlEngElement aElement, 
   506 										 TXmlEngElement aElement,
   532                                          const TDesC8& aTemplate, 
   507                                          const TDesC8& aTemplate,
   533                                          TBool aLandscapeOrientation,
   508                                          TBool aLandscapeOrientation,
   534                                          TBool aHighlighted )
   509                                          TBool aHighlighted )
   535     {
   510     {
   536     switch ( aMmTemplateType )
   511     switch ( aMmTemplateType )
   537 	    {
   512 	    {
   546 
   521 
   547 // -----------------------------------------------------------------------------
   522 // -----------------------------------------------------------------------------
   548 //
   523 //
   549 // -----------------------------------------------------------------------------
   524 // -----------------------------------------------------------------------------
   550 //
   525 //
   551 void CMmTemplateLibrary::ProcessLCTTemplateElementL(TXmlEngElement aElement, 
   526 void CMmTemplateLibrary::ProcessLCTTemplateElementL(TXmlEngElement aElement,
   552                                          const TDesC8& aTemplate, 
   527                                          const TDesC8& aTemplate,
   553                                          TBool aLandscapeOrientation,
   528                                          TBool aLandscapeOrientation,
   554                                          TBool aHighlighted )
   529                                          TBool aHighlighted )
   555 	{
   530 	{
   556 	RXmlEngNodeList<TXmlEngElement> layoutElements;
   531 	RXmlEngNodeList<TXmlEngElement> layoutElements;
   557 	CleanupClosePushL( layoutElements );
   532 	CleanupClosePushL( layoutElements );
   563 		layoutElement = layoutElements.Next();
   538 		layoutElement = layoutElements.Next();
   564 
   539 
   565 		if ( !layoutElement.Name().Compare( KLayout8 ) )
   540 		if ( !layoutElement.Name().Compare( KLayout8 ) )
   566 			{
   541 			{
   567 			TPtrC8 lctAtt = layoutElement.AttributeValueL(KLct8);
   542 			TPtrC8 lctAtt = layoutElement.AttributeValueL(KLct8);
   568 			
   543 
   569 			// set layout for grid
   544 			// set layout for grid
   570 			TInt variety;
   545 			TInt variety;
   571 			if ( Zoom() == EAknUiZoomLarge && iWidgetType == EGrid)
   546 			HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KVariety8), variety);
   572 				{
   547 
   573 				HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KVarietyZoom8), variety);
       
   574 				}
       
   575 			else 
       
   576 				{
       
   577 				HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KVariety8), variety);
       
   578 				}
       
   579 			
       
   580 			TSize layoutSize;
   548 			TSize layoutSize;
   581 			if ( iWidgetType == EGrid )
   549 			if ( iWidgetType == EGrid )
   582 				{
   550 				{
   583 				layoutSize = MmLCTUtils::GetLayoutSize( lctAtt, variety );
   551 				layoutSize = MmLCTUtils::GetLayoutSize( lctAtt, variety );
   584 				CacheLayoutSizeL( layoutSize, aTemplate, aLandscapeOrientation );
   552 				CacheLayoutSizeL( layoutSize, aTemplate, aLandscapeOrientation );
   588 				layoutSize = GetLayoutSizeL( iWidgetType, aTemplate, aLandscapeOrientation );
   556 				layoutSize = GetLayoutSizeL( iWidgetType, aTemplate, aLandscapeOrientation );
   589 				}
   557 				}
   590 
   558 
   591 			TAknWindowLineLayout layout;
   559 			TAknWindowLineLayout layout;
   592 			TSize itemSize = GetLCTSize( lctAtt, variety, layout, aLandscapeOrientation );
   560 			TSize itemSize = GetLCTSize( lctAtt, variety, layout, aLandscapeOrientation );
   593 			
   561 
   594 			AdjustItemSize( itemSize, layoutSize, aLandscapeOrientation );
   562 			AdjustItemSize( itemSize, layoutSize, aLandscapeOrientation );
   595 			HBufC8* lookup_string = LookupText( aTemplate, iWidgetType, iZoom,
   563 			HBufC8* lookup_string = LookupText( aTemplate, iWidgetType,
   596                 aLandscapeOrientation, aHighlighted );
   564                 aLandscapeOrientation, aHighlighted );
   597 			iTemplateSizesMap.InsertL( lookup_string, itemSize );
   565 			iTemplateSizesMap.InsertL( lookup_string, itemSize );
   598 			
   566 
   599 			// setup children
   567 			// setup children
   600 			RArray< TTemplateChild > childrenDefinition;
   568 			RArray< TTemplateChild > childrenDefinition;
   601 			CleanupClosePushL( childrenDefinition );
   569 			CleanupClosePushL( childrenDefinition );
   602 			RXmlEngNodeList<TXmlEngElement> childrenElements;
   570 			RXmlEngNodeList<TXmlEngElement> childrenElements;
   603 			CleanupClosePushL( childrenElements );
   571 			CleanupClosePushL( childrenElements );
   605 			TXmlEngElement childElement;
   573 			TXmlEngElement childElement;
   606 			while ( childrenElements.HasNext() )
   574 			while ( childrenElements.HasNext() )
   607 				{
   575 				{
   608 				childElement = childrenElements.Next();
   576 				childElement = childrenElements.Next();
   609 				TPtrC8 name = childElement.Name();
   577 				TPtrC8 name = childElement.Name();
   610 				if ( !name.Compare( KTextVisual8 ) || 
   578 				if ( !name.Compare( KTextVisual8 ) ||
   611 						!name.Compare( KImageVisual8 ) )
   579 						!name.Compare( KImageVisual8 ) )
   612 					{   
   580 					{
   613 					TTemplateChild childTemplate;
   581 					TTemplateChild childTemplate;
   614 					childTemplate.iLct = childElement.AttributeValueL(KLct8);
   582 					childTemplate.iLct = childElement.AttributeValueL(KLct8);
   615 					TInt variety;
   583 					TInt variety;
   616 					if ( Zoom() != EAknUiZoomNormal && iWidgetType == EGrid )
   584 					HnConvUtils::Str8ToInt(childElement.AttributeValueL(KVariety8), variety);
   617 						{
       
   618 						HnConvUtils::Str8ToInt(childElement.AttributeValueL(KVarietyZoom8), variety);
       
   619 						}
       
   620 					else 
       
   621 						{
       
   622 						HnConvUtils::Str8ToInt(childElement.AttributeValueL(KVariety8), variety);
       
   623 						}
       
   624 					childTemplate.iVariety = variety;
   585 					childTemplate.iVariety = variety;
   625 
   586 
   626 					TPtrC8 ptr = childElement.AttributeValueL(KHAlign8);
   587 					TPtrC8 ptr = childElement.AttributeValueL(KHAlign8);
   627                     if (!ptr.Compare(KNullDesC8))
   588                     if (!ptr.Compare(KNullDesC8))
   628                         {
   589                         {
   638                         }
   599                         }
   639                     else if (!ptr.Compare(KRight8))
   600                     else if (!ptr.Compare(KRight8))
   640                         {
   601                         {
   641                         childTemplate.iHAlign = EManualAlignRight;
   602                         childTemplate.iHAlign = EManualAlignRight;
   642                         }
   603                         }
   643 					
   604 
   644 					SetupLCTTemplateL( childTemplate, childElement, itemSize );
   605 					SetupLCTTemplateL( childTemplate, childElement, itemSize );
   645 					childrenDefinition.AppendL( childTemplate );
   606 					childrenDefinition.AppendL( childTemplate );
   646 					}
   607 					}
   647 				}
   608 				}
   648 			CleanupStack::PopAndDestroy( &childrenElements );
   609 			CleanupStack::PopAndDestroy( &childrenElements );
   649 			// save children defintion in map
   610 			// save children defintion in map
   650 			lookup_string = LookupText(aTemplate, iWidgetType, iZoom,
   611 			lookup_string = LookupText(aTemplate, iWidgetType,
   651                 aLandscapeOrientation, aHighlighted );
   612                 aLandscapeOrientation, aHighlighted );
   652 			iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
   613 			iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
   653 			CleanupStack::Pop( &childrenDefinition );			
   614 			CleanupStack::Pop( &childrenDefinition );
   654 			break;
   615 			break;
   655 	        }
   616 	        }
   656         }
   617         }
   657     CleanupStack::PopAndDestroy( &layoutElements );
   618     CleanupStack::PopAndDestroy( &layoutElements );
   658 	}
   619 	}
   659 
   620 
   660 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   661 //
   622 //
   662 // -----------------------------------------------------------------------------
   623 // -----------------------------------------------------------------------------
   663 //
   624 //
   664 void CMmTemplateLibrary::ProcessCustomTemplateElementL(TXmlEngElement aElement, 
   625 void CMmTemplateLibrary::ProcessCustomTemplateElementL(TXmlEngElement aElement,
   665                                          const TDesC8& aTemplate, 
   626                                          const TDesC8& aTemplate,
   666                                          TBool aLandscapeOrientation,
   627                                          TBool aLandscapeOrientation,
   667                                          TBool aHighlighted )
   628                                          TBool aHighlighted )
   668 	{
   629 	{
   669     RXmlEngNodeList<TXmlEngElement> layoutElements;
   630     RXmlEngNodeList<TXmlEngElement> layoutElements;
   670     CleanupClosePushL( layoutElements ); 
   631     CleanupClosePushL( layoutElements );
   671     aElement.GetChildElements( layoutElements );
   632     aElement.GetChildElements( layoutElements );
   672     TXmlEngElement layoutElement;
   633     TXmlEngElement layoutElement;
   673     while ( layoutElements.HasNext() )
   634     while ( layoutElements.HasNext() )
   674         {
   635         {
   675         layoutElement = layoutElements.Next();
   636         layoutElement = layoutElements.Next();
   678             TSize itemSize;
   639             TSize itemSize;
   679             // set sizes
   640             // set sizes
   680         	TInt height;
   641         	TInt height;
   681             TInt width;
   642             TInt width;
   682             HBufC8* lookup_string;
   643             HBufC8* lookup_string;
   683             
   644 
   684             HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KHeight8), height);
   645             HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KHeight8), height);
   685             HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KWidth8), width); 
   646             HnConvUtils::Str8ToInt(layoutElement.AttributeValueL(KWidth8), width);
   686         	lookup_string = LookupText( aTemplate, iWidgetType, iZoom,
   647         	lookup_string = LookupText( aTemplate, iWidgetType,
   687                 aLandscapeOrientation, aHighlighted );
   648                 aLandscapeOrientation, aHighlighted );
   688         	itemSize = TSize( width, height );      	
   649         	itemSize = TSize( width, height );
   689             
   650 
   690         	
   651 
   691             TSize layoutSize = ( aLandscapeOrientation ) ? 
   652             TSize layoutSize = ( aLandscapeOrientation ) ?
   692             		TSize( MmGrid::KColsLandscapeZoomNormal, MmGrid::KRowsLandscapeZoomNormal ): 
   653             		TSize( MmGrid::KColsLandscapeZoomNormal, MmGrid::KRowsLandscapeZoomNormal ):
   693             		TSize( MmGrid::KColsPortraitZoomNormal, MmGrid::KRowsPortraitZoomNormal ) ;
   654             		TSize( MmGrid::KColsPortraitZoomNormal, MmGrid::KRowsPortraitZoomNormal ) ;
   694             layoutSize = ( iWidgetType == EGrid ) ? layoutSize: TSize(MmListBox::KCols,0);
   655             layoutSize = ( iWidgetType == EGrid ) ? layoutSize: TSize(MmListBox::KCols,0);
   695             CacheLayoutSizeL( layoutSize, aTemplate, aLandscapeOrientation );
   656             CacheLayoutSizeL( layoutSize, aTemplate, aLandscapeOrientation );
   696             
   657 
   697             AdjustItemWidth( itemSize, layoutSize, aLandscapeOrientation );
   658             AdjustItemWidth( itemSize, layoutSize, aLandscapeOrientation );
   698         	iTemplateSizesMap.InsertL(lookup_string, itemSize);
   659         	iTemplateSizesMap.InsertL(lookup_string, itemSize);
   699 
   660 
   700             // set children
   661             // set children
   701             RArray< TTemplateChild > childrenDefinition;
   662             RArray< TTemplateChild > childrenDefinition;
   702             CleanupClosePushL( childrenDefinition ); 
   663             CleanupClosePushL( childrenDefinition );
   703             
   664 
   704             RXmlEngNodeList<TXmlEngElement> childrenElements;
   665             RXmlEngNodeList<TXmlEngElement> childrenElements;
   705             CleanupClosePushL( childrenElements );
   666             CleanupClosePushL( childrenElements );
   706             layoutElement.GetChildElements( childrenElements );
   667             layoutElement.GetChildElements( childrenElements );
   707             TXmlEngElement childElement;
   668             TXmlEngElement childElement;
   708             while ( childrenElements.HasNext() )
   669             while ( childrenElements.HasNext() )
   709                 {
   670                 {
   710                 childElement = childrenElements.Next();
   671                 childElement = childrenElements.Next();
   711                 TPtrC8 name = childElement.Name();
   672                 TPtrC8 name = childElement.Name();
   712                 if ( !name.Compare( KTextVisual8 ) || 
   673                 if ( !name.Compare( KTextVisual8 ) ||
   713                         !name.Compare( KImageVisual8 ) )
   674                         !name.Compare( KImageVisual8 ) )
   714                     {   
   675                     {
   715                     TTemplateChild childTemplate;
   676                     TTemplateChild childTemplate;
   716                     SetupCustomTemplateL( childTemplate, childElement );
   677                     SetupCustomTemplateL( childTemplate, childElement );
   717                     childrenDefinition.AppendL( childTemplate );
   678                     childrenDefinition.AppendL( childTemplate );
   718                     }
   679                     }
   719                 }
   680                 }
   720             CleanupStack::PopAndDestroy( &childrenElements );
   681             CleanupStack::PopAndDestroy( &childrenElements );
   721             // save children defintion in map
   682             // save children defintion in map
   722         	lookup_string = LookupText(aTemplate, iWidgetType, iZoom, 
   683         	lookup_string = LookupText(aTemplate, iWidgetType,
   723                 aLandscapeOrientation, aHighlighted );
   684                 aLandscapeOrientation, aHighlighted );
   724         	iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
   685         	iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
   725         	CleanupStack::Pop( &childrenDefinition );
   686         	CleanupStack::Pop( &childrenDefinition );
   726             // we found first layout, it is enough
   687             // we found first layout, it is enough
   727             break;
   688             break;
   731 	}
   692 	}
   732 
   693 
   733 // -----------------------------------------------------------------------------
   694 // -----------------------------------------------------------------------------
   734 //
   695 //
   735 // -----------------------------------------------------------------------------
   696 // -----------------------------------------------------------------------------
   736 //    
   697 //
   737 HBufC8* CMmTemplateLibrary::GetTemplateContentL(const TDesC8& aTemplate,
   698 HBufC8* CMmTemplateLibrary::GetTemplateContentL(const TDesC8& aTemplate,
   738 		TMmWidgetType aWidgetType, TMmTemplateType& aMmTemplateType)
   699 		TMmWidgetType aWidgetType, TMmTemplateType& aMmTemplateType)
   739 	{
   700 	{
   740 	HBufC8* content;
   701 	HBufC8* content;
   741 	TRAPD( err , GetTemplateFileContentL( content, aTemplate, aWidgetType, aMmTemplateType ) );
   702 	TRAPD( err , GetTemplateFileContentL( content, aTemplate, aWidgetType, aMmTemplateType ) );
   756 	}
   717 	}
   757 
   718 
   758 // -----------------------------------------------------------------------------
   719 // -----------------------------------------------------------------------------
   759 //
   720 //
   760 // -----------------------------------------------------------------------------
   721 // -----------------------------------------------------------------------------
   761 //     
   722 //
   762 void CMmTemplateLibrary::GetTemplateFileContentL( HBufC8*& aContent, 
   723 void CMmTemplateLibrary::GetTemplateFileContentL( HBufC8*& aContent,
   763 		const TDesC8& aTemplate, TMmWidgetType aWidgetType, 
   724 		const TDesC8& aTemplate, TMmWidgetType aWidgetType,
   764 		TMmTemplateType& aMmTemplateType, TBool aLoadCustomTemplate )
   725 		TMmTemplateType& aMmTemplateType, TBool aLoadCustomTemplate )
   765 	{
   726 	{
   766     DEBUG(("_Mm_:CMmTemplateLibrary::GetTemplateContentL IN")); 
   727     DEBUG(("_Mm_:CMmTemplateLibrary::GetTemplateContentL IN"));
   767     TFileName filename;
   728     TFileName filename;
   768 //  create filename  egz: akn_logical_template_3.xml
   729 //  create filename  egz: akn_logical_template_3.xml
   769 	filename.Copy(aTemplate);
   730 	filename.Copy(aTemplate);
   770 	filename.Insert(0, KUnderline );
   731 	filename.Insert(0, KUnderline );
   771 	filename.Insert(0, KAkn );
   732 	filename.Insert(0, KAkn );
   772 	filename.Append( KXmlExt );
   733 	filename.Append( KXmlExt );
   773 	
   734 
   774 //  append path egz: z:\\resource\\grid\\lct\\akn_logical_template_3.xml
   735 //  append path egz: z:\\resource\\grid\\lct\\akn_logical_template_3.xml
   775 	
   736 
   776 	if ( !aLoadCustomTemplate )
   737 	if ( !aLoadCustomTemplate )
   777 		{
   738 		{
   778 		filename.Insert(0, KBslash );
   739 		filename.Insert(0, KBslash );
   779 		filename.Insert(0, KLct );
   740 		filename.Insert(0, KLct );
   780 		}
   741 		}
   781 	else 
   742 	else
   782 		{
   743 		{
   783 		filename.Insert(0, KBslash );
   744 		filename.Insert(0, KBslash );
   784 		filename.Insert(0, KCustom );
   745 		filename.Insert(0, KCustom );
   785 		}
   746 		}
   786 	
   747 
   787 	switch (aWidgetType)
   748 	switch (aWidgetType)
   788 		{
   749 		{
   789 		case EGrid:
   750 		case EGrid:
   790 			filename.Insert(0, KBslash );
   751 			filename.Insert(0, KBslash );
   791 			filename.Insert(0, KWidgetTypeGrid);
   752 			filename.Insert(0, KWidgetTypeGrid);
   793 		case EListbox:
   754 		case EListbox:
   794 			filename.Insert(0, KBslash );
   755 			filename.Insert(0, KBslash );
   795 			filename.Insert(0, KWidgetTypeList );
   756 			filename.Insert(0, KWidgetTypeList );
   796 			break;
   757 			break;
   797 		}
   758 		}
   798 	
   759 
   799 	filename.Insert(0, KZResource );    
   760 	filename.Insert(0, KZResource );
   800 	
   761 
   801 	DEBUG(("\t_Mm_:tail: %S", &filename));
   762 	DEBUG(("\t_Mm_:tail: %S", &filename));
   802     DEBUG(("_Mm_:CMmTemplateLibrary::GetTemplateContentL OUT"));
   763     DEBUG(("_Mm_:CMmTemplateLibrary::GetTemplateContentL OUT"));
   803     
   764 
   804 //  load LCT Template or if it does not exist then load custom template
   765 //  load LCT Template or if it does not exist then load custom template
   805     aContent =  HnUtils::ReadFileLC(filename);
   766     aContent =  HnUtils::ReadFileLC(filename);
   806 	CleanupStack::Pop( aContent );
   767 	CleanupStack::Pop( aContent );
   807 	
   768 
   808 	if ( aLoadCustomTemplate )
   769 	if ( aLoadCustomTemplate )
   809 		{
   770 		{
   810 		aMmTemplateType = ETemplateTypeCustom;
   771 		aMmTemplateType = ETemplateTypeCustom;
   811 		}
   772 		}
   812 	else 
   773 	else
   813 		{
   774 		{
   814 		aMmTemplateType = ETemplateTypeLCT;
   775 		aMmTemplateType = ETemplateTypeLCT;
   815 		}
   776 		}
   816 	return;
   777 	return;
   817 	}
   778 	}
   818 
   779 
   819 // -----------------------------------------------------------------------------
   780 // -----------------------------------------------------------------------------
   820 //
   781 //
   821 // -----------------------------------------------------------------------------
   782 // -----------------------------------------------------------------------------
   822 //
   783 //
   823 TSize CMmTemplateLibrary::GetLCTSize( const TDesC8& aLCTTemplate, TInt aVariety, 
   784 TSize CMmTemplateLibrary::GetLCTSize( const TDesC8& aLCTTemplate, TInt aVariety,
   824 		TAknWindowLineLayout& aWindowLayout, TBool aLandscapeOrientation )
   785 		TAknWindowLineLayout& aWindowLayout, TBool aLandscapeOrientation )
   825 	{
   786 	{
   826 	TSize size = MmLCTUtils::GetLCTSize( aLCTTemplate, aVariety, 
   787 	TSize size = MmLCTUtils::GetLCTSize( aLCTTemplate, aVariety,
   827 			GetParentRect( aLandscapeOrientation ), aWindowLayout );
   788 			GetParentRect( aLandscapeOrientation ), aWindowLayout );
   828 	return size;
   789 	return size;
   829 	}
   790 	}
   830 
   791 
   831 // -----------------------------------------------------------------------------
   792 // -----------------------------------------------------------------------------
   832 //
   793 //
   833 // -----------------------------------------------------------------------------
   794 // -----------------------------------------------------------------------------
   834 //
   795 //
   835 void CMmTemplateLibrary::SetupLCTTemplateL(TTemplateChild& aChildTemplate, 
   796 void CMmTemplateLibrary::SetupLCTTemplateL(TTemplateChild& aChildTemplate,
   836 		TXmlEngElement& aChildElement, TSize aItemSize )
   797 		TXmlEngElement& aChildElement, TSize aItemSize )
   837 	{
   798 	{
   838     TPtrC8 name = aChildElement.Name();
   799     TPtrC8 name = aChildElement.Name();
   839     aChildTemplate.iData = aChildElement.AttributeValueL(KId8);
   800     aChildTemplate.iData = aChildElement.AttributeValueL(KId8);
   840     SetupTemplateVisualId( aChildTemplate );
   801     SetupTemplateVisualId( aChildTemplate );
   841     
   802 
   842     // read attribute name (mm_title, mm_icon)
   803     // read attribute name (mm_title, mm_icon)
   843     RXmlEngNodeList<TXmlEngElement> attributeElements;
   804     RXmlEngNodeList<TXmlEngElement> attributeElements;
   844     CleanupClosePushL( attributeElements );
   805     CleanupClosePushL( attributeElements );
   845     aChildElement.GetChildElements( attributeElements );
   806     aChildElement.GetChildElements( attributeElements );
   846     TXmlEngElement attElement;
   807     TXmlEngElement attElement;
   847     while ( attributeElements.HasNext() )
   808     while ( attributeElements.HasNext() )
   848         {
   809         {
   849         attElement = attributeElements.Next();   
   810         attElement = attributeElements.Next();
   850         TPtrC8 nameAtt = attElement.AttributeValueL(KName8);
   811         TPtrC8 nameAtt = attElement.AttributeValueL(KName8);
   851         if ( !name.Compare( KTextVisual8 ) &&
   812         if ( !name.Compare( KTextVisual8 ) &&
   852                 !nameAtt.Compare( KText8 ) )
   813                 !nameAtt.Compare( KText8 ) )
   853             {
   814             {
   854             MmLCTUtils::SetupTextSubCellTemplate( aItemSize, aChildTemplate );
   815             MmLCTUtils::SetupTextSubCellTemplate( aItemSize, aChildTemplate );
   871 		TXmlEngElement& aChildElement)
   832 		TXmlEngElement& aChildElement)
   872 	{
   833 	{
   873     TPtrC8 name = aChildElement.Name();
   834     TPtrC8 name = aChildElement.Name();
   874 	TInt positionx; TInt positiony;
   835 	TInt positionx; TInt positiony;
   875     TInt height; TInt width;
   836     TInt height; TInt width;
   876     
   837 
   877     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KPositionX8), positionx);
   838     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KPositionX8), positionx);
   878     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KPositionY8), positiony); 
   839     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KPositionY8), positiony);
   879     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KHeight8), height);
   840     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KHeight8), height);
   880     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KWidth8), width);
   841     HnConvUtils::Str8ToInt(aChildElement.AttributeValueL(KWidth8), width);
   881     aChildTemplate.iRectAccordingToParent = TRect( TPoint(positionx,positiony), TSize(width, height) );
   842     aChildTemplate.iRectAccordingToParent = TRect( TPoint(positionx,positiony), TSize(width, height) );
   882     
   843 
   883     aChildTemplate.iData = aChildElement.AttributeValueL(KId8);
   844     aChildTemplate.iData = aChildElement.AttributeValueL(KId8);
   884     SetupTemplateVisualId( aChildTemplate );
   845     SetupTemplateVisualId( aChildTemplate );
   885     
   846 
   886     // read attribute name (mm_title, mm_icon)
   847     // read attribute name (mm_title, mm_icon)
   887     RXmlEngNodeList<TXmlEngElement> attributeElements;
   848     RXmlEngNodeList<TXmlEngElement> attributeElements;
   888     CleanupClosePushL( attributeElements );
   849     CleanupClosePushL( attributeElements );
   889     aChildElement.GetChildElements( attributeElements );
   850     aChildElement.GetChildElements( attributeElements );
   890     TXmlEngElement attElement;
   851     TXmlEngElement attElement;
   891     while ( attributeElements.HasNext() )
   852     while ( attributeElements.HasNext() )
   892         {
   853         {
   893         attElement = attributeElements.Next();   
   854         attElement = attributeElements.Next();
   894         TPtrC8 nameAtt = attElement.AttributeValueL(KName8);
   855         TPtrC8 nameAtt = attElement.AttributeValueL(KName8);
   895         if ( !name.Compare( KTextVisual8 ) &&
   856         if ( !name.Compare( KTextVisual8 ) &&
   896                 !nameAtt.Compare( KText8 ) )
   857                 !nameAtt.Compare( KText8 ) )
   897             {
   858             {
   898             aChildTemplate.iIsImage = EFalse;
   859             aChildTemplate.iIsImage = EFalse;
   910             TPtrC8 font = attElement.AttributeValueL(KTargetValue8);
   871             TPtrC8 font = attElement.AttributeValueL(KTargetValue8);
   911             if ( !font.Compare( KQfnPrimarySmall8 ) )
   872             if ( !font.Compare( KQfnPrimarySmall8 ) )
   912                 {
   873                 {
   913                 aChildTemplate.iFontId = EAknLogicalFontPrimarySmallFont;
   874                 aChildTemplate.iFontId = EAknLogicalFontPrimarySmallFont;
   914                 }
   875                 }
   915             else 
   876             else
   916                 {
   877                 {
   917                 aChildTemplate.iFontId = EAknLogicalFontSecondaryFont;
   878                 aChildTemplate.iFontId = EAknLogicalFontSecondaryFont;
   918                 }
   879                 }
   919             }
   880             }
   920         else if ( !name.Compare( KTextVisual8 )  &&
   881         else if ( !name.Compare( KTextVisual8 )  &&
   923             TInt textAlign;
   884             TInt textAlign;
   924             HnConvUtils::Str8ToInt(attElement.AttributeValueL(KTargetValue8), textAlign);
   885             HnConvUtils::Str8ToInt(attElement.AttributeValueL(KTargetValue8), textAlign);
   925             aChildTemplate.iTextAlign = static_cast<CGraphicsContext::TTextAlign>(textAlign);
   886             aChildTemplate.iTextAlign = static_cast<CGraphicsContext::TTextAlign>(textAlign);
   926             }
   887             }
   927         }
   888         }
   928     
   889 
   929     CleanupStack::PopAndDestroy( &attributeElements );
   890     CleanupStack::PopAndDestroy( &attributeElements );
   930 	}
   891 	}
   931 
   892 
   932 // -----------------------------------------------------------------------------
   893 // -----------------------------------------------------------------------------
   933 //
   894 //
   937 	{
   898 	{
   938 	if( !aChildTemplate.iData.Compare( KMmBackdropIcon8 ))
   899 	if( !aChildTemplate.iData.Compare( KMmBackdropIcon8 ))
   939         {
   900         {
   940         aChildTemplate.iImageVisualId = EImageVisualIdEditMode;
   901         aChildTemplate.iImageVisualId = EImageVisualIdEditMode;
   941         }
   902         }
   942 	else 
   903 	else
   943 		{
   904 		{
   944 		aChildTemplate.iImageVisualId = EImageVisualIdNormalMode;
   905 		aChildTemplate.iImageVisualId = EImageVisualIdNormalMode;
   945 		}
   906 		}
   946 	}
   907 	}
   947 
   908 
   955     //setup backdrop icon
   916     //setup backdrop icon
   956     TTemplateChild childTemplate;
   917     TTemplateChild childTemplate;
   957     childTemplate.iIsImage = ETrue;
   918     childTemplate.iIsImage = ETrue;
   958     childTemplate.iFontId = EAknLogicalFontSecondaryFont;
   919     childTemplate.iFontId = EAknLogicalFontSecondaryFont;
   959     childTemplate.iTextAlign = CGraphicsContext::ELeft;
   920     childTemplate.iTextAlign = CGraphicsContext::ELeft;
   960     childTemplate.iRectAccordingToParent = TRect( TPoint( 0,0 ), 
   921     childTemplate.iRectAccordingToParent = TRect( TPoint( 0,0 ),
   961     		TPoint( aSize.iWidth, aSize.iHeight ) );
   922     		TPoint( aSize.iWidth, aSize.iHeight ) );
   962     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength >( KMmBackdropIcon8 );
   923     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength >( KMmBackdropIcon8 );
   963     SetupTemplateVisualId( childTemplate );
   924     SetupTemplateVisualId( childTemplate );
   964     aTemplateArray.AppendL( childTemplate );
   925     aTemplateArray.AppendL( childTemplate );
   965 	}
   926 	}
   967 
   928 
   968 // -----------------------------------------------------------------------------
   929 // -----------------------------------------------------------------------------
   969 //
   930 //
   970 // -----------------------------------------------------------------------------
   931 // -----------------------------------------------------------------------------
   971 //
   932 //
   972 void CMmTemplateLibrary::SetupMoveIndicatorTemplateChildrenL( 
   933 void CMmTemplateLibrary::SetupMoveIndicatorTemplateChildrenL(
   973 		const TDesC8& aLookupString, TSize aItemSize )
   934 		const TDesC8& aLookupString, TSize aItemSize )
   974 	{
   935 	{
   975 	RArray< TTemplateChild > childrenDefinition;
   936 	RArray< TTemplateChild > childrenDefinition;
   976     TTemplateChild childTemplate;
   937     TTemplateChild childTemplate;
   977     childTemplate.iIsImage = ETrue;
   938     childTemplate.iIsImage = ETrue;
   978     childTemplate.iImageVisualId = EImageVisualIdNormalMode;  
   939     childTemplate.iImageVisualId = EImageVisualIdNormalMode;
   979     childTemplate.iFontId = EAknLogicalFontSecondaryFont;
   940     childTemplate.iFontId = EAknLogicalFontSecondaryFont;
   980     childTemplate.iTextAlign = CGraphicsContext::ELeft;
   941     childTemplate.iTextAlign = CGraphicsContext::ELeft;
   981 	TPoint startingPosition = TPoint( 
   942 	TPoint startingPosition = TPoint(
   982 			MmTemplateContants::KMoveIndicatorStartingPos, 
   943 			MmTemplateContants::KMoveIndicatorStartingPos,
   983 			MmTemplateContants::KMoveIndicatorStartingPos);
   944 			MmTemplateContants::KMoveIndicatorStartingPos);
   984     
   945 
   985     //setup move_indicator_arrow_left
   946     //setup move_indicator_arrow_left
   986     childTemplate.iRectAccordingToParent = TRect(TPoint(0,aItemSize.iHeight/2 + startingPosition.iY/2), 
   947     childTemplate.iRectAccordingToParent = TRect(TPoint(0,aItemSize.iHeight/2 + startingPosition.iY/2),
   987     		TPoint(startingPosition.iX, 
   948     		TPoint(startingPosition.iX,
   988     				startingPosition.iY*3/2 + aItemSize.iHeight/2));
   949     				startingPosition.iY*3/2 + aItemSize.iHeight/2));
   989     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>( 
   950     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>(
   990     		KMmMoveIndicatorArrowLeft8 );
   951     		KMmMoveIndicatorArrowLeft8 );
   991     childrenDefinition.AppendL( childTemplate );
   952     childrenDefinition.AppendL( childTemplate );
   992     
   953 
   993     //setup move_indicator_arrow_right
   954     //setup move_indicator_arrow_right
   994     childTemplate.iRectAccordingToParent = TRect(
   955     childTemplate.iRectAccordingToParent = TRect(
   995     		TPoint(startingPosition.iX + aItemSize.iWidth , aItemSize.iHeight/2 + startingPosition.iY/2), 
   956     		TPoint(startingPosition.iX + aItemSize.iWidth , aItemSize.iHeight/2 + startingPosition.iY/2),
   996     		TPoint(startingPosition.iX*2 + aItemSize.iWidth, 
   957     		TPoint(startingPosition.iX*2 + aItemSize.iWidth,
   997     				startingPosition.iY*3/2 + aItemSize.iHeight/2));
   958     				startingPosition.iY*3/2 + aItemSize.iHeight/2));
   998     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>(
   959     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>(
   999     		KMmMoveIndicatorArrowRight8 );
   960     		KMmMoveIndicatorArrowRight8 );
  1000     childrenDefinition.AppendL( childTemplate );
   961     childrenDefinition.AppendL( childTemplate );
  1001     
   962 
  1002     //setup move_indicator_arrow_top
   963     //setup move_indicator_arrow_top
  1003     childTemplate.iRectAccordingToParent = TRect(TPoint( aItemSize.iWidth/2 + startingPosition.iX/2, 0 ), 
   964     childTemplate.iRectAccordingToParent = TRect(TPoint( aItemSize.iWidth/2 + startingPosition.iX/2, 0 ),
  1004     		TPoint(aItemSize.iWidth/2 + startingPosition.iX*3/2, startingPosition.iY));
   965     		TPoint(aItemSize.iWidth/2 + startingPosition.iX*3/2, startingPosition.iY));
  1005     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength >(
   966     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength >(
  1006     		KMmMoveIndicatorArrowTop8 );
   967     		KMmMoveIndicatorArrowTop8 );
  1007     childrenDefinition.AppendL( childTemplate );
   968     childrenDefinition.AppendL( childTemplate );
  1008     
   969 
  1009     //setup move_indicator_arrow_bottom
   970     //setup move_indicator_arrow_bottom
  1010     childTemplate.iRectAccordingToParent = TRect( TPoint( aItemSize.iWidth/2 + startingPosition.iX/2, 
   971     childTemplate.iRectAccordingToParent = TRect( TPoint( aItemSize.iWidth/2 + startingPosition.iX/2,
  1011     		aItemSize.iHeight + startingPosition.iY + 2 ), 
   972     		aItemSize.iHeight + startingPosition.iY + 2 ),
  1012     		TPoint(aItemSize.iWidth/2 + startingPosition.iX*3/2, 
   973     		TPoint(aItemSize.iWidth/2 + startingPosition.iX*3/2,
  1013     				aItemSize.iHeight + 2 *startingPosition.iY));
   974     				aItemSize.iHeight + 2 *startingPosition.iY));
  1014     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>( 
   975     childTemplate.iData = TBufC8< MmTemplateContants::KTemplateChildTextLength>(
  1015     		KMmMoveIndicatorArrowBottom8 );
   976     		KMmMoveIndicatorArrowBottom8 );
  1016     childrenDefinition.AppendL( childTemplate );
   977     childrenDefinition.AppendL( childTemplate );
  1017 
   978 
  1018 	HBufC8* lookup_string = aLookupString.AllocLC();
   979 	HBufC8* lookup_string = aLookupString.AllocLC();
  1019 	iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
   980 	iTemplateChildrenMap.InsertL(lookup_string, childrenDefinition);
  1020 	CleanupStack::Pop( lookup_string );
   981 	CleanupStack::Pop( lookup_string );
  1021 	lookup_string = NULL;
   982 	lookup_string = NULL;
  1022 	
   983 
  1023     lookup_string = aLookupString.AllocLC();
   984     lookup_string = aLookupString.AllocLC();
  1024 	TRect rectAccordingToParent = TRect( 
   985 	TRect rectAccordingToParent = TRect(
  1025 			TPoint( -startingPosition.iX, -startingPosition.iY), 
   986 			TPoint( -startingPosition.iX, -startingPosition.iY),
  1026 			TPoint(2*startingPosition.iX + aItemSize.iWidth , 
   987 			TPoint(2*startingPosition.iX + aItemSize.iWidth ,
  1027 					2*startingPosition.iY + aItemSize.iHeight) );
   988 					2*startingPosition.iY + aItemSize.iHeight) );
  1028 
   989 
  1029 	iMoveIndicatorRectsMap.InsertL( lookup_string, rectAccordingToParent );
   990 	iMoveIndicatorRectsMap.InsertL( lookup_string, rectAccordingToParent );
  1030 	CleanupStack::Pop( lookup_string );
   991 	CleanupStack::Pop( lookup_string );
  1031 	}
   992 	}
  1094 	{
  1055 	{
  1095 	if ( iIsScrollbarVisible )
  1056 	if ( iIsScrollbarVisible )
  1096 		{
  1057 		{
  1097 		aItemSize.iWidth = ( GetParentRect(aLandscapeOrientation).Width() - iScrollbarWidth ) / aLayoutSize.iWidth;
  1058 		aItemSize.iWidth = ( GetParentRect(aLandscapeOrientation).Width() - iScrollbarWidth ) / aLayoutSize.iWidth;
  1098 		}
  1059 		}
  1099 	else 
  1060 	else
  1100 		{
  1061 		{
  1101 		aItemSize.iWidth = GetParentRect(aLandscapeOrientation).Width() / aLayoutSize.iWidth;
  1062 		aItemSize.iWidth = GetParentRect(aLandscapeOrientation).Width() / aLayoutSize.iWidth;
  1102 		}
  1063 		}
  1103 	}
  1064 	}
  1104 
  1065 
  1159 
  1120 
  1160 // -----------------------------------------------------------------------------
  1121 // -----------------------------------------------------------------------------
  1161 //
  1122 //
  1162 // -----------------------------------------------------------------------------
  1123 // -----------------------------------------------------------------------------
  1163 //
  1124 //
  1164 TAknUiZoom CMmTemplateLibrary::Zoom( )
       
  1165 	{
       
  1166 	return iZoom;
       
  1167 	}
       
  1168 
       
  1169 // -----------------------------------------------------------------------------
       
  1170 //
       
  1171 // -----------------------------------------------------------------------------
       
  1172 //
       
  1173 void CMmTemplateLibrary::SetZoom( TAknUiZoom aZoom )
       
  1174 	{
       
  1175 	if ( (EAknUiZoomLarge == aZoom)
       
  1176 			|| (EAknUiZoomSmall == aZoom) )
       
  1177 		{
       
  1178 		iZoom = aZoom;
       
  1179 		}
       
  1180 	else
       
  1181 		{
       
  1182 		iZoom = EAknUiZoomNormal;
       
  1183 		}
       
  1184 	}
       
  1185 
       
  1186 // -----------------------------------------------------------------------------
       
  1187 //
       
  1188 // -----------------------------------------------------------------------------
       
  1189 //
       
  1190 void CMmTemplateLibrary::CacheLayoutSizeL(TSize aLayoutSize,
  1125 void CMmTemplateLibrary::CacheLayoutSizeL(TSize aLayoutSize,
  1191 		const TDesC8& aTemplate, TBool aLandscapeOrientation)
  1126 		const TDesC8& aTemplate, TBool aLandscapeOrientation)
  1192 	{
  1127 	{
  1193 	HBufC8* lookup_layout_text = LookupLayoutText( iWidgetType, iZoom, 
  1128 	HBufC8* lookup_layout_text = LookupLayoutText( iWidgetType,
  1194         aTemplate, aLandscapeOrientation );
  1129         aTemplate, aLandscapeOrientation );
  1195 
  1130 
  1196 	if ( iTemplateSizesMap.Find( lookup_layout_text ) )
  1131 	if ( iTemplateSizesMap.Find( lookup_layout_text ) )
  1197 		{
  1132 		{
  1198 		delete lookup_layout_text;
  1133 		delete lookup_layout_text;