graphicsapitest/graphicssvs/gdi/src/T_DataDrawTextExtendedParam.cpp
changeset 103 2717213c588a
parent 98 bf7481649c98
child 116 171fae344dd4
child 121 d72fc2aace31
child 187 9f66f99ee56f
equal deleted inserted replaced
98:bf7481649c98 103:2717213c588a
     1 /*
       
     2 * Copyright (c) 2005-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:
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @test
       
    20 @internalComponent
       
    21 
       
    22 This contains CT_DataDrawTextExtendedParam
       
    23 */
       
    24 
       
    25 //	User includes
       
    26 #include "T_DataDrawTextExtendedParam.h"
       
    27 
       
    28 /*@{*/
       
    29 ///	Commands
       
    30 _LIT(KCmd_new,										"new");
       
    31 _LIT(KCmd_destructor,								"~");
       
    32 _LIT(KCmd_iParRightToLeft,							"iParRightToLeft");
       
    33 
       
    34 ///	Parameters
       
    35 _LIT(KFldValue,										"value");
       
    36 
       
    37 ///	Logging
       
    38 _LIT(KLogError,										"Error=%d");
       
    39 /*@}*/
       
    40 
       
    41 /**
       
    42 * Constructor. First phase construction
       
    43 */
       
    44 CT_DataDrawTextExtendedParam::CT_DataDrawTextExtendedParam()
       
    45 :	CT_DataDrawTextParam()
       
    46 ,	iDrawTextExtendedParam(NULL)
       
    47 	{
       
    48 	}
       
    49 
       
    50 /**
       
    51 * Constructor. First phase construction
       
    52 */
       
    53 CT_DataDrawTextExtendedParam::~CT_DataDrawTextExtendedParam()
       
    54 	{
       
    55 	DestroyData();
       
    56 	}
       
    57 
       
    58 void CT_DataDrawTextExtendedParam::DestroyData()
       
    59 	{
       
    60 	delete iDrawTextExtendedParam;
       
    61 	iDrawTextExtendedParam=NULL;
       
    62 	}
       
    63 
       
    64 TAny* CT_DataDrawTextExtendedParam::GetObject()
       
    65 	{
       
    66 	return iDrawTextExtendedParam;
       
    67 	}
       
    68 
       
    69 void CT_DataDrawTextExtendedParam::SetObjectL(TAny* aAny)
       
    70 	{
       
    71 	DestroyData();
       
    72 	iDrawTextExtendedParam=static_cast<CGraphicsContext::TDrawTextExtendedParam*>(aAny);
       
    73 	}
       
    74 
       
    75 void CT_DataDrawTextExtendedParam::DisownObjectL()
       
    76 	{
       
    77 	iDrawTextExtendedParam=NULL;
       
    78 	}
       
    79 
       
    80 CGraphicsContext::TDrawTextParam* CT_DataDrawTextExtendedParam::GetDrawTextParam() const
       
    81 	{
       
    82 	return iDrawTextExtendedParam;
       
    83 	}
       
    84 
       
    85 /**
       
    86 * Process a command read from the ini file
       
    87 *
       
    88 * @param aDataWrapper	test step requiring command to be processed
       
    89 * @param aCommand	the command to process
       
    90 * @param aSection		the entry in the ini file requiring the command to be processed
       
    91 *
       
    92 * @return ETrue if the command is processed
       
    93 */
       
    94 TBool CT_DataDrawTextExtendedParam::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
    95 	{
       
    96 	TBool	ret=ETrue;
       
    97 	if ( aCommand==KCmd_new )
       
    98 		{
       
    99 		DoCmd_new();
       
   100 		}
       
   101 	else if ( aCommand==KCmd_destructor )
       
   102 		{
       
   103 		DoCmd_destructor();
       
   104 		}
       
   105 	else if ( aCommand==KCmd_iParRightToLeft )
       
   106 		{
       
   107 		DoCmd_iParRightToLeft(aSection);
       
   108 		}
       
   109 	else
       
   110 		{
       
   111 		ret=CT_DataDrawTextParam::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   112 		}
       
   113 
       
   114 	return ret;
       
   115 	}
       
   116 
       
   117 void CT_DataDrawTextExtendedParam::DoCmd_new()
       
   118 	{
       
   119 	DestroyData();
       
   120 	TRAPD(err, iDrawTextExtendedParam = new (ELeave) CGraphicsContext::TDrawTextExtendedParam());
       
   121 	if ( err!=KErrNone )
       
   122 		{
       
   123 		ERR_PRINTF2(KLogError, err);
       
   124 		SetError(err);
       
   125 		}
       
   126 	}
       
   127 
       
   128 void CT_DataDrawTextExtendedParam::DoCmd_destructor()
       
   129 	{
       
   130 	DestroyData();
       
   131 	CT_DataDrawTextParam::DoCmd_destructor();
       
   132 	}
       
   133 
       
   134 void CT_DataDrawTextExtendedParam::DoCmd_iParRightToLeft(const TDesC& aSection)
       
   135 	{
       
   136 	if ( !GetBoolFromConfig(aSection, KFldValue(), iDrawTextExtendedParam->iParRightToLeft) )
       
   137 		{
       
   138 		INFO_PRINTF2(_L("iParRightToLeft=%d"), iDrawTextExtendedParam->iParRightToLeft);
       
   139 		}
       
   140 	}