diff -r f1bdd6b078d1 -r 2cb9bae34d17 fep/aknfep/src/AknFepUiInputStateCompletionKatakana.cpp --- a/fep/aknfep/src/AknFepUiInputStateCompletionKatakana.cpp Tue Jul 06 14:38:41 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -/* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Provides the TAknFepInputStateCompletionKatakana methods. -* -*/ - - - - - - - - - - - - -// INCLUDE FILES -#include "AknFepUiInputStateCompletionKatakana.h" -#include "AknFepUIManagerStateInterface.h" // MAknFepUIManagerStateInterface -#include "AknFepManagerUIInterface.h" // MAknFepManagerUIInterface -#include "AknFepUICtrlContainerJapanese.h" - -#include // keys -#include -#include // MPtiEngineCompositionDataInterface - - -/** -* TAknFepUiInputStateCompletionHiraganaKanji class. -* -*/ - -//============================ MEMBER FUNCTIONS ============================== - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionKatakana:: -// TAknFepUiInputStateCompletionKatakana -// C++ default Constructor -// --------------------------------------------------------------------------- -// -TAknFepUiInputStateCompletionKatakana:: - TAknFepUiInputStateCompletionKatakana( - MAknFepUIManagerStateInterface* aOwner, - MAknFepUICtrlContainerJapanese* aUIContainer) - :TAknFepUiInputStateCompletionJapaneseMultitap(aOwner, aUIContainer) - { - } - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionKatakana:: -// HandleNumericShortKeyL -// Handling short keypress events of the numeric and the star. -// --------------------------------------------------------------------------- -// -TBool TAknFepUiInputStateCompletionKatakana::HandleNumericShortKeyL(TInt aKey) - { - TBool ret = ETrue; - MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); - CPtiEngine* ptiEngine = iOwner->PtiEngine(); - - CommitInlineEditingCharacterL(); - const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData(); - TPtrC text = data->ConvertingString(); - if (text.Length() > 0 && fepMan->EditorHasFreeSpace()) - { // for last character is space or line feed - iOwner->ChangeState(EInitial); - iOwner->FepMan()->SimulateKeyEventL(aKey, ETrue); - ret = ETrue; - } - else - { - ptiEngine->ClearCurrentWord(); - iOwner->ChangeState(EInitial); - } - - return ret; - } - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionJapaneseMultitap::UpdateInlineEditingCharacterL -// Update inline editing string -// --------------------------------------------------------------------------- -// -TBool TAknFepUiInputStateCompletionKatakana::UpdateInlineEditingCharacterL() - { - MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); - CPtiEngine* ptiEngine = iOwner->PtiEngine(); - TBool ret = EFalse; - - if(CommitInlineEditingCharacterL()) - { - ptiEngine->ClearCurrentWord(); - iOwner->ChangeState(EInitial); - ret = ETrue; - } - - return ret; - } - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionJapaneseMultitap::CommitInlineEditingCharacterL -// Commit inline editing string -// --------------------------------------------------------------------------- -// -TBool TAknFepUiInputStateCompletionKatakana::CommitInlineEditingCharacterL() - { - MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); - CPtiEngine* ptiEngine = iOwner->PtiEngine(); - const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData(); - TPtrC text = data->CompletedString(); - if (text.Length() > 0) - { - HBufC* buf = HBufC::NewLC(text.Length()); - TPtr ptr(buf->Des()); - ptr.Copy(text); - if (fepMan->InputMode() == EHiragana) - { - for (TInt index=text.Length()-1; index >= 0; index-- ) - { - if (!IsFullHiragana(TChar(text[index]))) - { - ptr.Delete(index, 1); - } - } - } - - fepMan->CommitInlineEditL(ptr, ptr.Length()); - CleanupStack::PopAndDestroy(buf); - } - return ETrue; - } - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionKatakana::IsFullHiragana -// Check a character whether it is Full-width Katakana -// --------------------------------------------------------------------------- -// -TBool TAknFepUiInputStateCompletionKatakana::IsFullHiragana(const TChar aChr) - { - TBool rtn = EFalse; - const TUint KFullHiraganaStart = 0x3041; - const TUint KFullHiraganaEnd = 0x3094; - - if (KFullHiraganaStart <= aChr && aChr <= KFullHiraganaEnd) - { - rtn = ETrue; - } - - return rtn; - } - -// --------------------------------------------------------------------------- -// TAknFepUiInputStateCompletionKatakana::HandleAuxKeyL -// Handling auxiliary keypress events including OK and Backspace -// --------------------------------------------------------------------------- -// -TBool TAknFepUiInputStateCompletionKatakana::HandleAuxKeyL(TInt aKey, - TKeyPressLength aLength) - { - TBool ret = ETrue; - CPtiEngine* ptiEngine = iOwner->PtiEngine(); - - if (aKey == EKeyOK - || aKey == EStdKeyDevice3 /* 0xA7 */ - || aKey == EStdKeyEnter - || aKey == EStdKeyNkpEnter) - { - TPtiEngineCommand ptiCommand = EPtiCommandUserActionComplete; - if (aLength == ELongKeyPress) - { - ptiCommand = EPtiCommandUserActionAllComplete; - } - ptiEngine->HandleCommandL(ptiCommand); - UpdateInlineEditingCharacterL(); - // OK-key or Enter-key shouldn't be consumed in Latin input. - // Because OK-key or Enter-key might be used in application side. - ret = EFalse; - } - - return ret; - } - -// End of file