textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp
branchRCL_3
changeset 11 c8fb4cf7b3ae
parent 9 e6a39382bb9c
child 19 ac7e4d1d9209
equal deleted inserted replaced
9:e6a39382bb9c 11:c8fb4cf7b3ae
    46 #include "peninputclientlayoutinfo.h"
    46 #include "peninputclientlayoutinfo.h"
    47 #include "peninputdataprovider.h"
    47 #include "peninputdataprovider.h"
    48 #include "peninputlayoutcontext.h"
    48 #include "peninputlayoutcontext.h"
    49 #include "peninputvkbctrlext.h"
    49 #include "peninputvkbctrlext.h"
    50 #include "peninputnumerickeymappingmgr.h"
    50 #include "peninputnumerickeymappingmgr.h"
       
    51 #include "peninputgenericvkb.hrh"
    51 
    52 
    52 // Constants
    53 // Constants
    53 const TInt KIntLengthForByte = 8;
    54 const TInt KIntLengthForByte = 8;
    54 const TInt KPeninputLayoutWindowUnitWidth = 12;
    55 const TInt KPeninputLayoutWindowUnitWidth = 12;
    55 const TInt KInvalidIndex = -1;
    56 const TInt KInvalidIndex = -1;
   643     {
   644     {
   644     TInt curRange = CPeninputDataConverter::AnyToInt
   645     TInt curRange = CPeninputDataConverter::AnyToInt
   645         ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
   646         ( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ) );
   646     TInt curVkbLayout = CPeninputDataConverter::AnyToInt
   647     TInt curVkbLayout = CPeninputDataConverter::AnyToInt
   647         ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
   648         ( iLayoutContext->RequestData( EPeninputDataTypeVkbLayout ) );
       
   649     TInt curLanguage =  CPeninputDataConverter::AnyToInt
       
   650             ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) );
   648 
   651 
   649     CFepUiBaseCtrl* bar = 
   652     CFepUiBaseCtrl* bar = 
   650         Control( EPeninutWindowCtrlIdRangeBar );
   653         Control( EPeninutWindowCtrlIdRangeBar );
   651     CAknFepCtrlRangeBar* rangebar = 
   654     CAknFepCtrlRangeBar* rangebar = 
   652         static_cast<CAknFepCtrlRangeBar*>( bar );
   655         static_cast<CAknFepCtrlRangeBar*>( bar );
   687         // Change vkb layout
   690         // Change vkb layout
   688         if ( iLayoutContext->LayoutType() == EPluginInputModeVkb ||
   691         if ( iLayoutContext->LayoutType() == EPluginInputModeVkb ||
   689             iLayoutContext->LayoutType() == EPluginInputModeFSQ )
   692             iLayoutContext->LayoutType() == EPluginInputModeFSQ )
   690             {
   693             {
   691             if ( ( aRange == ERangeEnglish ) || ( aRange == ERangeAccent ) 
   694             if ( ( aRange == ERangeEnglish ) || ( aRange == ERangeAccent ) 
   692                 || ( aRange == ERangeNativeNumber )
   695                 || (( aRange == ERangeNativeNumber ) && (iLayoutContext->LayoutType() != EPluginInputModeFSQ ))
   693                 || ( ConfigInfo()->CaseSensitive() 
   696                 || ( ConfigInfo()->CaseSensitive() 
   694                 && ( aRange == ERangeNative ) ) )
   697                 && ( aRange == ERangeNative ) ) )
   695                 {
   698                 {
   696                 // Change shift and capslock button status according to the current case
   699                 // Change shift and capslock button status according to the current case
   697                 TInt curCase = CPeninputDataConverter::AnyToInt
   700                 TInt curCase = CPeninputDataConverter::AnyToInt
   719                     vkblayoutid = vkblayoutid + curAccentIndex * 2;
   722                     vkblayoutid = vkblayoutid + curAccentIndex * 2;
   720                     }      
   723                     }      
   721                     
   724                     
   722                 // Change vkb layout
   725                 // Change vkb layout
   723                 ChangeVkbLayout( vkblayoutid );
   726                 ChangeVkbLayout( vkblayoutid );
       
   727                 }
       
   728             // Deal these four language in special way
       
   729             else if((( aRange == ERangeNativeNumber ) || ( aRange == ERangeNumber ))
       
   730             		&& ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
   731             		&& (( curLanguage == ELangArabic )
       
   732             		|| ( curLanguage == ELangFarsi) 
       
   733             		|| ( curLanguage == ELangUrdu )
       
   734             		|| ( curLanguage == ELangThai )))
       
   735             	{
       
   736                  if ( !aVkbLayoutId )
       
   737                      {
       
   738                      TInt shiftFlag = ( aRange == ERangeNativeNumber )? 0:1;
       
   739                      aVkbLayoutId = ( aRange == ERangeNativeNumber )? 
       
   740                 		     EPeninputVkbLayoutNativeNumberShift : EPeninputVkbLayoutLatinNumber;
       
   741                 		   
       
   742                      TInt capslockFlag = 0;                   
       
   743                    
       
   744                      iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftFlag );
       
   745                      iLayoutContext->SetData( EPeninputDataTypeCapslockDown, &capslockFlag );
       
   746                    
       
   747                      ChangeMergedButtonStatus( shiftFlag, capslockFlag );  
       
   748                      }
       
   749                 ChangeVkbLayout( aVkbLayoutId );
   724                 }
   750                 }
   725             else
   751             else
   726                 {
   752                 {
   727                 TInt flag = 0;
   753                 TInt flag = 0;
   728                 
   754                 
  1137     
  1163     
  1138     TInt shiftStatus = CPeninputDataConverter::AnyToInt
  1164     TInt shiftStatus = CPeninputDataConverter::AnyToInt
  1139         ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) );
  1165         ( iLayoutContext->RequestData( EPeninputDataTypeShiftDown ) );
  1140     TInt capslockStatus = CPeninputDataConverter::AnyToInt
  1166     TInt capslockStatus = CPeninputDataConverter::AnyToInt
  1141         ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) );
  1167         ( iLayoutContext->RequestData( EPeninputDataTypeCapslockDown ) );
       
  1168     TInt languageStatus = CPeninputDataConverter::AnyToInt
       
  1169             ( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ));
       
  1170     TInt permittedRange = CPeninputDataConverter::AnyToInt
       
  1171                 ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ));
  1142      
  1172      
  1143     if ( shiftStatus )
  1173     if ( shiftStatus )
  1144         {
  1174         {
  1145         shiftStatus = 0;
  1175         shiftStatus = 0;
  1146         }
  1176         }
  1186         TInt curAccentIndex = CPeninputDataConverter::AnyToInt
  1216         TInt curAccentIndex = CPeninputDataConverter::AnyToInt
  1187             ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
  1217             ( iLayoutContext->RequestData( EPeninputDataTypeCurrentAccent ) );
  1188         vkbLayout = vkbLayout + curAccentIndex * 2;
  1218         vkbLayout = vkbLayout + curAccentIndex * 2;
  1189         }
  1219         }
  1190         
  1220         
  1191     ChangeVkbLayout( vkbLayout );
  1221     TBool bSupportNative = ( languageStatus == ELangArabic )
       
  1222         		        || ( languageStatus == ELangFarsi) 
       
  1223         		        || ( languageStatus == ELangUrdu )
       
  1224         		        || ( languageStatus == ELangThai );
       
  1225     
       
  1226     // Click shift will change number between "native number" and "latin number"
       
  1227     if (( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) 
       
  1228      && ( bSupportNative )
       
  1229      && (( ERangeNativeNumber == curRange ) || ( ERangeNumber == curRange )))
       
  1230     	{
       
  1231         if (( ERangeNumber == curRange )
       
  1232          && ( permittedRange & ERangeNativeNumber ))
       
  1233        	    {
       
  1234             vkbLayout = EPeninputVkbLayoutNativeNumberShift;
       
  1235             }
       
  1236     
       
  1237         if (( ERangeNativeNumber == curRange )
       
  1238          && ( permittedRange & ERangeNumber ))
       
  1239        	    {
       
  1240             vkbLayout = EPeninputVkbLayoutLatinNumber;
       
  1241             }
       
  1242     	}
       
  1243     else
       
  1244     	{
       
  1245         ChangeVkbLayout( vkbLayout );
       
  1246     	}
  1192     
  1247     
  1193     // Synchronize case if needed    
  1248     // Synchronize case if needed    
  1194     if ( ( curRange == ERangeEnglish )  || ( curRange == ERangeAccent ) 
  1249     if ( ( curRange == ERangeEnglish )  || ( curRange == ERangeAccent ) 
  1195         || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) )
  1250         || ( ConfigInfo()->CaseSensitive() && ( curRange == ERangeNative ) ) )
  1196         {
  1251         {
  1199         TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid );
  1254         TInt fepcase = CPeninputDataConverter::FepCaseByCaseId( caseid );
  1200         iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase );
  1255         iLayoutContext->SetData( EPeninputDataTypeCase, &fepcase );
  1201         CPeninputDataConverter::IntToDesc( fepcase, buf );
  1256         CPeninputDataConverter::IntToDesc( fepcase, buf );
  1202         iLayoutContext->Sendkey( ESignalCaseMode, buf );
  1257         iLayoutContext->Sendkey( ESignalCaseMode, buf );
  1203         }
  1258         }
       
  1259     else if ((( curRange == ERangeNumber ) || ( curRange == ERangeNativeNumber ))
       
  1260     	   && ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
       
  1261     	   && ( bSupportNative ))
       
  1262     	{
       
  1263         // If support native number, change range to native number
       
  1264         if( curRange == ERangeNumber && ( permittedRange & ERangeNativeNumber ))
       
  1265         	{
       
  1266             ChangeRange( ERangeNativeNumber, vkbLayout );
       
  1267         	}
       
  1268         // If not support native number, set shift state back
       
  1269         else if (( curRange == ERangeNumber ) && !( permittedRange & ERangeNativeNumber ))
       
  1270         	{
       
  1271             TInt shiftButton = 1;
       
  1272             TInt capslockButton = 0;
       
  1273             ChangeMergedButtonStatus( shiftButton, capslockButton );
       
  1274             iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftButton );
       
  1275         	}
       
  1276         // If support latin number, change range to latin number
       
  1277         else if (( curRange == ERangeNativeNumber ) && ( permittedRange & ERangeNumber ) )
       
  1278         	{
       
  1279             ChangeRange( ERangeNumber, vkbLayout );
       
  1280         	}
       
  1281         // If not support latin number, set shift state back
       
  1282         else if (( curRange == ERangeNativeNumber ) && !( permittedRange & ERangeNumber ))
       
  1283             {
       
  1284             TInt shiftButton = 0;
       
  1285             TInt capslockButton = 0;
       
  1286             ChangeMergedButtonStatus( shiftButton, capslockButton );
       
  1287             iLayoutContext->SetData( EPeninputDataTypeShiftDown, &shiftButton );
       
  1288             }
       
  1289     	}
       
  1290     else
       
  1291     	{
       
  1292         // Do nothing
       
  1293     	}
  1204     
  1294     
  1205     
  1295     
  1206     }
  1296     }
  1207 
  1297 
  1208 // ---------------------------------------------------------------------------
  1298 // ---------------------------------------------------------------------------