fep/aknfep/src/AknFepUiInputStateInitialIndicMultitap.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Provides the TAknFepInputStateInitialIndicMultitap methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 #include "AknFepUIInputStateInitialIndicMultitap.h"
       
    29 #include "AknFepUIManagerStateInterface.h"      //MAknFepUIManagerStateInterface
       
    30 #include "AknFepUiManagerWestern.h"
       
    31 #include "AknFepUiIndicEnums.h"
       
    32 #include "AknFepCaseManager.h"
       
    33 #include "AknFepUiIndicInputManager.h"
       
    34 
       
    35 #include <uikon.hrh>
       
    36 #include <PtiEngine.h>
       
    37 #include <PtiDefs.h>
       
    38 #include <aknSctDialog.h>
       
    39 #include <avkon.rsg>
       
    40 #include <aknfep.rsg>
       
    41 #include <eikenv.h>
       
    42 
       
    43 #define PTI_CLEAR_CURRENTWORD( A, B ) \
       
    44 		( A )->ClearCurrentWord(); \
       
    45 		( B ) = ETrue; \
       
    46 
       
    47 	
       
    48 // -----------------------------------------------------------------------------
       
    49 // TAknFepInputStateInitialIndicMultitap::TAknFepInputStateInitialIndicMultitap
       
    50 
       
    51 // C++ default constructor can NOT contain any code, that
       
    52 // might leave or if it is absolutely necessary then MUST be trapped.
       
    53 // -----------------------------------------------------------------------------
       
    54 
       
    55 TAknFepInputStateInitialIndicMultitap::
       
    56 TAknFepInputStateInitialIndicMultitap( MAknFepUIManagerStateInterface* aOwner,
       
    57 																			TLanguage aLanguage )
       
    58 																			:TAknFepInputStateInitialMultitapBase( aOwner )
       
    59     {
       
    60     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    61     iIsStarKeyPressed = EFalse;
       
    62     iIsKeyTimerExpired = ETrue;
       
    63     iIndicLanguage = aLanguage;
       
    64     iIsHalantAllowed = EFalse;
       
    65     iZWSPresent = EFalse;
       
    66     iRephaPresent = EFalse;
       
    67     iRakarPresent = EFalse;
       
    68     iResponseInsertZWS = EFalse;
       
    69     iLigaturePresent = EFalse;
       
    70 #ifdef RD_MARATHI
       
    71 	iPreviousCommittedChar 		= 0;
       
    72 	iEyeLashRaPresent 	        = EFalse;
       
    73 	iChandraAPresent 	        = EFalse;
       
    74 #endif // RD_MARATHI
       
    75     TRAP_IGNORE( ptiengine->ActivateLanguageL( aLanguage ) )
       
    76     ptiengine->SetCase( EPtiCaseLower );
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // TAknFepInputStateInitialIndicMultitap::HandleKeyL
       
    81 
       
    82 // Handles the logic of Indic multitap input. This function first checks the validity
       
    83 // of the inputed text and then enters it.
       
    84 // -----------------------------------------------------------------------------
       
    85 
       
    86 TBool TAknFepInputStateInitialIndicMultitap::HandleKeyL( TInt aKey, TKeyPressLength aLength )
       
    87 	{
       
    88 	TBool                      result       	= ETrue;
       
    89 	MAknFepManagerUIInterface* fepMan       	= iOwner->FepMan();
       
    90 	CPtiEngine* 			   ptiengine 		= iOwner->PtiEngine();
       
    91 
       
    92 #ifdef RD_MARATHI
       
    93 	if( iIsKeyTimerExpired )
       
    94 		{
       
    95 		iPreviousCommittedChar = fepMan->PreviousChar( ETrue );
       
    96 		
       
    97 		if( iIndicLanguage == ELangMarathi )
       
    98 			{
       
    99 			HandleKeyMarathiL();
       
   100 			}
       
   101 		}
       
   102 #endif // RD_MARATHI
       
   103 
       
   104 	if(aKey == EPtiKey1)
       
   105 		{
       
   106 		iKey1Pressed = ETrue;	
       
   107 		}
       
   108 	else 
       
   109 		{
       
   110 		iKey1Pressed = EFalse;	
       
   111 		}	
       
   112 	if ( iData && ( iData != aKey ) )
       
   113     	{
       
   114 #ifdef RD_MARATHI
       
   115         iPreviousCommittedChar = fepMan->PreviousChar( ETrue );
       
   116 
       
   117         if( iPreviousCommittedChar == ZERO_WIDTH_SPACE &&
       
   118             aKey == EPtiKey2 )
       
   119             {
       
   120             // This is a scenario where the timer is forcefully
       
   121             // expired by quickly pressing a different key.
       
   122             // Should remove the ZWS from the editor.
       
   123             fepMan->RemovePreviousCharacterL();
       
   124             iZWSPresent = EFalse;
       
   125             
       
   126             // Reset the previous committed character.
       
   127             iPreviousCommittedChar = fepMan->PreviousChar( ETrue );
       
   128             }
       
   129 
       
   130 		if( iIndicLanguage == ELangMarathi )
       
   131 		    {
       
   132 		    HandleKeyMarathiL();
       
   133 		    }
       
   134 #endif // RD_MARATHI
       
   135 
       
   136 	    fepMan->CommitInlineEditL();
       
   137 	    PTI_CLEAR_CURRENTWORD( ptiengine, iIsKeyTimerExpired )
       
   138 
       
   139 	    if( iRephaPresent )
       
   140 	    	{
       
   141 	    	fepMan->AlignLogicalAndVisualCursorL( TTmDocPosSpec::ELeading, EFalse );
       
   142 	    	iRephaPresent = EFalse;
       
   143 	    	}
       
   144 	    if( iRakarPresent )
       
   145 	    	{
       
   146 	    	iRakarPresent = EFalse;
       
   147 	    	}
       
   148 
       
   149 #ifdef RD_MARATHI
       
   150         // This check should be done only after the text is committed.
       
   151 	    if( iEyeLashRaPresent )
       
   152             {
       
   153             // Calls the overloaded method which used find doc pos.
       
   154             // Reason: Unlike Repha, EyeLash Ra can be inserted in
       
   155             // an empty editor. GetNextVisualCursorPosition would
       
   156             // result in incorrect cursor alignment in this case.
       
   157             fepMan->AlignLogicalAndVisualCursorL();
       
   158             iEyeLashRaPresent = EFalse;
       
   159             }
       
   160 #endif
       
   161 
       
   162    		}
       
   163 
       
   164 	if ( aLength == EShortKeyPress )
       
   165 		{
       
   166 	    if ( aKey == EPtiKeyStar ) // Overriding Key
       
   167             {
       
   168             iIsStarKeyPressed = ETrue;
       
   169             fepMan->RemoveZWSCharacterL( iKey1Pressed, EFalse, EFalse, iLigaturePresent );	
       
   170     		}
       
   171 		else
       
   172 			{
       
   173 			TPtiTextCase newCase = ptiengine->Case();
       
   174 			
       
   175 			TIndicInputResponse keyResponse = 
       
   176 				TAknFepUiIndicInputManager::ValidateInput( aKey,
       
   177 														fepMan->PreviousChar( ETrue ),
       
   178 														NULL,NULL,
       
   179 														iIsHalantAllowed,
       
   180 														iIsStarKeyPressed,
       
   181 														iIsKeyTimerExpired,
       
   182 														newCase,
       
   183 														aLength,
       
   184 														iIndicLanguage
       
   185 #ifdef RD_MARATHI
       
   186 														, EFalse, EFalse, iChandraAPresent
       
   187 
       
   188 #endif // RD_MARATHI
       
   189 														 );
       
   190 				
       
   191 			ptiengine->SetCase( newCase );
       
   192 			TPtrC ptiText = ptiengine->AppendKeyPress( ( TPtiKey )aKey );
       
   193 			
       
   194 			if ( ptiText.Length() )
       
   195 				{
       
   196 				do
       
   197 					{
       
   198 					TText prChar;
       
   199 					// For Repha, use the Previous to Previous character
       
   200 					// only if multitap timer hasn't expired. This will
       
   201 					// handle cases like Matra attached to the consonant.
       
   202 					// Here, repha is not allowed and the character to 
       
   203 					// to checked is Matra. In cases like a consonant with
       
   204 					// Virama, all the characters should be skipped including
       
   205 					// repha. In this this case the timer is set to expired.
       
   206 					// So the previous character is Virama. And as per the 
       
   207 					// language rules, repha is not allowed after Virama.
       
   208 					if( TAknFepUiIndicInputManager::IsCharRepha( 
       
   209 						ptiText[0], iIndicLanguage ) && !iIsKeyTimerExpired )
       
   210 						{
       
   211 						prChar = fepMan->PreviousToPreviousChar( ETrue );
       
   212 #ifdef RD_MARATHI
       
   213                         prChar = iPreviousCommittedChar;
       
   214 #endif // RD_MARATHI
       
   215 						}
       
   216 					else
       
   217 						{
       
   218 						prChar = fepMan->PreviousChar( ETrue );
       
   219 						}
       
   220 
       
   221 					// When a base consonant is already entered and the
       
   222 					// user starts multitapping, the second modifier in the
       
   223 					// key map will not be allowed if the previous character 
       
   224 					// is considered. The base consonant has to be used
       
   225 					// instead. This change had to be added after the new
       
   226 					// function, IsModifierAllowed was added.
       
   227 					if( TAknFepUiIndicInputManager::IsCharModifier(
       
   228 						ptiText[0], iIndicLanguage ) && !iIsKeyTimerExpired )
       
   229 						{
       
   230 						prChar = fepMan->PreviousToPreviousChar( ETrue );
       
   231 						}
       
   232 
       
   233 					if( TAknFepUiIndicInputManager::IsCharLigature( 
       
   234 						ptiText[0], iIndicLanguage ) && !iIsKeyTimerExpired )
       
   235 						{
       
   236 						if( fepMan->IsZWSCharacterPresent( ETrue ) )
       
   237 							{
       
   238 							iZWSPresent = ETrue;
       
   239 							}
       
   240 						iLigaturePresent = ETrue;
       
   241 						prChar = fepMan->PreviousToPreviousChar( ETrue );
       
   242 						}
       
   243 					else
       
   244 						{
       
   245 						iLigaturePresent = EFalse;
       
   246 						}
       
   247 
       
   248 #ifdef RD_MARATHI
       
   249 
       
   250 					// While multitapping after inserting a base consonant,
       
   251 					// modifiers will get inserted first, followed by the
       
   252 					// Nukta character. Hence, use Prev to prev char which 
       
   253 					// will be a base consonant.
       
   254 					if( TAknFepUiIndicInputManager::IsCharNukta(
       
   255 						ptiText[0], iIndicLanguage ) && !iIsKeyTimerExpired )
       
   256 						{
       
   257 						prChar = fepMan->PreviousToPreviousChar( ETrue );
       
   258 						}
       
   259 #endif // RD_MARATHI
       
   260 
       
   261 					keyResponse = 
       
   262 						TAknFepUiIndicInputManager::ValidateInput( aKey,
       
   263         														prChar,
       
   264 																ptiText[0],
       
   265         														NULL,
       
   266         														iIsHalantAllowed,
       
   267         														iIsStarKeyPressed,
       
   268 																iIsKeyTimerExpired,
       
   269 																newCase,
       
   270 																aLength,
       
   271         														iIndicLanguage,
       
   272         														iRakarPresent,
       
   273         														iZWSPresent
       
   274 #ifdef RD_MARATHI
       
   275 										  						, iChandraAPresent 
       
   276 #endif // RD_MARATHI
       
   277         														 );	
       
   278 
       
   279 					if( !IsFreeSpaceAvailable( keyResponse ) )
       
   280 						{
       
   281 						keyResponse = EIndicInputResponseInvalid;
       
   282 						}
       
   283 
       
   284 					if( keyResponse == EIndicInputResponseInvalid )
       
   285 						{
       
   286 						ptiText.Set( ptiengine->AppendKeyPress( ( TPtiKey )aKey ) );
       
   287 						}
       
   288 						
       
   289 					if( !ptiText.Length() )
       
   290 						{
       
   291 						break;
       
   292 						}
       
   293 						
       
   294 					}while( keyResponse == EIndicInputResponseInvalid );
       
   295 
       
   296 				if( iIsStarKeyPressed && 
       
   297 					aKey == EPtiKey0 && 
       
   298 					TAknFepUiIndicInputManager::IsCharOther( 
       
   299 						ptiText[0], iIndicLanguage ) )
       
   300 					{
       
   301 					// Forcefully keep the star key flag to true. Else when
       
   302 					// the ligatures are entered, this flag will be false 
       
   303 					// thus preventing the ligature formation.
       
   304 					iIsStarKeyPressed = ETrue;
       
   305 					}
       
   306 				else
       
   307 					{
       
   308 					iIsStarKeyPressed = EFalse;
       
   309 					}
       
   310 
       
   311 				result = HandleIndicKeyResponseL( aKey, keyResponse, ptiText );
       
   312 				}
       
   313 			}
       
   314 		}
       
   315    	else
       
   316     	{
       
   317         /* Long press of a Key */
       
   318         if ( aKey == EPtiKeyStar )
       
   319 	        {
       
   320             /* Launch the SCT For Indic */
       
   321    			if( fepMan->EditorHasFreeSpace() )
       
   322 				{
       
   323 				if (fepMan->IsAbleToLaunchSCT() && !fepMan->EditSubmenuInUse())
       
   324         			{
       
   325 	            	fepMan->LaunchSpecialCharacterTableL();	
       
   326 	            	}
       
   327 				}
       
   328 		    }
       
   329         else
       
   330 	        {
       
   331 	        TUint prevchar = fepMan->PreviousChar(ETrue);
       
   332             if(!((aKey == EPtiKey1) && ((0x0031 == prevchar) || (0x0967 == prevchar)) ))
       
   333 		        {
       
   334 		        TChar ch( aKey );
       
   335 		        TBuf<1> buf;
       
   336 		        buf.Append( ch );
       
   337 		        fepMan->NewCharacterSequenceL( buf, EIndicInputResponseNumber );
       
   338 		        fepMan->CommitInlineEditL();			
       
   339 		        PTI_CLEAR_CURRENTWORD( ptiengine, iIsKeyTimerExpired )				
       
   340 				}
       
   341 	        }
       
   342     	}
       
   343     iData = aKey;
       
   344     return( result );
       
   345 	}
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // TAknFepInputStateInitialIndicMultitap::KeyTimerExpired
       
   349 
       
   350 // Handles the logic of post keytimerexpired event. This function commits 
       
   351 // the inline editing text to the editor.
       
   352 // -----------------------------------------------------------------------------
       
   353 
       
   354 void TAknFepInputStateInitialIndicMultitap::KeyTimerExpired()
       
   355 	{
       
   356 	iIsKeyTimerExpired = ETrue;
       
   357 	
       
   358 	if( iRakarPresent )
       
   359 		{
       
   360 		iRakarPresent = EFalse;
       
   361 		}
       
   362 		
       
   363 	if( iRephaPresent 
       
   364 #ifdef RD_MARATHI
       
   365 	|| ( iEyeLashRaPresent && 
       
   366 			TAknFepUiIndicInputManager::
       
   367 				IsCharBaseConsonant( iOwner->FepMan()->NextChar(), 
       
   368 									iIndicLanguage ) )
       
   369 #endif // RD_MARATHI
       
   370 	    )
       
   371 		{
       
   372 		TRAP_IGNORE( iOwner->FepMan()->AlignLogicalAndVisualCursorL( TTmDocPosSpec::ELeading, EFalse ) )
       
   373 		iRephaPresent = EFalse;
       
   374 		}
       
   375 
       
   376 #ifdef RD_MARATHI
       
   377 		iEyeLashRaPresent = EFalse;
       
   378 #endif // RD_MARATHI
       
   379 
       
   380 	if( iResponseInsertZWS || iZWSPresent )
       
   381 		{
       
   382 		iZWSPresent = EFalse;
       
   383 		iResponseInsertZWS = EFalse;
       
   384 		TRAP_IGNORE( iOwner->FepMan()->RemoveZWSCharacterL( iKey1Pressed, EFalse, 
       
   385                                                         EFalse, iLigaturePresent ) )
       
   386 		}
       
   387 	iLigaturePresent = EFalse;
       
   388 
       
   389 #ifdef RD_MARATHI
       
   390 	iChandraAPresent = EFalse;
       
   391 #endif // RD_MARATHI
       
   392 
       
   393 	TAknFepInputStateInitialMultitapBase::KeyTimerExpired();
       
   394 	}
       
   395 
       
   396 TBool TAknFepInputStateInitialIndicMultitap::
       
   397     HandleIndicKeyResponseL( TInt aKey, TIndicInputResponse aKeyResponse, TPtrC aPtiText )
       
   398     {
       
   399     TBool result = ETrue;
       
   400     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   401 
       
   402     switch( aKeyResponse )
       
   403         {
       
   404         case EIndicInputResponseNone:
       
   405         	{
       
   406         	if ( aPtiText.Length() && ( !iIsKeyTimerExpired || fepMan->EditorHasFreeSpace() ) )
       
   407         		{
       
   408             	if ( iIsKeyTimerExpired )
       
   409             		{
       
   410             		if ( iZWSPresent )
       
   411             			{
       
   412             			fepMan->RemoveZWSCharacterL( iKey1Pressed,EFalse, 
       
   413                         TAknFepUiIndicInputManager::IsCharModifier(aPtiText[0], iIndicLanguage));
       
   414             			iZWSPresent = EFalse;
       
   415             			}
       
   416             		
       
   417             		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseNone );
       
   418             		
       
   419             		if ( fepMan->IsZWSCharacterPresent() )
       
   420             			{
       
   421             			iZWSPresent = ETrue;
       
   422             			}
       
   423             		}
       
   424             	else
       
   425             		{
       
   426             		if ( aKey == EPtiKey1 )
       
   427             			{
       
   428             			if( iRephaPresent )
       
   429             				{
       
   430             				fepMan->RemoveRephaCharacterL();
       
   431             				iRephaPresent = EFalse;
       
   432             				}
       
   433             			if( iZWSPresent )
       
   434             				{						    				
       
   435             				fepMan->RemoveZWSCharacterL( iKey1Pressed, ETrue );
       
   436             				iZWSPresent = EFalse;
       
   437             				}
       
   438         				if( iRakarPresent )
       
   439             				{
       
   440             				// This is to handle the case when only
       
   441             				// two spaces are left in the editor.
       
   442             				fepMan->RemoveRakarCharacterL();
       
   443             				iRakarPresent = EFalse;
       
   444             				}
       
   445 #ifdef RD_MARATHI
       
   446             			iEyeLashRaPresent = EFalse;
       
   447 #endif // RD_MARATHI
       
   448             			}
       
   449             		else if( aKey == EPtiKey2 )
       
   450             			{
       
   451 #ifdef RD_MARATHI
       
   452                         iChandraAPresent = EFalse;
       
   453 #endif // RD_MARATHI
       
   454             			}
       
   455             		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseNone );
       
   456         			}
       
   457         		}
       
   458         	iIsKeyTimerExpired = EFalse;	
       
   459         	}
       
   460         	break;
       
   461 
       
   462         case EIndicInputResponseZWSandCharacter:
       
   463         	{
       
   464         	if( fepMan->EditorHasFreeSpace( 2 ) )
       
   465         		{
       
   466         		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseZWSandCharacter );
       
   467               	iZWSPresent = ETrue;
       
   468               	iIsKeyTimerExpired = EFalse;
       
   469         		}
       
   470         	}
       
   471         	break;
       
   472         case EIndicInputResponseInsertZWS: 
       
   473         	{
       
   474         	//Already in multitapping so we need to check wheather 
       
   475         	//there is additional single space for ZWS
       
   476         	if( !iIsKeyTimerExpired || fepMan->EditorHasFreeSpace( 1 ) ) 
       
   477         		{
       
   478                 fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertZWS );
       
   479         		
       
   480         		// Using a seperate flag here. Cannot use the flag
       
   481         		// iZWSPresent. Consider the scenario:- User enters 
       
   482         		// a consonant, then multitaps key-1 to insert halant.
       
   483         		// Now consider that we set the flag to ETrue.
       
   484         		// But before the key timer expires, key-5 is 
       
   485         		// multitapped to insert another consonant.
       
   486         		// In this case the code flow will go to the case
       
   487         		// EIndicInputResponseNone. Here the condition, 
       
   488         		// if ( iZWSPresent ) succeeds and ZWS is removed.
       
   489         		// This causes direct ligature formation. It should
       
   490         		// actually show the ligature formation after the timeout.
       
   491         		iResponseInsertZWS = ETrue;
       
   492         		}
       
   493         	else // Remove already entered Modifier "Visarga" if there is no space
       
   494         		{
       
   495         		fepMan->RemovePreviousCharacterL();	
       
   496         		}
       
   497         	iIsKeyTimerExpired = EFalse;		
       
   498         	}
       
   499         	break;
       
   500         case EIndicInputResponseInsertZWSandLigature:
       
   501         	{
       
   502         	if( fepMan->EditorHasFreeSpace( 3 )  )
       
   503         		{
       
   504         		if ( iIsKeyTimerExpired )
       
   505             		{
       
   506         			fepMan->RemoveZWSCharacterL( iKey1Pressed );
       
   507         			}
       
   508         		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertZWSandLigature );
       
   509                	}
       
   510         	iIsKeyTimerExpired = EFalse;
       
   511         	iZWSPresent = ETrue;	
       
   512         	}
       
   513         	break;
       
   514         case EIndicInputResponseIgnore:	
       
   515         	break;
       
   516 
       
   517         case EIndicInputResponseInsertRepha:
       
   518         	{
       
   519         	if( !iIsKeyTimerExpired )
       
   520         		{
       
   521         		if( iRakarPresent )
       
   522         			{
       
   523         			fepMan->RemoveRakarCharacterL();
       
   524         			iRakarPresent = EFalse;
       
   525         			}
       
   526 #ifdef RD_MARATHI
       
   527         		else if( iEyeLashRaPresent )
       
   528         			{
       
   529         			// Remove eye lash ra
       
   530         			TBuf<3>buf;
       
   531 
       
   532         			// Get the EyeLashRa string.
       
   533         			TAknFepUiIndicInputManager::
       
   534         					GetEyeLashRa( buf, iIndicLanguage );
       
   535         									
       
   536         			fepMan->RemoveTextFromEditorL( buf.Length(), 0, ETrue );
       
   537         			iEyeLashRaPresent = EFalse;
       
   538         			}
       
   539 #endif // RD_MARATHI
       
   540         		else if( TAknFepUiIndicInputManager::IsCharMatra( 
       
   541                              fepMan->PreviousToPreviousChar( ETrue ), iIndicLanguage ) )
       
   542         			{
       
   543         			// Consider that a matra is applied to any base 
       
   544         			// consonant and two nore spaces are left in the editor.
       
   545         			// On multitapping, user will get the first four modifiers.
       
   546         			// After that, rakar should be inserted which requires two
       
   547         			// spaces. But since the modifier is present, only one
       
   548         			// space is available. Here we need to free up the space 
       
   549         			// by removing the previous character which is a modifier.
       
   550         			// For inserting repha, the existing inline text needs to
       
   551         			// be first committed and then removed.
       
   552 
       
   553         			fepMan->RemovePreviousCharacterL();
       
   554         			}
       
   555 
       
   556         		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertRepha );
       
   557         		iRephaPresent = ETrue;
       
   558         		}
       
   559         	}
       
   560         	break;
       
   561 
       
   562         case EIndicInputResponseInsertRakar:
       
   563         	{
       
   564         	if( !iIsKeyTimerExpired )
       
   565         		{
       
   566         		// RemoveZWS is not invoked here as we are in inline 
       
   567         		// editing state and we can as well overwrite the previous
       
   568         		// characters. Hence directly invoke NewCharacterSequenceL.
       
   569         		// Secondly, the flag iZWSPresent is not reset here since
       
   570         		// it will happen anyways after timeout.
       
   571         		
       
   572         		fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertRakar );
       
   573         		iRakarPresent = ETrue;
       
   574         		
       
   575 #ifdef RD_MARATHI
       
   576         		// This check assumes that Rakar comes after EyelashRa in 
       
   577         		// Key map order.
       
   578         		iEyeLashRaPresent = EFalse;
       
   579 #endif
       
   580         		}
       
   581         	}
       
   582         	break;
       
   583         	
       
   584         case EIndicInputResponseInsertDirectLigature:
       
   585         	{
       
   586         	if( !iIsKeyTimerExpired )
       
   587         		{
       
   588         		TBuf<3> ligature;
       
   589         		ligature.Zero();
       
   590         		TAknFepUiIndicInputManager::
       
   591         			GetLigature( ligature, aPtiText[0], 
       
   592         						iIndicLanguage );
       
   593 
       
   594         		fepMan->NewCharacterSequenceL( ligature, 
       
   595         			EIndicInputResponseInsertDirectLigature );
       
   596         		}
       
   597         	}
       
   598         	break;
       
   599 
       
   600         case EIndicInputResponseInsertViramaZWSandDirectLigature:
       
   601         	{
       
   602         	if( fepMan->EditorHasFreeSpace( 5 )  )
       
   603         		{
       
   604         		if ( iIsKeyTimerExpired )
       
   605             		{
       
   606         			fepMan->RemoveZWSCharacterL( iKey1Pressed );
       
   607         			}
       
   608 
       
   609         		TBuf<3> ligature;
       
   610         		ligature.Zero();
       
   611         		TAknFepUiIndicInputManager::
       
   612         			GetLigature( ligature, aPtiText[0], 
       
   613         						iIndicLanguage );
       
   614         		fepMan->NewCharacterSequenceL( ligature, 
       
   615         			EIndicInputResponseInsertViramaZWSandDirectLigature );
       
   616                	}
       
   617         	iIsKeyTimerExpired = EFalse;
       
   618         	iZWSPresent = ETrue;	
       
   619         	}
       
   620         	break;
       
   621 
       
   622         case EIndicInputResponseZWSandDirectLigature:
       
   623         	{
       
   624         	if( fepMan->EditorHasFreeSpace( 4 ) )
       
   625         		{
       
   626         		TBuf<3> ligature;
       
   627         		ligature.Zero();
       
   628         		TAknFepUiIndicInputManager::
       
   629         			GetLigature( ligature, aPtiText[0], 
       
   630         						iIndicLanguage );
       
   631 
       
   632         		fepMan->NewCharacterSequenceL( ligature, 
       
   633         			EIndicInputResponseZWSandDirectLigature );
       
   634               	iZWSPresent = ETrue;
       
   635               	iIsKeyTimerExpired = EFalse;
       
   636         		}
       
   637         	}
       
   638         	break;
       
   639 
       
   640 #ifdef RD_MARATHI
       
   641         case EIndicInputResponseInsertEyeLashRa:
       
   642         	{
       
   643         	fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertEyeLashRa );
       
   644         	iIsKeyTimerExpired = EFalse;
       
   645         	iEyeLashRaPresent = ETrue;
       
   646         	}
       
   647         	break;
       
   648 
       
   649         case EIndicInputResponseInsertChandraA:
       
   650         	{
       
   651         	fepMan->NewCharacterSequenceL( aPtiText, EIndicInputResponseInsertChandraA );
       
   652         	iChandraAPresent = ETrue;
       
   653         	}
       
   654         	break;
       
   655 #endif // RD_MARATHI
       
   656 
       
   657         case EindicInputResponseLast:
       
   658         	break;
       
   659         default: 
       
   660             {
       
   661             }
       
   662         	break;
       
   663         }
       
   664     return result;
       
   665     }
       
   666 
       
   667 TBool TAknFepInputStateInitialIndicMultitap::IsFreeSpaceAvailable( 
       
   668                                 TIndicInputResponse aKeyResponse )
       
   669     {
       
   670     TBool result = ETrue;
       
   671 
       
   672     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   673 
       
   674     TBool isUnlimitedSpaceEditor;
       
   675 
       
   676 	TInt freeSpaceLeft = 
       
   677         fepMan->EditorFreeSpace( isUnlimitedSpaceEditor, ETrue );
       
   678 
       
   679 	// Check if space is available.
       
   680 	if( ( !isUnlimitedSpaceEditor ) && 
       
   681 		( ( ( aKeyResponse == EIndicInputResponseInsertRepha ||
       
   682 			aKeyResponse == EIndicInputResponseInsertRakar ) && ( freeSpaceLeft < 2 ) ) ||
       
   683 		( ( aKeyResponse == EIndicInputResponseInsertDirectLigature ) && ( freeSpaceLeft < 3 ) ) 
       
   684 #ifdef RD_MARATHI
       
   685 		|| ( ( aKeyResponse == EIndicInputResponseInsertEyeLashRa ) && ( freeSpaceLeft < 3 ) ) 
       
   686 		|| ( ( aKeyResponse == EIndicInputResponseInsertChandraA ) && ( freeSpaceLeft < 2 ) ) 
       
   687 #endif // RD_MARATHI
       
   688 		) )
       
   689 	    {
       
   690         result = EFalse;
       
   691 	    }
       
   692 	    return result;
       
   693     }
       
   694 
       
   695 #ifdef RD_MARATHI
       
   696 
       
   697 void TAknFepInputStateInitialIndicMultitap::HandleKeyMarathiL()
       
   698     {
       
   699     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   700 
       
   701     if( fepMan )
       
   702         {
       
   703         if( fepMan->IsChandraAPresentL() )
       
   704             {
       
   705             TBuf<1> buf;
       
   706             TAknFepUiIndicInputManager::GetChandraA( buf, ETrue );
       
   707         	iPreviousCommittedChar = buf[0];
       
   708             }
       
   709         }
       
   710     }
       
   711 #endif // RD_MARATHI
       
   712 //End of File