textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 9 e6a39382bb9c
child 13 1bbdde98cc2d
equal deleted inserted replaced
11:c8fb4cf7b3ae 12:5e18d8c489d6
    46 const TUint16 thaiUnicodeOri[KNumberOfDottedChar] = {0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39, 
    46 const TUint16 thaiUnicodeOri[KNumberOfDottedChar] = {0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39, 
    47                               0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D}; 
    47                               0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D}; 
    48 const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = {0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, 
    48 const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = {0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, 
    49                               0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D}; 
    49                               0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D}; 
    50 
    50 
       
    51 const TInt KNumberOfMirrorChar = 6; 
       
    52 const TUint16 mirrorUnicode[KNumberOfMirrorChar] = {0x0029,0x005D,0x003E,0x003C,0x005B,0x0028};
    51 
    53 
    52 _LIT(KDisplaySpace, "\x0020");
    54 _LIT(KDisplaySpace, "\x0020");
    53 _LIT(KEmptyString, "");
    55 _LIT(KEmptyString, "");
    54 
    56 
    55 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
   219             vkbWindow->HideCandidateList();
   221             vkbWindow->HideCandidateList();
   220             }
   222             }
   221             break;
   223             break;
   222         case ECmdPenInputLanguage:
   224         case ECmdPenInputLanguage:
   223             {
   225             {
       
   226             iDataMgr->SetData( EPeninputDataTypeInputLanguage, aData );
   224             vkbWindow->SetSwitchlistLanguage(*aData);
   227             vkbWindow->SetSwitchlistLanguage(*aData);
   225             vkbWindow->SetDeadKey();
   228             vkbWindow->SetDeadKey();
   226             if ( iLayoutType == EPluginInputModeFSQ )
   229             if ( iLayoutType == EPluginInputModeFSQ )
   227                 {
   230                 {
   228                 TRAP_IGNORE(vkbWindow->ConstructFSQAccentListL( *aData ));
   231                 TRAP_IGNORE(vkbWindow->ConstructFSQAccentListL( *aData ));
   491                     outputCode = thaiUnicodeOri[i];
   494                     outputCode = thaiUnicodeOri[i];
   492                     isDottedChar = ETrue;
   495                     isDottedChar = ETrue;
   493                     break;
   496                     break;
   494                     }
   497                     }
   495                 }
   498                 }
       
   499 
       
   500             isDottedChar = TranslateMirrorUnicode( inputCode, outputCode );
       
   501 
   496             if (isDottedChar)
   502             if (isDottedChar)
   497                 {
   503                 {
   498                 number->Des().Append( outputCode );                    
   504                 number->Des().Append( outputCode );                    
   499                 data->iKeyData.Set(*number);
   505                 data->iKeyData.Set(*number);
   500                 eventDataPtr.Set(reinterpret_cast<TUint16*>(data),sizeof(*data)/sizeof(TUint16));
   506                 eventDataPtr.Set(reinterpret_cast<TUint16*>(data),sizeof(*data)/sizeof(TUint16));
   501                 }
   507                 }
   502             }           
   508             }           
   503         CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, eventDataPtr);
   509         CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, eventDataPtr);
   504         delete number;
   510         delete number;
   505         }
   511         }
       
   512     }
       
   513 
       
   514 TBool CPeninputGenericVkbLayout::TranslateMirrorUnicode( TUint16 aInputCode, TUint16& aOutputCode )
       
   515     {
       
   516     TBool isMirrorChar = EFalse;
       
   517     TInt langCode = *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage )));
       
   518     if (( langCode != ELangArabic ) &&
       
   519         ( langCode != ELangHebrew ) &&
       
   520         ( langCode != ELangFarsi ) &&
       
   521         ( langCode != ELangUrdu ))
       
   522         {
       
   523         return isMirrorChar;
       
   524         }
       
   525     for (TInt i = 0; i < KNumberOfMirrorChar; i++)
       
   526         {
       
   527         if (mirrorUnicode[i] == aInputCode)
       
   528             {
       
   529             aOutputCode = mirrorUnicode[KNumberOfMirrorChar - i - 1];
       
   530             isMirrorChar = ETrue;
       
   531             break;
       
   532             }
       
   533         }
       
   534     return isMirrorChar;
   506     }
   535     }
   507 
   536 
   508 // ---------------------------------------------------------------------------
   537 // ---------------------------------------------------------------------------
   509 // Handle show tooltip command.
   538 // Handle show tooltip command.
   510 // ---------------------------------------------------------------------------
   539 // ---------------------------------------------------------------------------
   529         TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32));
   558         TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32));
   530         HBufC* tooltipText = ReadTextInfoHBufCL(dataAddress, (dataSize + 1) / 2);
   559         HBufC* tooltipText = ReadTextInfoHBufCL(dataAddress, (dataSize + 1) / 2);
   531         if (tooltipText)
   560         if (tooltipText)
   532             {
   561             {
   533             CleanupStack::PushL(tooltipText);
   562             CleanupStack::PushL(tooltipText);
   534             vkbWindow->ShowTooltipL(*tooltipText);
   563             vkbWindow->ShowTooltipL(*tooltipText, *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage ))));
   535             CleanupStack::PopAndDestroy(tooltipText);
   564             CleanupStack::PopAndDestroy(tooltipText);
   536             }        
   565             }        
   537         }     
   566         }     
   538     }
   567     }
   539 
   568