graphics/bitgdi/src/T_DataFbsBitGc.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 #include <e32cmn.h>
       
    17 #include <e32property.h>
       
    18 #include "T_DataFbsBitGc.h"
       
    19 #include "T_GraphicsUtil.h"
       
    20 
       
    21 /*@{*/
       
    22 ///	Commands
       
    23 _LIT(KCmdNewL,						"NewL");
       
    24 _LIT(KCmdDestructor,				"~");
       
    25 _LIT(KCmdActivate,					"Activate");
       
    26 _LIT(KCmdActivateNoJustAutoUpdate,	"ActivateNoJustAutoUpdate");
       
    27 _LIT(KCmdAlphaBlendBitmaps,			"AlphaBlendBitmaps");
       
    28 _LIT(KCmdDisown,                    "disown");
       
    29 _LIT(KCmdDrawPolyLineNoEndPoint,    "DrawPolyLineNoEndPoint");
       
    30 
       
    31 _LIT(KCmdCancelClipping,            "CancelClipping");
       
    32 _LIT(KCmdCopySettings,              "CopySettings");
       
    33 _LIT(KCmdBitBlt,                    "BitBlt");
       
    34 
       
    35 _LIT(KCmdDrawText,					"DrawText");
       
    36 _LIT(KCmdDrawTextVertical,			"DrawTextVertical");
       
    37 _LIT(KCmdUpdateJustification,		"UpdateJustification");
       
    38 _LIT(KCmdUpdateJustificationVertical,"UpdateJustificationVertical");
       
    39 
       
    40 _LIT(KCmdFadeArea,                   "FadeArea");
       
    41 _LIT(KCmdIsBrushPatternUsed,         "IsBrushPatternUsed");
       
    42 _LIT(KCmdIsFontUsed,                 "IsFontUsed");
       
    43 _LIT(KCmdOrientationsAvailable,      "OrientationsAvailable");
       
    44 _LIT(KCmdRectDrawnTo,                "RectDrawnTo");
       
    45 _LIT(KCmdResized,                    "Resized");
       
    46 _LIT(KCmdSetDitherOrigin,            "SetDitherOrigin");
       
    47 _LIT(KCmdSetFadeMode,                "SetFadeMode");
       
    48 _LIT(KCmdSetFadingParameters,        "SetFadingParameters");
       
    49 _LIT(KCmdSetOrientation,             "SetOrientation");
       
    50 _LIT(KCmdSetShadowMode,              "SetShadowMode");
       
    51 _LIT(KCmdSetUserDisplayMode,         "SetUserDisplayMode");
       
    52 _LIT(KCmdShadowArea,                 "ShadowArea");
       
    53 _LIT(KCmdUseBrushPattern,            "UseBrushPattern");
       
    54 _LIT(KCmdUseFont,                    "UseFont");
       
    55 _LIT(KCmdUseFontNoDuplicate,         "UseFontNoDuplicate");
       
    56 _LIT(KCmdGetAvailableOrientation,    "GetAvailableOrientation");
       
    57 _LIT(KCmdPromptMessage,				 "PromptMessage");
       
    58 ///	Fields
       
    59 _LIT(KFldAlphaBmp,					"alphabmp");
       
    60 _LIT(KFldAlphaPt,					"alphapt");
       
    61 _LIT(KFldDestPt,					"destpt");
       
    62 _LIT(KFldDevice,					"device");
       
    63 _LIT(KFldSrcBmp1,					"srcbmp1");
       
    64 _LIT(KFldSrcBmp2,					"srcbmp2");
       
    65 _LIT(KFldSrcPt,						"srcpt");
       
    66 _LIT(KFldSrcRect,					"srcrect");
       
    67 _LIT(KFldNumPoints,					"numpoints");
       
    68 _LIT(KFldPointList,					"pointlist");
       
    69 
       
    70 _LIT(KFldFbsBitGc,                  "fbsBitGc");
       
    71 _LIT(KFldPoint,                     "point");
       
    72 
       
    73 _LIT(KFldRect,						"rect");
       
    74 _LIT(KFldTextAlign,					"textalign");
       
    75 _LIT(KFldText,						"text");
       
    76 _LIT(KFldLeftMargin,				"leftmargin");
       
    77 _LIT(KFldBaselineOffset,			"baselineoffset");
       
    78 _LIT(KFldTextWidth,					"textwidth");
       
    79 _LIT(KFldUp,						"up");
       
    80 _LIT(KFldParam,						"param");
       
    81 
       
    82 _LIT(KFldRegion,					"region");
       
    83 _LIT(KFldFadeMode,                  "fademode");
       
    84 _LIT(KFldBlackMap,					"blackmap");
       
    85 _LIT(KFldWhiteMap,					"whitemap");
       
    86 _LIT(KFldGraphicsOrientation,       "orientation");
       
    87 _LIT(KFldShadowMode,                "shadowmode");
       
    88 _LIT(KFldDisplayMode,               "displaymode");
       
    89 _LIT(KFldHandle,                    "handle");
       
    90 _LIT(KFldFont,                      "font");
       
    91 _LIT(KFldBitmap,					"bitmap");
       
    92 _LIT(KFldUseHandle,					"usehandle");
       
    93 _LIT(KFldPromptText,				"message");
       
    94 _LIT(KFldExpectedKey,				"keyCode");
       
    95 
       
    96 _LIT(KFldExpect,                    "expect");
       
    97 _LIT(KFormatFieldNumber,	        "Orientation_%d=%d");
       
    98 ///	Logging
       
    99 _LIT(KLogError,						"Error=%d");
       
   100 _LIT(KLogMissingParameter,			"Missing parameter '%S'");
       
   101 _LIT(KLogNotExpectedValue,			"Not expected value,get %d, expectd %d");
       
   102 /*@}*/
       
   103 _LIT(KPromptProcess,				"t_prompt.exe");
       
   104 
       
   105 
       
   106 /**
       
   107 * Two phase constructor
       
   108 */
       
   109 CT_DataFbsBitGc* CT_DataFbsBitGc::NewL()
       
   110 	{
       
   111 	CT_DataFbsBitGc*	ret=new (ELeave) CT_DataFbsBitGc();
       
   112 	CleanupStack::PushL(ret);
       
   113 	ret->ConstructL();
       
   114 	CleanupStack::Pop(ret);
       
   115 	return ret;
       
   116 	}
       
   117 
       
   118 /**
       
   119 * Protected constructor. First phase construction
       
   120 */
       
   121 CT_DataFbsBitGc::CT_DataFbsBitGc()
       
   122 :	CT_DataBitmapContext()
       
   123 ,	iFbsBitGc(NULL)
       
   124 	{
       
   125 	}
       
   126 
       
   127 /**
       
   128 * Protected second phase construction
       
   129 */
       
   130 void CT_DataFbsBitGc::ConstructL()
       
   131 	{
       
   132 	
       
   133 	}
       
   134 
       
   135 /**
       
   136 * Destructor.
       
   137 */
       
   138 CT_DataFbsBitGc::~CT_DataFbsBitGc()
       
   139 	{
       
   140 
       
   141 	DestroyData();
       
   142 	}
       
   143 
       
   144 void CT_DataFbsBitGc::SetObjectL(TAny* aAny)
       
   145 	{
       
   146 	DestroyData();
       
   147 	iFbsBitGc	= static_cast<CFbsBitGc*> (aAny);
       
   148 	}
       
   149 
       
   150 void CT_DataFbsBitGc::DisownObjectL()
       
   151 	{
       
   152 	iFbsBitGc = NULL;
       
   153 	}
       
   154 
       
   155 void CT_DataFbsBitGc::DestroyData()
       
   156 	{
       
   157 	delete iFbsBitGc;
       
   158 	iFbsBitGc=NULL;
       
   159 	}
       
   160 
       
   161 /**
       
   162 * Return a pointer to the object that the data wraps
       
   163 *
       
   164 * @return pointer to the object that the data wraps
       
   165 */
       
   166 TAny* CT_DataFbsBitGc::GetObject()
       
   167 	{
       
   168 	return iFbsBitGc;
       
   169 	}
       
   170 
       
   171 //	CT_DataBitmapContext implementation
       
   172 CBitmapContext* CT_DataFbsBitGc::GetBitmapContext() const
       
   173 	{
       
   174 	return iFbsBitGc;
       
   175 	}
       
   176 
       
   177 //	CT_DataGraphicsContext implementation
       
   178 CGraphicsContext* CT_DataFbsBitGc::GetGraphicsContext() const
       
   179 	{
       
   180 	return iFbsBitGc;
       
   181 	}
       
   182 
       
   183 /**
       
   184 * Process a command read from the ini file
       
   185 *
       
   186 * @param aCommand			the command to process
       
   187 * @param aSection			the entry in the ini file requiring the command to be processed
       
   188 * @param aAsyncErrorIndex	index of command. used for async calls
       
   189 *
       
   190 * @return ETrue if the command is processed
       
   191 */
       
   192 TBool CT_DataFbsBitGc::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
   193 	{
       
   194 	/* Another work package will complete the implement of this */
       
   195 	TBool	ret = ETrue;
       
   196 
       
   197 	if ( aCommand==KCmdNewL )
       
   198 		{
       
   199 		DoCmdNewL();
       
   200 		}
       
   201 	else if ( aCommand==KCmdDestructor )
       
   202 		{
       
   203 		DoCmdDestructor();
       
   204 		}
       
   205 	else if ( aCommand==KCmdActivate )
       
   206 		{
       
   207 		DoCmdActivateL(aSection);
       
   208 		}
       
   209 	else if ( aCommand == KCmdDisown )
       
   210 		{
       
   211 		DisownObjectL();
       
   212 		}
       
   213 	else if ( aCommand==KCmdActivateNoJustAutoUpdate )
       
   214 		{
       
   215 		DoCmdActivateNoJustAutoUpdateL(aSection);
       
   216 		}
       
   217 	else if ( aCommand==KCmdAlphaBlendBitmaps )
       
   218 		{
       
   219 		if ( !DoCmdAlphaBlendBitmapsL(aSection) )
       
   220 			{
       
   221 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   222 			}
       
   223 		}
       
   224 	else if ( aCommand==KCmdDrawPolyLineNoEndPoint )
       
   225 		{
       
   226 		DoCmdDrawPolyLineNoEndPointL(aSection);
       
   227 		}
       
   228 	else if ( aCommand==KCmdCancelClipping)
       
   229 		{
       
   230 		DoCmdCancelClipping(aSection);
       
   231 		}
       
   232 	else if ( aCommand==KCmdCopySettings)
       
   233 		{
       
   234 		DoCmdCopySettingsL(aSection);
       
   235 		}
       
   236 	else if ( aCommand==KCmdBitBlt)
       
   237 		{
       
   238 		if(!DoCmdBitBltL(aSection))
       
   239 			{
       
   240 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   241 			}
       
   242 		}
       
   243 	else if(aCommand==KCmdDrawText)
       
   244 		{
       
   245 		DoCmdDrawTextL(aSection);
       
   246 		}
       
   247 	else if(aCommand==KCmdDrawTextVertical)
       
   248 		{
       
   249 		DoCmdDrawTextVerticalL(aSection);
       
   250 		}
       
   251 	else if(aCommand==KCmdUpdateJustification)
       
   252 		{
       
   253 		DoCmdUpdateJustificationL(aSection);
       
   254 		}
       
   255 	else if(aCommand==KCmdUpdateJustificationVertical)
       
   256 		{
       
   257 		DoCmdUpdateJustificationVerticalL(aSection);
       
   258 		}
       
   259 	else if(aCommand==KCmdFadeArea)
       
   260 		{
       
   261 		DoCmdFadeArea(aSection);
       
   262 		}
       
   263 	else if(aCommand==KCmdIsBrushPatternUsed)
       
   264 		{
       
   265 		DoCmdIsBrushPatternUsed(aSection);
       
   266 		}
       
   267 	else if(aCommand==KCmdIsFontUsed)
       
   268 		{
       
   269 		DoCmdIsFontUsed(aSection);
       
   270 		}
       
   271 	else if(aCommand==KCmdOrientationsAvailable)
       
   272 		{
       
   273 		DoCmdOrientationsAvailable(aSection);
       
   274 		}
       
   275 	else if(aCommand==KCmdRectDrawnTo)
       
   276 		{
       
   277 		DoCmdRectDrawnTo(aSection);
       
   278 		}
       
   279 	else if(aCommand==KCmdResized)
       
   280 		{
       
   281 		DoCmdResized(aSection);
       
   282 		}
       
   283 	else if(aCommand==KCmdSetDitherOrigin)
       
   284 		{
       
   285 		DoCmdSetDitherOrigin(aSection);
       
   286 		}
       
   287 	else if(aCommand==KCmdSetFadeMode)
       
   288 		{
       
   289 		DoCmdSetFadeMode(aSection);
       
   290 		}
       
   291 	else if(aCommand==KCmdSetFadingParameters)
       
   292 		{
       
   293 		if(!DoCmdSetFadingParameters(aSection))
       
   294 			{
       
   295 			ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   296 			}
       
   297 		}
       
   298 	else if(aCommand==KCmdSetOrientation)
       
   299 		{
       
   300 		DoCmdSetOrientation(aSection);
       
   301 		}
       
   302 	else if(aCommand==KCmdSetShadowMode)
       
   303 		{
       
   304 		DoCmdSetShadowMode(aSection);
       
   305 		}
       
   306 	else if(aCommand==KCmdSetUserDisplayMode)
       
   307 		{
       
   308 		DoCmdSetUserDisplayMode(aSection);
       
   309 		}
       
   310 	else if(aCommand==KCmdShadowArea)
       
   311 		{
       
   312 		DoCmdShadowArea(aSection);
       
   313 		}
       
   314 	else if(aCommand==KCmdUseBrushPattern)
       
   315 		{
       
   316 		DoCmdUseBrushPatternL(aSection);
       
   317 		}
       
   318 	else if(aCommand==KCmdUseFont)
       
   319 		{
       
   320 		DoCmdUseFontL(aSection);
       
   321 		}
       
   322 	else if(aCommand==KCmdUseFontNoDuplicate)
       
   323 		{
       
   324 		DoCmdUseFontNoDuplicateL(aSection);
       
   325 		}
       
   326 	else if(aCommand==KCmdPromptMessage)
       
   327 		{
       
   328 		DoCmdPromptMessageL(aSection);
       
   329 		}
       
   330 	else
       
   331 		{
       
   332 		ret=CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   333 		}
       
   334 
       
   335 	return ret;
       
   336 	}
       
   337 
       
   338 void CT_DataFbsBitGc::DoCmdNewL()
       
   339 	{
       
   340 	DestroyData();
       
   341 
       
   342 	INFO_PRINTF1(_L("execute CFbsBitGc::NewL"));
       
   343 	TRAPD( err, iFbsBitGc = CFbsBitGc::NewL() );
       
   344 	if ( err!=KErrNone )
       
   345 		{
       
   346 		ERR_PRINTF2(KLogError, err);
       
   347 		SetError(err);
       
   348 		}
       
   349 	}
       
   350 
       
   351 void CT_DataFbsBitGc::DoCmdDestructor()
       
   352 	{
       
   353 	DestroyData();
       
   354 	}
       
   355 
       
   356 void CT_DataFbsBitGc::DoCmdActivateL(const TDesC& aSection)
       
   357 	{
       
   358 	CFbsDevice*	device=NULL;
       
   359 	if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
       
   360 		{
       
   361 		ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
       
   362 		SetBlockResult(EFail);
       
   363 		}
       
   364 	else
       
   365 		{
       
   366 		// Execute command and log parameters
       
   367 		INFO_PRINTF1(_L("execute Activate(CFbsDevice*)"));
       
   368 		iFbsBitGc->Activate(device);
       
   369 		}
       
   370 	}
       
   371 
       
   372 void CT_DataFbsBitGc::DoCmdActivateNoJustAutoUpdateL(const TDesC& aSection)
       
   373 	{
       
   374 	CFbsDevice*	device=NULL;
       
   375 	if ( !CT_GraphicsUtil::GetFbsDeviceL(*this, aSection, KFldDevice, device) )
       
   376 		{
       
   377 		ERR_PRINTF2(KLogMissingParameter, &KFldDevice());
       
   378 		SetBlockResult(EFail);
       
   379 		}
       
   380 	else
       
   381 		{
       
   382 		// Execute command and log parameters
       
   383 		INFO_PRINTF1(_L("execute ActivateNoJustAutoUpdate(CFbsDevice*)"));
       
   384 		iFbsBitGc->ActivateNoJustAutoUpdate(device);
       
   385 		}
       
   386 	}
       
   387 
       
   388 TBool CT_DataFbsBitGc::DoCmdAlphaBlendBitmapsL(const TDesC& aSection)
       
   389 	{
       
   390 	CFbsBitmap*	fbsBitmap1=NULL;
       
   391 	TBool		ret=CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp1, fbsBitmap1);
       
   392 	if ( ret )
       
   393 		{
       
   394 		TBool		dataOk=ETrue;
       
   395 
       
   396 		CFbsBitmap*	fbsBitmap2=NULL;
       
   397 		if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldSrcBmp2, fbsBitmap2) )
       
   398 			{
       
   399 			dataOk=EFalse;
       
   400 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcBmp2());
       
   401 			SetBlockResult(EFail);
       
   402 			}
       
   403 
       
   404 		CFbsBitmap*	alphaBitmap=NULL;
       
   405 		if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldAlphaBmp, alphaBitmap) )
       
   406 			{
       
   407 			dataOk=EFalse;
       
   408 			ERR_PRINTF2(KLogMissingParameter, &KFldAlphaBmp());
       
   409 			SetBlockResult(EFail);
       
   410 			}
       
   411 
       
   412 		TPoint	destinationPoint;
       
   413 		if ( !GetPointFromConfig(aSection, KFldDestPt, destinationPoint) )
       
   414 			{
       
   415 			dataOk=EFalse;
       
   416 			ERR_PRINTF2(KLogMissingParameter, &KFldDestPt());
       
   417 			SetBlockResult(EFail);
       
   418 			}
       
   419 
       
   420 		TRect	sourceRect;
       
   421 		if ( !GetRectFromConfig(aSection, KFldSrcRect, sourceRect) )
       
   422 			{
       
   423 			dataOk=EFalse;
       
   424 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcRect());
       
   425 			SetBlockResult(EFail);
       
   426 			}
       
   427 
       
   428 		TPoint	sourcePoint;
       
   429 		if ( !GetPointFromConfig(aSection, KFldSrcPt, sourcePoint) )
       
   430 			{
       
   431 			dataOk=EFalse;
       
   432 			ERR_PRINTF2(KLogMissingParameter, &KFldSrcPt());
       
   433 			SetBlockResult(EFail);
       
   434 			}
       
   435 
       
   436 		TPoint	alphaPoint;
       
   437 		if ( !GetPointFromConfig(aSection, KFldAlphaPt, alphaPoint) )
       
   438 			{
       
   439 			dataOk=EFalse;
       
   440 			ERR_PRINTF2(KLogMissingParameter, &KFldAlphaPt());
       
   441 			SetBlockResult(EFail);
       
   442 			}
       
   443 
       
   444 		if ( dataOk )
       
   445 			{
       
   446 			INFO_PRINTF1(_L("execute AlphaBlendBitmaps(const TPoint&,const CFbsBitmap*,const CFbsBitmap*,const TRect&,const TPoint&,const CFbsBitmap*,const TPoint&"));
       
   447 			TInt	err=iFbsBitGc->AlphaBlendBitmaps(destinationPoint, fbsBitmap1, fbsBitmap2, sourceRect, sourcePoint, alphaBitmap, alphaPoint);
       
   448 			if ( err!=KErrNone )
       
   449 				{
       
   450 				ERR_PRINTF2(KLogError, err);
       
   451 				SetError(err);
       
   452 				}
       
   453 			}
       
   454 		}
       
   455 
       
   456 	return ret;
       
   457 	}
       
   458 
       
   459 void CT_DataFbsBitGc::DoCmdDrawPolyLineNoEndPointL(const TDesC& aSection)
       
   460 	{
       
   461 	TInt	datNumPoints;
       
   462 	if ( GetIntFromConfig(aSection, KFldNumPoints, datNumPoints) )
       
   463 		{
       
   464 		TPoint*	points=new (ELeave) TPoint[datNumPoints];
       
   465 		
       
   466 		if ( !GetPointListFromConfig(aSection, KFldPointList, datNumPoints, points) )
       
   467 			{
       
   468 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   469 			SetBlockResult(EFail);
       
   470 			}
       
   471 		else
       
   472 			{
       
   473 			// Execute command and log parameters
       
   474 			INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(TPoint*, TInt)"));
       
   475 			iFbsBitGc->DrawPolyLineNoEndPoint(points, datNumPoints);
       
   476 			}
       
   477 		delete [] points;
       
   478 		}
       
   479 	else
       
   480 		{
       
   481 		CArrayFix<TPoint>*	points=new (ELeave) CArrayFixFlat<TPoint>(1);
       
   482 		CleanupStack::PushL(points);
       
   483 		TBool	hasPointList=GetPointListFromConfigL(aSection, KFldPointList, *points);
       
   484 
       
   485 		if ( !hasPointList )
       
   486 			{
       
   487 			ERR_PRINTF2(KLogMissingParameter, &KFldPointList());
       
   488 			SetBlockResult(EFail);
       
   489 			}
       
   490 		else
       
   491 			{
       
   492 			// Execute command and log parameters
       
   493 			INFO_PRINTF1(_L("execute DrawPolyLineNoEndPoint(CArrayFix<TPoint>*)"));
       
   494 			iFbsBitGc->DrawPolyLineNoEndPoint(points);
       
   495 			}
       
   496 		CleanupStack::PopAndDestroy(points);
       
   497 		}
       
   498 	}
       
   499 
       
   500 void CT_DataFbsBitGc::DoCmdCancelClipping(const TDesC& /*aSection*/)
       
   501 	{
       
   502 	INFO_PRINTF1(_L("execute CancelClipping()"));
       
   503 	iFbsBitGc->CancelClipping();
       
   504 	}
       
   505 
       
   506 void CT_DataFbsBitGc::DoCmdCopySettingsL(const TDesC& aSection)
       
   507 	{
       
   508 	CFbsBitGc* fbsBitGc=NULL;
       
   509 
       
   510 	if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
       
   511 		{
       
   512 		ERR_PRINTF2(KLogMissingParameter, &KFldFbsBitGc());
       
   513 		SetBlockResult(EFail);
       
   514 		}
       
   515 	else
       
   516 		{
       
   517 		// Execute command and log parameters
       
   518 		INFO_PRINTF1(_L("execute CopySettings(CFbsBitGc&)"));
       
   519 		iFbsBitGc->CopySettings(*fbsBitGc);
       
   520 		}
       
   521 	}
       
   522 
       
   523 TBool CT_DataFbsBitGc::DoCmdBitBltL(const TDesC& aSection)
       
   524 	{
       
   525 	TBool ret=ETrue;
       
   526 	CFbsBitGc* fbsBitGc=NULL;
       
   527 	
       
   528 	if ( !CT_GraphicsUtil::GetFbsBitGcL(*this, aSection, KFldFbsBitGc, fbsBitGc) )
       
   529 		{
       
   530 		ret=EFalse;
       
   531 		}
       
   532 	else
       
   533 		{
       
   534 		// Execute command and log parameters
       
   535 		TPoint	point;
       
   536 		if ( !GetPointFromConfig(aSection, KFldPoint, point) )
       
   537 			{
       
   538 			ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   539 			SetBlockResult(EFail);
       
   540 			//Case failed, needn't execute other step.
       
   541 			return ret;
       
   542 			}
       
   543 		
       
   544 		TRect	sourceRect;
       
   545 		if(!GetRectFromConfig(aSection, KFldSrcRect, sourceRect))
       
   546 			{
       
   547 			INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&)"));
       
   548 			iFbsBitGc->BitBlt(point,*fbsBitGc);
       
   549 			}
       
   550 		else
       
   551 			{
       
   552 			INFO_PRINTF1(_L("execute BitBlt(const TPoint&, const CFbsBitGc&,const TRect &)"));
       
   553 			iFbsBitGc->BitBlt(point,*fbsBitGc,sourceRect);
       
   554 			}
       
   555 		}
       
   556 	
       
   557 	return ret;
       
   558 	}
       
   559 
       
   560 void CT_DataFbsBitGc::DoCmdDrawTextL(const TDesC& aSection)
       
   561 	{
       
   562 	TRect rect;
       
   563 	TInt baselineOffset=0;
       
   564 	TPtrC text;
       
   565 	TInt datTextWidth;
       
   566 
       
   567 	if ( !GetStringFromConfig(aSection, KFldText(), text) )
       
   568 		{
       
   569 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   570 		SetBlockResult(EFail);
       
   571 		return;
       
   572 		}
       
   573 
       
   574 	if (GetRectFromConfig(aSection, KFldRect, rect) )
       
   575 		{
       
   576 		if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
       
   577 			{
       
   578 			TInt datMargin=0;
       
   579 			CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
       
   580 			CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,
       
   581 					textAlign);
       
   582 			if (!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
       
   583 				{
       
   584 				INFO_PRINTF1(_L("Using the default value aMargin=0"));
       
   585 				}
       
   586 
       
   587 			if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
       
   588 				{
       
   589 				INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TInt,TTextAlign,TInt)"));
       
   590 				iFbsBitGc->DrawText(text, rect, baselineOffset, datTextWidth,
       
   591 						textAlign, datMargin);
       
   592 				}
       
   593 			else
       
   594 				{
       
   595 				INFO_PRINTF1(_L("execute DrawText(const TDesC &,const TRect &,TInt,TTextAlign,TInt)"));
       
   596 				iFbsBitGc->DrawText(text, rect, baselineOffset, textAlign,
       
   597 						datMargin);
       
   598 				}
       
   599 			}
       
   600 		else
       
   601 			{
       
   602 			INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TRect&)"));
       
   603 			iFbsBitGc->DrawText(text, rect);
       
   604 			}
       
   605 		}
       
   606 	else
       
   607 		{
       
   608 		TPoint point;
       
   609 		if (!GetPointFromConfig(aSection, KFldPoint, point))
       
   610 			{
       
   611 			INFO_PRINTF1(_L("execute DrawText(const TDesC&)"));
       
   612 			iFbsBitGc->DrawText(text);
       
   613 			}
       
   614 		else
       
   615 			{
       
   616 			INFO_PRINTF1(_L("execute DrawText(const TDesC&,const TPoint&)"));
       
   617 			iFbsBitGc->DrawText(text, point);
       
   618 			}
       
   619 		}
       
   620 	}
       
   621 
       
   622 void CT_DataFbsBitGc::DoCmdDrawTextVerticalL(const TDesC& aSection)
       
   623 	{
       
   624 	TPtrC text;
       
   625 	TInt datTextWidth;
       
   626 	TBool up=EFalse;
       
   627 
       
   628 	if ( !GetStringFromConfig(aSection, KFldText(), text) )
       
   629 		{
       
   630 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   631 		SetBlockResult(EFail);
       
   632 		return;
       
   633 		}
       
   634 
       
   635 	if ( !GetBoolFromConfig(aSection, KFldUp, up))
       
   636 		{
       
   637 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
       
   638 		SetBlockResult(EFail);
       
   639 		return;
       
   640 		}
       
   641 
       
   642 	TRect rect;
       
   643 	TInt baselineOffset=0;
       
   644 	if (GetRectFromConfig(aSection, KFldRect, rect) )
       
   645 		{
       
   646 		if (GetIntFromConfig(aSection, KFldBaselineOffset, baselineOffset))
       
   647 			{
       
   648 			TInt datMargin=0;
       
   649 			CGraphicsContext::TTextAlign textAlign=CGraphicsContext::ELeft;
       
   650 			CT_GraphicsUtil::ReadTextAlign(*this, aSection, KFldTextAlign,
       
   651 					textAlign);
       
   652 			if (!GetIntFromConfig(aSection, KFldLeftMargin, datMargin))
       
   653 				{
       
   654 				INFO_PRINTF1(_L("Using the default value aMargin=0"));
       
   655 				}
       
   656 
       
   657 			if (GetIntFromConfig(aSection, KFldTextWidth, datTextWidth))
       
   658 				{
       
   659 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TInt,TBool,TTextAlign,TInt)"));
       
   660 				iFbsBitGc->DrawTextVertical(text, rect, baselineOffset,
       
   661 						datTextWidth, up, textAlign, datMargin);
       
   662 				}
       
   663 			else
       
   664 				{
       
   665 				INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TInt,TBool,TTextAlign,TInt)"));
       
   666 				iFbsBitGc->DrawTextVertical(text, rect, baselineOffset, up,
       
   667 						textAlign, datMargin);
       
   668 				}
       
   669 			}
       
   670 		else
       
   671 			{
       
   672 			INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TRect &,TBool)"));
       
   673 			iFbsBitGc->DrawTextVertical(text, rect, up);
       
   674 			}
       
   675 		}
       
   676 	else
       
   677 		{
       
   678 		TPoint point;
       
   679 		if (!GetPointFromConfig(aSection, KFldPoint, point))
       
   680 			{
       
   681 			INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,TBool)"));
       
   682 			iFbsBitGc->DrawTextVertical(text, up);
       
   683 			}
       
   684 		else
       
   685 			{
       
   686 			INFO_PRINTF1(_L("execute DrawTextVertical(const TDesC &,const TPoint &,TBool)"));
       
   687 			iFbsBitGc->DrawTextVertical(text, point, up);
       
   688 			}
       
   689 		}
       
   690 	}
       
   691 
       
   692 void CT_DataFbsBitGc::DoCmdUpdateJustificationL(const TDesC& aSection)
       
   693 	{
       
   694 	TPtrC text;
       
   695 	if ( !GetStringFromConfig(aSection, KFldText(), text) )
       
   696 		{
       
   697 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   698 		SetBlockResult(EFail);
       
   699 		return;
       
   700 		}
       
   701 	INFO_PRINTF1(_L("execute UpdateJustification(const TDesC &)"));
       
   702 	iFbsBitGc->UpdateJustification(text);
       
   703 	}
       
   704 
       
   705 void CT_DataFbsBitGc::DoCmdUpdateJustificationVerticalL(const TDesC& aSection)
       
   706 	{
       
   707 	TPtrC text;
       
   708 	TBool up=EFalse;
       
   709 
       
   710 	if ( !GetStringFromConfig(aSection, KFldText(), text) )
       
   711 		{
       
   712 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldText());
       
   713 		SetBlockResult(EFail);
       
   714 		return;
       
   715 		}
       
   716 
       
   717 	if ( !GetBoolFromConfig(aSection, KFldUp, up))
       
   718 		{
       
   719 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldUp());
       
   720 		SetBlockResult(EFail);
       
   721 		return;
       
   722 		}
       
   723 	INFO_PRINTF1(_L("execute UpdateJustificationVertical(const TDesC &,TBool)"));
       
   724 	iFbsBitGc->UpdateJustificationVertical(text, up);
       
   725 	}
       
   726 
       
   727 void CT_DataFbsBitGc::DoCmdFadeArea(const TDesC& aSection)
       
   728 	{
       
   729 	RRegion reg;
       
   730 	if(GetRegionFromConfig(aSection,KFldRegion,reg))
       
   731 		{
       
   732 		INFO_PRINTF1(_L("execute FadeArea(const TRegion *)"));
       
   733 		iFbsBitGc->FadeArea(&reg);
       
   734 		}
       
   735 	else
       
   736 		{
       
   737 		INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
       
   738 		INFO_PRINTF1(_L("execute FadeArea(NULL)"));
       
   739 		iFbsBitGc->FadeArea(NULL);
       
   740 		}
       
   741 	}
       
   742 
       
   743 void CT_DataFbsBitGc::DoCmdIsBrushPatternUsed(const TDesC& aSection)
       
   744 	{
       
   745 	INFO_PRINTF1(_L("execute IsBrushPatternUsed()"));
       
   746 	TBool bUsed=iFbsBitGc->IsBrushPatternUsed();
       
   747 	
       
   748 	TBool expect;
       
   749 	if(GetBoolFromConfig(aSection,KFldExpect,expect))
       
   750 		{
       
   751 		if(expect!=bUsed)
       
   752 			{
       
   753 			ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
       
   754 			SetBlockResult(EFail);
       
   755 			}
       
   756 		}
       
   757 	}
       
   758 
       
   759 void CT_DataFbsBitGc::DoCmdIsFontUsed(const TDesC& aSection)
       
   760 	{
       
   761 	INFO_PRINTF1(_L("execute IsFontUsed()"));
       
   762 	TBool bUsed=iFbsBitGc->IsFontUsed();
       
   763 		
       
   764 	TBool expect;
       
   765 	if(GetBoolFromConfig(aSection,KFldExpect,expect))
       
   766 		{
       
   767 		if(expect!=bUsed)
       
   768 			{
       
   769 			ERR_PRINTF3(KLogNotExpectedValue, bUsed,expect);
       
   770 			SetBlockResult(EFail);
       
   771 			}
       
   772 		}
       
   773 	}
       
   774 
       
   775 void CT_DataFbsBitGc::DoCmdOrientationsAvailable(const TDesC& /*aSection*/)
       
   776 	{
       
   777 	INFO_PRINTF1(_L("execute OrientationsAvailable(TBool aOrientation[4])"));
       
   778 
       
   779 	//iGraphicsOrientation defined in CDataWrapperBase
       
   780 	iFbsBitGc->OrientationsAvailable(iGraphicsOrientation);
       
   781 	
       
   782 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
       
   783 	
       
   784 	for(TInt i=0;i<4;i++)
       
   785 		{
       
   786 		tempStore.Format(KFormatFieldNumber, i+1,iGraphicsOrientation[i]);
       
   787 		INFO_PRINTF1(KFormatFieldNumber);
       
   788 		}
       
   789 	}
       
   790 
       
   791 void CT_DataFbsBitGc::DoCmdRectDrawnTo(const TDesC& aSection)
       
   792 	{
       
   793 	TRect	rect;
       
   794 	if(GetRectFromConfig(aSection, KFldRect, rect))
       
   795 		{
       
   796 		INFO_PRINTF1(_L("execute RectDrawnTo(TRect&)"));
       
   797 		iFbsBitGc->RectDrawnTo(rect);
       
   798 		}
       
   799 	else
       
   800 		{
       
   801 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldRect());
       
   802 		SetBlockResult(EFail);
       
   803 		}
       
   804 
       
   805 	}
       
   806 
       
   807 void CT_DataFbsBitGc::DoCmdResized(const TDesC& /*aSection*/)
       
   808 	{
       
   809 	INFO_PRINTF1(_L("execute Resized()"));
       
   810 	iFbsBitGc->Resized();
       
   811 	
       
   812 	}
       
   813 
       
   814 void CT_DataFbsBitGc::DoCmdSetDitherOrigin(const TDesC& aSection)
       
   815 	{
       
   816 	TPoint	point;
       
   817 	if (GetPointFromConfig(aSection, KFldPoint, point))
       
   818 		{
       
   819 		INFO_PRINTF1(_L("execute SetDitherOrigin(const TPoint &)"));
       
   820 		iFbsBitGc->SetDitherOrigin(point);
       
   821 		}
       
   822 	else
       
   823 		{
       
   824 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   825 		SetBlockResult(EFail);
       
   826 		}
       
   827 	}
       
   828 
       
   829 void CT_DataFbsBitGc::DoCmdSetFadeMode(const TDesC& aSection)
       
   830 	{
       
   831 	TBool fade;
       
   832 	if(GetBoolFromConfig(aSection,KFldFadeMode,fade))
       
   833 		{
       
   834 		INFO_PRINTF1(_L("execute SetFadeMode(TBool)"));
       
   835 		iFbsBitGc->SetFadeMode(fade);
       
   836 		}
       
   837 	else
       
   838 		{
       
   839 		INFO_PRINTF1(_L("execute SetFadeMode(TBool aFadeMode=EFalse)"));
       
   840 		iFbsBitGc->SetFadeMode();
       
   841 		}
       
   842 	}
       
   843 
       
   844 TBool CT_DataFbsBitGc::DoCmdSetFadingParameters(const TDesC& aSection)
       
   845 	{
       
   846 	TInt blackmap=0;
       
   847 	TInt whitemap=255;
       
   848 	if(GetIntFromConfig(aSection,KFldWhiteMap,whitemap))
       
   849 		{
       
   850 		//let base class handle this
       
   851 		return EFalse;
       
   852 		}
       
   853 	else
       
   854 		{
       
   855 		if(GetBoolFromConfig(aSection,KFldBlackMap,blackmap))
       
   856 			{
       
   857 			INFO_PRINTF1(_L("execute SetFadingParameters(TUint8)"));
       
   858 			iFbsBitGc->SetFadingParameters(blackmap);
       
   859 			}
       
   860 		else
       
   861 			{
       
   862 			INFO_PRINTF1(_L("execute SetFadingParameters(TUint8 aBlackMap=0)"));
       
   863 			iFbsBitGc->SetFadingParameters();
       
   864 			}
       
   865 		}
       
   866 	return ETrue;
       
   867 	}
       
   868 
       
   869 void CT_DataFbsBitGc::DoCmdSetOrientation(const TDesC& aSection)
       
   870 	{
       
   871 	CFbsBitGc::TGraphicsOrientation orientation;
       
   872 	TBool ret=EFalse;
       
   873 	if(CT_GraphicsUtil::GetGraphicsOrientation(*this,aSection,KFldGraphicsOrientation,orientation))
       
   874 		{
       
   875 		INFO_PRINTF1(_L("execute SetOrientation(TGraphicsOrientation)"));
       
   876 		ret=iFbsBitGc->SetOrientation(orientation);
       
   877 		if(ret!=iGraphicsOrientation[orientation])
       
   878 			{
       
   879 			INFO_PRINTF1(_L("SetOrientation and OrientationsAvailable return values are not match!"));
       
   880 			SetBlockResult(EFail);
       
   881 			}
       
   882 		}
       
   883 	else
       
   884 		{
       
   885 		ERR_PRINTF2(KLogMissingParameter, &KFldGraphicsOrientation());
       
   886 		SetBlockResult(EFail);
       
   887 		}
       
   888 	}
       
   889 
       
   890 void CT_DataFbsBitGc::DoCmdSetShadowMode(const TDesC& aSection)
       
   891 	{
       
   892 	TBool mode;
       
   893 	if(GetBoolFromConfig(aSection,KFldShadowMode,mode))
       
   894 		{
       
   895 		INFO_PRINTF1(_L("execute SetShadowMode(TBool)"));
       
   896 		iFbsBitGc->SetShadowMode(mode);
       
   897 		}
       
   898 	else
       
   899 		{
       
   900 		INFO_PRINTF1(_L("execute SetShadowMode(TBool aShadowMode=EFalse)"));
       
   901 		iFbsBitGc->SetShadowMode();
       
   902 		}
       
   903 	}
       
   904 
       
   905 void CT_DataFbsBitGc::DoCmdSetUserDisplayMode(const TDesC& aSection)
       
   906 	{
       
   907 	TDisplayMode mode;
       
   908 	if(CT_GraphicsUtil::ReadDisplayMode(*this,aSection,KFldDisplayMode,mode))
       
   909 		{
       
   910 		INFO_PRINTF1(_L("execute SetUserDisplayMode(TDisplayMode)"));
       
   911 		iFbsBitGc->SetUserDisplayMode(mode);
       
   912 		}
       
   913 	else
       
   914 		{
       
   915 		ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode());
       
   916 		SetBlockResult(EFail);
       
   917 		}
       
   918 	}
       
   919 
       
   920 void CT_DataFbsBitGc::DoCmdShadowArea(const TDesC& aSection)
       
   921 	{
       
   922 	RRegion reg;
       
   923 	if(GetRegionFromConfig(aSection,KFldRegion,reg))
       
   924 		{
       
   925 		INFO_PRINTF1(_L("execute ShadowArea(const TRegion *)"));
       
   926 		iFbsBitGc->ShadowArea(&reg);
       
   927 		}
       
   928 	else
       
   929 		{
       
   930 		INFO_PRINTF2(_L("Missing parameter %S"), &KFldRegion());
       
   931 		INFO_PRINTF1(_L("execute ShadowArea(NULL)"));
       
   932 		iFbsBitGc->ShadowArea(NULL);
       
   933 		}
       
   934 	}
       
   935 
       
   936 void CT_DataFbsBitGc::DoCmdUseBrushPatternL(const TDesC& aSection)
       
   937 	{
       
   938 	TInt handle;
       
   939 	if(GetIntFromConfig(aSection,KFldHandle,handle))
       
   940 		{
       
   941 		INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the specified handle."));
       
   942 		TInt err=iFbsBitGc->UseBrushPattern(handle);
       
   943 		if(KErrNone!=err)
       
   944 			{
       
   945 			ERR_PRINTF2(KLogError, err);
       
   946 			SetError(err);
       
   947 			}
       
   948 		}
       
   949 	else
       
   950 		{
       
   951 		CFbsBitmap*	bitmap=NULL;
       
   952 		if (CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldBitmap, bitmap))
       
   953 			{
       
   954 			TBool usehandle;
       
   955 			if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
       
   956 				{
       
   957 				INFO_PRINTF1(_L("execute UseBrushPattern(TInt) using the bitmap object's handle."));
       
   958 				TInt err=iFbsBitGc->UseBrushPattern(bitmap->Handle());
       
   959 				if(KErrNone!=err)
       
   960 					{
       
   961 					ERR_PRINTF2(KLogError, err);
       
   962 					SetError(err);
       
   963 					}
       
   964 				}
       
   965 			else
       
   966 				{
       
   967 				INFO_PRINTF1(_L("execute UseBrushPattern(CFbsBitmap*)"));
       
   968 				iFbsBitGc->UseBrushPattern(bitmap);
       
   969 				}
       
   970 			}
       
   971 		else
       
   972 			{
       
   973 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldBitmap());
       
   974 			SetBlockResult(EFail);
       
   975 			}
       
   976 		}
       
   977 	}
       
   978 
       
   979 void CT_DataFbsBitGc::DoCmdUseFontL(const TDesC& aSection)
       
   980 	{
       
   981 	TInt handle;
       
   982 	if(GetIntFromConfig(aSection,KFldHandle,handle))
       
   983 		{
       
   984 		INFO_PRINTF1(_L("execute UseFont(TInt) using the specified handle"));
       
   985 		TInt err=iFbsBitGc->UseFont(handle);
       
   986 		if(KErrNone!=err)
       
   987 			{
       
   988 			ERR_PRINTF2(KLogError, err);
       
   989 			SetError(err);
       
   990 			}
       
   991 		}
       
   992 	else
       
   993 		{
       
   994 		CFont* font=NULL;
       
   995 		if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
       
   996 			{
       
   997 			TBool usehandle;
       
   998 			if(GetBoolFromConfig(aSection,KFldUseHandle,usehandle))
       
   999 				{
       
  1000 				INFO_PRINTF1(_L("execute UseFont(TInt) using the font object's handle"));
       
  1001 				TInt err=iFbsBitGc->UseFont(((CFbsFont*)font)->Handle());
       
  1002 				if(KErrNone!=err)
       
  1003 					{
       
  1004 					ERR_PRINTF2(KLogError, err);
       
  1005 					SetError(err);
       
  1006 					}
       
  1007 				}
       
  1008 			else
       
  1009 				{
       
  1010 				INFO_PRINTF1(_L("execute UseFont(CFont*)"));
       
  1011 				iFbsBitGc->UseFont(font);
       
  1012 				}
       
  1013 			}
       
  1014 		else
       
  1015 			{
       
  1016 			ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
       
  1017 			SetBlockResult(EFail);
       
  1018 			}
       
  1019 		}
       
  1020 	}
       
  1021 
       
  1022 void CT_DataFbsBitGc::DoCmdUseFontNoDuplicateL(const TDesC& aSection)
       
  1023 	{
       
  1024 	CFont* font=NULL;
       
  1025 	if(CT_GraphicsUtil::GetFontL(*this,aSection,KFldFont,font))
       
  1026 		{
       
  1027 		INFO_PRINTF1(_L("execute UseFontNoDuplicate(const CFbsBitGcFont*)"));
       
  1028 		iFbsBitGc->UseFontNoDuplicate((CFbsBitGcFont*)font);
       
  1029 		}
       
  1030 	else
       
  1031 		{
       
  1032 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldFont());
       
  1033 		SetBlockResult(EFail);
       
  1034 		}
       
  1035 	}
       
  1036 
       
  1037 void  CT_DataFbsBitGc::DoCmdPromptMessageL(const TDesC& aSection)
       
  1038 	{
       
  1039 	TPtrC text;
       
  1040 	//get prompt text to display in console in order to help user verify. 
       
  1041 	if(!GetStringFromConfig(aSection, KFldPromptText(), text))
       
  1042 		{
       
  1043 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldPromptText());
       
  1044 		SetBlockResult(EFail);
       
  1045 		}
       
  1046 	TInt expectedKey;
       
  1047 	if(!GetIntFromConfig(aSection, KFldExpectedKey(), expectedKey))
       
  1048 		{
       
  1049 		ERR_PRINTF2(_L("Missing parameter %S"), &KFldExpectedKey());
       
  1050 		SetBlockResult(EFail);
       
  1051 		}
       
  1052 	TInt actualKey;
       
  1053 	RProperty property;
       
  1054 	const TUid KMyPropertyCat={0x10012345};
       
  1055 	TUint key=1;
       
  1056 	TSecurityPolicy read(TSecurityPolicy::EAlwaysPass); 
       
  1057 	TSecurityPolicy write(TSecurityPolicy::EAlwaysPass); 
       
  1058 	TInt err=property.Define(KMyPropertyCat,key,RProperty::EInt,read,write);
       
  1059 	if (err==KErrAlreadyExists)
       
  1060 		{
       
  1061 		ERR_PRINTF1(_L("RProperty has existed!"));
       
  1062 		SetBlockResult(EFail);
       
  1063 		User::LeaveIfError(err);
       
  1064 		}
       
  1065 	err=property.Attach(KMyPropertyCat,key);
       
  1066 	TRequestStatus substatus;
       
  1067 	//issue a request to get property change information.
       
  1068 	property.Subscribe(substatus);
       
  1069 	RProcess promptProcess;
       
  1070 	err = promptProcess.Create(KPromptProcess, text);
       
  1071 	if (err == KErrNone)
       
  1072 		{
       
  1073 		CleanupClosePushL(promptProcess);
       
  1074 		TRequestStatus promptStatus;
       
  1075 		promptProcess.Rendezvous(promptStatus);
       
  1076 		if (promptStatus == KRequestPending)
       
  1077 			{
       
  1078 			promptProcess.Resume();
       
  1079 			User::WaitForRequest(promptStatus);
       
  1080 			}
       
  1081 		else
       
  1082 			{
       
  1083 			promptProcess.RendezvousCancel(promptStatus);
       
  1084 			promptProcess.Kill(0);
       
  1085 			ERR_PRINTF2(_L("Executing of prompt process failed with error %d"), promptStatus.Int());
       
  1086 			SetBlockResult(EFail);
       
  1087 			}
       
  1088 		CleanupStack::PopAndDestroy();
       
  1089 		}
       
  1090 	else
       
  1091 		{
       
  1092 		ERR_PRINTF2(_L("Failed to create prompt process with error %d"), err);
       
  1093 		SetBlockResult(EFail);
       
  1094 		}
       
  1095 	//get property change information. 
       
  1096 	User::WaitForRequest(substatus);
       
  1097 	if (substatus!=KRequestPending)
       
  1098 		{
       
  1099 		property.Get(KMyPropertyCat,key,actualKey);
       
  1100 		INFO_PRINTF2(_L("property.Get %d"), actualKey);
       
  1101 		}
       
  1102 		err=RProperty::Delete(KMyPropertyCat,key);
       
  1103 		if (err!=KErrNotFound)
       
  1104 		User::LeaveIfError(err);
       
  1105 		property.Close();
       
  1106 		if(actualKey != expectedKey)
       
  1107 		{
       
  1108 		ERR_PRINTF3(_L("expectedKey=%d pressed key=%d"), expectedKey, actualKey);
       
  1109 		SetBlockResult(EFail);
       
  1110 		}
       
  1111 	}
       
  1112 		
       
  1113