diff -r 000000000000 -r eb1f2e154e89 textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmicfnomatchesinline.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmicfnomatchesinline.cpp Tue Feb 02 01:02:04 2010 +0200 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2009 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: +* +*/ +#include "peninputlayoutmicfnomatchesinline.h" + +_LIT(KTextForUnknownPredictiveTextWestern, "?"); +_LIT(KTextForUnknownPredictiveTextArabic, "\x061f"); // Arabic Question Mark +#define ARABIC_CODE_PAGE_BASE 0x0600 + +TPtrC TFepLayoutMIcfNoMatchesInline::TextForUnknownPredictiveTextIndication( + const TDesC& aTextSample) + { + TUint codebase = CodeBaseOfText(aTextSample); + + if (codebase == ARABIC_CODE_PAGE_BASE) + return KTextForUnknownPredictiveTextArabic(); //unknownTextBuffer; + else + return KTextForUnknownPredictiveTextWestern(); //unknownTextBuffer; + } + +TUint TFepLayoutMIcfNoMatchesInline::CodeBaseOfText(const TDesC& aTextSample) + { + TUint base = 0; + + // examine buffer; take first printable character + // if none found, then 0 is returned + TChar character; + for (TInt index = 0;index < aTextSample.Length(); index++) + { + character = aTextSample[index]; + if ( character.IsPrint()) + { + TUint ch(character); + ch &= 0xffffff00; // only interested in upper bits + base = (TUint)ch; + break; + } + } + + return base; + } + +// End Of File