summaryrefslogtreecommitdiff
path: root/i18npool/source/inputchecker
diff options
context:
space:
mode:
Diffstat (limited to 'i18npool/source/inputchecker')
-rw-r--r--i18npool/source/inputchecker/inputsequencechecker.cxx166
-rw-r--r--i18npool/source/inputchecker/inputsequencechecker_hi.cxx148
-rw-r--r--i18npool/source/inputchecker/inputsequencechecker_th.cxx154
-rw-r--r--i18npool/source/inputchecker/makefile.mk51
4 files changed, 519 insertions, 0 deletions
diff --git a/i18npool/source/inputchecker/inputsequencechecker.cxx b/i18npool/source/inputchecker/inputsequencechecker.cxx
new file mode 100644
index 000000000000..946cdd07064d
--- /dev/null
+++ b/i18npool/source/inputchecker/inputsequencechecker.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_i18npool.hxx"
+
+#include <inputsequencechecker.hxx>
+#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
+#include <com/sun/star/i18n/UnicodeType.hpp>
+#include <i18nutil/unicode.hxx>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::rtl;
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+InputSequenceCheckerImpl::InputSequenceCheckerImpl( const Reference < XMultiServiceFactory >& rxMSF ) : xMSF( rxMSF )
+{
+ serviceName = "com.sun.star.i18n.InputSequenceCheckerImpl";
+ cachedItem = NULL;
+}
+
+InputSequenceCheckerImpl::InputSequenceCheckerImpl()
+{
+}
+
+InputSequenceCheckerImpl::~InputSequenceCheckerImpl()
+{
+ // Clear lookuptable
+ for (size_t l = 0; l < lookupTable.size(); l++)
+ delete lookupTable[l];
+
+ lookupTable.clear();
+}
+
+sal_Bool SAL_CALL
+InputSequenceCheckerImpl::checkInputSequence(const OUString& Text, sal_Int32 nStartPos,
+ sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException)
+{
+ if (inputCheckMode == InputSequenceCheckMode::PASSTHROUGH)
+ return sal_True;
+
+ sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar);
+
+ if (language)
+ return getInputSequenceChecker(language)->checkInputSequence(Text, nStartPos, inputChar, inputCheckMode);
+ else
+ return sal_True; // not a checkable languages.
+}
+
+sal_Int32 SAL_CALL
+InputSequenceCheckerImpl::correctInputSequence(OUString& Text, sal_Int32 nStartPos,
+ sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(RuntimeException)
+{
+ if (inputCheckMode != InputSequenceCheckMode::PASSTHROUGH) {
+ sal_Char* language = getLanguageByScripType(Text[nStartPos], inputChar);
+
+ if (language)
+ return getInputSequenceChecker(language)->correctInputSequence(Text, nStartPos, inputChar, inputCheckMode);
+ }
+ Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar));
+ return nStartPos;
+}
+
+static ScriptTypeList typeList[] = {
+ //{ UnicodeScript_kHebrew, UnicodeScript_kHebrew }, // 10,
+ //{ UnicodeScript_kArabic, UnicodeScript_kArabic }, // 11,
+ { UnicodeScript_kDevanagari,UnicodeScript_kDevanagari, UnicodeScript_kDevanagari }, // 14,
+ { UnicodeScript_kThai, UnicodeScript_kThai, UnicodeScript_kThai }, // 24,
+
+ { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, UnicodeScript_kScriptCount } // 88
+};
+
+sal_Char* SAL_CALL
+InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode nChar)
+{
+ sal_Int16 type = unicode::getUnicodeScriptType( cChar, typeList, UnicodeScript_kScriptCount );
+
+ if (type != UnicodeScript_kScriptCount &&
+ type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) {
+ switch(type) {
+ case UnicodeScript_kThai: return (sal_Char*)"th";
+ //case UnicodeScript_kArabic: return (sal_Char*)"ar";
+ //case UnicodeScript_kHebrew: return (sal_Char*)"he";
+ case UnicodeScript_kDevanagari: return (sal_Char*)"hi";
+ }
+ }
+ return NULL;
+}
+
+Reference< XExtendedInputSequenceChecker >& SAL_CALL
+InputSequenceCheckerImpl::getInputSequenceChecker(sal_Char* rLanguage) throw (RuntimeException)
+{
+ if (cachedItem && cachedItem->aLanguage == rLanguage) {
+ return cachedItem->xISC;
+ }
+ else if (xMSF.is()) {
+ for (size_t l = 0; l < lookupTable.size(); l++) {
+ cachedItem = lookupTable[l];
+ if (cachedItem->aLanguage == rLanguage)
+ return cachedItem->xISC;
+ }
+
+ Reference < uno::XInterface > xI = xMSF->createInstance(
+ OUString::createFromAscii("com.sun.star.i18n.InputSequenceChecker_") +
+ OUString::createFromAscii(rLanguage));
+
+ if ( xI.is() ) {
+ Reference< XExtendedInputSequenceChecker > xISC;
+ xI->queryInterface( getCppuType((const Reference< XExtendedInputSequenceChecker>*)0) ) >>= xISC;
+ if (xISC.is()) {
+ lookupTable.push_back(cachedItem = new lookupTableItem(rLanguage, xISC));
+ return cachedItem->xISC;
+ }
+ }
+ }
+ throw RuntimeException();
+}
+
+OUString SAL_CALL
+InputSequenceCheckerImpl::getImplementationName(void) throw( RuntimeException )
+{
+ return OUString::createFromAscii(serviceName);
+}
+
+sal_Bool SAL_CALL
+InputSequenceCheckerImpl::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii(serviceName);
+}
+
+Sequence< OUString > SAL_CALL
+InputSequenceCheckerImpl::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ aRet[0] = OUString::createFromAscii(serviceName);
+ return aRet;
+}
+
+} } } }
diff --git a/i18npool/source/inputchecker/inputsequencechecker_hi.cxx b/i18npool/source/inputchecker/inputsequencechecker_hi.cxx
new file mode 100644
index 000000000000..a265ef0a651e
--- /dev/null
+++ b/i18npool/source/inputchecker/inputsequencechecker_hi.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_i18npool.hxx"
+
+#include <inputsequencechecker_hi.hxx>
+
+using namespace rtl;
+
+namespace com {
+namespace sun {
+namespace star {
+namespace i18n {
+
+InputSequenceChecker_hi::InputSequenceChecker_hi()
+{
+ serviceName = "com.sun.star.i18n.InputSequenceChecker_hi";
+}
+
+InputSequenceChecker_hi::~InputSequenceChecker_hi()
+{
+}
+/* Non-Defined Class type */
+#define __ND 0
+
+/*
+ * Devanagari character type definitions
+ */
+#define __UP 1 // ChandraBindu & Anuswar
+#define __NP 2 // Visarg
+#define __IV 3 // Independant Vowels
+#define __CN 4 // Consonants except _CK & _RC
+#define __CK 5 // Consonants that can be followed by Nukta
+#define __RC 6 // Ra
+#define __NM 7 // Matra
+#define __RM 8 // Ra + HAL
+#define __IM 9 // Choti I Matra
+#define __HL 10 // HAL
+#define __NK 11 // Nukta
+#define __VD 12 // Vedic
+#define __HD 13 // Hindu Numerals
+
+/*
+ * Devanagari character type table
+ */
+static const sal_uInt16 devaCT[128] = {
+/* 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, A, B, C, D, E, F, */
+/* 0900 */ __ND, __UP, __UP, __NP, __ND, __IV, __IV, __IV,
+ __IV, __IV, __IV, __IV, __IV, __IV, __IV, __IV,
+/* 0910 */ __IV, __IV, __IV, __IV, __IV, __CK, __CK, __CK,
+ __CN, __CN, __CN, __CN, __CK, __CN, __CN, __CN,
+/* 0920 */ __CN, __CK, __CK, __CN, __CN, __CN, __CN, __CN,
+ __CN, __CN, __CN, __CK, __CN, __CN, __CN, __CN,
+/* 0930 */ __RC, __CN, __CN, __CN, __CN, __CN, __CN, __CN,
+ __CN, __CN, __ND, __ND, __NK, __VD, __NM, __IM,
+/* 0940 */ __RM, __NM, __NM, __NM, __NM, __RM, __RM, __RM,
+ __RM, __RM, __RM, __RM, __RM, __HL, __ND, __ND,
+/* 0950 */ __ND, __VD, __VD, __VD, __VD, __ND, __ND, __ND,
+ __CN, __CN, __CN, __CN, __CN, __CN, __CN, __CN,
+/* 0960 */ __IV, __IV, __NM, __NM, __ND, __ND, __HD, __HD,
+ __HD, __HD, __HD, __HD, __HD, __HD, __HD, __HD,
+/* 0970 */ __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND,
+ __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND,
+};
+
+/*
+ * Devanagari character composition table
+ */
+static const sal_uInt16 dev_cell_check[14][14] = {
+ /* ND, UP, NP, IV, CN, CK, RC, NM, RM, IM, HL, NK, VD, HD, */
+ /* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* ND */
+ /* 1 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* UP */
+ /* 2 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* NP */
+ /* 3 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IV */
+ /* 4 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, /* CN */
+ /* 5 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0 }, /* CK */
+ /* 6 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, /* RC */
+ /* 7 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* NM */
+ /* 8 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* RM */
+ /* 9 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* IM */
+ /* 10 */ { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, /* HL */
+ /* 11 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, /* NK */
+ /* 12 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* VD */
+ /* 13 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } /* HD */
+};
+
+sal_Bool _DEV_Composible[2][2] = {
+/* Mode 0 */ {sal_True, sal_True }, // PASSTHROUGH = 0
+/* Mode 1 */ {sal_False, sal_True} // STRICT = 1
+};
+
+#define getCharType(x) \
+ ((x >= 0x0900 && x < 0x097f) ? devaCT[x - 0x0900] : __ND)
+
+sal_Bool SAL_CALL
+InputSequenceChecker_hi::checkInputSequence(const OUString& Text,
+ sal_Int32 nStartPos,
+ sal_Unicode inputChar,
+ sal_Int16 inputCheckMode)
+ throw(com::sun::star::uno::RuntimeException)
+{
+ sal_Unicode currentChar = Text[nStartPos];
+ sal_uInt16 ch1 = getCharType(inputChar);
+ sal_uInt16 ch2 = getCharType(currentChar);
+
+ return (_DEV_Composible[inputCheckMode][dev_cell_check[ch2][ch1]]);
+}
+
+sal_Int32 SAL_CALL
+InputSequenceChecker_hi::correctInputSequence(OUString& Text,
+ sal_Int32 nStartPos,
+ sal_Unicode inputChar,
+ sal_Int16 inputCheckMode)
+ throw(com::sun::star::uno::RuntimeException)
+{
+ if (checkInputSequence(Text, nStartPos, inputChar, inputCheckMode))
+ Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar));
+ else
+ nStartPos=Text.getLength();
+ return nStartPos;
+}
+} } } }
diff --git a/i18npool/source/inputchecker/inputsequencechecker_th.cxx b/i18npool/source/inputchecker/inputsequencechecker_th.cxx
new file mode 100644
index 000000000000..d4956c9758ea
--- /dev/null
+++ b/i18npool/source/inputchecker/inputsequencechecker_th.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_i18npool.hxx"
+
+#include <inputsequencechecker_th.hxx>
+#include <wtt.h>
+
+using namespace rtl;
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+InputSequenceChecker_th::InputSequenceChecker_th()
+{
+ serviceName = "com.sun.star.i18n.InputSequenceChecker_th";
+}
+
+InputSequenceChecker_th::~InputSequenceChecker_th()
+{
+}
+
+/* Table for Thai Cell Manipulation */
+sal_Char _TAC_celltype_inputcheck[17][17] = {
+/* Cn */ /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */
+/* Cn-1 00 */{ 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 10 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 20 */{ 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C' },
+ /* 30 */{ 'X', 'S', 'A', 'S', 'S', 'S', 'S', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 40 */{ 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 50 */{ 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 60 */{ 'X', 'A', 'A', 'A', 'S', 'A', 'S', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 70 */{ 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'R', 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' },
+ /* 80 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* 90 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* A0 */{ 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* B0 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* C0 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* D0 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' },
+ /* E0 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' },
+ /* F0 */{ 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' },
+ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', 'R', 'R', 'C', 'R', 'C', 'R', 'R', 'R', 'R' }
+};
+
+sal_Bool _TAC_Composible[3][5] = {
+ /* 'A', 'C', 'S', 'R', 'X' */
+/* Mode 0 */ {sal_True, sal_True, sal_True, sal_True, sal_True}, // PASSTHROUGH = 0
+/* Mode 1 */ {sal_True, sal_True, sal_True, sal_False, sal_True}, // BASIC = 1
+/* Mode 2 */ {sal_True, sal_True, sal_False, sal_False, sal_True} // STRICT = 2
+};
+
+static sal_Bool SAL_CALL check(sal_Unicode ch1, sal_Unicode ch2, sal_Int16 inputCheckMode)
+{
+ sal_Int16 composible_class;
+ switch (_TAC_celltype_inputcheck[getCharType(ch1)][getCharType(ch2)]) {
+ case 'A': composible_class = 0; break;
+ case 'C': composible_class = 1; break;
+ case 'S': composible_class = 2; break;
+ case 'R': composible_class = 3; break;
+ case 'X': composible_class = 4; break;
+ default: composible_class = 0;
+ }
+ return (_TAC_Composible[inputCheckMode][composible_class]);
+}
+
+sal_Bool SAL_CALL
+InputSequenceChecker_th::checkInputSequence(const OUString& Text, sal_Int32 nStartPos,
+ sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException)
+{
+ return check(Text[nStartPos], inputChar, inputCheckMode);
+}
+
+sal_Int32 SAL_CALL
+InputSequenceChecker_th::correctInputSequence(OUString& Text,
+ sal_Int32 nStartPos,
+ sal_Unicode inputChar,
+ sal_Int16 inputCheckMode)
+ throw(com::sun::star::uno::RuntimeException)
+{
+/* 9 rules for input sequence correction, see issue i42661 for detail,
+
+http://www.openoffice.org/issues/show_bug.cgi?id=42661
+
+<abv> = <av1>|<av2>|<av3>|<bv1>|<bv2>
+<abv1> = <av1>|<bv1>
+<thanthakhat> = 0E4C (karan)
+
+1. <cons> <abv>_x + <abv>_y => <cons> <abv>_y (replace)
+2. <cons> <tone>_x + <tone>_y => <cons> <tone>_y (replace)
+3. <cons> <abv> <tone>_x + <tone>_y => <cons> <abv> <tone>_y (replace)
+4. <cons> <abv>_x <tone> + <abv>_y => <cons> <abv>_y <tone> (replace, reorder)
+5. <cons> <tone> + <abv> => <cons> <abv> <tone> (reorder)
+6. <cons> <fv1> + <tone> => <cons> <tone> <fv1> (reorder)
+7. <cons> <tone>_x <fv1> + <tone>_y => <cons> <tone>_y <fv1> (replace, reorder)
+8. <cons> <thanthakhat> + <abv1> => <cons> <abv1> <thanthakhat> (reorder)
+9. <cons> <abv1>_x <thanthakhat> + <abv1>_y => <cons> <abv1>_y <thanthakhat>(reorder, replace)
+*/
+#define CT_ABV(t) ( (t>=CT_AV1 && t<=CT_AV3) || t==CT_BV1 || t==CT_BV2)
+#define CT_ABV1(t) (t==CT_AV1 || t==CT_BV1)
+
+ if (check(Text[nStartPos], inputChar, inputCheckMode))
+ Text = Text.replaceAt(++nStartPos, 0, OUString(inputChar));
+ else if (nStartPos > 0 && getCharType(Text[nStartPos-1]) == CT_CONS) {
+ sal_uInt16 t1=getCharType(Text[nStartPos]), t2=getCharType(inputChar);
+ if ( (CT_ABV(t1) && CT_ABV(t2)) || // 1.
+ (t1==CT_TONE && t2==CT_TONE) )// 2.
+ Text = Text.replaceAt(nStartPos, 1, OUString(inputChar));
+ else if ( (t1==CT_TONE && CT_ABV(t2)) || // 5.
+ (t1==CT_FV1 && t2==CT_TONE) || // 6.
+ (Text[nStartPos]==0x0E4C && CT_ABV1(t2)) ) // 8.
+ Text = Text.replaceAt(nStartPos++, 0, OUString(inputChar));
+ else
+ nStartPos=Text.getLength();
+ } else if (nStartPos > 1 && getCharType(Text[nStartPos-2]) == CT_CONS) {
+ sal_uInt16 t1=getCharType(Text[nStartPos-1]), t2=getCharType(Text[nStartPos]), t3=getCharType(inputChar);
+ if (CT_ABV(t1) && t2==CT_TONE && t3==CT_TONE) // 3.
+ Text = Text.replaceAt(nStartPos, 1, OUString(inputChar));
+ else if ( (CT_ABV(t1) && t2==CT_TONE && CT_ABV(t3)) || // 4.
+ (t1==CT_TONE && t2==CT_FV1 && t3==CT_TONE) || // 7.
+ (CT_ABV1(t1) && Text[nStartPos]==0x0E4C && CT_ABV1(t3)) ) // 9.
+ Text = Text.replaceAt(nStartPos-1, 1, OUString(inputChar));
+ else
+ nStartPos=Text.getLength();
+ } else
+ nStartPos=Text.getLength();
+
+ return nStartPos;
+}
+
+} } } }
diff --git a/i18npool/source/inputchecker/makefile.mk b/i18npool/source/inputchecker/makefile.mk
new file mode 100644
index 000000000000..2100b205b3e3
--- /dev/null
+++ b/i18npool/source/inputchecker/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#*
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#************************************************************************/
+
+PRJ=..$/..
+
+PRJNAME=i18npool
+TARGET=inputchecker
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/inputsequencechecker.obj \
+ $(SLO)$/inputsequencechecker_th.obj \
+ $(SLO)$/inputsequencechecker_hi.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+