textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp
branchRCL_3
changeset 12 5e18d8c489d6
parent 9 e6a39382bb9c
child 13 1bbdde98cc2d
--- a/textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp	Tue May 11 16:31:42 2010 +0300
+++ b/textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp	Tue May 25 13:03:44 2010 +0300
@@ -48,6 +48,8 @@
 const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = {0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, 
                               0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D}; 
 
+const TInt KNumberOfMirrorChar = 6; 
+const TUint16 mirrorUnicode[KNumberOfMirrorChar] = {0x0029,0x005D,0x003E,0x003C,0x005B,0x0028};
 
 _LIT(KDisplaySpace, "\x0020");
 _LIT(KEmptyString, "");
@@ -221,6 +223,7 @@
             break;
         case ECmdPenInputLanguage:
             {
+            iDataMgr->SetData( EPeninputDataTypeInputLanguage, aData );
             vkbWindow->SetSwitchlistLanguage(*aData);
             vkbWindow->SetDeadKey();
             if ( iLayoutType == EPluginInputModeFSQ )
@@ -493,6 +496,9 @@
                     break;
                     }
                 }
+
+            isDottedChar = TranslateMirrorUnicode( inputCode, outputCode );
+
             if (isDottedChar)
                 {
                 number->Des().Append( outputCode );                    
@@ -505,6 +511,29 @@
         }
     }
 
+TBool CPeninputGenericVkbLayout::TranslateMirrorUnicode( TUint16 aInputCode, TUint16& aOutputCode )
+    {
+    TBool isMirrorChar = EFalse;
+    TInt langCode = *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage )));
+    if (( langCode != ELangArabic ) &&
+        ( langCode != ELangHebrew ) &&
+        ( langCode != ELangFarsi ) &&
+        ( langCode != ELangUrdu ))
+        {
+        return isMirrorChar;
+        }
+    for (TInt i = 0; i < KNumberOfMirrorChar; i++)
+        {
+        if (mirrorUnicode[i] == aInputCode)
+            {
+            aOutputCode = mirrorUnicode[KNumberOfMirrorChar - i - 1];
+            isMirrorChar = ETrue;
+            break;
+            }
+        }
+    return isMirrorChar;
+    }
+
 // ---------------------------------------------------------------------------
 // Handle show tooltip command.
 // ---------------------------------------------------------------------------
@@ -531,7 +560,7 @@
         if (tooltipText)
             {
             CleanupStack::PushL(tooltipText);
-            vkbWindow->ShowTooltipL(*tooltipText);
+            vkbWindow->ShowTooltipL(*tooltipText, *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage ))));
             CleanupStack::PopAndDestroy(tooltipText);
             }        
         }