equal
deleted
inserted
replaced
17 */ |
17 */ |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 |
20 |
21 #include "CPcsAlgorithm2.h" |
21 #include "CPcsAlgorithm2.h" |
|
22 #include "CPcsAlgorithm2Utils.h" |
22 #include "FindUtilChineseECE.h" |
23 #include "FindUtilChineseECE.h" |
23 #include "CPcsDebug.h" |
24 #include "CPcsDebug.h" |
24 #include "CPcsKeyMap.h" |
25 #include "CPcsKeyMap.h" |
25 #include <bldvariant.hrh> |
26 #include <bldvariant.hrh> |
26 #include <AknFepInternalCRKeys.h> |
27 #include <AknFepInternalCRKeys.h> |
691 } |
692 } |
692 // ---------------------------------------------------------------------------- |
693 // ---------------------------------------------------------------------------- |
693 // CPcsKeyMap::PoolIdForCharacter |
694 // CPcsKeyMap::PoolIdForCharacter |
694 // |
695 // |
695 // ---------------------------------------------------------------------------- |
696 // ---------------------------------------------------------------------------- |
696 TInt CPcsKeyMap::PoolIdForCharacter(const TChar& aChar) |
697 TInt CPcsKeyMap::PoolIdForCharacter(TChar aChar) |
697 { |
698 { |
698 TInt numValue = KErrNotFound; |
699 TInt numValue = KErrNotFound; |
|
700 |
|
701 // If character is a Chinese word character, then we select the |
|
702 // pool ID according the first character of the first spelling of the word. |
|
703 TRAP_IGNORE( aChar = FirstCharFromSpellingL( aChar ) ); |
|
704 |
699 TInt key = KeyForCharacter(aChar); |
705 TInt key = KeyForCharacter(aChar); |
700 if (key != KErrNotFound) |
706 if (key != KErrNotFound) |
701 { |
707 { |
702 numValue = iKeysForPoolFormation.Find((TPtiKey) key); |
708 numValue = iKeysForPoolFormation.Find((TPtiKey) key); |
703 } |
709 } |
710 |
716 |
711 return numValue; |
717 return numValue; |
712 } |
718 } |
713 |
719 |
714 // ---------------------------------------------------------------------------- |
720 // ---------------------------------------------------------------------------- |
|
721 // CPcsKeyMap::CPcsKeyMap::FirstCharFromSpellingL |
|
722 // |
|
723 // ---------------------------------------------------------------------------- |
|
724 TChar CPcsKeyMap::FirstCharFromSpellingL( TChar aChar ) const |
|
725 { |
|
726 TChar translated( aChar ); |
|
727 TBuf<1> temp; |
|
728 temp.Append( aChar ); |
|
729 if ( iAlgorithm->FindUtilECE()->IsChineseWord( temp ) ) |
|
730 { |
|
731 RPointerArray<HBufC> spellList; |
|
732 CleanupResetAndDestroyPushL( spellList ); |
|
733 if (iAlgorithm->FindUtilECE()->DoTranslationL(aChar, spellList)) |
|
734 { |
|
735 translated = (*spellList[0])[0]; |
|
736 } |
|
737 CleanupStack::PopAndDestroy( &spellList ); // ResetAndDestroy |
|
738 } |
|
739 return translated; |
|
740 } |
|
741 // ---------------------------------------------------------------------------- |
715 // CPcsKeyMap::PoolCount |
742 // CPcsKeyMap::PoolCount |
716 // |
743 // |
717 // ---------------------------------------------------------------------------- |
744 // ---------------------------------------------------------------------------- |
718 TInt CPcsKeyMap::PoolCount() |
745 TInt CPcsKeyMap::PoolCount() |
719 { |
746 { |