diff -r 000000000000 -r 8466d47a6819 emailuis/uicomponents/src/fstextviewerselectembed.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailuis/uicomponents/src/fstextviewerselectembed.cpp Thu Dec 17 08:39:21 2009 +0200 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Expand area class +* +*/ + + +// removed __FS_ALFRED_SUPPORT flag +//#include +// removed __FS_ALFRED_SUPPORT flag +// SF +#include "emailtrace.h" +#include +#include +// +#include "fstextviewerselectembed.h" +#include "fstextviewervisualizer.h" +#include "fstextviewervisualizerdata.h" +#include "fstextviewerselectsmanager.h" + +CFsTextViewerSelectEmbed* CFsTextViewerSelectEmbed::NewL( + CFsTextViewerSelectsManager* aManager ) + { + FUNC_LOG; + CFsTextViewerSelectEmbed* self = + new (ELeave) CFsTextViewerSelectEmbed( aManager ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// SelectL +// --------------------------------------------------------------------------- +void CFsTextViewerSelectEmbed::SelectL() + { + FUNC_LOG; + for ( TInt i = 0; i < iVisuals.Count(); ++i ) + { + if ( iVisuals[i]->iVisual ) + { + CAlfTextVisual* textVisual( dynamic_cast( iVisuals[i]->iVisual ) ); + if ( textVisual ) + { + textVisual->SetColor( KRgbRed ); + } + } + } + } + +// --------------------------------------------------------------------------- +// Deselect +// --------------------------------------------------------------------------- +void CFsTextViewerSelectEmbed::DeselectL() + { + FUNC_LOG; + for ( TInt i = 0; i < iVisuals.Count(); ++i ) + { + if ( iVisuals[i]->iVisual ) + { + CAlfTextVisual* textVisual( dynamic_cast( iVisuals[i]->iVisual ) ); + if ( textVisual ) + { + textVisual->SetColor( KRgbBlack ); + } + } + } + } + +// --------------------------------------------------------------------------- +// SelectedL +// --------------------------------------------------------------------------- +void CFsTextViewerSelectEmbed::SelectedL() + { + FUNC_LOG; + if ( iIsExpanded ) + { + iManager->Visualizer()->CollapseL( iLayout, iId ); + iIsExpanded = EFalse; + } + else if ( EFalse == iIsExpanded && iLayout ) + { + iManager->Visualizer()->ExpandExistingL( iLayout, iLayoutSize, iId ); + iIsExpanded = ETrue; + } + else + { + TInt visIndex; + visIndex = + iManager->Visualizer()->Navigator()->Find( + iVisuals[iVisuals.Count() - 1]->iVisual ); + TInt rtStart = + iManager->Visualizer()->Navigator()->GetVisEndOffset( + visIndex ) + 1; + iLayout = iManager->Visualizer()->ExpandL( + iId, + rtStart, + iVisuals[iVisuals.Count() - 1]->iVisual ); + iLayoutSize = TSize( + iLayout->Size().Target().iX, + iLayout->Size().Target().iY ); + iIsExpanded = ETrue; + } + } + +// --------------------------------------------------------------------------- +// CFsTextViewerSelectEmbed +// --------------------------------------------------------------------------- +CFsTextViewerSelectEmbed::CFsTextViewerSelectEmbed( + CFsTextViewerSelectsManager* aManager ) + { + FUNC_LOG; + iManager = aManager; + iType = EFsEmbedType; + iLayout = NULL; + iIsExpanded = EFalse; + } +