emailuis/uicomponents/src/fstextviewerselectembed.cpp
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Expand area class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    20 //#include <fsconfig.h>
       
    21 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    22 // <cmail> SF
       
    23 #include "emailtrace.h"
       
    24 #include <alf/alftextvisual.h>
       
    25 #include <alf/alflayout.h>
       
    26 // </cmail>
       
    27 #include "fstextviewerselectembed.h"
       
    28 #include "fstextviewervisualizer.h"
       
    29 #include "fstextviewervisualizerdata.h"
       
    30 #include "fstextviewerselectsmanager.h"
       
    31 
       
    32 CFsTextViewerSelectEmbed* CFsTextViewerSelectEmbed::NewL( 
       
    33         CFsTextViewerSelectsManager* aManager )
       
    34      {
       
    35     FUNC_LOG;
       
    36      CFsTextViewerSelectEmbed* self = 
       
    37          new (ELeave) CFsTextViewerSelectEmbed( aManager );
       
    38      CleanupStack::PushL( self );
       
    39      self->ConstructL();
       
    40      CleanupStack::Pop( self );
       
    41      return self;
       
    42      }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // SelectL
       
    46 // ---------------------------------------------------------------------------
       
    47 void CFsTextViewerSelectEmbed::SelectL()
       
    48     {
       
    49     FUNC_LOG;
       
    50     for ( TInt i = 0; i < iVisuals.Count(); ++i )
       
    51         {
       
    52         if ( iVisuals[i]->iVisual )
       
    53             {
       
    54             CAlfTextVisual* textVisual( dynamic_cast<CAlfTextVisual*>( iVisuals[i]->iVisual ) );
       
    55             if ( textVisual )
       
    56                 {
       
    57                 textVisual->SetColor( KRgbRed );
       
    58                 }
       
    59             }
       
    60         }
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // Deselect
       
    65 // ---------------------------------------------------------------------------
       
    66 void CFsTextViewerSelectEmbed::DeselectL()
       
    67     {
       
    68     FUNC_LOG;
       
    69     for ( TInt i = 0; i < iVisuals.Count(); ++i )
       
    70         {
       
    71         if ( iVisuals[i]->iVisual )
       
    72             {
       
    73             CAlfTextVisual* textVisual( dynamic_cast<CAlfTextVisual*>( iVisuals[i]->iVisual ) );
       
    74             if ( textVisual )
       
    75                 {
       
    76                 textVisual->SetColor( KRgbBlack );
       
    77                 }
       
    78             }
       
    79         }
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // SelectedL
       
    84 // ---------------------------------------------------------------------------
       
    85 void CFsTextViewerSelectEmbed::SelectedL()
       
    86     {
       
    87     FUNC_LOG;
       
    88     if ( iIsExpanded )
       
    89         {
       
    90         iManager->Visualizer()->CollapseL( iLayout, iId );
       
    91         iIsExpanded = EFalse;
       
    92         }
       
    93     else if ( EFalse == iIsExpanded && iLayout )
       
    94         {
       
    95         iManager->Visualizer()->ExpandExistingL( iLayout, iLayoutSize, iId );
       
    96         iIsExpanded = ETrue;
       
    97         }
       
    98     else 
       
    99         {
       
   100         TInt visIndex;
       
   101         visIndex = 
       
   102             iManager->Visualizer()->Navigator()->Find( 
       
   103                     iVisuals[iVisuals.Count() - 1]->iVisual );
       
   104         TInt rtStart = 
       
   105             iManager->Visualizer()->Navigator()->GetVisEndOffset( 
       
   106                     visIndex ) + 1;
       
   107         iLayout = iManager->Visualizer()->ExpandL( 
       
   108                 iId, 
       
   109                 rtStart, 
       
   110                 iVisuals[iVisuals.Count() - 1]->iVisual );
       
   111         iLayoutSize = TSize( 
       
   112                 iLayout->Size().Target().iX, 
       
   113                 iLayout->Size().Target().iY );
       
   114         iIsExpanded = ETrue;
       
   115         }
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // CFsTextViewerSelectEmbed
       
   120 // ---------------------------------------------------------------------------
       
   121 CFsTextViewerSelectEmbed::CFsTextViewerSelectEmbed( 
       
   122         CFsTextViewerSelectsManager* aManager )
       
   123     {
       
   124     FUNC_LOG;
       
   125     iManager = aManager;
       
   126     iType = EFsEmbedType;
       
   127     iLayout = NULL;
       
   128     iIsExpanded = EFalse;
       
   129     }
       
   130