Index: i18npool/inc/inputsequencechecker_th.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/i18npool/inc/inputsequencechecker_th.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 inputsequencechecker_th.hxx
--- i18npool/inc/inputsequencechecker_th.hxx	15 Sep 2004 05:34:28 -0000	1.1.1.1
+++ i18npool/inc/inputsequencechecker_th.hxx	17 Sep 2004 05:12:53 -0000
@@ -76,6 +76,7 @@
 
 	virtual sal_Bool SAL_CALL checkInputSequence(const rtl::OUString& Text, sal_Int32 nStartPos,
 		sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException);
+	sal_Bool checkSpecailSkip( sal_Unicode oChar, sal_Unicode nChar );
 };
 
 } } } } 
Index: i18npool/inc/wtt.h
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/i18npool/inc/wtt.h,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 wtt.h
--- i18npool/inc/wtt.h	15 Sep 2004 05:34:28 -0000	1.1.1.1
+++ i18npool/inc/wtt.h	17 Sep 2004 05:12:53 -0000
@@ -71,21 +71,23 @@
 #define CT_NON		1		// Non-composible
 #define CT_CONS		2		// Consonant
 #define CT_LV		3		// Leading vowel
-#define CT_FV1		4		// Following vowel
-#define CT_FV2		5		// Following vowel
-#define CT_FV3		6
-#define CT_BV1		7		// Below vowel
-#define CT_BV2		8
-#define CT_BD		9		// Below diacritic
-#define CT_TONE		10		// Tone
-#define CT_AD1		11		// Above diacritic
-#define CT_AD2		12
-#define CT_AD3		13
-#define CT_AV1		14		// Above vowel
-#define CT_AV2		15
-#define CT_AV3		16
+#define CT_FV1		4		// Following vowel à¸°
+#define CT_FV2		5		// Following vowel à¹…
+#define CT_FV3		6		// Following vowel à¸¤,à¸¦
+#define CT_FV4		7		// Following vowel à¸²
+#define CT_FV5		8		// Following vowel à¸³
+#define CT_BV1		9		// Below vowel
+#define CT_BV2		10
+#define CT_BD		11		// Below diacritic
+#define CT_TONE		12		// Tone
+#define CT_AD1		13		// Above diacritic
+#define CT_AD2		14
+#define CT_AD3		15
+#define CT_AV1		16		// Above vowel
+#define CT_AV2		17
+#define CT_AV3		18
 
-#define MAX_CT		17
+#define MAX_CT		19
 
 static const sal_uInt16 thaiCT[128] = {		// Thai character type
 	CT_NON, CT_CONS, CT_CONS, CT_CONS, CT_CONS,CT_CONS, CT_CONS, CT_CONS,		//0E00
@@ -94,7 +96,7 @@
 	CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS,
 	CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_FV3, CT_CONS, CT_FV3, CT_CONS,		//0E20
 	CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_CONS, CT_NON,
-	CT_FV1, CT_AV2, CT_FV1, CT_FV1, CT_AV1, CT_AV3, CT_AV2, CT_AV3,			//0E30
+	CT_FV1, CT_AV2, CT_FV4, CT_FV5, CT_AV1, CT_AV3, CT_AV2, CT_AV3,			//0E30
 	CT_BV1, CT_BV2, CT_BD, CT_NON, CT_NON, CT_NON, CT_NON, CT_NON,
 	CT_LV, CT_LV, CT_LV, CT_LV, CT_LV, CT_FV2, CT_NON, CT_AD2,			//0E40
 	CT_TONE, CT_TONE, CT_TONE, CT_TONE, CT_AD1, CT_AD1, CT_AD3, CT_NON,
Index: i18npool/source/inputchecker/inputsequencechecker.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/i18npool/source/inputchecker/inputsequencechecker.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 inputsequencechecker.cxx
--- i18npool/source/inputchecker/inputsequencechecker.cxx	15 Sep 2004 05:34:32 -0000	1.1.1.1
+++ i18npool/source/inputchecker/inputsequencechecker.cxx	17 Sep 2004 05:12:53 -0000
@@ -117,10 +117,9 @@
 sal_Char* SAL_CALL
 InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode nChar)
 {
-    sal_Int16 type = unicode::getUnicodeScriptType( cChar, typeList, UnicodeScript_kScriptCount );
+    sal_Int16 type = unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount );
 
-    if (type != UnicodeScript_kScriptCount && 
-	    type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) {
+    if (type != UnicodeScript_kScriptCount) {
 	switch(type) {
 	    case UnicodeScript_kThai: 		return "th";
 	    //case UnicodeScript_kArabic: 	return "ar";
Index: i18npool/source/inputchecker/inputsequencechecker_th.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/i18npool/source/inputchecker/inputsequencechecker_th.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 inputsequencechecker_th.cxx
--- i18npool/source/inputchecker/inputsequencechecker_th.cxx	15 Sep 2004 05:34:32 -0000	1.1.1.1
+++ i18npool/source/inputchecker/inputsequencechecker_th.cxx	17 Sep 2004 05:12:53 -0000
@@ -76,25 +76,29 @@
 }
 
 /* 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', 'S', 'A', 'S', '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_Char _TAC_celltype_inputcheck[19][19] = {
+/* 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',  'A', 'A',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 10 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 20 */   'X', 'A', 'A', 'A', 'A', 'S', 'A',  'A', 'A',  'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C',
+     /* 30 */   'X', 'S', 'A', 'S', 'S', 'S', 'S',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 40 */   'X', 'S', 'A', 'A', 'S', 'S', 'S',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 50 */   'X', 'A', 'A', 'A', 'A', 'S', 'S',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 60 */   'X', 'A', 'A', 'A', 'S', 'A', 'S',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+
+     /* 70 */   'X', 'S', 'A', 'A', 'A', 'S', 'S',  'A', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* 80 */   'X', 'S', 'A', 'A', 'S', 'S', 'S',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+
+     /* 90 */   'X', 'A', 'A', 'A', 'A', 'S', 'A',  'A', 'A',  'R', 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R',
+     /* A0 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* B0 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* C0 */   'X', 'A', 'A', 'A', 'A', 'A', 'A',  'A', 'A',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* D0 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* E0 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /* F0 */   'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
+     /*   */    'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R',
+     /*   */    'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R',
+                'X', 'A', 'A', 'A', 'S', 'S', 'A',  'S', 'S',  'R', 'R', 'R', 'C', 'R', 'C', 'R', 'R', 'R', 'R'
 };
 
 sal_Bool _TAC_Composible[3][5] = {
@@ -108,17 +112,51 @@
 InputSequenceChecker_th::checkInputSequence(const OUString& Text, sal_Int32 nStartPos,
 	sal_Unicode inputChar, sal_Int16 inputCheckMode) throw(com::sun::star::uno::RuntimeException)
 {
-	sal_Int16  composible_class;
-	sal_Unicode currentChar = Text[nStartPos];
-	switch (_TAC_celltype_inputcheck[getCharType(currentChar)][getCharType(inputChar)]) {
-	    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 bTAC = sal_False;
+        sal_Bool bSkip = sal_False;
+        sal_Int16  composible_class;
+        sal_Unicode currentChar;
+
+        if (nStartPos >= 0) { 
+                currentChar = Text[nStartPos];
+                switch (_TAC_celltype_inputcheck[getCharType(currentChar)][getCharType(inputChar)]) {
+                    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;
+                }
+
+                bTAC = _TAC_Composible[inputCheckMode][composible_class];
+        }
+        else {
+                currentChar = 0x0;
+                bTAC = sal_True;
+        }
+
+        bSkip = checkSpecailSkip(currentChar, inputChar);
+
+        return (bTAC && !bSkip);
+}
+
+/* Check special rule for THAI
+ * 1. Top vowels and bottom vowels can not behind spacebar.
+ * 2. SARA AA can behind SARA AA.
+ * 3. Vowels can not behind another language characters.
+ */
+sal_Bool InputSequenceChecker_th::checkSpecailSkip( sal_Unicode oChar, sal_Unicode nChar )
+{
+        sal_Bool bSkipChar = sal_False;
+
+        // previous character is spacebar and current character are top vowels and bottom vowels, skip
+        if ( oChar < 0x0e00 || oChar >= 0x0e60 )
+        {
+                if ( (nChar >= 0x0e30 && nChar <= 0x0e3a) || ( nChar >= 0x0e47 && nChar <= 0x0e4e ))
+                        bSkipChar = sal_True;
+        }
+
+        return bSkipChar;
 }
 
 } } } }
Index: officecfg/registry/schema/org/openoffice/Office/Common.xcs
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/officecfg/registry/schema/org/openoffice/Office/Common.xcs,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 Common.xcs
--- officecfg/registry/schema/org/openoffice/Office/Common.xcs	15 Sep 2004 05:32:56 -0000	1.1.1.1
+++ officecfg/registry/schema/org/openoffice/Office/Common.xcs	17 Sep 2004 05:12:56 -0000
@@ -39858,7 +39858,7 @@
 					</info>
 					<value>false</value>
 				</prop>
-				<prop oor:name="CTLSequenceChecking" oor:type="xs:boolean">
+				<prop oor:name="CTLSequenceChecking" oor:type="xs:int">
 					<!-- UIHints: setup -->
 					<info>
 						<desc xml:lang="en-US">Specifies whether CTL strings are checked for the correct input sequence(true) or not (false).</desc>
@@ -39902,7 +39902,7 @@
 						<desc xml:lang="kn-IN">Specifies whether CTL strings are checked for the correct input sequence(true) or not (false).</desc>
 						<desc xml:lang="gl">Specifies whether CTL strings are checked for the correct input sequence(true) or not (false).</desc>
 					</info>
-					<value>false</value>
+					<value>2</value>
 				</prop>
 				<prop oor:name="CTLCursorMovement" oor:type="xs:int">
 					<!-- UIHints: options-->
Index: svtools/inc/ctloptions.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svtools/inc/ctloptions.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 ctloptions.hxx
--- svtools/inc/ctloptions.hxx	15 Sep 2004 05:32:18 -0000	1.1.1.1
+++ svtools/inc/ctloptions.hxx	17 Sep 2004 05:15:36 -0000
@@ -92,8 +92,14 @@
     void            SetCTLFontEnabled( sal_Bool _bEnabled );
     sal_Bool		IsCTLFontEnabled() const;
 
-    void			SetCTLSequenceChecking( sal_Bool _bEnabled );
-    sal_Bool		IsCTLSequenceChecking() const;
+	enum SequenceCheck
+	{
+		SEQUENCECHECK_NONE = 0,
+		SEQUENCECHECK_USE,
+		SEQUENCECHECK_AUTOCORRECT
+	};
+    void			SetCTLSequenceChecking( SequenceCheck _eSequence );
+    SequenceCheck		GetCTLSequenceChecking() const;
 
 	enum CursorMovement
 	{
Index: svtools/inc/languageoptions.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svtools/inc/languageoptions.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 languageoptions.hxx
--- svtools/inc/languageoptions.hxx	15 Sep 2004 05:32:19 -0000	1.1.1.1
+++ svtools/inc/languageoptions.hxx	17 Sep 2004 05:15:36 -0000
@@ -108,7 +108,12 @@
         E_CTLCURSORMOVEMENT,
         E_CTLTEXTNUMERALS
     };
-
+    enum SequenceCheck
+    {
+	SEQUENCECHECK_NONE = 0,
+	SEQUENCECHECK_USE,
+	SEQUENCECHECK_AUTOCORRECT
+    };
     // bDontLoad is for referencing purposes only
     SvtLanguageOptions( sal_Bool _bDontLoad = sal_False );
     ~SvtLanguageOptions();
@@ -132,8 +137,8 @@
 	void        SetCTLFontEnabled( sal_Bool _bEnabled );
 	sal_Bool	IsCTLFontEnabled() const;
 
-    void        SetCTLSequenceChecking( sal_Bool _bEnabled );
-    sal_Bool    IsCTLSequenceChecking() const;
+    	void 	SetCTLSequenceChecking( SequenceCheck _eSequence );
+    	SequenceCheck GetCTLSequenceChecking() const;
 
     sal_Bool    IsReadOnly(EOption eOption) const;
 
Index: svtools/source/config/ctloptions.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svtools/source/config/ctloptions.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 ctloptions.cxx
--- svtools/source/config/ctloptions.cxx	15 Sep 2004 05:32:22 -0000	1.1.1.1
+++ svtools/source/config/ctloptions.cxx	17 Sep 2004 05:15:37 -0000
@@ -110,7 +110,7 @@
 
     sal_Bool						m_bIsLoaded;
     sal_Bool						m_bCTLFontEnabled;
-    sal_Bool						m_bCTLSequenceChecking;
+    SvtCTLOptions::SequenceCheck			m_eCTLSequenceChecking;
 	SvtCTLOptions::CursorMovement	m_eCTLCursorMovement;
 	SvtCTLOptions::TextNumerals		m_eCTLTextNumerals;
 
@@ -131,8 +131,9 @@
     void			SetCTLFontEnabled( sal_Bool _bEnabled );
     sal_Bool		IsCTLFontEnabled() const { return m_bCTLFontEnabled; }
 
-    void            SetCTLSequenceChecking( sal_Bool _bEnabled );
-    sal_Bool        IsCTLSequenceChecking() const { return m_bCTLSequenceChecking;}
+    void        	SetCTLSequenceChecking( SvtCTLOptions::SequenceCheck _eSequence );
+    SvtCTLOptions::SequenceCheck
+					GetCTLSequenceChecking() const { return m_eCTLSequenceChecking; }
 
     void        	SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement );
     SvtCTLOptions::CursorMovement
@@ -166,7 +167,7 @@
 
 	m_bIsLoaded				( sal_False ),
     m_bCTLFontEnabled		( sal_False ),
-    m_bCTLSequenceChecking	( sal_False ),
+    m_eCTLSequenceChecking	( SvtCTLOptions::SEQUENCECHECK_AUTOCORRECT ),
 	m_eCTLCursorMovement	( SvtCTLOptions::MOVEMENT_LOGICAL ),
     m_eCTLTextNumerals      ( SvtCTLOptions::NUMERALS_ARABIC ),
 
@@ -223,7 +224,7 @@
                 if (!m_bROCTLSequenceChecking)
                 {
                     pNames[nRealCount] = pOrgNames[nProp];
-                    pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType );
+                    pValues[nRealCount] <<= (sal_Int32)m_eCTLSequenceChecking;
                     ++nRealCount;
                 }
             }
@@ -291,13 +292,13 @@
                 	switch ( nProp )
                 	{
                         case 0: { m_bCTLFontEnabled = bValue; m_bROCTLFontEnabled = pROStates[nProp]; } break;
-                        case 1: { m_bCTLSequenceChecking = bValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break;
                 	}
 				}
                 else if ( pValues[nProp] >>= nValue )
 				{
                 	switch ( nProp )
                 	{
+                        case 1: { m_eCTLSequenceChecking = (SvtCTLOptions::SequenceCheck)nValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break;
                         case 2: { m_eCTLCursorMovement = (SvtCTLOptions::CursorMovement)nValue; m_bROCTLCursorMovement = pROStates[nProp]; } break;
                         case 3: { m_eCTLTextNumerals = (SvtCTLOptions::TextNumerals)nValue; m_bROCTLTextNumerals = pROStates[nProp]; } break;
                 	}
@@ -323,12 +324,12 @@
     }
 }
 //------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled )
+void SvtCTLOptions_Impl::SetCTLSequenceChecking( SvtCTLOptions::SequenceCheck _eSequence )
 {
-    if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled)
+    if(!m_bROCTLSequenceChecking && m_eCTLSequenceChecking != _eSequence)
     {
         SetModified();
-        m_bCTLSequenceChecking = _bEnabled;
+        m_eCTLSequenceChecking = _eSequence;
     }
 }
 //------------------------------------------------------------------------------
@@ -394,16 +395,16 @@
     return pCTLOptions->IsCTLFontEnabled();
 }
 // -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLSequenceChecking( sal_Bool _bEnabled )
+void SvtCTLOptions::SetCTLSequenceChecking( SvtCTLOptions::SequenceCheck _eSequence )
 {
     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
-    pCTLOptions->SetCTLSequenceChecking(_bEnabled);
+    pCTLOptions->SetCTLSequenceChecking(_eSequence);
 }
 // -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsCTLSequenceChecking() const
+SvtCTLOptions::SequenceCheck SvtCTLOptions::GetCTLSequenceChecking() const
 {
     DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
-    return pCTLOptions->IsCTLSequenceChecking();
+    return pCTLOptions->GetCTLSequenceChecking();
 }
 // -----------------------------------------------------------------------------
 void SvtCTLOptions::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement )
Index: svtools/source/config/languageoptions.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svtools/source/config/languageoptions.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 languageoptions.cxx
--- svtools/source/config/languageoptions.cxx	15 Sep 2004 05:32:22 -0000	1.1.1.1
+++ svtools/source/config/languageoptions.cxx	17 Sep 2004 05:15:38 -0000
@@ -181,14 +181,14 @@
 	return m_pCTLOptions->IsCTLFontEnabled();
 }
 //------------------------------------------------------------------------------
-void SvtLanguageOptions::SetCTLSequenceChecking( sal_Bool _bEnabled )
+void SvtLanguageOptions::SetCTLSequenceChecking( SequenceCheck _eSequence )
 {
-    m_pCTLOptions->SetCTLSequenceChecking( _bEnabled );
+    m_pCTLOptions->SetCTLSequenceChecking( (SvtCTLOptions::SequenceCheck)_eSequence );
 }
 //------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsCTLSequenceChecking() const
+SvtLanguageOptions::SequenceCheck SvtLanguageOptions::GetCTLSequenceChecking() const
 {
-    return m_pCTLOptions->IsCTLSequenceChecking();
+    return (SvtLanguageOptions::SequenceCheck)m_pCTLOptions->GetCTLSequenceChecking();
 }
 //------------------------------------------------------------------------------
 sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const
Index: svtools/source/misc/lingucfg.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svtools/source/misc/lingucfg.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 lingucfg.cxx
--- svtools/source/misc/lingucfg.cxx	15 Sep 2004 05:32:27 -0000	1.1.1.1
+++ svtools/source/misc/lingucfg.cxx	17 Sep 2004 05:15:41 -0000
@@ -168,7 +168,7 @@
     nDefaultLanguage = LANGUAGE_ENGLISH_US;
 
 	nDefaultLanguage_CJK = LANGUAGE_NONE;
-	nDefaultLanguage_CTL = LANGUAGE_NONE;
+	nDefaultLanguage_CTL = LANGUAGE_THAI;
 
 	// general options
 	bIsGermanPreReform		= FALSE;
Index: svx/inc/optctl.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/inc/optctl.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 optctl.hxx
--- svx/inc/optctl.hxx	15 Sep 2004 05:29:07 -0000	1.1.1.1
+++ svx/inc/optctl.hxx	17 Sep 2004 05:15:44 -0000
@@ -80,7 +80,9 @@
 {
 private:
 	FixedLine			m_aSequenceCheckingFL;
-	CheckBox			m_aSequenceCheckingCB;
+	RadioButton			m_aNoSequenceCheckingRB;
+	RadioButton			m_aSequenceCheckingRB;
+	RadioButton			m_aAutoCorrectRB;
 
 	FixedLine			m_aCursorControlFL;
 	FixedText			m_aMovementFT;
Index: svx/inc/svxacorr.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/inc/svxacorr.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 svxacorr.hxx
--- svx/inc/svxacorr.hxx	15 Sep 2004 05:29:08 -0000	1.1.1.1
+++ svx/inc/svxacorr.hxx	17 Sep 2004 05:15:44 -0000
@@ -430,4 +430,25 @@
 };
 
 
+// Thai Auto correct
+enum 	{ 
+	NON_COMBINABLE 	= 0, 
+	BASE ,
+	LOWER_VOWEL ,
+	UPPER_VOWEL ,
+	TONE ,
+	SARA_AM ,
+	NIKHAHIT_THANTHAKHAT
+	};
+
+BOOL th_isconsnt(sal_Unicode c);
+BOOL th_isuppervowel(sal_Unicode c);
+BOOL th_ismidvowel(sal_Unicode c);
+BOOL th_islowervowel(sal_Unicode c);
+BOOL th_istone(sal_Unicode c);
+int CombiningClass(sal_Unicode c);
+int IsCombiningChar(sal_Unicode c);
+int MutexGroup(int combClass);
+static void AutoNormalize( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nInsPos, sal_Unicode cChar);
+
 #endif
Index: svx/source/editeng/editeng.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/editeng/editeng.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 editeng.cxx
--- svx/source/editeng/editeng.cxx	15 Sep 2004 05:29:12 -0000	1.1.1.1
+++ svx/source/editeng/editeng.cxx	17 Sep 2004 05:15:48 -0000
@@ -1082,7 +1082,7 @@
 					if ( ( pImpEditEngine->GetStatus().DoAutoCorrect() ) &&
 						 (  ( nCharCode == ' ' ) || ( nCharCode == '*' ) ||
 						 	( nCharCode == '\"' ) || ( nCharCode == '\'' ) ||
-							( nCharCode == '_' )  ) )
+							( nCharCode == '_' ) || IsCombiningChar(nCharCode)  ) )
 					{
 						aCurSel = pImpEditEngine->AutoCorrect( aCurSel, nCharCode, !pEditView->IsInsertMode() );
 					}
@@ -1090,6 +1090,10 @@
 					{
 						aCurSel = pImpEditEngine->InsertText( (const EditSelection&)aCurSel, nCharCode, !pEditView->IsInsertMode() );
 					}
+					
+					// Check input sequence
+					aCurSel = pImpEditEngine->InputSequenceChecker( aCurSel, nCharCode );
+					
 					// AutoComplete ???
 					if ( pImpEditEngine->GetStatus().DoAutoComplete() && ( nCharCode != ' ' ) )
 					{
Index: svx/source/editeng/impedit.hxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/editeng/impedit.hxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 impedit.hxx
--- svx/source/editeng/impedit.hxx	15 Sep 2004 05:29:12 -0000	1.1.1.1
+++ svx/source/editeng/impedit.hxx	17 Sep 2004 05:15:48 -0000
@@ -107,6 +107,10 @@
 #include <com/sun/star/i18n/XBreakIterator.hpp>
 #endif
 
+#ifndef _COM_SUN_STAR_I18N_XINPUTSEQUENCECHECKER_HPP_
+#include <com/sun/star/i18n/XInputSequenceChecker.hpp>
+#endif
+
 #ifndef _COM_SUN_STAR_I18N_CHARACTERITERATORMODE_HPP_
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #endif
@@ -501,6 +505,7 @@
 		::com::sun::star::linguistic2::XHyphenator >	xHyphenator;
 	SpellInfo*			pSpellInfo;
 	::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > xBI;
+	::com::sun::star::uno::Reference < ::com::sun::star::i18n::XInputSequenceChecker > xISC;
 
 	XubString			aAutoCompleteText;
 
@@ -710,6 +715,7 @@
 	void				SetValidPaperSize( const Size& rSz );
 
 	::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator();
+	::com::sun::star::uno::Reference < ::com::sun::star::i18n::XInputSequenceChecker > ImplGetInputSequenceChecker();
 
 
 
@@ -791,6 +797,7 @@
 	EditPaM			InsertText( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite );
 	EditPaM			InsertText( EditSelection aCurEditSelection, const String& rStr );
 	EditPaM			AutoCorrect( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite );
+	EditPaM 		InputSequenceChecker( const EditSelection& rCurSel, xub_Unicode c );
 	EditPaM			DeleteLeftOrRight( const EditSelection& rEditSelection, BYTE nMode, BYTE nDelMode = DELMODE_SIMPLE );
 	EditPaM			InsertParaBreak( EditSelection aEditSelection );
 	EditPaM			InsertLineBreak( EditSelection aEditSelection );
Index: svx/source/editeng/impedit2.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/editeng/impedit2.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 impedit2.cxx
--- svx/source/editeng/impedit2.cxx	15 Sep 2004 05:29:12 -0000	1.1.1.1
+++ svx/source/editeng/impedit2.cxx	17 Sep 2004 05:15:49 -0000
@@ -115,6 +115,10 @@
 #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
 #endif
 
+#ifndef _COM_SUN_STAR_I18N_XINPUTSEQUENCECHECKMODE_HPP_
+#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
+#endif
+
 #ifndef _COM_SUN_STAR_I18N_WORDTYPE_HPP_
 #include <com/sun/star/i18n/WordType.hpp>
 #endif
@@ -2351,6 +2355,38 @@
 		aSel.Max().SetIndex( aAuto.GetCursor() );
 	}
 #endif // !SVX_LIGHT
+	return aSel.Max();
+}
+
+EditPaM ImpEditEngine::InputSequenceChecker( const EditSelection& rCurSel, xub_Unicode c )
+{
+	EditSelection aSel( rCurSel );
+	if ( aSel.HasRange() )
+		aSel = ImpDeleteSelection( rCurSel );
+		
+	ContentNode* pNode = aSel.Max().GetNode();
+	USHORT nIndex = aSel.Max().GetIndex();
+	EdtAutoCorrDoc aAuto( this, pNode, nIndex, c );
+
+	if( !pCTLOptions )
+		pCTLOptions = new SvtCTLOptions;
+	
+	uno::Reference < i18n::XInputSequenceChecker > xCheck = ImplGetInputSequenceChecker();
+	uno::Reference < i18n::XBreakIterator > xBreak = ImplGetBreakIterator();
+
+	if ( pCTLOptions->IsCTLFontEnabled() && pCTLOptions->GetCTLSequenceChecking() == SvtCTLOptions::SEQUENCECHECK_USE && xCheck.is() && 		
+		::com::sun::star::i18n::ScriptType::COMPLEX == (USHORT)xBreak->getScriptType( *pNode, nIndex-1 ) && nIndex )
+	{
+		USHORT aIndex = nIndex - 1;
+		
+		// Check sequence check from wtt
+		if ( ! (USHORT)xCheck->checkInputSequence( *pNode, aIndex - 1, c, ::com::sun::star::i18n::InputSequenceCheckMode::STRICT ))
+		{
+			aAuto.Delete( nIndex - 1, nIndex );
+			aSel.Max().SetIndex( aAuto.GetCursor() );
+		}
+	}
+
 	return aSel.Max();
 }
 
Index: svx/source/editeng/impedit3.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/editeng/impedit3.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 impedit3.cxx
--- svx/source/editeng/impedit3.cxx	15 Sep 2004 05:29:12 -0000	1.1.1.1
+++ svx/source/editeng/impedit3.cxx	17 Sep 2004 05:15:49 -0000
@@ -3936,6 +3936,21 @@
 	return xBI;
 }
 
+Reference < i18n::XInputSequenceChecker > ImpEditEngine::ImplGetInputSequenceChecker()
+{
+	if ( !xISC.is() )
+	{
+		Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+		Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
+		if ( xI.is() )
+		{
+			Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XInputSequenceChecker >*)0) );
+			x >>= xISC;
+		}
+	}
+	return xISC;
+}
+
 Color ImpEditEngine::GetAutoColor() const
 {
 	Color aColor = const_cast<ImpEditEngine*>(this)->GetColorConfig().GetColorValue( svtools::FONTCOLOR ).nColor;
Index: svx/source/editeng/svxacorr.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/editeng/svxacorr.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 svxacorr.cxx
--- svx/source/editeng/svxacorr.cxx	15 Sep 2004 05:29:12 -0000	1.1.1.1
+++ svx/source/editeng/svxacorr.cxx	17 Sep 2004 05:15:49 -0000
@@ -111,6 +111,9 @@
 #ifndef SVTOOLS_URIHELPER_HXX
 #include <svtools/urihelper.hxx>
 #endif
+#ifndef SVTOOLS_CTLOPTIONS_HXX
+#include <svtools/ctloptions.hxx>
+#endif
 #ifndef _UNOTOOLS_CHARCLASS_HXX
 #include <unotools/charclass.hxx>
 #endif
@@ -1213,6 +1216,7 @@
 									xub_StrLen nInsPos, sal_Unicode cChar,
 									BOOL bInsert )
 {
+	SvtCTLOptions* rCTLOptions = new SvtCTLOptions();
 	ULONG nRet = 0;
 	do{		                            // only for middle check loop !!
 		if( cChar )
@@ -1245,7 +1249,13 @@
 				nRet = bSingle ? ChgSglQuotes : ChgQuotes;
 				break;
 			}
-
+			if (rCTLOptions->GetCTLSequenceChecking() == SvtCTLOptions::SEQUENCECHECK_AUTOCORRECT && 
+				CombiningClass( cChar ) > BASE) { // bInsert is ignored for CombiningChar
+				if ( nInsPos > 0) { // ingChar at begin -> ignore
+					AutoNormalize( rDoc, rTxt, nInsPos, cChar );
+				}
+ 				break;				
+			}
 			if( bInsert )
 				rDoc.Insert( nInsPos, cChar );
 			else
@@ -3063,3 +3073,179 @@
 	}
 	return bRet;
 }
+
+
+// Thai Auto correct
+BOOL th_isconsnt(sal_Unicode c)
+{
+	BOOL isconsnt = FALSE;
+	if ( c>=0xe01 && c<=0xe2f && c!= 0xe24 )
+		isconsnt = TRUE;
+	else
+		isconsnt = FALSE;
+	return isconsnt;
+}
+
+BOOL th_isuppervowel(sal_Unicode c)
+{
+	BOOL isup = FALSE;
+	switch (c) {
+	case 0xe31 :
+	case 0xe34 :
+	case 0xe35 :
+	case 0xe36 :
+	case 0xe37 :
+	case 0xe47 :
+	case 0xe4e :
+		isup = TRUE;
+		break;
+	default :			
+		isup = FALSE;
+	}
+	return isup;
+}
+
+BOOL th_ismidvowel(sal_Unicode c)
+{
+	BOOL ismid = FALSE;
+	switch (c) {
+	case 0xe30 :
+	case 0xe32 :
+	case 0xe33 :
+	case 0xe40 :
+	case 0xe41 :
+	case 0xe42 :
+	case 0xe43 :
+	case 0xe44 :
+	case 0xe45 :
+		ismid = TRUE;
+		break;
+	default :			
+		ismid = FALSE;
+	}
+	return ismid;
+}
+
+BOOL th_islowervowel(sal_Unicode c)
+{
+	BOOL islow = FALSE;
+	switch (c) {
+	case 0xe38 :
+	case 0xe39 :
+		islow = TRUE;
+		break;
+	default :			
+		islow = FALSE;
+	}
+	return islow;
+}
+
+BOOL th_istone(sal_Unicode c)
+{
+	BOOL istone = FALSE;
+	switch (c) {
+	case 0xe48 :
+	case 0xe49 :
+	case 0xe4a :
+	case 0xe4b :
+		istone = TRUE;
+		break;
+	default :			
+		istone = FALSE;
+	}
+	return istone;
+}
+
+int CombiningClass(sal_Unicode c)
+{
+        if ( (th_ismidvowel(c) && c != 0xe33) || c == 0xe24 || c == 0xe45 ) 
+		return NON_COMBINABLE;
+        if ( th_isconsnt(c) ) // except TH_RU and TH_LU
+		return BASE; 
+        if ( th_islowervowel(c) ) 
+		return LOWER_VOWEL;
+        if ( th_isuppervowel(c) ) 
+		return UPPER_VOWEL;
+        if ( th_istone(c) ) 
+		return TONE;
+        if ( c==0xe33 ) 
+		return SARA_AM;
+        if ( c==0xe4c || c==0xe4d ) 
+		return NIKHAHIT_THANTHAKHAT;
+        return NON_COMBINABLE; // assert(false)
+}
+
+int IsCombiningChar(sal_Unicode c)
+{
+        return CombiningClass(c) > BASE;
+}
+
+int MutexGroup(int combClass)
+{
+        switch(combClass) {
+                case NON_COMBINABLE : return 0;
+                case BASE : return 0;
+                case LOWER_VOWEL : return 1;
+                case UPPER_VOWEL : return 1;
+                case TONE : return 2;
+                case SARA_AM : return 1;
+                case NIKHAHIT_THANTHAKHAT : return 2;
+        }
+        return 0; // assert(false);
+}
+
+static void AutoNormalize( SvxAutoCorrDoc& rDoc, const String& rTxt, xub_StrLen nInsPos, sal_Unicode cChar)
+{
+	int classChar = CombiningClass(cChar);
+	if (classChar <= BASE) { rDoc.Insert( nInsPos, cChar ); return; } // impossible, cChar must be combining
+	if (nInsPos == 0) return; // impossible, cChar is combining at begin
+
+	sal_Unicode cPrev = rTxt.GetChar(nInsPos-1);
+	int classPrev = CombiningClass(cPrev);
+	if (classPrev == NON_COMBINABLE) return; // non-combinable + combining -> ignore
+	if (classPrev == BASE) { rDoc.Insert( nInsPos, cChar ); return; } // base + combining -> append
+	// else two consecutive combining chars, sort by Combining class and check for mutual-exclusion
+	if (nInsPos == 1) return; // impossible, cPrev is combining already at begin, don't make the matter worse
+
+	sal_Unicode cPrev2 = rTxt.GetChar(nInsPos-2);
+	int classPrev2 = CombiningClass(cPrev2);
+	int groupChar = MutexGroup(classChar);
+	int groupPrev = MutexGroup(classPrev);
+	int groupPrev2 = MutexGroup(classPrev2);
+	
+	if (groupPrev == groupChar && groupChar != 0) { // (cPrev,cChar) mutually-exclude each other
+		if (cPrev != cChar) { // cChar replace cPrev
+			if (classPrev2 <= classChar) { // (cPrev2,cChra) right order
+				rDoc.Replace( nInsPos-1, cChar);
+			} else {
+				rDoc.Delete( nInsPos-1, nInsPos ); // delete cPrev
+				rDoc.Insert( nInsPos-2, cChar ); // insert cChar before cPrev2
+			}
+		} // else repeated mutex combining -> ignore
+		return;
+	}
+
+	if (classPrev <= classChar) { // (cPrev,cChar) right order
+		rDoc.Insert( nInsPos, cChar ); // -> append
+		if (groupPrev2 == groupChar && groupChar != 0) { // cPrev2 and cChar is mutex
+			rDoc.Delete( nInsPos-2, nInsPos-1 ); // -> delete cPrev2
+		}
+		return; // that's it for Thai (cPrev3 must be base)
+	} // else classChar < classPrev, wrong order -> swap
+
+	if (classPrev2 <= classChar) { // (cPrev2,cChar,cPrev) right order, swap cChar with cPrev
+		if (groupPrev2 == groupChar && groupChar != 0) { // cPrev2 and cChar is mutex
+			rDoc.Replace( nInsPos-2, cChar);
+		} else {
+			rDoc.Insert( nInsPos-1, cChar ); // impossible for Thai, three combining in a row
+		}
+		return; // that's it for Thai (cPrev3 must be base)
+	} // else classChar < classPrev2, must be (cChar,cPrev2,cPrev)
+	
+	if (groupPrev2 == groupChar && groupChar != 0) { // cPrev2 and cChar is mutex
+		rDoc.Replace( nInsPos-2, cChar);
+	} else {
+		rDoc.Insert( nInsPos-2, cChar ); // impossible for Thai, three combining in a row
+	}
+}
+
Index: svx/source/items/textitem.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/items/textitem.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 textitem.cxx
--- svx/source/items/textitem.cxx	15 Sep 2004 05:29:13 -0000	1.1.1.1
+++ svx/source/items/textitem.cxx	17 Sep 2004 05:15:50 -0000
@@ -3713,7 +3713,7 @@
 	{
 		{  DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US },
 		{  DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US },
-		{  DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA }
+		{  DEFAULTFONT_CTL_TEXT, LANGUAGE_THAI }
 	};
 
 	SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex };
Index: svx/source/options/optctl.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/options/optctl.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 optctl.cxx
--- svx/source/options/optctl.cxx	15 Sep 2004 05:29:14 -0000	1.1.1.1
+++ svx/source/options/optctl.cxx	17 Sep 2004 05:15:51 -0000
@@ -84,7 +84,10 @@
 	SfxTabPage( pParent, ResId( RID_SVXPAGE_OPTIONS_CTL, DIALOG_MGR() ), rSet ),
 
 	m_aSequenceCheckingFL	( this, ResId( FL_SEQUENCECHECKING ) ),
-	m_aSequenceCheckingCB	( this, ResId( CB_SEQUENCECHECKING ) ),
+	m_aNoSequenceCheckingRB		( this, ResId( RB_NOSEQUENCECHECKING ) ),
+	m_aSequenceCheckingRB		( this, ResId( RB_SEQUENCECHECKING ) ),
+	m_aAutoCorrectRB		( this, ResId( RB_AUTOCORRECT ) ),
+	
 	m_aCursorControlFL		( this, ResId( FL_CURSORCONTROL ) ),
 	m_aMovementFT			( this, ResId( FT_MOVEMENT ) ),
 	m_aMovementLogicalRB	( this, ResId( RB_MOVEMENT_LOGICAL ) ),
@@ -114,12 +117,20 @@
 	SvtCTLOptions aCTLOptions;
 
 	// Sequence checking
-	BOOL bChecked = m_aSequenceCheckingCB.IsChecked();
-	if ( bChecked != m_aSequenceCheckingCB.GetSavedValue() )
-    {
-        aCTLOptions.SetCTLSequenceChecking( bChecked );
+	BOOL bNoSequenceChecked = m_aNoSequenceCheckingRB.IsChecked();
+	BOOL bSequenceChecked = m_aSequenceCheckingRB.IsChecked();
+	BOOL bAutoCorrectChecked = m_aAutoCorrectRB.IsChecked();
+	if ( bNoSequenceChecked != m_aNoSequenceCheckingRB.GetSavedValue() ||
+		 bSequenceChecked != m_aSequenceCheckingRB.GetSavedValue() ||
+		 bAutoCorrectChecked != m_aAutoCorrectRB.GetSavedValue() )
+    	{
+		SvtCTLOptions::SequenceCheck eSequence =
+			bNoSequenceChecked ? SvtCTLOptions::SEQUENCECHECK_NONE : 
+			(bSequenceChecked ? SvtCTLOptions::SEQUENCECHECK_USE : SvtCTLOptions::SEQUENCECHECK_AUTOCORRECT);
+        aCTLOptions.SetCTLSequenceChecking( eSequence );
         bModified = TRUE;
-    }
+	}
+
 
 	BOOL bLogicalChecked = m_aMovementLogicalRB.IsChecked();
 	BOOL bVisualChecked = m_aMovementVisualRB.IsChecked();
@@ -146,7 +157,23 @@
 {
 	SvtCTLOptions aCTLOptions;
 
-	m_aSequenceCheckingCB.Check( aCTLOptions.IsCTLSequenceChecking() );
+	SvtCTLOptions::SequenceCheck eSequence = aCTLOptions.GetCTLSequenceChecking();
+	switch ( eSequence )
+	{
+		case SvtCTLOptions::SEQUENCECHECK_NONE :
+			m_aNoSequenceCheckingRB.Check();
+			break;
+
+		case SvtCTLOptions::SEQUENCECHECK_USE :
+			m_aSequenceCheckingRB.Check();
+			break;
+			
+		case SvtCTLOptions::SEQUENCECHECK_AUTOCORRECT :
+			m_aAutoCorrectRB.Check();
+			break;
+		default:
+			DBG_ERRORFILE( "SvxCTLOptionsPage::Reset(): invalid sequence check enum" );
+	}	
 
 	SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement();
 	switch ( eMovement )
@@ -167,7 +194,9 @@
 	DBG_ASSERT( nPos < m_aNumeralsLB.GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" );
 	m_aNumeralsLB.SelectEntryPos( nPos );
 
-	m_aSequenceCheckingCB.SaveValue();
+	m_aNoSequenceCheckingRB.SaveValue();
+	m_aSequenceCheckingRB.SaveValue();
+	m_aAutoCorrectRB.SaveValue();
 	m_aMovementLogicalRB.SaveValue();
 	m_aMovementVisualRB.SaveValue();
 	m_aNumeralsLB.SaveValue();
Index: svx/source/options/optctl.hrc
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/options/optctl.hrc,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 optctl.hrc
--- svx/source/options/optctl.hrc	15 Sep 2004 05:29:14 -0000	1.1.1.1
+++ svx/source/options/optctl.hrc	17 Sep 2004 05:15:51 -0000
@@ -62,7 +62,9 @@
 #define _SVX_OPTCTL_HRC
 
 #define FL_SEQUENCECHECKING		10
-#define CB_SEQUENCECHECKING		11
+#define RB_NOSEQUENCECHECKING		11 
+#define RB_SEQUENCECHECKING		12
+#define RB_AUTOCORRECT			13
 
 #define FL_CURSORCONTROL		20
 #define FT_MOVEMENT				21
Index: svx/source/options/optctl.src
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/svx/source/options/optctl.src,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 optctl.src
--- svx/source/options/optctl.src	15 Sep 2004 05:29:14 -0000	1.1.1.1
+++ svx/source/options/optctl.src	17 Sep 2004 05:15:51 -0000
@@ -119,9 +119,17 @@
 		Text[ lithuanian ] = "EiliÅ¡kumo tikrinimas";
 		Text[ galician ] = "Sequence checking";
 	};
-	CheckBox CB_SEQUENCECHECKING
-	{
-		Pos = MAP_APPFONT ( 12, 14 ) ;
+        RadioButton RB_NOSEQUENCECHECKING
+        {
+                Pos = MAP_APPFONT ( 12, 14 ) ;
+        Size = MAP_APPFONT ( 69 , 10 ) ;
+        Text = "None";
+        Text[ english_us ] = "None";
+                Text[ thai ] = "None";
+        };
+        RadioButton RB_SEQUENCECHECKING
+        {
+		Pos = MAP_APPFONT ( 12, 27 ) ;
         Size = MAP_APPFONT ( 236 , 10 ) ;
         Text = "Se~quenzüberprüfung anwenden" ;
     	Text[ english_us ] = "Use se~quence checking";
@@ -164,9 +172,17 @@
 		Text[ lithuanian ] = "Naudoti ~eiliÅ¡kumo tikrinimï¿½?";
 		Text[ galician ] = "Use se~quence checking";
 	};
+        RadioButton RB_AUTOCORRECT
+        {
+                Pos = MAP_APPFONT ( 12, 40 ) ;
+        Size = MAP_APPFONT ( 69 , 10 ) ;
+        Text = "Use auto correct";
+        Text[ english_us ] = "Use auto correct";
+                Text[ thai ] = "Use auto correct";
+	};
 	FixedLine FL_CURSORCONTROL
 	{
-		Pos = MAP_APPFONT ( 6, 27 ) ;
+		Pos = MAP_APPFONT ( 6, 53 ) ;
         Size = MAP_APPFONT ( 248 , 8 ) ;
         Text = "Cursorkontrolle" ;
     	Text[ english_us ] = "Cursor control";
@@ -211,7 +227,7 @@
 	};
 	FixedText FT_MOVEMENT
 	{
-		Pos = MAP_APPFONT ( 12, 38 ) ;
+		Pos = MAP_APPFONT ( 12, 64 ) ;
         Size = MAP_APPFONT ( 90 , 8 ) ;
         Text = "Bewegung" ;
     	Text[ english_us ] = "Movement";
@@ -256,7 +272,7 @@
 	};
 	RadioButton RB_MOVEMENT_LOGICAL
 	{
-		Pos = MAP_APPFONT ( 105, 38 ) ;
+		Pos = MAP_APPFONT ( 105, 64 ) ;
         Size = MAP_APPFONT ( 69 , 10 ) ;
         Text = "Lo~gisch" ;
     	Text[ english_us ] = "Lo~gical";
@@ -301,7 +317,7 @@
 	};
 	RadioButton RB_MOVEMENT_VISUAL
 	{
-		Pos = MAP_APPFONT ( 177, 38 ) ;
+		Pos = MAP_APPFONT ( 177, 64) ;
         Size = MAP_APPFONT ( 69 , 10 ) ;
         Text = "~Visuell" ;
     	Text[ english_us ] = "~Visual";
@@ -346,7 +362,7 @@
 	};
 	FixedLine FL_GENERAL
 	{
-		Pos = MAP_APPFONT ( 6, 51 ) ;
+		Pos = MAP_APPFONT ( 6, 77 ) ;
         Size = MAP_APPFONT ( 248 , 8 ) ;
         Text = "Allgemeine Optionen" ;
     	Text[ english_us ] = "General options";
@@ -392,7 +408,7 @@
 	};
 	FixedText FT_NUMERALS
 	{
-		Pos = MAP_APPFONT ( 12, 64 ) ;
+		Pos = MAP_APPFONT ( 12, 90 ) ;
         Size = MAP_APPFONT ( 90 , 8 ) ;
         Text = "~Ziffern" ;
     	Text[ english_us ] = "~Numerals";
@@ -437,7 +453,7 @@
 	};
 	ListBox LB_NUMERALS
 	{
-		Pos = MAP_APPFONT ( 105, 62 ) ;
+		Pos = MAP_APPFONT ( 105, 88 ) ;
         Size = MAP_APPFONT ( 69 , 8 ) ;
         DropDown = TRUE ;
 		Border = TRUE ;
Index: sw/source/core/txtnode/ndtxt.cxx
===================================================================
RCS file: /cvsroot/thaioo/OpenOffice_Test/sw/source/core/txtnode/ndtxt.cxx,v
retrieving revision 1.1.1.1
diff -a -u -r1.1.1.1 ndtxt.cxx
--- sw/source/core/txtnode/ndtxt.cxx	15 Sep 2004 05:31:07 -0000	1.1.1.1
+++ sw/source/core/txtnode/ndtxt.cxx	17 Sep 2004 05:15:56 -0000
@@ -1640,9 +1640,11 @@
     // We check only buffers which contain less than MAX_SEQUENCE_CHECK_LEN
     // characters. This is for performance reasons, because a "copy and paste"
     // can give us a really big input string.
+    // **** check each position in string for newline. *****
     SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
     if ( rCTLOptions.IsCTLFontEnabled() &&
-         rCTLOptions.IsCTLSequenceChecking() && aPos &&
+         (rCTLOptions.GetCTLSequenceChecking() == SvtCTLOptions::SEQUENCECHECK_USE || 
+         rCTLOptions.GetCTLSequenceChecking() == SvtCTLOptions::SEQUENCECHECK_AUTOCORRECT) && /* aPos && */
          rStr.Len() < MAX_SEQUENCE_CHECK_LEN && pBreakIt->xBreak.is() &&
          ::com::sun::star::i18n::ScriptType::COMPLEX ==
          pBreakIt->xBreak->getScriptType( rStr, 0 ) )
@@ -1660,9 +1662,10 @@
             while ( nI < rStr.Len() )
             {
                 cChar = rStr.GetChar( nI++ );
+		// use STRICT check
                 if ( pCheckIt->xCheck->checkInputSequence(
                         aText, nTmpPos - 1, cChar,
-                        ::com::sun::star::i18n::InputSequenceCheckMode::BASIC ) )
+                        ::com::sun::star::i18n::InputSequenceCheckMode::STRICT ) )
                 {
                     // character can be inserted
                     aText.Insert( cChar, nTmpPos++ );
