imagehandlinglib/Src/IHLViewerFactory.cpp
changeset 54 48dd0f169f0d
parent 42 2e2a89493e2b
equal deleted inserted replaced
42:2e2a89493e2b 54:48dd0f169f0d
     1 /*
       
     2 * Copyright (c) 2004-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:  Static factory class for creating viewers.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <IHLViewerFactory.h>
       
    21 
       
    22 #include "CIHLImageViewerExtJpg.h"
       
    23 #include "MIHLFileImageExtJpg.h"
       
    24 #include "IHLImplementationIds.h"
       
    25 
       
    26 #include "CIHLImageViewer.h"
       
    27 #include <MIHLImage.h>
       
    28 #include <MIHLFileImage.h>
       
    29 #include <IHLInterfaceIds.h>
       
    30 
       
    31 
       
    32 // ============================ STATIC FUNCTIONS ===============================
       
    33 // -----------------------------------------------------------------------------
       
    34 // IHLViewerFactory::CreateImageViewerL
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 EXPORT_C MIHLImageViewer* IHLViewerFactory::CreateImageViewerL(
       
    38 											const TSize& aViewerSize,
       
    39 											MIHLImage& aSource,
       
    40 											MIHLBitmap& aDestination,
       
    41 											MIHLViewerObserver& aObserver,
       
    42 											const TUint32 aOptions )
       
    43 	{
       
    44 	MIHLImageViewer* viewer = NULL;
       
    45 	if( aSource.Type().iInterfaceId == KIHLInterfaceIdFileImage )
       
    46 		{
       
    47 		if( aSource.Type().iImplementationId == KIHLImplementationIdFileImageExtJpg )
       
    48 			{
       
    49 			viewer = CIHLImageViewerExtJpg::NewL( aViewerSize, static_cast< MIHLFileImageExtJpg& >( aSource ), // CSI: 35 #
       
    50 													 aDestination, aObserver, aOptions );
       
    51 			}
       
    52 		else
       
    53 			{
       
    54 			viewer = CIHLImageViewer::NewL( aViewerSize, static_cast< MIHLFileImage& >( aSource ),  // CSI: 35 #
       
    55 													aDestination, aObserver, aOptions );
       
    56 			}
       
    57 		}
       
    58 	else
       
    59 		{
       
    60 		User::Leave( KErrArgument );
       
    61 		}
       
    62 	return viewer;
       
    63 	}
       
    64 
       
    65 //  End of File