--- officecfg/registry/schema/org/openoffice/Office/Calc.xcs	2005-07-24 17:09:34.000000000 +0530
+++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs	2005-09-19 22:38:05.000000000 +0530
@@ -1041,6 +1041,72 @@
 				<value>NULL</value>
 			</prop>
 		</group>
+		<group oor:name="Dialogs">
+			<info>
+				<desc>Contains the dialogs settings.</desc>
+			</info>
+			<group oor:name="CSVImport">
+				<info>
+					<desc>Contains setting for Text CSV Import</desc>
+				</info>
+				<prop oor:name="MergeDelimiters" oor:type="xs:boolean">
+					<info>
+						<author>muthusuba</author>
+						<desc>Merge Delimiter check box status</desc>
+						<label>MergeDelimiters</label>
+					</info>
+					<value>false</value>
+				</prop>
+				<prop oor:name="Separators" oor:type="xs:string">
+					<info>
+						<author>muthusuba</author>
+						<desc>List of Separators - as a String</desc>
+						<label>Separators</label>
+					</info>
+					<value>;	</value>
+				</prop>
+				<prop oor:name="TextSeparators" oor:type="xs:string">
+					<info>
+						<author>muthusuba</author>
+						<desc>Text Separators</desc>
+						<label>TextSeparators</label>
+					</info>
+					<value>"</value>
+				</prop>
+				<prop oor:name="FixedWidth" oor:type="xs:boolean">
+					<info>
+						<author>muthusuba</author>
+						<desc>Fixed width</desc>
+						<label>FixedWidth</label>
+					</info>
+					<value>false</value>
+				</prop>
+				<prop oor:name="FromRow" oor:type="xs:int">
+					<info>
+						<author>muthusuba</author>
+						<desc>From Row</desc>
+						<label>FromRow</label>
+					</info>
+					<value>1</value>
+				</prop>
+				<prop oor:name="CharSet" oor:type="xs:int">
+					<info>
+						<author>muthusuba</author>
+						<desc>Char Set</desc>
+						<label>CharSet</label>
+					</info>
+					<value>-1</value>
+				</prop>
+				<prop oor:name="FixedWidthList" oor:type="xs:string">
+					<info>
+						<author>muthusuba</author>
+						<desc>Fixed Width List of separators</desc>
+						<label>FixedWidthList</label>
+					</info>
+					<value></value>
+				</prop>
+			</group>
+		</group>
 		<group oor:name="Calculate">
 			<info>
 				<desc>Contains settings that affect cell calculation.</desc>
--- sc/source/ui/dbgui/scuiasciiopt.cxx	2005-07-24 17:46:45.000000000 +0530
+++ sc/source/ui/dbgui/scuiasciiopt.cxx	2005-09-07 23:00:03.494705192 +0530
@@ -79,6 +79,12 @@
 // ause
 #include "editutil.hxx"
 
+#include <optutil.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "miscuno.hxx"
+
+
 //! TODO make dynamic
 #ifdef WIN
 const SCSIZE ASCIIDLG_MAXROWS                = 10000;
@@ -86,6 +92,20 @@ const SCSIZE ASCIIDLG_MAXROWS           
 const SCSIZE ASCIIDLG_MAXROWS                = MAXROWCOUNT;
 #endif
 
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+// Defines - CSV Import Preserve Options
+#define FIXED_WIDTH			"FixedWidth"
+#define FROM_ROW			"FromRow"
+#define CHAR_SET			"CharSet"
+#define SEPARATORS			"Separators"
+#define TEXT_SEPARATORS		"TextSeparators"
+#define MERGE_DELIMITERS	"MergeDelimiters"
+#define SEP_PATH			"Office.Calc/Dialogs/CSVImport"
+
+
 // ============================================================================
 
 void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
@@ -133,6 +153,70 @@ sal_Unicode lcl_CharFromCombo( ComboBox&
 	return c;
 }
 
+static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, 
+							 bool &bMergeDelimiters, bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet )
+{
+	Sequence<Any>aValues;
+	const Any *pProperties;
+	Sequence<OUString> aNames(6);
+	OUString* pNames = aNames.getArray();
+	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+
+	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
+	pNames[1] = OUString::createFromAscii( SEPARATORS );
+	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
+	pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
+	pNames[4] = OUString::createFromAscii( FROM_ROW );
+	pNames[5] = OUString::createFromAscii( CHAR_SET );
+	aValues = aItem.GetProperties( aNames );
+	pProperties = aValues.getConstArray();
+	if( pProperties[1].hasValue() )
+		pProperties[1] >>= sFieldSeparators;
+
+	if( pProperties[2].hasValue() )
+		pProperties[2] >>= sTextSeparators;
+
+	if( pProperties[0].hasValue() )
+		bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] );
+
+	if( pProperties[3].hasValue() )
+		bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] );
+
+	if( pProperties[4].hasValue() )
+		pProperties[4] >>= nFromRow;
+
+	if( pProperties[5].hasValue() )
+		pProperties[5] >>= nCharSet;
+}
+
+static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, 
+							 bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
+{
+	OUString sFieldSeparators = OUString( maSeparators );
+	OUString sTextSeparators = OUString( maTxtSep );
+	Sequence<Any> aValues;
+	Any *pProperties;
+	Sequence<OUString> aNames(6);
+	OUString* pNames = aNames.getArray();
+	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+
+	pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS );
+	pNames[1] = OUString::createFromAscii( SEPARATORS );
+	pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS );
+	pNames[3] = OUString::createFromAscii( FIXED_WIDTH );
+	pNames[4] = OUString::createFromAscii( FROM_ROW );
+	pNames[5] = OUString::createFromAscii( CHAR_SET );
+	aValues = aItem.GetProperties( aNames );
+	pProperties = aValues.getArray();
+	pProperties[1] <<= sFieldSeparators;
+	pProperties[2] <<= sTextSeparators;
+	ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters );
+	ScUnoHelpFunctions::SetBoolInAny( pProperties[3], bFixedWidth );
+	pProperties[4] <<= nFromRow;
+	pProperties[5] <<= nCharSet;
+
+	aItem.PutProperties(aNames, aValues);
+}
 
 // ----------------------------------------------------------------------------
 
@@ -190,16 +274,42 @@ ScImportAsciiDlg::ScImportAsciiDlg( Wind
 	aName += ']';
 	SetText( aName );
 
-	switch(cSep)
+
+	OUString sFieldSeparators;
+	OUString sTextSeparators;
+	bool bMergeDelimiters = false;
+	bool bFixedWidth = false;
+	sal_Int32 nFromRow = 1;
+	sal_Int32 nCharSet = -1;
+	load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, bFixedWidth, nFromRow, nCharSet);
+	maFieldSeparators = String(sFieldSeparators);
+
+	if( bMergeDelimiters )
+		aCkbAsOnce.Check();
+	if( bFixedWidth )
+		aRbFixed.Check();
+	if( nFromRow != 1 )
+		aNfRow.SetValue( nFromRow );
+
+	ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252);
+	const sal_Char *aSep = bString.GetBuffer();
+	int i = 0;
+	int len = maFieldSeparators.Len();
+	for(i=0;i<len;i++)
 	{
-        case '\t':  aCkbTab.Check();        break;
-        case ';':   aCkbSemicolon.Check();  break;
-        case ',':   aCkbComma.Check();      break;
-        case ' ':   aCkbSpace.Check();      break;
-        default:
-            aCkbOther.Check();
-            aEdOther.SetText( cSep );
+		switch( aSep[i] )
+		{
+			case '\t':  aCkbTab.Check();        break;
+	        case ';':   aCkbSemicolon.Check();  break;
+    	    case ',':   aCkbComma.Check();      break;
+        	case ' ':   aCkbSpace.Check();      break;
+	        default:
+    	        aCkbOther.Check();
+        	    aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) );
+		}
 	}
+	
+	// Get Separators from the dialog
     maFieldSeparators = GetSeparators();
 
 	BOOL bPreselectUnicode = FALSE;
@@ -238,6 +348,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Wind
 
     // *** Separator characters ***
     lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
+	aCbTextSep.SetText( sTextSeparators );
 
     Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
     aCbTextSep.SetSelectHdl( aSeparatorHdl );
@@ -261,6 +372,9 @@ ScImportAsciiDlg::ScImportAsciiDlg( Wind
     SetSelectedCharSet();
 	aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
 
+	if( nCharSet >= 0 )
+		aLbCharSet.SelectEntryPos( nCharSet );
+
     // *** column type ListBox ***
 	xub_StrLen nCount = aColumnUser.GetTokenCount();
 	for (xub_StrLen i=0; i<nCount; i++)
@@ -289,6 +403,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Wind
 
 ScImportAsciiDlg::~ScImportAsciiDlg()
 {
+	save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), 
+					 aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
 	delete[] mpRowPosArray;
 }
 
--- sc/source/ui/inc/csvruler.hxx	2005-09-18 22:48:04.000000000 +0530
+++ sc/source/ui/inc/csvruler.hxx	2005-09-18 22:55:37.000000000 +0530
@@ -112,6 +112,7 @@ private:
     // ------------------------------------------------------------------------
 public:
     explicit                    ScCsvRuler( ScCsvControl& rParent );
+								~ScCsvRuler();
 
     // common ruler handling --------------------------------------------------
 public:
--- sc/source/ui/dbgui/csvruler.cxx	2005-09-18 22:14:42.000000000 +0530
+++ sc/source/ui/dbgui/csvruler.cxx	2005-09-19 22:04:55.074689184 +0530
@@ -75,7 +75,75 @@
 #endif
 
 
+#include <optutil.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "miscuno.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+
+
 // ============================================================================
+#define SEP_PATH			"Office.Calc/Dialogs/CSVImport"
+#define FIXED_WIDTH_LIST	"FixedWidthList"
+
+
+// ============================================================================
+
+static void load_FixedWidthList(ScCsvSplits &aSplits)
+{
+	String sSplits;
+	OUString sFixedWidthLists;
+
+	Sequence<Any>aValues;
+	const Any *pProperties;
+	Sequence<OUString> aNames(1);
+	OUString* pNames = aNames.getArray();
+	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+
+	pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
+	aValues = aItem.GetProperties( aNames );
+	pProperties = aValues.getConstArray();
+
+	if( pProperties[0].hasValue() )
+	{
+		aSplits.Clear();
+		pProperties[0] >>= sFixedWidthLists;
+
+		sSplits = String( sFixedWidthLists );
+
+		// String ends with a semi-colon so there is no 'int' after the last one.
+		for(int i=0;i<sSplits.GetTokenCount()-1;i++ )
+			aSplits.Insert( sSplits.GetToken(i).ToInt32() );
+	}
+}
+static void save_FixedWidthList(ScCsvSplits aSplits)
+{
+	int i;
+	String sSplits;
+	// Create a semi-colon separated string to save the splits
+	for(i=0;i<aSplits.Count();i++)
+	{
+		sSplits.Append( String::CreateFromInt32( aSplits[i] ) );
+		sSplits.Append((char)';');
+	}
+
+	OUString sFixedWidthLists = OUString( sSplits );
+	Sequence<Any> aValues;
+	Any *pProperties;
+	Sequence<OUString> aNames(1);
+	OUString* pNames = aNames.getArray();
+	ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+
+	pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST );
+	aValues = aItem.GetProperties( aNames );
+	pProperties = aValues.getArray();
+	pProperties[0] <<= sFixedWidthLists;
+
+	aItem.PutProperties(aNames, aValues);
+}
 
 ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) :
     ScCsvControl( rParent ),
@@ -86,6 +154,13 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rP
     InitSizeData();
     maBackgrDev.SetFont( GetFont() );
     maRulerDev.SetFont( GetFont() );
+
+	load_FixedWidthList( maSplits );
+}
+
+ScCsvRuler::~ScCsvRuler()
+{
+	save_FixedWidthList( maSplits );
 }
 
 
