meetingrequest/mrgui/src/cesmrlayoutmgr.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  ESMR checkbox component for es mr gui (editor)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include "cesmrlayoutmgr.h"
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32cmn.h>
       
    24 #include <gdi.h>
       
    25 #include <fbs.h>
       
    26 #include <coemain.h>
       
    27 #include <eikenv.h>
       
    28 #include <gulfont.h>
       
    29 #include <avkon.hrh>
       
    30 #include <AknUtils.h>
       
    31 #include <AknFontSpecification.h>
       
    32 #include <AknLayoutFont.h>
       
    33 #include <AvkonInternalCRKeys.h>
       
    34 #include <centralrepository.h>
       
    35 #include <AknsConstants.h>
       
    36 #include <aknsconstants.hrh>
       
    37 #include <AknsUtils.h>
       
    38 #include <aknappui.h>
       
    39 #include <data_caging_path_literals.hrh>
       
    40 #include <esmrgui.mbg>
       
    41 
       
    42 #include "mesmrfontsizeobserver.h"
       
    43 #include "esmrhelper.h"
       
    44 
       
    45 // Unnamed namespace for local definitions
       
    46 namespace {
       
    47 
       
    48 // icon margins
       
    49 const TInt KIconTopMarginSmallFont = 0;
       
    50 const TInt KIconTopMarginNormalFont = 1;
       
    51 const TInt KIconTopMarginLargeFont = 3;
       
    52 
       
    53 /** Enumeration for font sizes */
       
    54 enum TESMRFontSize
       
    55     {
       
    56     EESMRFontSmall = 21,
       
    57     EESMRFontNormal = 23,
       
    58     EESMRFontLarge = 26
       
    59     };
       
    60 
       
    61 /** Enumeration for text top margin*/
       
    62 enum TESMRTextTopMargin
       
    63     {
       
    64     EESMRTextTopMarginSmall = 2,
       
    65     EESMRTextTopMarginNormal = 2,
       
    66     EESMRTextTopMarginLarge = 3
       
    67     };
       
    68 
       
    69 // Field heights
       
    70 const TInt KRegularFieldHeightSmallFont(20);
       
    71 const TInt KRegularFieldHeightNormalFont(22);
       
    72 const TInt KRegularFieldHeightLargeFont(25);
       
    73 const TInt KTitlePaneHeight(26);
       
    74 
       
    75 // Basic margins
       
    76 const TInt KBasicTopMargin( 3 );
       
    77 const TInt KBasicBottomMargin( 3 );
       
    78 const TInt KBasicLeftMargin( 9 );
       
    79 const TInt KBasicTightMargin( 3 );
       
    80 
       
    81 // Response area related
       
    82 #define KResponseAreaAnswerTextSize TSize( 180, 25 )
       
    83 #define KResponseAreaTopicTextSizePortrait TSize( 212, 25 )
       
    84 #define KResponseAreaTopicTextSizeLandscape TSize( 280, 25 )
       
    85 #define KResponseAreaAnswerTextPositionSmallFont TPoint( 27, 3 )
       
    86 #define KResponseAreaAnswerTextPositionNormalFont TPoint( 27, 3 )
       
    87 #define KResponseAreaAnswerTextPositionLargeFont TPoint( 27, 5 )
       
    88 #define KResponseAreaAnswerIconPositionSmallFont TPoint( 8, 3 )
       
    89 #define KResponseAreaAnswerIconPositionNormalFont TPoint( 8, 5 )
       
    90 #define KResponseAreaAnswerIconPositionLargeFont TPoint( 8, 7 )
       
    91 #define KResponseAreaAnswerTextPositionSmallFontMirrored TPoint( 46, 3 )
       
    92 #define KResponseAreaAnswerTextPositionNormalFontMirrored TPoint( 46, 3 )
       
    93 #define KResponseAreaAnswerTextPositionLargeFontMirrored TPoint( 46, 5 )
       
    94 
       
    95 #define KResponseAreaAnswerTextPositionSmallFontMirroredLandscape TPoint( 127, 3 )
       
    96 #define KResponseAreaAnswerTextPositionNormalFontMirroredLandscape TPoint( 127, 3 )
       
    97 #define KResponseAreaAnswerTextPositionLargeFontMirroredLandscape TPoint( 127, 5 )
       
    98 #define KResponseAreaAnswerIconPositionSmallFontMirroredLandscape TPoint( 280, 3 )
       
    99 #define KResponseAreaAnswerIconPositionNormalFontMirroredLandscape TPoint( 280, 5 )
       
   100 #define KResponseAreaAnswerIconPositionLargeFontMirroredLandscape TPoint( 280, 7 )
       
   101 
       
   102 
       
   103 #define KResponseAreaAnswerIconPositionSmallFontMirrored TPoint( 194, 3 )
       
   104 #define KResponseAreaAnswerIconPositionNormalFontMirrored TPoint( 194, 5 )
       
   105 #define KResponseAreaAnswerIconPositionLargeFontMirrored TPoint( 194, 7 )
       
   106 
       
   107 #define KConflictPopupPositionPortrait TPoint(30,150)
       
   108 #define KConflictPopupPositionLandscape TPoint(30,100)
       
   109 
       
   110 const TInt KResponseAreaAnserItemHeightSmallFont(20);
       
   111 const TInt KResponseAreaAnserItemHeightNormalFont(22);
       
   112 const TInt KResponseAreaAnserItemHeightLargeFont(26);
       
   113 
       
   114 // Organizer field related
       
   115 const TInt KOrganizerTextWidth(150);
       
   116 
       
   117 // Color id:s KViewerAreaTextColorID
       
   118 const TInt KViewerAreaTextColorID( EAknsCIQsnTextColorsCG6 );
       
   119 const TInt KViewerAreaHighlightedTextColorID( EAknsCIQsnHighlightColorsCG2 );
       
   120 const TInt KNormalTextColorID( EAknsCIQsnTextColorsCG26 );
       
   121 const TInt KNormalHighLightedTextColorID( EAknsCIQsnTextColorsCG24 );
       
   122 const TInt KTitleAreaTextColorID( EAknsCIQsnTextColorsCG2 );
       
   123 const TInt KNormalTextBgColorID( EAknsCIFsOtherColorsCG12 );
       
   124 const TInt KListAreaTextColorID( EAknsCIQsnTextColorsCG6 );
       
   125 const TInt KListAreaBgColorID( EAknsCIFsOtherColorsCG13 );
       
   126 const TInt KFieldBorderColorID( EAknsCIFsOtherColorsCG14 );
       
   127 
       
   128 
       
   129 #define KDefaultListAreaBgColor TRgb( 0xffffff );
       
   130 #define KDefaultBorderColor TRgb( 0x000000 );
       
   131 #define KDefaultTextColor TRgb( 0x000000 );
       
   132 #define KDefaultNormalTextBgColor TRgb( 0xe8e8e8 );
       
   133 
       
   134 // Text side margin in basic field (editor & viewer )
       
   135 const TInt KTextSideMargin( 5 );
       
   136 
       
   137 TESMRFontSize MapFontSettingToFontSize(
       
   138         TInt& aCurrentFontSetting )
       
   139     {
       
   140     TESMRFontSize fontSize( EESMRFontNormal );
       
   141 
       
   142     if ( EAknUiZoomSmall == aCurrentFontSetting )
       
   143         {
       
   144         fontSize = EESMRFontSmall;
       
   145         }
       
   146     else if ( EAknUiZoomLarge == aCurrentFontSetting )
       
   147         {
       
   148         fontSize = EESMRFontLarge;
       
   149         }
       
   150     return fontSize;
       
   151     }
       
   152 
       
   153 TBool FindFieldSizeInfoById(
       
   154         const CESMRLayoutManager::SFieldSize& aLhs,
       
   155         const CESMRLayoutManager::SFieldSize& aRhs )
       
   156     {
       
   157     if ( aLhs.iId == aRhs.iId )
       
   158         {
       
   159         return ETrue;
       
   160         }
       
   161     return EFalse;
       
   162     }
       
   163 
       
   164 }  // namespace
       
   165 
       
   166 // ======== MEMBER FUNCTIONS ========
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // CESMRLayoutManager::CESMRLayoutManager
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 inline CESMRLayoutManager::CESMRLayoutManager()
       
   173 :   iFontSettingsValue( EAknUiZoomNormal ),
       
   174     iFontSettingsChanged( EFalse )
       
   175     {
       
   176     FUNC_LOG;
       
   177     // Do nothing
       
   178     }
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // CESMRLayoutManager::~CESMRLayoutManager
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 CESMRLayoutManager::~CESMRLayoutManager()
       
   185     {
       
   186     FUNC_LOG;
       
   187     iSize.Reset();
       
   188     iSize.Close();
       
   189     delete iFont;
       
   190     delete iMfneFont;
       
   191     if ( iNotifyHandler )
       
   192         {
       
   193         iNotifyHandler->StopListening();
       
   194         }
       
   195     delete iNotifyHandler;
       
   196     delete iFontSettings;// session can be deleted only after iNotifyHandler
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // CESMRLayoutManager::NewL
       
   201 // ---------------------------------------------------------------------------
       
   202 //
       
   203 CESMRLayoutManager* CESMRLayoutManager::NewL()
       
   204     {
       
   205     FUNC_LOG;
       
   206     CESMRLayoutManager* self = new (ELeave) CESMRLayoutManager;
       
   207     CleanupStack::PushL( self );
       
   208     self->ConstructL();
       
   209     CleanupStack::Pop( self );
       
   210     return self;
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CESMRLayoutManager::ConstructL
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 void CESMRLayoutManager::ConstructL()
       
   218     {
       
   219     FUNC_LOG;
       
   220     // args: field id, height(smallfont), 
       
   221     //       height(normalfont), height(largefont),
       
   222     //       width(landscape), width(portrait)
       
   223 
       
   224     AddSize( EESMRFieldAttendeeLabel,               20, 22, 26, 299, 218 );
       
   225     AddSize( EESMRFieldAttendee,                    20, 22, 26, 299, 218 );
       
   226     AddSize( EESMRFieldOptAttendee,                 20, 22, 26, 299, 218 );
       
   227     AddSize( EESMRFieldMeetingTime,                 22, 24, 26, 299, 218 );
       
   228     AddSize( EESMRFieldStartDate,                   22, 24, 26, 299, 218 );
       
   229     AddSize( EESMRFieldStopDate,                    22, 24, 26, 299, 218 );
       
   230     AddSize( EESMRFieldLocation,                    19, 21, 25, 299, 218 );
       
   231     AddSize( EESMRFieldAlarm,                       22, 24, 26, 299, 218 );
       
   232     AddSize( EESMRFieldAlarmDate,                   22, 24, 26, 299, 218 );
       
   233     AddSize( EESMRFieldSubject,                     19, 21, 25, 299, 218 );
       
   234     AddSize( EESMRFieldOccasion,                    19, 21, 25, 299, 218 );
       
   235     AddSize( EESMRFieldDescription,                 60, 63, 60, 299, 218 ); 
       
   236     AddSize( EESMRFieldRecurrence,                  22, 24, 28, 299, 218 );
       
   237     AddSize( EESMRFieldRecurrenceDate,              44, 49, 53, 299, 218 ); 
       
   238     AddSize( EESMRFieldPriority,                    24, 26, 26, 299, 218 );
       
   239     AddSize( EESMRFieldAllDayEvent,                 20, 22, 26, 299, 218 );
       
   240     AddSize( EESMRFieldAlarmOnOff,                  20, 22, 26, 299, 218 );
       
   241     AddSize( EESMRFieldAlarmTime,                   22, 24, 26, 299, 218 );
       
   242     AddSize( EESMRFieldSync,                        22, 24, 28, 299, 218 );
       
   243     AddSize( EESMRFieldViewerBasic,                 20, 22, 26, 299, 218 );
       
   244     AddSize( EESMRFieldOrganizer,                   40, 44, 52, 299, 218 );
       
   245     AddSize( EESMRFieldResponseArea,                93, 102, 120, 299,218 );
       
   246     AddSize( EESMRFieldResponseAreaWithOneItem,     48, 57, 65, 299, 218 );
       
   247     AddSize( EESMRFieldResponseReadyArea,           24, 26, 28, 299, 218 );
       
   248     AddSize( EESMRFieldDetailedSubject,             20, 22, 25, 299, 218 );
       
   249     AddSize( EESMRFieldAttachments,                 22, 24, 28, 299, 218 );
       
   250     AddSize( EESMRFieldReqTrack,                    20, 22, 26, 299, 218 );
       
   251     AddSize( EESMRFieldOptTrack,                    20, 22, 26, 299, 218 );
       
   252     AddSize( EESMRTrackStatus,                      20, 22, 26, 299, 218 );
       
   253 
       
   254     iFontSettings = CRepository::NewL( KCRUidAvkon );
       
   255     iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iFontSettings,
       
   256             CCenRepNotifyHandler::EIntKey, KAknGlobalUiZoom );
       
   257     iNotifyHandler->StartListeningL();
       
   258 
       
   259     // Check the current font size
       
   260     TAknUiZoom zoom;
       
   261     zoom = static_cast<CAknAppUi*>(
       
   262             CEikonEnv::Static()->AppUi()// codescanner::eikonenvstatic
       
   263                 )->LocalUiZoom();
       
   264 
       
   265     if ( zoom == EAknUiZoomAutomatic )
       
   266         {
       
   267         CAknEnv::Static()->GetCurrentGlobalUiZoom( zoom );
       
   268         }
       
   269 
       
   270     iFontSettingsValue = zoom;
       
   271 
       
   272     // Check the font settings, note that id is not used yet (can be anything)
       
   273     Font(CCoeEnv::Static(), EESMRFieldViewerBasic );
       
   274     }
       
   275 
       
   276 // ---------------------------------------------------------------------------
       
   277 // CESMRLayoutManager::CurrentFontSizeL
       
   278 // ---------------------------------------------------------------------------
       
   279 //
       
   280 TInt CESMRLayoutManager::CurrentFontZoom()
       
   281     {
       
   282     FUNC_LOG;
       
   283     return iFontSettingsValue;
       
   284     }
       
   285 
       
   286 // ---------------------------------------------------------------------------
       
   287 // CESMRLayoutManager::FieldSize
       
   288 // ---------------------------------------------------------------------------
       
   289 //
       
   290 TSize CESMRLayoutManager::FieldSize( TESMREntryFieldId aId )
       
   291     {
       
   292     FUNC_LOG;
       
   293     TSize size( 0, 0 );
       
   294 
       
   295     CESMRLayoutManager::SFieldSize fieldToFound;
       
   296     fieldToFound.iId = aId;
       
   297 
       
   298     TInt pos = iSize.Find( fieldToFound, FindFieldSizeInfoById );
       
   299     if ( KErrNotFound != pos )
       
   300         {
       
   301         TInt width = Layout_Meta_Data::IsLandscapeOrientation() ?
       
   302                 iSize[pos].iWidthLandscape : iSize[pos].iWidthPortrait;
       
   303 
       
   304         TInt height;
       
   305 
       
   306         // Field height depends on font height
       
   307         // Field height when small font is in use
       
   308         if( iFontSettingsValue == EAknUiZoomSmall ||
       
   309             iFontSettingsValue == EAknUiZoomVerySmall )
       
   310             {
       
   311             height = iSize[pos].iFontSmallHeight;
       
   312             }
       
   313         // Field height when large font is in use
       
   314         else if( iFontSettingsValue == EAknUiZoomLarge ||
       
   315             iFontSettingsValue == EAknUiZoomVeryLarge )
       
   316             {
       
   317             height = iSize[pos].iFontLargeHeight;
       
   318             }
       
   319         // Field height if font height is not specified or it's normal
       
   320         else
       
   321             {
       
   322             height = iSize[pos].iFontNormalHeight;
       
   323             }
       
   324 
       
   325         size.SetSize( width, height );
       
   326         }
       
   327 
       
   328     return size;
       
   329     }
       
   330 
       
   331 // ---------------------------------------------------------------------------
       
   332 // CESMRLayoutManager::Font
       
   333 // ---------------------------------------------------------------------------
       
   334 //
       
   335 const CFont* CESMRLayoutManager::Font(
       
   336         CCoeEnv* /*aEnv*/,
       
   337         TESMREntryFieldId aId )
       
   338     {
       
   339     FUNC_LOG;
       
   340     if ( !iFont || !iMfneFont )
       
   341         {
       
   342         TAknFontSpecification aknFontSpec( EAknLogicalFontTitleFont );
       
   343         aknFontSpec.SetUnits( TAknFontSpecification::EPixels );
       
   344 
       
   345         TESMRFontSize fontSize = MapFontSettingToFontSize( iFontSettingsValue );
       
   346 
       
   347         // text pane height for edwins (text fields)
       
   348         aknFontSpec.SetTextPaneHeight( fontSize );
       
   349 
       
   350         // There is nothing mrui can do if this method leaves
       
   351         delete iFont;
       
   352         iFont = NULL;
       
   353         TRAP_IGNORE( iFont = AknLayoutUtils::
       
   354                 CreateLayoutFontFromSpecificationL( aknFontSpec ) );
       
   355 
       
   356         if ( fontSize == EESMRFontLarge )
       
   357             {
       
   358             // If large font is used:
       
   359             aknFontSpec.SetTextPaneHeight( fontSize - 2);
       
   360             }
       
   361         else
       
   362             {
       
   363             aknFontSpec.SetTextPaneHeight( fontSize - 1);
       
   364             }
       
   365 
       
   366 
       
   367         // separate font for CEikMfne based controls:
       
   368         delete iMfneFont;
       
   369         iMfneFont = NULL;
       
   370 
       
   371         TRAP_IGNORE( iMfneFont = AknLayoutUtils::
       
   372                 CreateLayoutFontFromSpecificationL( aknFontSpec ) );
       
   373 
       
   374         }
       
   375     if ( aId == EESMRFieldStartDate ||
       
   376          aId == EESMRFieldStopDate ||
       
   377          aId == EESMRFieldMeetingTime ||
       
   378          aId == EESMRFieldAlarmDate ||
       
   379          aId == EESMRFieldRecurrenceDate ||
       
   380          aId == EESMRFieldAlarmTime ||
       
   381          aId == EESMRFieldDate )
       
   382         {
       
   383         return static_cast<const CFont*>(iMfneFont);
       
   384         }
       
   385     else
       
   386         {
       
   387         return static_cast<const CFont*>(iFont);
       
   388         }
       
   389     }
       
   390 // ---------------------------------------------------------------------------
       
   391 // CESMRLayoutManager::Margins
       
   392 // ---------------------------------------------------------------------------
       
   393 //
       
   394 TMargins CESMRLayoutManager::Margins(
       
   395         TMarginsId /*aId*/ )
       
   396     {
       
   397     FUNC_LOG;
       
   398     TMargins m;
       
   399     m.iTop = KBasicTopMargin;
       
   400     m.iBottom = KBasicBottomMargin;
       
   401     m.iLeft = KBasicLeftMargin;
       
   402     m.iRight = KBasicTightMargin;
       
   403     return m;
       
   404     }
       
   405 
       
   406 // ---------------------------------------------------------------------------
       
   407 // CESMRLayoutManager::IconTopMargin
       
   408 // ---------------------------------------------------------------------------
       
   409 //
       
   410 TInt CESMRLayoutManager::IconTopMargin()
       
   411     {
       
   412     FUNC_LOG;
       
   413     TInt retValue = 0;
       
   414 
       
   415     switch ( iFontSettingsValue )
       
   416         {
       
   417         case EAknUiZoomSmall: //Fallthrough
       
   418         case EAknUiZoomVerySmall:
       
   419             {
       
   420             retValue = KIconTopMarginSmallFont;
       
   421             break;
       
   422             }
       
   423         case EAknUiZoomNormal:
       
   424             {
       
   425             retValue = KIconTopMarginNormalFont;
       
   426             break;
       
   427             }
       
   428         case EAknUiZoomLarge: //Fallthrough
       
   429         case EAknUiZoomVeryLarge:
       
   430             {
       
   431             retValue = KIconTopMarginLargeFont;
       
   432             break;
       
   433             }
       
   434         default:
       
   435             {
       
   436             retValue = KIconTopMarginNormalFont;
       
   437             break;
       
   438             }
       
   439         }
       
   440     return retValue;
       
   441     }
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // CESMRLayoutManager::TextTopMargin
       
   445 // ---------------------------------------------------------------------------
       
   446 //
       
   447 TInt CESMRLayoutManager::TextTopMargin()
       
   448     {
       
   449     FUNC_LOG;
       
   450     TInt retValue = 0;
       
   451 
       
   452     switch ( iFontSettingsValue )
       
   453         {
       
   454         case EAknUiZoomSmall: //Fallthrough
       
   455         case EAknUiZoomVerySmall:
       
   456             {
       
   457             retValue = EESMRTextTopMarginSmall;
       
   458             break;
       
   459             }
       
   460         case EAknUiZoomNormal:
       
   461             {
       
   462             retValue = EESMRTextTopMarginNormal;
       
   463             break;
       
   464             }
       
   465         case EAknUiZoomLarge: //Fallthrough
       
   466         case EAknUiZoomVeryLarge:
       
   467             {
       
   468             retValue = EESMRTextTopMarginLarge;
       
   469             break;
       
   470             }
       
   471         default:
       
   472             {
       
   473             retValue = KIconTopMarginNormalFont;
       
   474             break;
       
   475             }
       
   476         }
       
   477     return retValue;
       
   478     }
       
   479 
       
   480 // ---------------------------------------------------------------------------
       
   481 // CESMRLayoutManager::TextSideMargin
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 TInt CESMRLayoutManager::TextSideMargin()
       
   485     {
       
   486     FUNC_LOG;
       
   487     return KTextSideMargin;
       
   488     }
       
   489 
       
   490 // ---------------------------------------------------------------------------
       
   491 // CESMRLayoutManager::TitlePaneHeight
       
   492 // ---------------------------------------------------------------------------
       
   493 //
       
   494 TInt CESMRLayoutManager::TitlePaneHeight()
       
   495     {
       
   496     FUNC_LOG;
       
   497     return KTitlePaneHeight;
       
   498     }
       
   499 
       
   500 // ---------------------------------------------------------------------------
       
   501 // CESMRLayoutManager::AddSize
       
   502 // ---------------------------------------------------------------------------
       
   503 //
       
   504 void CESMRLayoutManager::AddSize(
       
   505         TESMREntryFieldId aId,
       
   506         TInt aFontSmallHeight,
       
   507         TInt aFontNormalHeight,
       
   508         TInt aFontLargeHeight,
       
   509         TInt aWidthLandscape,
       
   510         TInt aWidthPortrait )
       
   511     {
       
   512     FUNC_LOG;
       
   513     SFieldSize size;
       
   514     size.iId = aId;
       
   515     size.iFontSmallHeight = aFontSmallHeight;
       
   516     size.iFontNormalHeight = aFontNormalHeight;
       
   517     size.iFontLargeHeight = aFontLargeHeight;
       
   518     size.iWidthLandscape = aWidthLandscape;
       
   519     size.iWidthPortrait = aWidthPortrait;
       
   520     iSize.Append( size );
       
   521     }
       
   522 
       
   523 // ---------------------------------------------------------------------------
       
   524 // CESMRLayoutManager::IsMirrored
       
   525 // ---------------------------------------------------------------------------
       
   526 //
       
   527 EXPORT_C TBool CESMRLayoutManager::IsMirrored()
       
   528     {
       
   529     FUNC_LOG;
       
   530     return Layout_Meta_Data::IsMirrored();
       
   531     }
       
   532 
       
   533 // ---------------------------------------------------------------------------
       
   534 // CESMRLayoutManager::SetBitmapFallback
       
   535 // If a new scalable graphic
       
   536 // is added to the mif file, it should be mapped to fallback here.
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 EXPORT_C void CESMRLayoutManager::SetBitmapFallback(const TAknsItemID& aIconId,
       
   540                                                 TInt& aFileIndex,
       
   541                                                 TInt& aFileMaskIndex)
       
   542     {
       
   543 // <cmail> icons changed
       
   544     FUNC_LOG;
       
   545     switch ( aIconId.iMinor )
       
   546         {
       
   547         case EAknsMinorGenericQgnFscalIndiPriorityHigh:
       
   548         case EAknsMinorGenericQgnFsIndiPriorityHigh:
       
   549             {
       
   550             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_high;
       
   551             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_high_mask;
       
   552             break;
       
   553             }
       
   554         case EAknsMinorGenericQgnFscalIndiPriorityNormal:
       
   555         case EAknsMinorGenericQgnFsIndiPriorityNormal:
       
   556             {
       
   557             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_normal;
       
   558             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_normal_mask;
       
   559             break;
       
   560             }
       
   561         case EAknsMinorGenericQgnFscalIndiPriorityLow:
       
   562         case EAknsMinorGenericQgnFsIndiPriorityLow:
       
   563             {
       
   564             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_low;
       
   565             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_low_mask;
       
   566             break;
       
   567             }
       
   568         case EAknsMinorGenericQgnFscalIndiAlarmDay:
       
   569             {
       
   570             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_day;
       
   571             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_day_mask;
       
   572             break;
       
   573             }
       
   574         case EAknsMinorGenericQgnFscalIndiAlarmTime:
       
   575             {
       
   576             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm;
       
   577             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_mask;
       
   578             break;
       
   579             }
       
   580         case EAknsMinorGenericQgnFscalIndiSubject:
       
   581             {
       
   582             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_subject;
       
   583             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_subject_mask;
       
   584             break;
       
   585             }
       
   586         case EAknsMinorGenericQgnFscalIndiRecurrence:
       
   587             {
       
   588             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_recurrence;
       
   589             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_recurrence_mask;
       
   590             break;
       
   591             }
       
   592         case EAknsMinorGenericQgnMeetReqIndiAlarm:
       
   593             {
       
   594             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_alarm;
       
   595             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_alarm_mask;
       
   596             break;
       
   597             }
       
   598         case EAknsMinorGenericQgnMeetReqIndiCheckboxMark:
       
   599             {
       
   600             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_on;
       
   601             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_on_mask;
       
   602             break;
       
   603             }
       
   604         case EAknsMinorGenericQgnMeetReqIndiCheckboxUnmark:
       
   605             {
       
   606             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_off;
       
   607             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_off_mask;
       
   608             break;
       
   609             }
       
   610         case EAknsMinorGenericQgnMeetReqIndiClock:
       
   611             {
       
   612             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_clock;
       
   613             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_clock_mask;
       
   614             break;
       
   615             }
       
   616         case EAknsMinorGenericQgnMeetReqIndiDateEnd:
       
   617             {
       
   618             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_end;
       
   619             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_end_mask;
       
   620             break;
       
   621             }
       
   622         case EAknsMinorGenericQgnMeetReqIndiDateStart:
       
   623             {
       
   624             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_start;
       
   625             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_start_mask;
       
   626             break;
       
   627             }
       
   628         case EAknsMinorGenericQgnMeetReqIndiLocation:
       
   629             {
       
   630             aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_location;
       
   631             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_location_mask;
       
   632             break;
       
   633             }
       
   634         case EAknsMinorGenericQgnFscalIndiSynchronisation:
       
   635             {
       
   636             aFileIndex = EMbmEsmrguiQgn_indi_cmail_synchronisation;
       
   637             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_synchronisation_mask;
       
   638             break;
       
   639             }
       
   640         case EAknsMinorGenericQgnFscalIndiOccasion:
       
   641             {
       
   642             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_occasion;
       
   643             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_occasion_mask;
       
   644             break;
       
   645             }
       
   646 
       
   647         case EAknsMinorGenericQgnFsIndiCaleTrackingTentative:
       
   648             {
       
   649             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_tentative;
       
   650             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_tentative_mask;
       
   651             break;
       
   652             }
       
   653         case EAknsMinorGenericQgnFsIndiCaleTrackingAccept:
       
   654             {
       
   655             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_accept;
       
   656             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_accept_mask;
       
   657             break;
       
   658             }
       
   659         case EAknsMinorGenericQgnFsIndiCaleTrackingNone:
       
   660             {
       
   661             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_none;
       
   662             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_none_mask;
       
   663             break;
       
   664             }
       
   665         case EAknsMinorGenericQgnFsIndiCaleTrackingReject:
       
   666             {
       
   667             aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_reject;
       
   668             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_reject_mask;
       
   669             break;
       
   670             }
       
   671         case EAknsMinorGenericQgnFseMailAttachment:
       
   672             {
       
   673             aFileIndex = EMbmEsmrguiQgn_indi_cmail_attachment;
       
   674             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_attachment_mask;
       
   675             break;
       
   676             }
       
   677         case EAknsMinorGenericQgnFsGrafEmailCtrlbar:
       
   678             {
       
   679             aFileIndex = EMbmEsmrguiQgn_graf_cmail_email_ctrlbar;
       
   680             aFileMaskIndex = EMbmEsmrguiQgn_graf_cmail_email_ctrlbar_mask;
       
   681             break;
       
   682             }
       
   683         case EAknsMinorQgnPropCheckboxOn:
       
   684             aFileIndex = EMbmEsmrguiQgn_prop_checkbox_on;
       
   685             aFileMaskIndex = EMbmEsmrguiQgn_prop_checkbox_on_mask;
       
   686         	break;
       
   687         case EAknsMinorQgnPropCheckboxOff:
       
   688             aFileIndex = EMbmEsmrguiQgn_prop_checkbox_off;
       
   689             aFileMaskIndex = EMbmEsmrguiQgn_prop_checkbox_off_mask;
       
   690         	break;
       
   691         case EAknsMinorQgnFsListCenter:
       
   692             {
       
   693             aFileIndex = EMbmEsmrguiQsn_fr_list_center;
       
   694             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_center_mask;
       
   695             break;
       
   696             }
       
   697         case EAknsMinorQgnFsListSideT:
       
   698             {
       
   699             aFileIndex = EMbmEsmrguiQsn_fr_list_side_t;
       
   700             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_t_mask;
       
   701             break;
       
   702             }
       
   703         case EAknsMinorQgnFsListSideL:
       
   704             {
       
   705             aFileIndex = EMbmEsmrguiQsn_fr_list_side_l;
       
   706             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_l_mask;
       
   707             break;
       
   708             }
       
   709         case EAknsMinorQgnFsListSideR:
       
   710             {
       
   711             aFileIndex = EMbmEsmrguiQsn_fr_list_side_r;
       
   712             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_r_mask;
       
   713             break;
       
   714             }
       
   715         case EAknsMinorQgnFsListSideB:
       
   716             {
       
   717             aFileIndex = EMbmEsmrguiQsn_fr_list_side_b;
       
   718             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_b_mask;
       
   719             break;
       
   720             }
       
   721         case EAknsMinorQgnFsListCornerTl:
       
   722             {
       
   723             aFileIndex = EMbmEsmrguiQsn_fr_list_corner_tl;
       
   724             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_tl_mask;
       
   725             break;
       
   726             }
       
   727         case EAknsMinorQgnFsListCornerTr:
       
   728             {
       
   729             aFileIndex = EMbmEsmrguiQsn_fr_list_corner_tr;
       
   730             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_tr_mask;
       
   731             break;
       
   732             }
       
   733         case EAknsMinorQgnFsListCornerBl:
       
   734             {
       
   735             aFileIndex = EMbmEsmrguiQsn_fr_list_corner_bl;
       
   736             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_bl_mask;
       
   737             break;
       
   738             }
       
   739         case EAknsMinorQgnFsListCornerBr:
       
   740             {
       
   741             aFileIndex = EMbmEsmrguiQsn_fr_list_corner_br;
       
   742             aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_br_mask;
       
   743             break;
       
   744             }
       
   745         case EAknsMinorGenericQgnFsHscrActionArrowLeft:
       
   746             {
       
   747             aFileIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right;
       
   748             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right_mask;
       
   749             break;
       
   750             }
       
   751         // <cmail> removed when icons changed to common ones
       
   752         /*    
       
   753         case EAknsMinorGenericQgnFsHscrActionArrowRight:
       
   754             {
       
   755             aFileIndex = EMbmEsmrguiQgn_indi_action_menu;
       
   756             aFileMaskIndex = EMbmEsmrguiQgn_indi_action_menu_mask;
       
   757             break;
       
   758             }
       
   759             */
       
   760         // </cmail>    
       
   761         // <cmail> Commented to enable compilation in wk04
       
   762         /*case EAknsMinorGenericQgnFseActionMenuOpenInWebIcon:
       
   763             {
       
   764             aFileIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_web_icon;
       
   765             aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_web_icon;
       
   766             break;
       
   767             }
       
   768         case EAknsMinorGenericQgnFseActionMenuOpenInIntranetIcon:
       
   769             {
       
   770             aFileIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_intranet_icon;
       
   771             aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_intranet_icon_mask;
       
   772             break;
       
   773             }
       
   774         case EAknsMinorGenericQgnFseActionMenuBookmarkIcon:
       
   775             {
       
   776             aFileIndex = EMbmEsmrguiQgn_fse_action_menu_bookmark_icon;
       
   777             aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_bookmark_icon_mask;
       
   778             break;
       
   779             }*/
       
   780         // </cmail>
       
   781         // <cmail> removed when icons changed to common ones
       
   782         /*          
       
   783         case EAknsMinorGenericQgnPropBlidWaypoint:
       
   784             {
       
   785             aFileIndex = EMbmEsmrguiQgn_fs_action_show_on_maps;
       
   786             aFileMaskIndex = EMbmEsmrguiQgn_fs_action_show_on_maps_mask;
       
   787             break;
       
   788             }
       
   789             */
       
   790         // </cmail>             
       
   791         default:
       
   792             {
       
   793             // <cmail> icons changed    
       
   794             aFileIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right;
       
   795             aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right_mask;
       
   796             break;
       
   797             // </cmail>              
       
   798             }
       
   799           
       
   800 // </cmail>
       
   801         }
       
   802     }
       
   803 
       
   804 
       
   805 
       
   806 // ---------------------------------------------------------------------------
       
   807 // CESMRLayoutManager::ResponseAreaAnswerTextSize
       
   808 // ---------------------------------------------------------------------------
       
   809 //
       
   810 TSize CESMRLayoutManager::ResponseAreaAnswerTextSize()
       
   811     {
       
   812     FUNC_LOG;
       
   813     return KResponseAreaAnswerTextSize;
       
   814     }
       
   815 
       
   816 // ---------------------------------------------------------------------------
       
   817 // CESMRLayoutManager::ResponseAreaTopicTextSize
       
   818 // ---------------------------------------------------------------------------
       
   819 //
       
   820 TSize CESMRLayoutManager::ResponseAreaTopicTextSize()
       
   821     {
       
   822     FUNC_LOG;
       
   823     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   824         {
       
   825         return KResponseAreaTopicTextSizeLandscape;
       
   826         }
       
   827     else
       
   828         {
       
   829         return KResponseAreaTopicTextSizePortrait;
       
   830         }
       
   831     }
       
   832 
       
   833 
       
   834 // ---------------------------------------------------------------------------
       
   835 // CESMRLayoutManager::ResponseAreaAnswerTextPosition
       
   836 // ---------------------------------------------------------------------------
       
   837 //
       
   838 TPoint CESMRLayoutManager::ResponseAreaAnswerTextPosition()
       
   839     {
       
   840     FUNC_LOG;
       
   841     TPoint retValue;
       
   842     TBool mirrored = IsMirrored();
       
   843 
       
   844     switch ( iFontSettingsValue )
       
   845         {
       
   846         case EAknUiZoomSmall: //Fallthrough
       
   847         case EAknUiZoomVerySmall:
       
   848             {
       
   849             if( !mirrored )
       
   850                 {
       
   851                 retValue = KResponseAreaAnswerTextPositionSmallFont;
       
   852                 }
       
   853             else
       
   854                 {
       
   855                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   856                     {
       
   857                     retValue = 
       
   858                      KResponseAreaAnswerTextPositionSmallFontMirroredLandscape;
       
   859                     }
       
   860                 else
       
   861                     {
       
   862                     retValue = 
       
   863                      KResponseAreaAnswerTextPositionSmallFontMirrored;
       
   864                     }
       
   865                 }
       
   866             break;
       
   867             }
       
   868         case EAknUiZoomNormal:
       
   869             {
       
   870             if( !mirrored )
       
   871                 {
       
   872                 retValue = KResponseAreaAnswerTextPositionNormalFont;
       
   873                 }
       
   874             else
       
   875                 {
       
   876                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   877                     {
       
   878                     retValue = 
       
   879                      KResponseAreaAnswerTextPositionNormalFontMirroredLandscape;
       
   880                     }
       
   881                 else
       
   882                     {
       
   883                     retValue = 
       
   884 						KResponseAreaAnswerTextPositionNormalFontMirrored;
       
   885                     }
       
   886                 }
       
   887             break;
       
   888             }
       
   889         case EAknUiZoomLarge: //Fallthrough
       
   890         case EAknUiZoomVeryLarge:
       
   891             {
       
   892             if( !mirrored )
       
   893                 {
       
   894                 retValue = KResponseAreaAnswerTextPositionLargeFont;
       
   895                 }
       
   896             else
       
   897                 {
       
   898                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   899                     {
       
   900                     retValue = 
       
   901 					 KResponseAreaAnswerTextPositionLargeFontMirroredLandscape;
       
   902                     }
       
   903                 else
       
   904                     {
       
   905                     retValue = 
       
   906 						KResponseAreaAnswerTextPositionLargeFontMirrored;
       
   907                     }
       
   908                 }
       
   909             break;
       
   910             }
       
   911         default:
       
   912             {
       
   913             if( !mirrored )
       
   914                 {
       
   915                 retValue = KResponseAreaAnswerTextPositionLargeFont;
       
   916                 }
       
   917             else
       
   918                 {
       
   919                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   920                     {
       
   921                     retValue = 
       
   922                      KResponseAreaAnswerTextPositionNormalFontMirroredLandscape;
       
   923                     }
       
   924                 else
       
   925                     {
       
   926                     retValue = 
       
   927 						KResponseAreaAnswerTextPositionNormalFontMirrored;
       
   928                     }
       
   929                 }
       
   930             break;
       
   931             }
       
   932         }
       
   933     return retValue;
       
   934     }
       
   935 
       
   936 
       
   937 // ---------------------------------------------------------------------------
       
   938 // CESMRLayoutManager::ResponseAreaAnswerIconPosition
       
   939 // ---------------------------------------------------------------------------
       
   940 //
       
   941 TPoint CESMRLayoutManager::ResponseAreaAnswerIconPosition()
       
   942     {
       
   943     FUNC_LOG;
       
   944     TPoint retValue;
       
   945     TBool mirrored = IsMirrored();
       
   946 
       
   947     switch ( iFontSettingsValue )
       
   948         {
       
   949         case EAknUiZoomSmall: //Fallthrough
       
   950         case EAknUiZoomVerySmall:
       
   951             {
       
   952             if( !mirrored )
       
   953                 {
       
   954                 retValue = KResponseAreaAnswerIconPositionSmallFont;
       
   955                 }
       
   956             else
       
   957                 {
       
   958                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   959                     {
       
   960                     retValue = 
       
   961                      KResponseAreaAnswerIconPositionSmallFontMirroredLandscape;
       
   962                     }
       
   963                 else
       
   964                     {
       
   965                     retValue = 
       
   966 						KResponseAreaAnswerIconPositionSmallFontMirrored;
       
   967                     }
       
   968                 }
       
   969             break;
       
   970             }
       
   971         case EAknUiZoomNormal:
       
   972             {
       
   973             if( !mirrored )
       
   974                 {
       
   975                 retValue = KResponseAreaAnswerIconPositionNormalFont;
       
   976                 }
       
   977             else
       
   978                 {
       
   979                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   980                     {
       
   981                     retValue = 
       
   982                      KResponseAreaAnswerIconPositionNormalFontMirroredLandscape;
       
   983                     }
       
   984                 else
       
   985                     {
       
   986                     retValue = 
       
   987 						KResponseAreaAnswerIconPositionNormalFontMirrored;
       
   988                     }
       
   989                 }
       
   990             break;
       
   991             }
       
   992         case EAknUiZoomLarge: //Fallthrough
       
   993         case EAknUiZoomVeryLarge:
       
   994             {
       
   995             if( !mirrored )
       
   996                 {
       
   997                 retValue = KResponseAreaAnswerIconPositionLargeFont;
       
   998                 }
       
   999             else
       
  1000                 {
       
  1001                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1002                     {
       
  1003                     retValue = 
       
  1004                      KResponseAreaAnswerIconPositionLargeFontMirroredLandscape;
       
  1005                     }
       
  1006                 else
       
  1007                     {
       
  1008                     retValue = 
       
  1009 						KResponseAreaAnswerIconPositionLargeFontMirrored;
       
  1010                     }
       
  1011                 }
       
  1012             break;
       
  1013             }
       
  1014         default:
       
  1015             {
       
  1016             if( !mirrored )
       
  1017                 {
       
  1018                 retValue = KResponseAreaAnswerIconPositionNormalFont;
       
  1019                 }
       
  1020             else
       
  1021                 {
       
  1022                 if( Layout_Meta_Data::IsLandscapeOrientation() )
       
  1023                     {
       
  1024                     retValue = 
       
  1025 					 KResponseAreaAnswerIconPositionNormalFontMirroredLandscape;
       
  1026                     }
       
  1027                 else
       
  1028                     {
       
  1029                     retValue = 
       
  1030 						KResponseAreaAnswerIconPositionNormalFontMirrored;
       
  1031                     }
       
  1032                 }
       
  1033             break;
       
  1034             }
       
  1035         }
       
  1036     return retValue;
       
  1037     }
       
  1038 
       
  1039 // ---------------------------------------------------------------------------
       
  1040 // CESMRLayoutManager::ResponseAreaAnswerItemheight
       
  1041 // ---------------------------------------------------------------------------
       
  1042 //
       
  1043 TInt CESMRLayoutManager::ResponseAreaAnswerItemheight()
       
  1044     {
       
  1045     FUNC_LOG;
       
  1046     TInt retValue;
       
  1047 
       
  1048     switch ( iFontSettingsValue )
       
  1049         {
       
  1050         case EAknUiZoomSmall: //Fallthrough
       
  1051         case EAknUiZoomVerySmall:
       
  1052             {
       
  1053             retValue = KResponseAreaAnserItemHeightSmallFont;
       
  1054             break;
       
  1055             }
       
  1056         case EAknUiZoomNormal:
       
  1057             {
       
  1058             retValue = KResponseAreaAnserItemHeightNormalFont;
       
  1059             break;
       
  1060             }
       
  1061         case EAknUiZoomLarge: //Fallthrough
       
  1062         case EAknUiZoomVeryLarge:
       
  1063             {
       
  1064             retValue = KResponseAreaAnserItemHeightLargeFont;
       
  1065             break;
       
  1066             }
       
  1067         default:
       
  1068             {
       
  1069             retValue = KResponseAreaAnserItemHeightNormalFont;
       
  1070             break;
       
  1071             }
       
  1072         }
       
  1073     return retValue;
       
  1074     }
       
  1075 
       
  1076 // ---------------------------------------------------------------------------
       
  1077 // CESMRLayoutManager::RegularFieldHeight
       
  1078 // ---------------------------------------------------------------------------
       
  1079 //
       
  1080 TInt CESMRLayoutManager::RegularFieldHeight()
       
  1081     {
       
  1082     FUNC_LOG;
       
  1083     TInt retValue;
       
  1084 
       
  1085     switch ( iFontSettingsValue )
       
  1086         {
       
  1087         case EAknUiZoomSmall: //Fallthrough
       
  1088         case EAknUiZoomVerySmall:
       
  1089             {
       
  1090             retValue = KRegularFieldHeightSmallFont;
       
  1091             break;
       
  1092             }
       
  1093         case EAknUiZoomNormal:
       
  1094             {
       
  1095             retValue = KRegularFieldHeightNormalFont;
       
  1096             break;
       
  1097             }
       
  1098         case EAknUiZoomLarge: //Fallthrough
       
  1099         case EAknUiZoomVeryLarge:
       
  1100             {
       
  1101             retValue = KRegularFieldHeightLargeFont;
       
  1102             break;
       
  1103             }
       
  1104         default:
       
  1105             {
       
  1106             retValue = KRegularFieldHeightNormalFont;
       
  1107             break;
       
  1108             }
       
  1109         }
       
  1110     return retValue;
       
  1111     }
       
  1112 
       
  1113 // ---------------------------------------------------------------------------
       
  1114 // CESMRLayoutManager::OrganizerTextWidth
       
  1115 // ---------------------------------------------------------------------------
       
  1116 //
       
  1117 TInt CESMRLayoutManager::OrganizerTextWidth()
       
  1118     {
       
  1119     FUNC_LOG;
       
  1120     return KOrganizerTextWidth;
       
  1121     }
       
  1122 
       
  1123 // ---------------------------------------------------------------------------
       
  1124 // CESMRLayoutManager::OrganizerTextPosition
       
  1125 // ---------------------------------------------------------------------------
       
  1126 //
       
  1127 TPoint CESMRLayoutManager::OrganizerTextPosition()
       
  1128     {
       
  1129     FUNC_LOG;
       
  1130     TPoint retValue(0,0);
       
  1131     if( IsMirrored() )
       
  1132         {
       
  1133         TInt fieldWidth = FieldSize( EESMRFieldOrganizer ).iWidth;
       
  1134         retValue = TPoint( fieldWidth - KIconSize.iWidth - 
       
  1135         		           ESMRLayout::KIconBorderMargin - OrganizerTextWidth(), 
       
  1136         		           RegularFieldHeight() );
       
  1137         }
       
  1138     else
       
  1139         {
       
  1140         retValue = TPoint( KIconSize.iWidth +
       
  1141                            ESMRLayout::KIconBorderMargin + 
       
  1142 						   TextSideMargin(), 
       
  1143 						   RegularFieldHeight() );
       
  1144         }
       
  1145     return retValue;
       
  1146     }
       
  1147 
       
  1148 // ---------------------------------------------------------------------------
       
  1149 // CESMRLayoutManager::ConflictPopupPosition
       
  1150 // ---------------------------------------------------------------------------
       
  1151 //
       
  1152 EXPORT_C TPoint CESMRLayoutManager::ConflictPopupPosition()
       
  1153     {
       
  1154     FUNC_LOG;
       
  1155 	TPoint PopupPoint = Layout_Meta_Data::IsLandscapeOrientation() ?
       
  1156 		KConflictPopupPositionLandscape : KConflictPopupPositionPortrait ;
       
  1157 
       
  1158 	return PopupPoint;
       
  1159     }
       
  1160 
       
  1161 // ---------------------------------------------------------------------------
       
  1162 // CESMRLayoutManager::ListAreaBgColor
       
  1163 // ---------------------------------------------------------------------------
       
  1164 //
       
  1165 TRgb CESMRLayoutManager::ListAreaBgColor()
       
  1166     {
       
  1167     FUNC_LOG;
       
  1168     TRgb bgColor;
       
  1169     TInt err;
       
  1170 
       
  1171     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1172                                      bgColor,
       
  1173                                      KAknsIIDQsnOtherColors,
       
  1174                                      KListAreaBgColorID );
       
  1175     if( err != KErrNone )
       
  1176         {
       
  1177         bgColor = KDefaultListAreaBgColor;
       
  1178         }
       
  1179 
       
  1180     return bgColor;
       
  1181     }
       
  1182 
       
  1183 // ---------------------------------------------------------------------------
       
  1184 // CESMRLayoutManager::GeneralListAreaTextColor
       
  1185 // ---------------------------------------------------------------------------
       
  1186 //
       
  1187 TRgb CESMRLayoutManager::GeneralListAreaTextColor()
       
  1188     {
       
  1189     FUNC_LOG;
       
  1190     TRgb bgColor;
       
  1191     TInt err;
       
  1192 
       
  1193     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1194                                      bgColor,
       
  1195                                      KAknsIIDQsnTextColors,
       
  1196                                      KListAreaTextColorID );
       
  1197     if( err != KErrNone )
       
  1198         {
       
  1199         bgColor = KDefaultTextColor;
       
  1200         }
       
  1201     return bgColor;
       
  1202     }
       
  1203 
       
  1204 // ---------------------------------------------------------------------------
       
  1205 // CESMRLayoutManager::NormalTextColor
       
  1206 // ---------------------------------------------------------------------------
       
  1207 //
       
  1208 TRgb CESMRLayoutManager::NormalTextColor()
       
  1209     {
       
  1210     FUNC_LOG;
       
  1211     TRgb bgColor;
       
  1212     TInt err;
       
  1213 
       
  1214     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1215                                      bgColor,
       
  1216                                      KAknsIIDQsnTextColors,
       
  1217                                      KNormalTextColorID );
       
  1218     if( err != KErrNone )
       
  1219         {
       
  1220         bgColor = KDefaultTextColor;
       
  1221         }
       
  1222     return bgColor;
       
  1223     }
       
  1224 
       
  1225 // ---------------------------------------------------------------------------
       
  1226 // CESMRLayoutManager::NormalTextColor
       
  1227 // ---------------------------------------------------------------------------
       
  1228 //
       
  1229 TRgb CESMRLayoutManager::HighlightedTextColor()
       
  1230     {
       
  1231     FUNC_LOG;
       
  1232     TRgb bgColor;
       
  1233     TInt err;
       
  1234 
       
  1235     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1236                                      bgColor,
       
  1237                                      KAknsIIDQsnTextColors,
       
  1238                                      KNormalHighLightedTextColorID );
       
  1239     if( err != KErrNone )
       
  1240         {
       
  1241         bgColor = KDefaultTextColor;
       
  1242         }
       
  1243     return bgColor;
       
  1244     }
       
  1245 
       
  1246 // ---------------------------------------------------------------------------
       
  1247 // CESMRLayoutManager::ViewerListAreaTextColor
       
  1248 // ---------------------------------------------------------------------------
       
  1249 //
       
  1250 TRgb CESMRLayoutManager::ViewerListAreaTextColor()
       
  1251     {
       
  1252     FUNC_LOG;
       
  1253     TRgb bgColor;
       
  1254     TInt err;
       
  1255 
       
  1256     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1257                                      bgColor,
       
  1258                                      KAknsIIDQsnTextColors,
       
  1259                                      KViewerAreaTextColorID );
       
  1260     if( err != KErrNone )
       
  1261         {
       
  1262         bgColor = KDefaultTextColor;
       
  1263         }
       
  1264     return bgColor;
       
  1265     }
       
  1266 
       
  1267 // ---------------------------------------------------------------------------
       
  1268 // CESMRLayoutManager::ViewerListAreaHighlightedTextColor
       
  1269 // ---------------------------------------------------------------------------
       
  1270 //
       
  1271 TRgb CESMRLayoutManager::ViewerListAreaHighlightedTextColor()
       
  1272     {
       
  1273     FUNC_LOG;
       
  1274     TRgb bgColor;
       
  1275     TInt err;
       
  1276 
       
  1277     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1278                                      bgColor,
       
  1279                                      KAknsIIDQsnHighlightColors,
       
  1280                                      KViewerAreaHighlightedTextColorID );
       
  1281     if( err != KErrNone )
       
  1282         {
       
  1283         bgColor = KDefaultTextColor;
       
  1284         }
       
  1285     return bgColor;
       
  1286     }
       
  1287 
       
  1288 // ---------------------------------------------------------------------------
       
  1289 // CESMRLayoutManager::TitleAreaTextColor
       
  1290 // ---------------------------------------------------------------------------
       
  1291 //
       
  1292 TRgb CESMRLayoutManager::TitleAreaTextColor()
       
  1293     {
       
  1294     FUNC_LOG;
       
  1295     TRgb bgColor;
       
  1296     TInt err;
       
  1297 
       
  1298     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1299                                      bgColor,
       
  1300                                      KAknsIIDQsnTextColors,
       
  1301                                      KTitleAreaTextColorID );
       
  1302     if( err != KErrNone )
       
  1303         {
       
  1304         bgColor = KDefaultTextColor;
       
  1305         }
       
  1306     return bgColor;
       
  1307     }
       
  1308 
       
  1309 // ---------------------------------------------------------------------------
       
  1310 // CESMRLayoutManager::NormalTextBgColor
       
  1311 // ---------------------------------------------------------------------------
       
  1312 //
       
  1313 TRgb CESMRLayoutManager::NormalTextBgColor()
       
  1314     {
       
  1315     FUNC_LOG;
       
  1316     TRgb bgColor;
       
  1317     TInt err;
       
  1318 
       
  1319     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1320                                      bgColor,
       
  1321                                      KAknsIIDQsnOtherColors,
       
  1322                                      KNormalTextBgColorID );
       
  1323 
       
  1324     if( err != KErrNone )
       
  1325         {
       
  1326         bgColor = KDefaultNormalTextBgColor;
       
  1327         }
       
  1328     return bgColor;
       
  1329     }
       
  1330 
       
  1331 // ---------------------------------------------------------------------------
       
  1332 // CESMRLayoutManager::FieldBorderColor
       
  1333 // ---------------------------------------------------------------------------
       
  1334 //
       
  1335 TRgb CESMRLayoutManager::FieldBorderColor()
       
  1336     {
       
  1337     FUNC_LOG;
       
  1338     TRgb bgColor;
       
  1339     TInt err;
       
  1340 
       
  1341     err = AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
       
  1342                                      bgColor,
       
  1343                                      KAknsIIDQsnOtherColors ,
       
  1344                                      KFieldBorderColorID );
       
  1345     if( err != KErrNone )
       
  1346         {
       
  1347         bgColor = KDefaultBorderColor;
       
  1348         }
       
  1349     return bgColor;
       
  1350     }
       
  1351 
       
  1352 // ---------------------------------------------------------------------------
       
  1353 // CESMRLayoutManager::NormalTextColorID
       
  1354 // ---------------------------------------------------------------------------
       
  1355 //
       
  1356 TInt CESMRLayoutManager::NormalTextColorID()
       
  1357     {
       
  1358     FUNC_LOG;
       
  1359     return KNormalTextColorID;
       
  1360     }
       
  1361 
       
  1362 // ---------------------------------------------------------------------------
       
  1363 // CESMRLayoutManager::ViewerListAreaTextColorID
       
  1364 // ---------------------------------------------------------------------------
       
  1365 //
       
  1366 TInt CESMRLayoutManager::ViewerListAreaTextColorID()
       
  1367     {
       
  1368     FUNC_LOG;
       
  1369     return KListAreaTextColorID;
       
  1370     }
       
  1371 
       
  1372 // ---------------------------------------------------------------------------
       
  1373 // CESMRLayoutManager::GetSkinBasedBitmap
       
  1374 // ---------------------------------------------------------------------------
       
  1375 //
       
  1376 TInt CESMRLayoutManager::GetSkinBasedBitmap( 
       
  1377 		TAknsItemID aIconID, 
       
  1378 		CFbsBitmap*& aBitmap, 
       
  1379 		CFbsBitmap*& aMask, 
       
  1380 		TSize aSize )
       
  1381     {
       
  1382     FUNC_LOG;
       
  1383     TInt retValue = KErrNone;
       
  1384     delete aBitmap;
       
  1385     aBitmap = NULL;
       
  1386     delete aMask;
       
  1387     aMask = NULL;
       
  1388 
       
  1389     TInt fileIndex(-1);
       
  1390     TInt fileMaskIndex(-1);
       
  1391 
       
  1392     SetBitmapFallback( aIconID, fileIndex, fileMaskIndex );
       
  1393 
       
  1394     TFileName bitmapFilePath;
       
  1395     ESMRHelper::LocateResourceFile(
       
  1396             KESMRMifFile,
       
  1397             KDC_APP_BITMAP_DIR,
       
  1398             bitmapFilePath);
       
  1399 
       
  1400     TRAPD(error, AknsUtils::CreateIconL( AknsUtils::SkinInstance(),
       
  1401 										 aIconID,
       
  1402 										 aBitmap,
       
  1403 										 aMask,
       
  1404 										 bitmapFilePath,
       
  1405 										 fileIndex,
       
  1406 										 fileMaskIndex ));
       
  1407     if ( error != KErrNone )
       
  1408         {
       
  1409         return error;
       
  1410         }
       
  1411 
       
  1412     AknIconUtils::SetSize( aBitmap, aSize, EAspectRatioNotPreserved );
       
  1413 
       
  1414     if( !aBitmap || !aMask )
       
  1415         {
       
  1416         retValue = KErrNotFound;
       
  1417         }
       
  1418     return retValue;
       
  1419     }
       
  1420 
       
  1421 // ---------------------------------------------------------------------------
       
  1422 // CESMRLayoutManager::IsFontChanged
       
  1423 // ---------------------------------------------------------------------------
       
  1424 //
       
  1425 TBool CESMRLayoutManager::IsFontChanged()
       
  1426     {
       
  1427     FUNC_LOG;
       
  1428     return iFontSettingsChanged;
       
  1429     }
       
  1430 
       
  1431 // ---------------------------------------------------------------------------
       
  1432 // CESMRLayoutManager::HandleNotifyInt
       
  1433 // ---------------------------------------------------------------------------
       
  1434 //
       
  1435 void CESMRLayoutManager::HandleNotifyInt( TUint32 aId, TInt aNewValue )
       
  1436     {
       
  1437     FUNC_LOG;
       
  1438     if( aId == KAknGlobalUiZoom )
       
  1439         {
       
  1440         iFontSettingsValue = aNewValue;
       
  1441         iFontSettingsChanged = ETrue;
       
  1442 
       
  1443         // Force CESMRLayoutManager::Font to create new font
       
  1444         delete iFont;
       
  1445         iFont = NULL;
       
  1446 
       
  1447         delete iMfneFont;
       
  1448         iMfneFont = NULL;
       
  1449 
       
  1450         if ( iFontSizeObserver )
       
  1451             {
       
  1452             iFontSizeObserver->FontSizeSettingsChanged();//Synchronous update
       
  1453             iFontSettingsChanged = EFalse;
       
  1454             }
       
  1455         }
       
  1456     }
       
  1457 
       
  1458 // ---------------------------------------------------------------------------
       
  1459 // CESMRLayoutManager::SetObserver
       
  1460 // ---------------------------------------------------------------------------
       
  1461 //
       
  1462 void CESMRLayoutManager::SetObserver( MESMRFontSizeObserver* aObserver )
       
  1463     {
       
  1464     FUNC_LOG;
       
  1465     iFontSizeObserver = aObserver;
       
  1466     }
       
  1467 
       
  1468 // EOF
       
  1469