--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/FindUtilChineseECE.h Thu Jul 15 18:22:55 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/FindUtilChineseECE.h Thu Aug 19 09:41:07 2010 +0300
@@ -36,7 +36,7 @@
Defines flags that can be used to indicate what is the default search method for each language.
*/
-enum TDefaultAdaptiveSearchMethod
+enum TChineseSearchMethod
{
EAdptSearchPinyin =0,
EAdptSearchStroke,
@@ -48,7 +48,7 @@
/**
* STRINGINFO struct
*
- * This data struct is for splited taxt in find pane.
+ * This data struct is for splited text in find pane.
* It includes two type word, which is Chinese or no-Chinese
*
* @lib FindUtil.dll
@@ -58,6 +58,7 @@
{
TBuf<KMaxWordLength> segmentString;
TBool isChinese;
+ TInt segmentPos;
};
/**
@@ -88,12 +89,26 @@
*
* @since S60 v3.2
* @param aItemString Reference to the searching target
- * @param aWord Reference to text in find pane
+ * @param aPsQuery Reference to the search query
* @return ETrue for the text are matched; otherwise EFalse
*/
virtual TBool MatchRefineL(const TDesC& aItemString, CPsQuery& aPsQuery);
/**
+ * Match arithmetic for accurate search
+ *
+ * @since S60 v5.2
+ * @param aItemString Reference to the searching target
+ * @param aPsQuery Reference to the search query
+ * @param aMatchPos On return, contain positions of matching parts within aItemString
+ * @param aMatchLength On return, contains lenghts of matching parts within aItemString
+ * @param aHighLight If highlight or underline position of matched contact is enabled
+ * @return ETrue for the text are matched; otherwise EFalse
+ */
+ TBool MatchRefineL(const TDesC& aItemString, CPsQuery& aPsQuery,
+ RArray<TInt>& aMatchPos, RArray<TInt>& aMatchLength, TBool aHighLight );
+
+ /**
* Current input text is handled by this model
*
* @since S60 v3.2
@@ -170,30 +185,6 @@
public:
/**
- * Do translate for Chinese word
- *
- * @since S60 v3.2
- * @param aHZUnicode For translate word
- * @param aSpellList Reference to spelling list for polyphonic word
- * @return ETrue for it can be translated; otherwise EFalse
- */
- TBool T9ChineseTranslationL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
-
- /**
- * Find pane text is including Chinese word
- *
- * @since S60 v3.2
- * @param aWord Reference to text for analyse
- * @return ETrue it includes Chinese; otherwise EFalse
- */
- TBool IsChineseWord(const TDesC& aWord);
-
- /*
- *
- */
- void SetKeyboardMode(TInt aMode);
-
- /**
* Translate Chinese word to its spelling
*
* @since S60 v3.2
@@ -203,6 +194,15 @@
*/
TBool DoTranslationL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
+ /**
+ * Find pane text is including Chinese word
+ *
+ * @since S60 v3.2
+ * @param aWord Reference to text for analyse
+ * @return ETrue it includes Chinese; otherwise EFalse
+ */
+ TBool IsChineseWordIncluded(const TDesC& aWord);
+
/*
*
*/
@@ -211,6 +211,11 @@
return iLanguage;
}
+ inline TChineseSearchMethod CurrentSearchMethod()
+ {
+ return iSearchMethod;
+ }
+
private:
/**
@@ -238,9 +243,6 @@
*/
void CloseT9InterfaceL();
- TInt CategoryOfLang(TLanguage aLanguage);
-
-
/**
* This letter is stroke symbol
*
@@ -248,12 +250,18 @@
* @param aFindWord For analyse
* @return ETrue for it is stroke symbol; otherwise EFalse
*/
- TInt IsStrokeSymbol(const TInt aFindWord);
+ TInt IsStrokeSymbol(const TUint16 aFindWord);
- // The below code is commented out because current CFindUtilChineseECE is used
- // on 3.2.3 which is not supported adaptive search. It will be easy to keep these code
- // for the further merging work (merge from FindUtil 5.0)
-#if 0
+ /**
+ * Do translate for Chinese word
+ *
+ * @since S60 v3.2
+ * @param aHZUnicode For translate word
+ * @param aSpellList Reference to spelling list for polyphonic word
+ * @return ETrue for it can be translated; otherwise EFalse
+ */
+ TBool T9ChineseTranslationL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
+
/**
* Do translate for Chinese word
*
@@ -263,7 +271,6 @@
* @return ETrue for it can be translated; otherwise EFalse
*/
TBool T9ChineseTranslationAdaptiveL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
-#endif
/**
* Find pane text is including separator
@@ -284,6 +291,14 @@
TBool IsStrokeSymbolInString(const TDesC& aWord);
/**
+ * Find pane text is just Chinese word
+ *
+ * @param aWord Reference to text for analyse
+ * @return ETrue it is all Chinese word(s); otherwise EFalse
+ */
+ TBool IsAllChineseWord(const TDesC& aWord);
+
+ /**
* Find pane text is including zhuyin symbol
*
* @since S60 v3.2
@@ -327,10 +342,13 @@
* @param aStringInfoArr Reference to segment list
* @param aSegmentStr Reference to segment text
* @param aChinese The segment is Chinese
+ * @param aIndexAfterStr The first index in the source string after the aSegmentStr.
+ * The indices of characters of aSegmentStr are
+ * [aIndexAfterStr-aSegmementStr.Length(), aIndexAfterStr-1]
* @return none
*/
void InsertStrInforArrayL(RPointerArray<STRINGINFO>& aStringInfoArr,
- TDes &aSegmentStr, const TBool aChinese);
+ TDes &aSegmentStr, TBool aChinese, TInt aIndexAfterStr);
/**
* This segment is matched by search text
@@ -338,9 +356,13 @@
* @since S60 v3.2
* @param aStringInfoArr Reference to segment list
* @param aSearchText Reference to searching text
+ * @param aMatchPos On return, contain positions of matching parts within the original searcg target text
+ * @param aMatchLength On return, contains lenghts of matching parts within the original search target text
+ * @param aHighLight If highlight or underline position of matched contact is enabled
* @return ETrue it is matched; otherwise EFalse
*/
- TBool MatchSegmentL(RPointerArray<STRINGINFO>& aStringInfoArr, CPsQuery& aQuery);
+ TBool MatchSegmentL(RPointerArray<STRINGINFO>& aStringInfoArr,
+ CPsQuery& aQuery, RArray<TInt>& aMatchPos, RArray<TInt>& aMatchLength, TBool aHighLight );
/**
* Search text by reverse
@@ -348,9 +370,10 @@
* @since S60 v3.2
* @param aFirst Reference to matched text
* @param aSecond Reference to matched text
+ * @param aFullQuery Reference to the FullQuery
* @return Matched count
*/
- TInt ReverseMatchString(const TDesC& aFirst, const TDesC& aSecond);
+ TInt ReverseMatchStringL(const TDesC& aFirst, const TDesC& aSecond, CPsQuery& aFullQuery );
/**
* Search text in other text
@@ -358,29 +381,34 @@
* @since S60 v3.2
* @param aFirst Reference to matched text
* @param aSecond Reference to matched text
+ * @param aFullQuery Reference to the FullQuery
* @return Matched count
*/
- TInt MatchString(const TDesC& aFirst, const TDesC& aSecond);
+ TInt MatchStringL(const TDesC& aFirst, const TDesC& aSecond, CPsQuery& aFullQuery);
/**
* Search text in other text
*
* @since S60 v3.2
- * @param aSearhTargetStr Reference to the target text to be queried
- * @param CPsQuery maintain the matched text from user
- * @return Matched count
+ * @param aSearchTargetString Data to be searched through
+ * @param aQuery Text to be searched from aSearchTargetString
+ * @return Number of matched characters from the begining of aQuery
*/
- TInt MatchString(const TDesC& aSearhTargetStr, CPsQuery& aQuery);
+ TInt MatchStringL(const TDesC& aSearhTargetString, CPsQuery& aQuery);
/**
* Search Chinese word in input text
*
* @since S60 v3.2
- * @param aFirst Reference to matched text
- * @param aSecond Reference to matched text
- * @return Matched count
+ * @param aSearchTargetString Data to be searched through
+ * @param aQuery Text to be searched from aSearchTargetString
+ * @param aMatchStrtIdx On return, will contain the start index
+ * of the matching part within aSearchTargetString
+ * @param aMatchEndIdx On return, will contain the end index
+ * of the matching part within aSearchTargetString
+ * @return Number of matched characters from the begining of aQuery
*/
- TInt MatchChineseStringL(const TDesC& aSearchTargetString, CPsQuery& aQuery, TInt& aIndex);
+ TInt MatchChineseStringL(const TDesC& aSearchTargetString, CPsQuery& aQuery, TInt& aMatchStartIdx, TInt& aMatchEndIdx);
/**
* Initial character search
@@ -397,18 +425,19 @@
* Maximal matched count in spelling list
*
* @since S60 v3.2
- * @param spellList Reference to spelling list
+ * @param aSpellList Reference to spelling list
* @param aSearchStr Reference to search text
* @param aPreviouStr Reference to previous matched word
* @param aMatchIndex Reference to match index in Search text
* @param aFullMatched Previous word is fully matched
* @param aMatchedCount Previous word matched count
* @param aAgain Search again
+ * @param aFullQuery Reference to the FullQuery
* @return Matched count
*/
- TInt MaxMatchInList(RPointerArray<HBufC> &spellList, CPsQuery& aQuery,
+ TInt MaxMatchInListL(RPointerArray<HBufC>& aSpellList, CPsQuery& aQuery,
TDesC& aPreviouStr, TInt& aMatchIndex, const TBool aFullMatched,
- const TInt aMatchedCount, TBool& aAgain);
+ const TInt aMatchedCount, TBool& aAgain, TBool& aPrevReplaced, CPsQuery& aFullQuery);
/**
* Search the taxt is include the input text
@@ -527,18 +556,6 @@
const TDes& aCurrentBuf,HBufC*& aNextChars );
#endif
- /**
- * Converts the input data to the key board mode specified by the query.
- * Mode is referred in the CPsQuery.
- * If the mode is ITU-T, data is converted to numeric.
- * If the mode is Qwerty, data is retained as is.
- * If the mode is Mix, data is conerted according to the keyboard mode
- * of the corresponding query chararter
- */
- void ConvertdDataToKeyBoardModeL(CPsQuery& aQuery,
- const TDesC& aSearchTargetStr,
- TBuf<KMaxWordInterpretationLen>& aOutputNumInterpretationStr);
-
// help function for using CPsQuery
public:
void GetPartOfQueryL(CPsQuery& aSrcQuery, TInt aStartIndex,
@@ -555,21 +572,11 @@
CPtiEngine* iPtiEngine;
/**
- * Ptiengine for Chinese translation in English language (Own)
- */
- CPtiEngine* iPtiEnginePrc;
-
- /**
* Current text input language
*/
TLanguage iLanguage;
/**
- * It is support Chinese Language
- */
- TBool iSupportPRCChinese;
-
- /**
* Current input mode
*/
TInt iCurInputMode;
@@ -584,14 +591,10 @@
*/
CFindRepositoryWatcher* iWatcher;
- // The below code is commented out because current CFindUtilChineseECE is used
- // on 3.2.3 which is not supported adaptive search. It will be easy to keep these code
- // for the further merging work (merge from FindUtil 5.0)
-#if 0
/**
* Repository for input mode (Own)
*/
- CRepository* iRepositoryFindAdaptive;
+ CRepository* iRepositoryFindAdaptive;
/**
* The repository watcher(Own);
@@ -602,31 +605,15 @@
/**
* The default adaptive search method;
*/
- TDefaultAdaptiveSearchMethod iSearchMethodPRC;
-
- /**
- * The default adaptive search method;
- */
- TDefaultAdaptiveSearchMethod iSearchMethodTaiWan;
-
- /**
- * The default adaptive search method;
- */
- TDefaultAdaptiveSearchMethod iSearchMethodHongKong;
+ TChineseSearchMethod iSearchMethod;
/**
* The search method;
*/
TBool iSearchMethodAdaptive;
-#endif
CPcsAlgorithm2* iAlgorithm;
- /*
- * The keyboard Mode
- */
- TInt iKeyboardMode;
-
};
#endif // __FINDUTILCHINESE_ECE__