graphics/gdi/src/T_DataGraphicsContext.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-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_DataGraphicsContext
       
    23 */
       
    24 
       
    25 //	User includes
       
    26 #include "T_DataGraphicsContext.h"
       
    27 #include "T_GraphicsUtil.h"
       
    28 
       
    29 /*@{*/
       
    30 ///	Commands
       
    31 _LIT(KCmdCancelClippingRect,						"CancelClippingRect");
       
    32 _LIT(KCmdCancelClippingRegion,						"CancelClippingRegion");
       
    33 _LIT(KCmdDevice,									"Device");
       
    34 _LIT(KCmdDiscardBrushPattern,						"DiscardBrushPattern");
       
    35 _LIT(KCmdDiscardFont,								"DiscardFont");
       
    36 _LIT(KCmdDrawArc,									"DrawArc");
       
    37 _LIT(KCmdDrawBitmap,								"DrawBitmap");
       
    38 _LIT(KCmdDrawBitmapMasked,							"DrawBitmapMasked");
       
    39 _LIT(KCmdDrawEllipse,								"DrawEllipse");
       
    40 _LIT(KCmdDrawLine,									"DrawLine");
       
    41 _LIT(KCmdDrawLineBy,								"DrawLineBy");
       
    42 _LIT(KCmdDrawLineTo,								"DrawLineTo");
       
    43 _LIT(KCmdDrawPie,									"DrawPie");
       
    44 _LIT(KCmdDrawPolygon,								"DrawPolygon");
       
    45 _LIT(KCmdDrawPolyLine,								"DrawPolyLine");
       
    46 _LIT(KCmdDrawRect,									"DrawRect");
       
    47 _LIT(KCmdDrawRoundRect,								"DrawRoundRect");
       
    48 _LIT(KCmdDrawText,									"DrawText");
       
    49 _LIT(KCmdDrawTextExtended,							"DrawTextExtended");
       
    50 _LIT(KCmdDrawTextVertical,							"DrawTextVertical");
       
    51 _LIT(KCmdGetShadowColor,							"GetShadowColor");
       
    52 _LIT(KCmdGetUnderlineMetrics,						"GetUnderlineMetrics");
       
    53 _LIT(KCmdJustificationInPixels,						"JustificationInPixels");
       
    54 _LIT(KCmdMapColors,									"MapColors");
       
    55 _LIT(KCmdMoveBy,									"MoveBy");
       
    56 _LIT(KCmdMoveTo,									"MoveTo");
       
    57 _LIT(KCmdPlot,										"Plot");
       
    58 _LIT(KCmdReserved,									"Reserved");
       
    59 _LIT(KCmdReset,										"Reset");
       
    60 _LIT(KCmdSetBrushColor,								"SetBrushColor");
       
    61 _LIT(KCmdSetBrushOrigin,							"SetBrushOrigin");
       
    62 _LIT(KCmdSetBrushStyle,								"SetBrushStyle");
       
    63 _LIT(KCmdSetClippingRegion,							"SetClippingRegion");
       
    64 _LIT(KCmdSetCharJustification,						"SetCharJustification");
       
    65 _LIT(KCmdSetClippingRect,							"SetClippingRect");
       
    66 _LIT(KCmdSetDrawMode,								"SetDrawMode");
       
    67 _LIT(KCmdSetOrigin,									"SetOrigin");
       
    68 _LIT(KCmdSetPenColor,								"SetPenColor");
       
    69 _LIT(KCmdSetPenSize,								"SetPenSize");
       
    70 _LIT(KCmdSetPenStyle,								"SetPenStyle");
       
    71 _LIT(KCmdSetShadowColor,							"SetShadowColor");
       
    72 _LIT(KCmdSetStrikethroughStyle,						"SetStrikethroughStyle");
       
    73 _LIT(KCmdSetUnderlineStyle,							"SetUnderlineStyle");
       
    74 _LIT(KCmdSetWordJustification,						"SetWordJustification");
       
    75 _LIT(KCmdUseBrushPattern,							"UseBrushPattern");
       
    76 _LIT(KCmdUseFont,									"UseFont");
       
    77 
       
    78 ///	Parameters
       
    79 _LIT(KFldBaselineOffset,							"baselineoffset");
       
    80 _LIT(KFldBitmap,									"bitmap");
       
    81 _LIT(KFldBottom,									"bottom");
       
    82 _LIT(KFldBrushStyle,								"brushstyle");
       
    83 _LIT(KFldColor,										"color");
       
    84 _LIT(KFldDestRect,									"destrect");
       
    85 _LIT(KFldDevice,									"device");
       
    86 _LIT(KFldDrawMode,									"drawmode");
       
    87 _LIT(KFldExcessPixels,								"excessPixels");
       
    88 _LIT(KFldExcessWidth,								"excesswidth");
       
    89 _LIT(KFldExpected,									"expected");
       
    90 _LIT(KFldFillRule,									"fillrule");
       
    91 _LIT(KFldFirstUnit,									"firstUnit");
       
    92 _LIT(KFldFont,										"font");
       
    93 _LIT(KFldFontStrikethrough,							"fontstrikethrough");
       
    94 _LIT(KFldFontUnderline,								"fontunderline");
       
    95 _LIT(KFldEnd,										"end");
       
    96 _LIT(KFldInvertMask,								"invertmask");
       
    97 _LIT(KFldLeftMargin,								"leftmargin");
       
    98 _LIT(KFldMapForwards,								"mapforwards");
       
    99 _LIT(KFldMaskBitmap,								"maskbitmap");
       
   100 _LIT(KFldNumChars,									"numchars");
       
   101 _LIT(KFldNumColors,									"numcolors");
       
   102 _LIT(KFldNumGaps,									"numgaps");
       
   103 _LIT(KFldNumPoints,									"numpoints");
       
   104 _LIT(KFldNumUnits,									"numunits");
       
   105 _LIT(KFldPenStyle,									"penstyle");
       
   106 _LIT(KFldPoint,										"point");
       
   107 _LIT(KFldPoint1,									"point1");
       
   108 _LIT(KFldPoint2,									"point2");
       
   109 _LIT(KFldPointList,									"pointlist");
       
   110 _LIT(KFldRect,										"rect");
       
   111 _LIT(KFldRegion,									"region");
       
   112 _LIT(KFldRgb,										"rgb");
       
   113 _LIT(KFldRgbList,									"rgblist");
       
   114 _LIT(KFldSourceRect,								"sourcerect");
       
   115 _LIT(KFldSize,										"size");
       
   116 _LIT(KFldStart,										"start");
       
   117 _LIT(KFldText,										"text");
       
   118 _LIT(KFldTextAlign,									"textalign");
       
   119 _LIT(KFldTextExtendedParam,							"textextendedparam");
       
   120 _LIT(KFldTop,										"top");
       
   121 _LIT(KFldTopLeft,									"topleft");
       
   122 _LIT(KFldTotalUnits,								"totalUnits");
       
   123 _LIT(KFldUp,										"up");
       
   124 _LIT(KFldWsBitmap,									"wsbitmap");
       
   125 
       
   126 ///	Logging
       
   127 _LIT(KLogColor,										"Color Red=%d Green=%d Blue=%d Alpha=%d");
       
   128 _LIT(KLogError,										"Error=%d");
       
   129 _LIT(KLogMetrics,									"Top=%d Bottom=%d");
       
   130 _LIT(KLogMissingParameter,							"Missing parameter '%S'");
       
   131 _LIT(KLogNotExpectedValue,							"Not expected value");
       
   132 /*@}*/
       
   133 
       
   134 /**
       
   135 * Constructor. First phase construction
       
   136 */
       
   137 CT_DataGraphicsContext::CT_DataGraphicsContext()
       
   138 :	CDataWrapperBase()
       
   139 	{
       
   140 	}
       
   141 
       
   142 /**
       
   143 * Process a command read from the ini file
       
   144 *
       
   145 * @param aDataWrapper	test step requiring command to be processed
       
   146 * @param aCommand	the command to process
       
   147 * @param aSection		the entry in the ini file requiring the command to be processed
       
   148 *
       
   149 * @return ETrue if the command is processed
       
   150 */
       
   151 TBool CT_DataGraphicsContext::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
       
   152 	{
       
   153 	TBool	ret=ETrue;
       
   154 	if ( aCommand==KCmdCancelClippingRect )
       
   155 		{
       
   156 		DoCmdCancelClippingRect();
       
   157 		}
       
   158 	else if ( aCommand==KCmdCancelClippingRegion )
       
   159 		{
       
   160 		DoCmdCancelClippingRegion();
       
   161 		}
       
   162 	else if ( aCommand==KCmdDevice )
       
   163 		{
       
   164 		DoCmdDeviceL(aSection);
       
   165 		}
       
   166 	else if ( aCommand==KCmdDiscardBrushPattern )
       
   167 		{
       
   168 		DoCmdDiscardBrushPattern();
       
   169 		}
       
   170 	else if ( aCommand==KCmdDiscardFont )
       
   171 		{
       
   172 		DoCmdDiscardFont();
       
   173 		}
       
   174 	else if ( aCommand==KCmdDrawArc )
       
   175 		{
       
   176 		DoCmdDrawArc(aSection);
       
   177 		}
       
   178 	else if ( aCommand==KCmdDrawBitmap )
       
   179 		{
       
   180 		DoCmdDrawBitmapL(aSection);
       
   181 		}
       
   182 	else if ( aCommand==KCmdDrawBitmapMasked )
       
   183 		{
       
   184 		DoCmdDrawBitmapMaskedL(aSection);
       
   185 		}
       
   186 	else if ( aCommand==KCmdDrawEllipse )
       
   187 		{
       
   188 		DoCmdDrawEllipse(aSection);
       
   189 		}
       
   190 	else if ( aCommand==KCmdDrawLine )
       
   191 		{
       
   192 		DoCmdDrawLine(aSection);
       
   193 		}
       
   194 	else if ( aCommand==KCmdDrawLineBy )
       
   195 		{
       
   196 		DoCmdDrawLineBy(aSection);
       
   197 		}
       
   198 	else if ( aCommand==KCmdDrawLineTo )
       
   199 		{
       
   200 		DoCmdDrawLineTo(aSection);
       
   201 		}
       
   202 	else if ( aCommand==KCmdDrawPie )
       
   203 		{
       
   204 		DoCmdDrawPie(aSection);
       
   205 		}
       
   206 	else if ( aCommand==KCmdDrawPolygon )
       
   207 		{
       
   208 		DoCmdDrawPolygonL(aSection);
       
   209 		}
       
   210 	else if ( aCommand==KCmdDrawPolyLine )
       
   211 		{
       
   212 		DoCmdDrawPolyLineL(aSection);
       
   213 		}
       
   214 	else if ( aCommand==KCmdDrawRect )
       
   215 		{
       
   216 		DoCmdDrawRect(aSection);
       
   217 		}
       
   218 	else if ( aCommand==KCmdDrawRoundRect )
       
   219 		{
       
   220 		DoCmdDrawRoundRect(aSection);
       
   221 		}
       
   222 	else if ( aCommand==KCmdDrawText )
       
   223 		{
       
   224 		DoCmdDrawText(aSection);
       
   225 		}
       
   226 	else if ( aCommand==KCmdDrawTextExtended )
       
   227 		{
       
   228 		DoCmdDrawTextExtendedL(aSection);
       
   229 		}
       
   230 	else if ( aCommand==KCmdDrawTextVertical )
       
   231 		{
       
   232 		DoCmdDrawTextVertical(aSection);
       
   233 		}
       
   234 	else if ( aCommand==KCmdGetShadowColor )
       
   235 		{
       
   236 		DoCmdGetShadowColor(aSection);
       
   237 		}
       
   238 	else if ( aCommand==KCmdGetUnderlineMetrics )
       
   239 		{
       
   240 		DoCmdGetUnderlineMetrics(aSection);
       
   241 		}
       
   242 	else if ( aCommand==KCmdJustificationInPixels )
       
   243 		{
       
   244 		DoCmdJustificationInPixels(aSection);
       
   245 		}
       
   246 	else if ( aCommand==KCmdMapColors )
       
   247 		{
       
   248 		DoCmdMapColorsL(aSection);
       
   249 		}
       
   250 	else if ( aCommand==KCmdMoveBy )
       
   251 		{
       
   252 		DoCmdMoveBy(aSection);
       
   253 		}
       
   254 	else if ( aCommand==KCmdMoveTo )
       
   255 		{
       
   256 		DoCmdMoveTo(aSection);
       
   257 		}
       
   258 	else if ( aCommand==KCmdPlot )
       
   259 		{
       
   260 		DoCmdPlot(aSection);
       
   261 		}
       
   262 	else if ( aCommand==KCmdReserved )
       
   263 		{
       
   264 		DoCmdReserved();
       
   265 		}
       
   266 	else if ( aCommand==KCmdReset )
       
   267 		{
       
   268 		DoCmdReset();
       
   269 		}
       
   270 	else if ( aCommand==KCmdSetBrushColor )
       
   271 		{
       
   272 		DoCmdSetBrushColor(aSection);
       
   273 		}
       
   274 	else if ( aCommand==KCmdSetBrushOrigin )
       
   275 		{
       
   276 		DoCmdSetBrushOrigin(aSection);
       
   277 		}
       
   278 	else if ( aCommand==KCmdSetBrushStyle )
       
   279 		{
       
   280 		DoCmdSetBrushStyle(aSection);
       
   281 		}
       
   282 	else if ( aCommand==KCmdSetClippingRegion )
       
   283 		{
       
   284 		DoCmdSetClippingRegion(aSection);
       
   285 		}
       
   286 	else if ( aCommand==KCmdSetCharJustification )
       
   287 		{
       
   288 		DoCmdSetCharJustification(aSection);
       
   289 		}
       
   290 	else if ( aCommand==KCmdSetClippingRect )
       
   291 		{
       
   292 		DoCmdSetClippingRect(aSection);
       
   293 		}
       
   294 	else if ( aCommand==KCmdSetDrawMode )
       
   295 		{
       
   296 		DoCmdSetDrawMode(aSection);
       
   297 		}
       
   298 	else if ( aCommand==KCmdSetOrigin )
       
   299 		{
       
   300 		DoCmdSetOrigin(aSection);
       
   301 		}
       
   302 	else if ( aCommand==KCmdSetPenColor )
       
   303 		{
       
   304 		DoCmdSetPenColor(aSection);
       
   305 		}
       
   306 	else if ( aCommand==KCmdSetPenSize )
       
   307 		{
       
   308 		DoCmdSetPenSize(aSection);
       
   309 		}
       
   310 	else if ( aCommand==KCmdSetPenStyle )
       
   311 		{
       
   312 		DoCmdSetPenStyle(aSection);
       
   313 		}
       
   314 	else if ( aCommand==KCmdSetShadowColor )
       
   315 		{
       
   316 		DoCmdSetShadowColor(aSection);
       
   317 		}
       
   318 	else if ( aCommand==KCmdSetStrikethroughStyle )
       
   319 		{
       
   320 		DoCmdSetStrikethroughStyle(aSection);
       
   321 		}
       
   322 	else if ( aCommand==KCmdSetUnderlineStyle )
       
   323 		{
       
   324 		DoCmdSetUnderlineStyle(aSection);
       
   325 		}
       
   326 	else if ( aCommand==KCmdSetWordJustification )
       
   327 		{
       
   328 		DoCmdSetWordJustification(aSection);
       
   329 		}
       
   330 	else if ( aCommand==KCmdUseBrushPattern )
       
   331 		{
       
   332 		DoCmdUseBrushPatternL(aSection);
       
   333 		}
       
   334 	else if ( aCommand==KCmdUseFont )
       
   335 		{
       
   336 		DoCmdUseFontL(aSection);
       
   337 		}
       
   338 	else
       
   339 		{
       
   340 		ret=EFalse;
       
   341 		}
       
   342 
       
   343 	return ret;
       
   344 	}
       
   345 
       
   346 void CT_DataGraphicsContext::DoCmdCancelClippingRect()
       
   347 	{
       
   348 	INFO_PRINTF1(_L("execute CancelClippingRect()"));
       
   349 	GetGraphicsContext()->CancelClippingRect();
       
   350 	}
       
   351 
       
   352 void CT_DataGraphicsContext::DoCmdCancelClippingRegion()
       
   353 	{
       
   354 	INFO_PRINTF1(_L("execute CancelClippingRegion()"));
       
   355 	GetGraphicsContext()->CancelClippingRegion();
       
   356 	}
       
   357 
       
   358 void CT_DataGraphicsContext::DoCmdDeviceL(const TDesC& aSection)
       
   359 	{
       
   360 	INFO_PRINTF1(_L("execute Device()"));
       
   361 	CGraphicsDevice*	device = GetGraphicsContext()->Device();
       
   362 	TPtrC				deviceName;
       
   363 	if ( GetStringFromConfig(aSection, KFldDevice(), deviceName) )
       
   364 		{
       
   365 		// check that the data object was found
       
   366 		CDataWrapper*	dataWrapper=GetDataWrapperL(deviceName);
       
   367 		dataWrapper->SetObjectL(device);
       
   368 		}
       
   369 	}
       
   370 
       
   371 void CT_DataGraphicsContext::DoCmdDiscardBrushPattern()
       
   372 	{
       
   373 	INFO_PRINTF1(_L("execute DiscardBrushPattern()"));
       
   374 	GetGraphicsContext()->DiscardBrushPattern();
       
   375 	}
       
   376 
       
   377 void CT_DataGraphicsContext::DoCmdDiscardFont()
       
   378 	{
       
   379 	INFO_PRINTF1(_L("execute DiscardFont()"));
       
   380 	GetGraphicsContext()->DiscardFont();
       
   381 	}
       
   382 
       
   383 void CT_DataGraphicsContext::DoCmdDrawArc(const TDesC& aSection)
       
   384 	{
       
   385 	TBool	dataOk=ETrue;
       
   386 
       
   387 	// Get test data for command input parameter(s)
       
   388 	TRect	datRect;
       
   389 	if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
       
   390 		{
       
   391 		dataOk=EFalse;
       
   392 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
   393 		SetBlockResult(EFail);
       
   394 		}
       
   395 
       
   396 	TPoint	datStart;
       
   397 	if ( !GetPointFromConfig(aSection, KFldStart, datStart) )
       
   398 		{
       
   399 		dataOk=EFalse;
       
   400 		ERR_PRINTF2(KLogMissingParameter, &KFldStart());
       
   401 		SetBlockResult(EFail);
       
   402 		}
       
   403 
       
   404 	TPoint	datEnd;
       
   405 	if ( !GetPointFromConfig(aSection, KFldEnd, datEnd) )
       
   406 		{
       
   407 		dataOk=EFalse;
       
   408 		ERR_PRINTF2(KLogMissingParameter, &KFldEnd());
       
   409 		SetBlockResult(EFail);
       
   410 		}
       
   411 
       
   412 	if ( dataOk )
       
   413 		{
       
   414 		INFO_PRINTF1(_L("execute DrawArc(TRect, TPoint, TPoint)"));
       
   415 		GetGraphicsContext()->DrawArc(datRect, datStart, datEnd);
       
   416 		}
       
   417 	}
       
   418 
       
   419 void CT_DataGraphicsContext::DoCmdDrawBitmapL(const TDesC& aSection)
       
   420 	{
       
   421 	TBool	dataOk=ETrue;
       
   422 
       
   423 	CFbsBitmap*	bitmap=NULL;
       
   424 	if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
       
   425 		{
       
   426 		dataOk=EFalse;
       
   427 		ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
       
   428 		SetBlockResult(EFail);
       
   429 		}
       
   430 
       
   431 	TPoint	datTopLeft;
       
   432 	if ( GetPointFromConfig(aSection, KFldTopLeft, datTopLeft) )
       
   433 		{
       
   434 		if ( dataOk )
       
   435 			{
       
   436 			// Execute command and log parameters
       
   437 			INFO_PRINTF1(_L("execute DrawBitmap(TPoint, CFbsBitmap*)"));
       
   438 			GetGraphicsContext()->DrawBitmap(datTopLeft, bitmap);
       
   439 			}
       
   440 		}
       
   441 	else
       
   442 		{
       
   443 		TRect	datDestRect;
       
   444 		if ( !GetRectFromConfig(aSection, KFldDestRect, datDestRect) )
       
   445 			{
       
   446 			dataOk=EFalse;
       
   447 			ERR_PRINTF2(KLogMissingParameter, &KFldDestRect());
       
   448 			SetBlockResult(EFail);
       
   449 			}
       
   450 
       
   451 		TRect	datSourceRect;
       
   452 		if ( GetRectFromConfig(aSection, KFldSourceRect, datSourceRect) )
       
   453 			{
       
   454 			if ( dataOk )
       
   455 				{
       
   456 				// Execute command and log parameters
       
   457 				INFO_PRINTF1(_L("execute DrawBitmap(TRect, CFbsBitmap*, TRect)"));
       
   458 				GetGraphicsContext()->DrawBitmap(datDestRect, bitmap, datSourceRect);
       
   459 				}
       
   460 			}
       
   461 		else
       
   462 			{
       
   463 			if ( dataOk )
       
   464 				{
       
   465 				// Execute command and log parameters
       
   466 				INFO_PRINTF1(_L("execute DrawBitmap(TRect, CFbsBitmap*)"));
       
   467 				GetGraphicsContext()->DrawBitmap(datDestRect, bitmap);
       
   468 				}
       
   469 			}
       
   470 		}
       
   471 	}
       
   472 
       
   473 void CT_DataGraphicsContext::DoCmdDrawBitmapMaskedL(const TDesC& aSection)
       
   474 	{
       
   475 	TBool	dataOk=ETrue;
       
   476 
       
   477 	// Get test data for command input parameter(s)
       
   478 	TRect	datDestRect;
       
   479 	if ( !GetRectFromConfig(aSection, KFldDestRect, datDestRect) )
       
   480 		{
       
   481 		dataOk=EFalse;
       
   482 		ERR_PRINTF2(KLogMissingParameter, &KFldDestRect());
       
   483 		SetBlockResult(EFail);
       
   484 		}
       
   485 
       
   486 	TRect	datSourceRect;
       
   487 	if ( !GetRectFromConfig(aSection, KFldSourceRect, datSourceRect) )
       
   488 		{
       
   489 		dataOk=EFalse;
       
   490 		ERR_PRINTF2(KLogMissingParameter, &KFldSourceRect());
       
   491 		SetBlockResult(EFail);
       
   492 		}
       
   493 
       
   494 	TBool	datInvertMask;
       
   495 	if ( !GetBoolFromConfig(aSection, KFldInvertMask, datInvertMask) )
       
   496 		{
       
   497 		dataOk=EFalse;
       
   498 		ERR_PRINTF2(KLogMissingParameter, &KFldInvertMask());
       
   499 		SetBlockResult(EFail);
       
   500 		}
       
   501 
       
   502 	if ( dataOk )
       
   503 		{
       
   504 		CWsBitmap*	wsBitmap = NULL;
       
   505 		if ( CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldWsBitmap, wsBitmap) )
       
   506 			{
       
   507 			CWsBitmap*	mask=NULL;
       
   508 			CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldMaskBitmap, mask);
       
   509 
       
   510 			// Execute command and log parameters
       
   511 			INFO_PRINTF1(_L("execute DrawBitmapMasked(TRect, CWsBitmap*, TRect, CWsBitmap*, TBool)"));
       
   512 			GetGraphicsContext()->DrawBitmapMasked(datDestRect, wsBitmap, datSourceRect, mask, datInvertMask);
       
   513 			}
       
   514 		else
       
   515 			{
       
   516 			CFbsBitmap*	fbsBitmap = NULL;
       
   517 			if ( CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, fbsBitmap) )
       
   518 				{
       
   519 				CFbsBitmap*	mask=NULL;
       
   520 				CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldMaskBitmap, mask);
       
   521 
       
   522 				// Execute command and log parameters
       
   523 				INFO_PRINTF1(_L("execute DrawBitmapMasked(TRect, CFbsBitmap*, TRect, CFbsBitmap*, TBool)"));
       
   524 				GetGraphicsContext()->DrawBitmapMasked(datDestRect, fbsBitmap, datSourceRect, mask, datInvertMask);
       
   525 				}
       
   526 			else
       
   527 				{
       
   528 				ERR_PRINTF2(KLogMissingParameter, &KFldWsBitmap());
       
   529 				ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
       
   530 				SetBlockResult(EFail);
       
   531 				}
       
   532 			}
       
   533 		}
       
   534 	}
       
   535 
       
   536 void CT_DataGraphicsContext::DoCmdDrawEllipse(const TDesC& aSection)
       
   537 	{
       
   538 	// Get test data for command input parameter(s)
       
   539 	TRect	datRect;
       
   540 	if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
       
   541 		{
       
   542 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
   543 		SetBlockResult(EFail);
       
   544 		}
       
   545 	else
       
   546 		{
       
   547 		INFO_PRINTF1(_L("execute DrawEllipse(TRect)"));
       
   548 		GetGraphicsContext()->DrawEllipse(datRect);
       
   549 		}
       
   550 	}
       
   551 
       
   552 void CT_DataGraphicsContext::DoCmdDrawLine(const TDesC& aSection)
       
   553 	{
       
   554 	TBool	dataOk=ETrue;
       
   555 
       
   556 	// Get test data for command input parameter(s)
       
   557 	TPoint	datPoint1;
       
   558 	if ( !GetPointFromConfig(aSection, KFldPoint1, datPoint1) )
       
   559 		{
       
   560 		dataOk=EFalse;
       
   561 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint1());
       
   562 		SetBlockResult(EFail);
       
   563 		}
       
   564 
       
   565 	TPoint	datPoint2;
       
   566 	if ( !GetPointFromConfig(aSection, KFldPoint2, datPoint2) )
       
   567 		{
       
   568 		dataOk=EFalse;
       
   569 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint2());
       
   570 		SetBlockResult(EFail);
       
   571 		}
       
   572 
       
   573 	if ( dataOk )
       
   574 		{
       
   575 		// Execute command and log parameters
       
   576 		INFO_PRINTF1(_L("execute DrawLine(TPoint, TPoint)"));
       
   577 		GetGraphicsContext()->DrawLine(datPoint1, datPoint2);
       
   578 		}
       
   579 	}
       
   580 
       
   581 void CT_DataGraphicsContext::DoCmdDrawLineBy(const TDesC& aSection)
       
   582 	{
       
   583 	// Get test data for command input parameter(s)
       
   584 	TPoint	datPoint;
       
   585 	if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
       
   586 		{
       
   587 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   588 		SetBlockResult(EFail);
       
   589 		}
       
   590 	else
       
   591 		{
       
   592 		// Execute command and log parameters
       
   593 		INFO_PRINTF1(_L("execute DrawLineBy(TPoint)"));
       
   594 		GetGraphicsContext()->DrawLineBy(datPoint);
       
   595 		}
       
   596 	}
       
   597 
       
   598 void CT_DataGraphicsContext::DoCmdDrawLineTo(const TDesC& aSection)
       
   599 	{
       
   600 	// Get test data for command input parameter(s)
       
   601 	TPoint	datPoint;
       
   602 	if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) )
       
   603 		{
       
   604 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   605 		SetBlockResult(EFail);
       
   606 		}
       
   607 	else
       
   608 		{
       
   609 		// Execute command and log parameters
       
   610 		INFO_PRINTF1(_L("execute DrawLineTo(TPoint)"));
       
   611 		GetGraphicsContext()->DrawLineTo(datPoint);
       
   612 		}
       
   613 	}
       
   614 
       
   615 void CT_DataGraphicsContext::DoCmdDrawPie(const TDesC& aSection)
       
   616 	{
       
   617 	TBool	dataOk=ETrue;
       
   618 
       
   619 	// Get test data for command input parameter(s)
       
   620 	TRect	datRect;
       
   621 	if ( !GetRectFromConfig(aSection, KFldRect, datRect) )
       
   622 		{
       
   623 		dataOk=EFalse;
       
   624 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
   625 		SetBlockResult(EFail);
       
   626 		}
       
   627 
       
   628 	TPoint	datStart;
       
   629 	if ( !GetPointFromConfig(aSection, KFldStart, datStart) )
       
   630 		{
       
   631 		dataOk=EFalse;
       
   632 		ERR_PRINTF2(KLogMissingParameter, &KFldStart());
       
   633 		SetBlockResult(EFail);
       
   634 		}
       
   635 
       
   636 	TPoint	datEnd;
       
   637 	if ( !GetPointFromConfig(aSection, KFldEnd, datEnd) )
       
   638 		{
       
   639 		dataOk=EFalse;
       
   640 		ERR_PRINTF2(KLogMissingParameter, &KFldEnd());
       
   641 		SetBlockResult(EFail);
       
   642 		}
       
   643 
       
   644 	if ( dataOk )
       
   645 		{
       
   646 		// Execute command and log parameters
       
   647 		INFO_PRINTF1(_L("execute DrawPie(TRect, TPoint, TPoint)"));
       
   648 		GetGraphicsContext()->DrawPie(datRect, datStart, datEnd);
       
   649 		}
       
   650 	}
       
   651 
       
   652 void CT_DataGraphicsContext::DoCmdDrawPolygonL(const TDesC& aSection)
       
   653 	{
       
   654 	TInt	err=KErrNone;
       
   655 
       
   656 	// Get test data for command input parameter(s)
       
   657 	CGraphicsContext::TFillRule	datFillRule=CGraphicsContext::EAlternate;
       
   658 	CT_GraphicsUtil::ReadFillRule(*this, aSection, KFldFillRule, datFillRule);
       
   659 
       
   660 	TInt	datNumPoints;
       
   661 	if ( GetIntFromConfig(aSection, KFldNumPoints, datNumPoints) )
       
   662 		{
       
   663 		TPoint*	points=new (ELeave) TPoint[datNumPoints];
       
   664 		CleanupArrayDeletePushL(points);
       
   665 
       
   666 		if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, points) )
       
   667 			{
       
   668 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   669 			SetBlockResult(EFail);
       
   670 			}
       
   671 		else
       
   672 			{
       
   673 			// Execute command and log parameters
       
   674 			INFO_PRINTF1(_L("execute DrawPolygon(TPoint*, TInt, TFillRule)"));
       
   675 			err=GetGraphicsContext()->DrawPolygon(points, datNumPoints, datFillRule);
       
   676 			}
       
   677 		CleanupStack::PopAndDestroy(points);
       
   678 		}
       
   679 	else
       
   680 		{
       
   681 		CArrayFix<TPoint>*	points=new (ELeave) CArrayFixFlat<TPoint>(1);
       
   682 		CleanupStack::PushL(points);
       
   683 		TBool	hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
       
   684 
       
   685 		if ( !hasPointList )
       
   686 			{
       
   687 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   688 			SetBlockResult(EFail);
       
   689 			}
       
   690 		else
       
   691 			{
       
   692 			// Execute command and log parameters
       
   693 			INFO_PRINTF1(_L("execute DrawPolygon(CArrayFix<TPoint>*, TFillRule)"));
       
   694 			err=GetGraphicsContext()->DrawPolygon(points, datFillRule);
       
   695 			}
       
   696 		CleanupStack::PopAndDestroy(points);
       
   697 		}
       
   698 
       
   699 	// Check the command return code, if !=KErrNone then stop this command
       
   700 	if ( err!=KErrNone )
       
   701 		{
       
   702 		ERR_PRINTF2(KLogError, err);
       
   703 		SetError(err);
       
   704 		}
       
   705 	}
       
   706 
       
   707 void CT_DataGraphicsContext::DoCmdDrawPolyLineL(const TDesC& aSection)
       
   708 	{
       
   709 	// Get test data for command input parameter(s)
       
   710 	TInt	numPoints;
       
   711 	if ( GetIntFromConfig(aSection, KFldNumPoints, numPoints) )
       
   712 		{
       
   713 		TPoint*	points=new (ELeave) TPoint[numPoints];
       
   714 		CleanupArrayDeletePushL(points);
       
   715 
       
   716 		if ( !GetPointListFromConfig(aSection, KFldPointList, numPoints, points) )
       
   717 			{
       
   718 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   719 			SetBlockResult(EFail);
       
   720 			}
       
   721 		else
       
   722 			{
       
   723 			// Execute command and log parameters
       
   724 			INFO_PRINTF1(_L("execute DrawPolyLine(TPoint*, TInt)"));
       
   725 			GetGraphicsContext()->DrawPolyLine(points, numPoints);
       
   726 			}
       
   727 		CleanupStack::PopAndDestroy(points);
       
   728 		}
       
   729 	else
       
   730 		{
       
   731 		CArrayFix<TPoint>*	points=new (ELeave) CArrayFixFlat<TPoint>(1);
       
   732 		CleanupStack::PushL(points);
       
   733 		TBool	hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
       
   734 
       
   735 		if ( !hasPointList )
       
   736 			{
       
   737 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   738 			SetBlockResult(EFail);
       
   739 			}
       
   740 		else
       
   741 			{
       
   742 			// Execute command and log parameters
       
   743 			INFO_PRINTF1(_L("execute DrawPolyLine(CArrayFix<TPoint>*)"));
       
   744 			GetGraphicsContext()->DrawPolyLine(points);
       
   745 			}
       
   746 		CleanupStack::PopAndDestroy(points);
       
   747 		}
       
   748 	}
       
   749 
       
   750 void CT_DataGraphicsContext::DoCmdDrawRect(const TDesC& aSection)
       
   751 	{
       
   752 	// Get test data for command input parameter(s)
       
   753 	TRect	rect;
       
   754 	if ( !GetRectFromConfig(aSection, KFldRect, rect) )
       
   755 		{
       
   756 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
   757 		SetBlockResult(EFail);
       
   758 		}
       
   759 	else
       
   760 		{
       
   761 		// Execute command and log parameters
       
   762 		INFO_PRINTF1(_L("execute DrawRect(TRect)"));
       
   763 		GetGraphicsContext()->DrawRect(rect);
       
   764 		}
       
   765 	}
       
   766 
       
   767 void CT_DataGraphicsContext::DoCmdDrawRoundRect(const TDesC& aSection)
       
   768 	{
       
   769 	TBool	dataOk=ETrue;
       
   770 
       
   771 	// Get test data for command input parameter(s)
       
   772 	TRect	rect;
       
   773 	if ( !GetRectFromConfig(aSection, KFldRect, rect) )
       
   774 		{
       
   775 		dataOk=EFalse;
       
   776 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
   777 		SetBlockResult(EFail);
       
   778 		}
       
   779 
       
   780 	TSize	size;
       
   781 	if ( !GetSizeFromConfig(aSection, KFldSize, size) )
       
   782 		{
       
   783 		dataOk=EFalse;
       
   784 		ERR_PRINTF2(KLogMissingParameter, &KFldSize());
       
   785 		SetBlockResult(EFail);
       
   786 		}
       
   787 
       
   788 	if ( dataOk )
       
   789 		{
       
   790 		// Execute command and log parameters
       
   791 		INFO_PRINTF1(_L("execute DrawRoundRect(TRect, TSize)"));
       
   792 		GetGraphicsContext()->DrawRoundRect(rect, size);
       
   793 		}
       
   794 	}
       
   795 
       
   796 void CT_DataGraphicsContext::DoCmdDrawText(const TDesC& aSection)
       
   797 	{
       
   798 	TBool	dataOk=ETrue;
       
   799 	TPtrC	text;
       
   800 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   801 		{
       
   802 		dataOk=EFalse;
       
   803 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   804 		SetBlockResult(EFail);
       
   805 		}
       
   806 
       
   807 	TPoint	point;
       
   808 	if(	GetPointFromConfig(aSection, KFldPoint(), point))
       
   809 		{
       
   810 		if ( dataOk )
       
   811 			{
       
   812 			// Execute command and log parameters
       
   813 			INFO_PRINTF1(_L("execute DrawText(const TDesC&, const TPoint &)"));
       
   814 			GetGraphicsContext()->DrawText(text, point);
       
   815 			}
       
   816 		}
       
   817 	else
       
   818 		{
       
   819 		TRect	rect;
       
   820 		if ( GetRectFromConfig(aSection, KFldRect(), rect) )
       
   821 			{
       
   822 			TInt	baselineOffset=0;
       
   823 			if ( !GetIntFromConfig(aSection, KFldBaselineOffset(), baselineOffset))
       
   824 				{
       
   825 				dataOk=EFalse;
       
   826 				ERR_PRINTF2(_L("Missing parameter %S"), &KFldBaselineOffset());
       
   827 				SetBlockResult(EFail);
       
   828 				}
       
   829 
       
   830 			CGraphicsContext::TTextAlign	textAlign=CGraphicsContext::ELeft;
       
   831 			CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign, textAlign);
       
   832 
       
   833 			TInt	leftMargin=0;
       
   834 			GetIntFromConfig(aSection, KFldLeftMargin(), leftMargin);
       
   835 			if( dataOk )
       
   836 				{
       
   837 				// Execute command and log parameters
       
   838 				INFO_PRINTF1(_L("execute DrawText(const TDesC&, const TRect&, TInt, TTextAlign, TInt)"));
       
   839 				GetGraphicsContext()->DrawText(text, rect, baselineOffset, textAlign, leftMargin);
       
   840 				}
       
   841 			}
       
   842 		else
       
   843 			{
       
   844 			dataOk=EFalse;
       
   845 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
       
   846 			SetBlockResult(EFail);
       
   847 			}
       
   848 		}
       
   849 	}
       
   850 
       
   851 void CT_DataGraphicsContext::DoCmdDrawTextExtendedL(const TDesC& aSection)
       
   852 	{
       
   853 	TBool	dataOk=ETrue;
       
   854 	TPtrC	text;
       
   855 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   856 		{
       
   857 		dataOk=EFalse;
       
   858 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   859 		SetBlockResult(EFail);
       
   860 		}
       
   861 
       
   862 	TPoint	point;
       
   863 	if(	!GetPointFromConfig(aSection, KFldPoint(), point))
       
   864 		{
       
   865 		dataOk=EFalse;
       
   866 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldPoint());
       
   867 		SetBlockResult(EFail);
       
   868 		}
       
   869 
       
   870 	CGraphicsContext::TDrawTextExtendedParam*	drawTextExtendedParam=NULL;
       
   871 	if ( !CT_GraphicsUtil::GetDrawTextExtendedParamL(*this, aSection, KFldTextExtendedParam(), drawTextExtendedParam) )
       
   872 		{
       
   873 		dataOk=EFalse;
       
   874 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldTextExtendedParam());
       
   875 		SetBlockResult(EFail);
       
   876 		}
       
   877 
       
   878 	if ( dataOk )
       
   879 		{
       
   880 		INFO_PRINTF1(_L("execute DrawTextExtended(const TDesC&, TPoint, CGraphicsContext::TDrawTextExtendedParam)"));
       
   881 		TInt	err=GetGraphicsContext()->DrawTextExtended(text, point, *drawTextExtendedParam);
       
   882 		if ( err!=KErrNone )
       
   883 			{
       
   884 			ERR_PRINTF2(KLogError, err);
       
   885 			SetError(err);
       
   886 			}
       
   887 		}
       
   888 	}
       
   889 
       
   890 void CT_DataGraphicsContext::DoCmdDrawTextVertical(const TDesC& aSection)
       
   891 	{
       
   892 	TBool	dataOk=ETrue;
       
   893 	TPtrC	text;
       
   894 	if( !GetStringFromConfig(aSection, KFldText(), text) )
       
   895 		{
       
   896 		dataOk=EFalse;
       
   897 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   898 		SetBlockResult(EFail);
       
   899 		}
       
   900 
       
   901 	TBool	up=EFalse;
       
   902 	if(	!GetBoolFromConfig(aSection, KFldUp(), up))
       
   903 		{
       
   904 		dataOk=EFalse;
       
   905 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
       
   906 		SetBlockResult(EFail);
       
   907 		}
       
   908 
       
   909 	TPoint	point;
       
   910 	if(	GetPointFromConfig(aSection, KFldPoint(), point))
       
   911 		{
       
   912 		if ( dataOk )
       
   913 			{
       
   914 			// Execute command and log parameters
       
   915 			INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC&, const TPoint &, TBool)"));
       
   916 			GetGraphicsContext()->DrawTextVertical(text, point, up);
       
   917 			}
       
   918 		}
       
   919 	else
       
   920 		{
       
   921 		// Another overload DrawTextVertical function
       
   922 		TRect	rect;
       
   923 		if(	!GetRectFromConfig(aSection, KFldRect(), rect) )
       
   924 			{
       
   925 			dataOk=EFalse;
       
   926 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
       
   927 			SetBlockResult(EFail);
       
   928 			}
       
   929 
       
   930 		TInt	baselineOffset=0;
       
   931 		if ( !GetIntFromConfig(aSection, KFldBaselineOffset(), baselineOffset))
       
   932 			{
       
   933 			dataOk=EFalse;
       
   934 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldBaselineOffset());
       
   935 			SetBlockResult(EFail);
       
   936 			}
       
   937 
       
   938 		CGraphicsContext::TTextAlign	textAlign=CGraphicsContext::ELeft;
       
   939 		CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign, textAlign);
       
   940 
       
   941 		TInt	leftMargin=0;
       
   942 		GetIntFromConfig(aSection, KFldLeftMargin(), leftMargin);
       
   943 
       
   944 		if ( dataOk )
       
   945 			{
       
   946 			INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC&, const TRect&, TInt, TBool, TTextAlign, TInt)"));
       
   947 			GetGraphicsContext()->DrawTextVertical(text, rect, baselineOffset, up, textAlign, leftMargin);
       
   948 			}
       
   949 		}
       
   950 	}
       
   951 
       
   952 void CT_DataGraphicsContext::DoCmdGetShadowColor(const TDesC& aSection)
       
   953 	{
       
   954 	TRgb	color;
       
   955 	INFO_PRINTF1(_L("execute GetShadowColor(TRgb)"));
       
   956 	TInt	err=GetGraphicsContext()->GetShadowColor(color);
       
   957 	INFO_PRINTF5(KLogColor, color.Red(), color.Green(), color.Blue(), color.Alpha());
       
   958 	if ( err!=KErrNone )
       
   959 		{
       
   960 		ERR_PRINTF2(KLogError, err);
       
   961 		SetError(err);
       
   962 		}
       
   963 	else
       
   964 		{
       
   965 		TRgb	expected;
       
   966 		if ( GetRgbFromConfig(aSection, KFldRgb(), expected) )
       
   967 			{
       
   968 			if ( color!=expected )
       
   969 				{
       
   970 				ERR_PRINTF1(KLogNotExpectedValue);
       
   971 				SetBlockResult(EFail);
       
   972 				}
       
   973 			}
       
   974 		}
       
   975 	}
       
   976 
       
   977 void CT_DataGraphicsContext::DoCmdGetUnderlineMetrics(const TDesC& aSection)
       
   978 	{
       
   979 	TInt	top;
       
   980 	TInt	bottom;
       
   981 	INFO_PRINTF1(_L("execute GetUnderlineMetrics(TInt, TInt)"));
       
   982 	TInt	err=GetGraphicsContext()->GetUnderlineMetrics(top, bottom);
       
   983 	INFO_PRINTF3(KLogMetrics, top, bottom);
       
   984 
       
   985 	if ( err!=KErrNone )
       
   986 		{
       
   987 		ERR_PRINTF2(KLogError, err);
       
   988 		SetError(err);
       
   989 		}
       
   990 	else
       
   991 		{
       
   992 		TInt	expected;
       
   993 		if ( GetIntFromConfig(aSection, KFldTop(), expected) )
       
   994 			{
       
   995 			if ( top!=expected )
       
   996 				{
       
   997 				ERR_PRINTF1(KLogNotExpectedValue);
       
   998 				SetBlockResult(EFail);
       
   999 				}
       
  1000 			}
       
  1001 		if ( GetIntFromConfig(aSection, KFldBottom(), expected) )
       
  1002 			{
       
  1003 			if ( bottom!=expected )
       
  1004 				{
       
  1005 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1006 				SetBlockResult(EFail);
       
  1007 				}
       
  1008 			}
       
  1009 		}
       
  1010 	}
       
  1011 
       
  1012 void CT_DataGraphicsContext::DoCmdJustificationInPixels(const TDesC& aSection)
       
  1013 	{
       
  1014 	TBool	dataOk=ETrue;
       
  1015 
       
  1016 	TInt	excessPixels;
       
  1017 	if(	!GetIntFromConfig(aSection, KFldExcessPixels(), excessPixels) )
       
  1018 		{
       
  1019 		dataOk=EFalse;
       
  1020 		ERR_PRINTF2(KLogMissingParameter, &KFldExcessPixels());
       
  1021 		SetBlockResult(EFail);
       
  1022 		}
       
  1023 
       
  1024 	TInt	totalUnits;
       
  1025 	if(	!GetIntFromConfig(aSection, KFldTotalUnits(), totalUnits) )
       
  1026 		{
       
  1027 		dataOk=EFalse;
       
  1028 		ERR_PRINTF2(KLogMissingParameter, &KFldTotalUnits());
       
  1029 		SetBlockResult(EFail);
       
  1030 		}
       
  1031 
       
  1032 	TInt	firstUnit;
       
  1033 	if(	!GetIntFromConfig(aSection, KFldFirstUnit(), firstUnit) )
       
  1034 		{
       
  1035 		dataOk=EFalse;
       
  1036 		ERR_PRINTF2(KLogMissingParameter, &KFldFirstUnit());
       
  1037 		SetBlockResult(EFail);
       
  1038 		}
       
  1039 
       
  1040 	TInt	numUnits;
       
  1041 	if(	!GetIntFromConfig(aSection, KFldNumUnits(), numUnits) )
       
  1042 		{
       
  1043 		dataOk=EFalse;
       
  1044 		ERR_PRINTF2(KLogMissingParameter, &KFldNumUnits());
       
  1045 		SetBlockResult(EFail);
       
  1046 		}
       
  1047 
       
  1048 	if ( dataOk )
       
  1049 		{
       
  1050 		INFO_PRINTF1(_L("execute JustificationInPixels(TInt, TInt, TInt, TInt)"));
       
  1051 		TInt	actual=GetGraphicsContext()->JustificationInPixels(excessPixels, totalUnits, firstUnit, numUnits);
       
  1052 		INFO_PRINTF2(_L("JustificationInPixels=%d"), actual);
       
  1053 
       
  1054 		TInt	expected;
       
  1055 		if ( GetIntFromConfig(aSection, KFldExpected(), expected) )
       
  1056 			{
       
  1057 			if ( actual!=expected )
       
  1058 				{
       
  1059 				ERR_PRINTF1(KLogNotExpectedValue);
       
  1060 				SetBlockResult(EFail);
       
  1061 				}
       
  1062 			}
       
  1063 		}
       
  1064 	}
       
  1065 
       
  1066 void CT_DataGraphicsContext::DoCmdMapColorsL(const TDesC& aSection)
       
  1067 	{
       
  1068 	TBool	dataOk=ETrue;
       
  1069 
       
  1070 	TRect	rect;
       
  1071 	if(	!GetRectFromConfig(aSection, KFldRect(), rect) )
       
  1072 		{
       
  1073 		dataOk=EFalse;
       
  1074 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
  1075 		SetBlockResult(EFail);
       
  1076 		}
       
  1077 
       
  1078 	TInt	numColors;
       
  1079 	if ( !GetIntFromConfig(aSection, KFldNumColors, numColors) )
       
  1080 		{
       
  1081 		dataOk=EFalse;
       
  1082 		ERR_PRINTF2(KLogMissingParameter, &KFldNumColors());
       
  1083 		SetBlockResult(EFail);
       
  1084 		}
       
  1085 
       
  1086 	TBool	mapForwards=EFalse;
       
  1087 	if(	!GetBoolFromConfig(aSection, KFldMapForwards(), mapForwards))
       
  1088 		{
       
  1089 		dataOk=EFalse;
       
  1090 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldMapForwards());
       
  1091 		SetBlockResult(EFail);
       
  1092 		}
       
  1093 
       
  1094 	if ( dataOk )
       
  1095 		{
       
  1096 		TRgb*	colors=new (ELeave) TRgb[numColors];
       
  1097 		CleanupArrayDeletePushL(colors);
       
  1098 
       
  1099 		if ( !GetRgbListFromConfig(aSection, KFldRgbList, numColors, colors) )
       
  1100 			{
       
  1101 			ERR_PRINTF2(KLogMissingParameter, &KFldRgbList());
       
  1102 			SetBlockResult(EFail);
       
  1103 			}
       
  1104 		else
       
  1105 			{
       
  1106 			// Execute command and log parameters
       
  1107 			INFO_PRINTF1(_L("execute MapColors(const TRect&, const TRgb*, TInt, TBool)"));
       
  1108 			GetGraphicsContext()->MapColors(rect, colors, numColors, mapForwards);
       
  1109 			}
       
  1110 		CleanupStack::PopAndDestroy(colors);
       
  1111 		}
       
  1112 	}
       
  1113 
       
  1114 void CT_DataGraphicsContext::DoCmdMoveBy(const TDesC& aSection)
       
  1115 	{
       
  1116 	TPoint	point;
       
  1117 	if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
  1118 		{
       
  1119 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
  1120 		SetBlockResult(EFail);
       
  1121 		}
       
  1122 	else
       
  1123 		{
       
  1124 		// Execute command and log parameters
       
  1125 		INFO_PRINTF1(_L("execute MoveBy(TPoint)"));
       
  1126 		GetGraphicsContext()->MoveBy(point);
       
  1127 		}
       
  1128 	}
       
  1129 
       
  1130 void CT_DataGraphicsContext::DoCmdMoveTo(const TDesC& aSection)
       
  1131 	{
       
  1132 	TPoint	point;
       
  1133 	if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
  1134 		{
       
  1135 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
  1136 		SetBlockResult(EFail);
       
  1137 		}
       
  1138 	else
       
  1139 		{
       
  1140 		// Execute command and log parameters
       
  1141 		INFO_PRINTF1(_L("execute MoveTo(TPoint)"));
       
  1142 		GetGraphicsContext()->MoveTo(point);
       
  1143 		}
       
  1144 	}
       
  1145 
       
  1146 void CT_DataGraphicsContext::DoCmdPlot(const TDesC& aSection)
       
  1147 	{
       
  1148 	TPoint	point;
       
  1149 	if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
  1150 		{
       
  1151 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
  1152 		SetBlockResult(EFail);
       
  1153 		}
       
  1154 	else
       
  1155 		{
       
  1156 		// Execute command and log parameters
       
  1157 		INFO_PRINTF1(_L("execute Plot(TPoint)"));
       
  1158 		GetGraphicsContext()->Plot(point);
       
  1159 		}
       
  1160 	}
       
  1161 
       
  1162 void CT_DataGraphicsContext::DoCmdReserved()
       
  1163 	{
       
  1164 	INFO_PRINTF1(_L("execute Reserved()"));
       
  1165 	GetGraphicsContext()->Reserved();
       
  1166 	}
       
  1167 
       
  1168 void CT_DataGraphicsContext::DoCmdReset()
       
  1169 	{
       
  1170 	INFO_PRINTF1(_L("execute Reset()"));
       
  1171 	GetGraphicsContext()->Reset();
       
  1172 	}
       
  1173 
       
  1174 void CT_DataGraphicsContext::DoCmdSetBrushColor(const TDesC& aSection)
       
  1175 	{
       
  1176 	TRgb	rgb;
       
  1177 	if(	!GetRgbFromConfig(aSection, KFldColor(), rgb))
       
  1178 		{
       
  1179 		ERR_PRINTF2(KLogMissingParameter, &KFldColor());
       
  1180 		SetBlockResult(EFail);
       
  1181 		}
       
  1182 	else
       
  1183 		{
       
  1184 		INFO_PRINTF1(_L("execute SetBrushColor(TRgb)"));
       
  1185 		GetGraphicsContext()->SetBrushColor(rgb);
       
  1186 		}
       
  1187 	}
       
  1188 
       
  1189 void CT_DataGraphicsContext::DoCmdSetBrushOrigin(const TDesC& aSection)
       
  1190 	{
       
  1191 	TPoint	point;
       
  1192 	if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
  1193 		{
       
  1194 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
  1195 		SetBlockResult(EFail);
       
  1196 		}
       
  1197 	else
       
  1198 		{
       
  1199 		// Execute command and log parameters
       
  1200 		INFO_PRINTF1(_L("execute SetBrushOrigin(TPoint)"));
       
  1201 		GetGraphicsContext()->SetBrushOrigin(point);
       
  1202 		}
       
  1203 	}
       
  1204 
       
  1205 void CT_DataGraphicsContext::DoCmdSetBrushStyle(const TDesC& aSection)
       
  1206 	{
       
  1207 	CGraphicsContext::TBrushStyle	brushStyle;
       
  1208 	if(	!CT_GraphicsUtil::ReadBrushStyle(*this, aSection, KFldBrushStyle(), brushStyle))
       
  1209 		{
       
  1210 		ERR_PRINTF2(KLogMissingParameter, &KFldBrushStyle());
       
  1211 		SetBlockResult(EFail);
       
  1212 		}
       
  1213 	else
       
  1214 		{
       
  1215 		// Execute command and log parameters
       
  1216 		INFO_PRINTF1(_L("execute SetBrushStyle(CGraphicsContext::TBrushStyle)"));
       
  1217 		GetGraphicsContext()->SetBrushStyle(brushStyle);
       
  1218 		}
       
  1219 	}
       
  1220 
       
  1221 void CT_DataGraphicsContext::DoCmdSetClippingRegion(const TDesC& aSection)
       
  1222 	{
       
  1223 	RRegion	region;
       
  1224 	CleanupClosePushL(region);
       
  1225 	if ( !GetRegionFromConfig(aSection, KFldRegion, region) )
       
  1226 		{
       
  1227 		ERR_PRINTF2(KLogMissingParameter, &KFldRegion());
       
  1228 		SetBlockResult(EFail);
       
  1229 		}
       
  1230 	else
       
  1231 		{
       
  1232 		// Execute command and log parameters
       
  1233 		INFO_PRINTF1(_L("execute SetClippingRegion(TRegion)"));
       
  1234 		TInt	err=GetGraphicsContext()->SetClippingRegion(region);
       
  1235 
       
  1236 		// Check the command return code, if !=KErrNone then stop this command
       
  1237 		if ( err!=KErrNone )
       
  1238 			{
       
  1239 			ERR_PRINTF2(KLogError, err);
       
  1240 			SetError(err);
       
  1241 			}
       
  1242 		}
       
  1243 	CleanupStack::PopAndDestroy(&region);
       
  1244 	}
       
  1245 
       
  1246 void CT_DataGraphicsContext::DoCmdSetCharJustification(const TDesC& aSection)
       
  1247 	{
       
  1248 	TBool	dataOk=ETrue;
       
  1249 
       
  1250 	TInt	excessWidth=0;
       
  1251 	if(	!GetIntFromConfig(aSection, KFldExcessWidth(), excessWidth) )
       
  1252 		{
       
  1253 		dataOk=EFalse;
       
  1254 		ERR_PRINTF2(KLogMissingParameter, &KFldExcessWidth());
       
  1255 		SetBlockResult(EFail);
       
  1256 		}
       
  1257 
       
  1258 	TInt	numChars=0;
       
  1259 	if(	!GetIntFromConfig(aSection, KFldNumChars(), numChars) )
       
  1260 		{
       
  1261 		dataOk=EFalse;
       
  1262 		ERR_PRINTF2(KLogMissingParameter, &KFldNumChars());
       
  1263 		SetBlockResult(EFail);
       
  1264 		}
       
  1265 
       
  1266 	if ( dataOk )
       
  1267 		{
       
  1268 		INFO_PRINTF1(_L("execute SetCharJustification(TInt, TInt)"));
       
  1269 		GetGraphicsContext()->SetCharJustification(excessWidth, numChars);
       
  1270 		}
       
  1271 	}
       
  1272 
       
  1273 void CT_DataGraphicsContext::DoCmdSetClippingRect(const TDesC& aSection)
       
  1274 	{
       
  1275 	TRect	rect;
       
  1276 	if ( !GetRectFromConfig(aSection, KFldRect, rect) )
       
  1277 		{
       
  1278 		ERR_PRINTF2(KLogMissingParameter, &KFldRect());
       
  1279 		SetBlockResult(EFail);
       
  1280 		}
       
  1281 	else
       
  1282 		{
       
  1283 		INFO_PRINTF1(_L("execute SetClippingRect(TRect)"));
       
  1284 		GetGraphicsContext()->SetClippingRect(rect);
       
  1285 		}
       
  1286 	}
       
  1287 
       
  1288 void CT_DataGraphicsContext::DoCmdSetDrawMode(const TDesC& aSection)
       
  1289 	{
       
  1290 	CGraphicsContext::TDrawMode	drawMode;
       
  1291 	if(	!CT_GraphicsUtil::ReadDrawMode(*this, aSection, KFldDrawMode(), drawMode) )
       
  1292 		{
       
  1293 		ERR_PRINTF2(KLogMissingParameter, &KFldDrawMode());
       
  1294 		SetBlockResult(EFail);
       
  1295 		}
       
  1296 	else
       
  1297 		{
       
  1298 		INFO_PRINTF1(_L("execute SetDrawMode(CGraphicsContext::TDrawMode)"));
       
  1299 		GetGraphicsContext()->SetDrawMode(drawMode);
       
  1300 		}
       
  1301 	}
       
  1302 
       
  1303 void CT_DataGraphicsContext::DoCmdSetOrigin(const TDesC& aSection)
       
  1304 	{
       
  1305 	TPoint	point;
       
  1306 	if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
  1307 		{
       
  1308 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
  1309 		SetBlockResult(EFail);
       
  1310 		}
       
  1311 	else
       
  1312 		{
       
  1313 		// Execute command and log parameters
       
  1314 		INFO_PRINTF1(_L("execute SetOrigin(TPoint)"));
       
  1315 		GetGraphicsContext()->SetOrigin(point);
       
  1316 		}
       
  1317 	}
       
  1318 
       
  1319 void CT_DataGraphicsContext::DoCmdSetPenColor(const TDesC& aSection)
       
  1320 	{
       
  1321 	TRgb	rgb;
       
  1322 	if(	!GetRgbFromConfig(aSection, KFldColor(), rgb))
       
  1323 		{
       
  1324 		ERR_PRINTF2(KLogMissingParameter, &KFldColor());
       
  1325 		SetBlockResult(EFail);
       
  1326 		}
       
  1327 	else
       
  1328 		{
       
  1329 		INFO_PRINTF1(_L("execute SetPenColor(TRgb)"));
       
  1330 		GetGraphicsContext()->SetPenColor(rgb);
       
  1331 		}
       
  1332 	}
       
  1333 
       
  1334 void CT_DataGraphicsContext::DoCmdSetPenSize(const TDesC& aSection)
       
  1335 	{
       
  1336 	TSize	size;
       
  1337 	if(	!GetSizeFromConfig(aSection, KFldSize(), size))
       
  1338 		{
       
  1339 		ERR_PRINTF2(KLogMissingParameter, &KFldSize());
       
  1340 		SetBlockResult(EFail);
       
  1341 		}
       
  1342 	else
       
  1343 		{
       
  1344 		INFO_PRINTF1(_L("execute SetPenSize(TSize)"));
       
  1345 		GetGraphicsContext()->SetPenSize(size);
       
  1346 		}
       
  1347 	}
       
  1348 
       
  1349 void CT_DataGraphicsContext::DoCmdSetPenStyle(const TDesC& aSection)
       
  1350 	{
       
  1351 	CGraphicsContext::TPenStyle	penStyle;
       
  1352 	if(	!CT_GraphicsUtil::ReadPenStyle(*this, aSection, KFldPenStyle(), penStyle))
       
  1353 		{
       
  1354 		ERR_PRINTF2(KLogMissingParameter, &KFldPenStyle());
       
  1355 		SetBlockResult(EFail);
       
  1356 		}
       
  1357 	else
       
  1358 		{
       
  1359 		INFO_PRINTF1(_L("execute SetPenStyle(CGraphicsContext::TPenStyle)"));
       
  1360 		GetGraphicsContext()->SetPenStyle(penStyle);
       
  1361 		}
       
  1362 	}
       
  1363 
       
  1364 void CT_DataGraphicsContext::DoCmdSetShadowColor(const TDesC& aSection)
       
  1365 	{
       
  1366 	TRgb	color;
       
  1367 	if ( !GetRgbFromConfig(aSection, KFldRgb(), color) )
       
  1368 		{
       
  1369 		ERR_PRINTF2(KLogMissingParameter, &KFldRgb());
       
  1370 		SetBlockResult(EFail);
       
  1371 		}
       
  1372 	else
       
  1373 		{
       
  1374 		INFO_PRINTF1(_L("execute SetShadowColor(TRgb)"));
       
  1375 		TInt	err=GetGraphicsContext()->SetShadowColor(color);
       
  1376 		if ( err!=KErrNone )
       
  1377 			{
       
  1378 			ERR_PRINTF2(KLogError, err);
       
  1379 			SetError(err);
       
  1380 			}
       
  1381 		}
       
  1382 	}
       
  1383 
       
  1384 void CT_DataGraphicsContext::DoCmdSetStrikethroughStyle(const TDesC& aSection)
       
  1385 	{
       
  1386 	TFontStrikethrough	fontStrikethrough;
       
  1387 	if(	!CT_GraphicsUtil::ReadFontStrikethrough(*this, aSection, KFldFontStrikethrough(), fontStrikethrough) )
       
  1388 		{
       
  1389 		ERR_PRINTF2(KLogMissingParameter, &KFldFontStrikethrough());
       
  1390 		SetBlockResult(EFail);
       
  1391 		}
       
  1392 	else
       
  1393 		{
       
  1394 		INFO_PRINTF1(_L("execute SetStrikethroughStyle(TFontStrikethrough)"));
       
  1395 		GetGraphicsContext()->SetStrikethroughStyle(fontStrikethrough);
       
  1396 		}
       
  1397 	}
       
  1398 
       
  1399 void CT_DataGraphicsContext::DoCmdSetUnderlineStyle(const TDesC& aSection)
       
  1400 	{
       
  1401 	TFontUnderline	fontUnderline;
       
  1402 	if(	!CT_GraphicsUtil::ReadFontUnderline(*this, aSection, KFldFontUnderline(), fontUnderline) )
       
  1403 		{
       
  1404 		ERR_PRINTF2(KLogMissingParameter, &KFldFontUnderline());
       
  1405 		SetBlockResult(EFail);
       
  1406 		}
       
  1407 	else
       
  1408 		{
       
  1409 		INFO_PRINTF1(_L("execute SetUnderlineStyle(TFontUnderline)"));
       
  1410 		GetGraphicsContext()->SetUnderlineStyle(fontUnderline);
       
  1411 		}
       
  1412 	}
       
  1413 
       
  1414 void CT_DataGraphicsContext::DoCmdSetWordJustification(const TDesC& aSection)
       
  1415 	{
       
  1416 	TBool	dataOk=ETrue;
       
  1417 
       
  1418 	TInt	excessWidth=0;
       
  1419 	if(	!GetIntFromConfig(aSection, KFldExcessWidth(), excessWidth))
       
  1420 		{
       
  1421 		dataOk=EFalse;
       
  1422 		ERR_PRINTF2(KLogMissingParameter, &KFldExcessWidth());
       
  1423 		SetBlockResult(EFail);
       
  1424 		}
       
  1425 
       
  1426 	TInt	numGaps=0;
       
  1427 	if(	!GetIntFromConfig(aSection, KFldNumGaps(), numGaps))
       
  1428 		{
       
  1429 		dataOk=EFalse;
       
  1430 		ERR_PRINTF2(KLogMissingParameter, &KFldNumGaps());
       
  1431 		SetBlockResult(EFail);
       
  1432 		}
       
  1433 
       
  1434 	if ( dataOk )
       
  1435 		{
       
  1436 		INFO_PRINTF1(_L("execute SetWordJustification(TInt, TInt)"));
       
  1437 		GetGraphicsContext()->SetWordJustification(excessWidth, numGaps);
       
  1438 		}
       
  1439 	}
       
  1440 
       
  1441 void CT_DataGraphicsContext::DoCmdUseBrushPatternL(const TDesC& aSection)
       
  1442 	{
       
  1443 	CFbsBitmap*	bitmap=NULL;
       
  1444 	if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap) )
       
  1445 		{
       
  1446 		ERR_PRINTF2(KLogMissingParameter, &KFldBitmap());
       
  1447 		SetBlockResult(EFail);
       
  1448 		}
       
  1449 	else
       
  1450 		{
       
  1451 		INFO_PRINTF1(_L("execute UseBrushPattern(CFbsBitmap*)"));
       
  1452 		GetGraphicsContext()->UseBrushPattern(bitmap);
       
  1453 		}
       
  1454 	}
       
  1455 
       
  1456 void CT_DataGraphicsContext::DoCmdUseFontL(const TDesC& aSection)
       
  1457 	{
       
  1458 	CFont*	font=NULL;
       
  1459 
       
  1460 	CT_GraphicsUtil::GetFontL(*this, aSection, KFldFont, font);
       
  1461 	INFO_PRINTF1(_L("execute UseFont(CFont*)"));
       
  1462 	GetGraphicsContext()->UseFont(font);
       
  1463 	}