Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > cd8ce32c919af60229fca1d7f792c60e > files > 113

openoffice.org-3.2.0-12.35.fc13.src.rpm

diff -r fbee84f89f7d officecfg/registry/schema/org/openoffice/Office/Calc.xcs
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs	Thu Feb 18 15:33:38 2010 +0100
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs	Fri Feb 19 14:28:21 2010 +0100
@@ -1019,6 +1019,81 @@
 				<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="QuotedFieldAsText" oor:type="xs:boolean">
+                    <info>
+                        <author>kyoshida</author>
+                        <desc>If true, quoted field is always imported as text 
+                            with no exception.</desc>
+                        <label>QuotedFieldAsText</label>
+                    </info>
+                    <value>true</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>
diff -r fbee84f89f7d sc/inc/optutil.hxx
--- a/sc/inc/optutil.hxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/inc/optutil.hxx	Fri Feb 19 14:28:21 2010 +0100
@@ -33,6 +33,7 @@
 
 #include <unotools/configitem.hxx>
 #include <tools/link.hxx>
+#include "scdllapi.h"
 
 
 class ScOptionsUtil
@@ -44,13 +45,13 @@
 
 //	ConfigItem for classes that use items from several sub trees
 
-class ScLinkConfigItem : public utl::ConfigItem
+class SC_DLLPUBLIC ScLinkConfigItem : public utl::ConfigItem
 {
 	Link	aCommitLink;
 
 public:
-			ScLinkConfigItem( const rtl::OUString rSubTree );
-            ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode );
+            ScLinkConfigItem( const rtl::OUString& rSubTree );
+            ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode );
 	void	SetCommitLink( const Link& rLink );
 
 	virtual void	Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames );
diff -r fbee84f89f7d sc/source/core/tool/optutil.cxx
--- a/sc/source/core/tool/optutil.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/core/tool/optutil.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -54,12 +54,12 @@
 
 //------------------------------------------------------------------
 
-ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree ) :
-	ConfigItem( rSubTree )
+ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree ) :
+    ConfigItem( rSubTree )
 {
 }
 
-ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode ) :
+ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode ) :
     ConfigItem( rSubTree, nMode )
 {
 }
diff -r fbee84f89f7d sc/source/ui/dbgui/asciiopt.cxx
--- a/sc/source/ui/dbgui/asciiopt.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/asciiopt.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -56,6 +56,7 @@
 	bFixedLen		( FALSE ),
 	aFieldSeps		( ';' ),
 	bMergeFieldSeps	( FALSE ),
+    bQuotedFieldAsText(false),
 	cTextSep		( cDefaultTextSep ),
 	eCharSet		( gsl_getSystemTextEncoding() ),
 	bCharSetSystem	( FALSE ),
@@ -71,6 +72,7 @@
 	bFixedLen		( rOpt.bFixedLen ),
 	aFieldSeps		( rOpt.aFieldSeps ),
 	bMergeFieldSeps	( rOpt.bMergeFieldSeps ),
+    bQuotedFieldAsText(rOpt.bQuotedFieldAsText),
 	cTextSep		( rOpt.cTextSep ),
 	eCharSet		( rOpt.eCharSet ),
 	bCharSetSystem	( rOpt.bCharSetSystem ),
@@ -155,6 +157,7 @@
 	bFixedLen		= rCpy.bFixedLen;
 	aFieldSeps		= rCpy.aFieldSeps;
 	bMergeFieldSeps	= rCpy.bMergeFieldSeps;
+    bQuotedFieldAsText = rCpy.bQuotedFieldAsText;
 	cTextSep		= rCpy.cTextSep;
 	eCharSet		= rCpy.eCharSet;
 	bCharSetSystem	= rCpy.bCharSetSystem;
@@ -169,6 +172,7 @@
 	if ( bFixedLen		 == rCmp.bFixedLen &&
 		 aFieldSeps		 == rCmp.aFieldSeps &&
 		 bMergeFieldSeps == rCmp.bMergeFieldSeps &&
+         bQuotedFieldAsText == rCmp.bQuotedFieldAsText &&
 		 cTextSep		 == rCmp.cTextSep &&
 		 eCharSet		 == rCmp.eCharSet &&
 		 bCharSetSystem  == rCmp.bCharSetSystem &&
@@ -286,6 +290,13 @@
 			pColFormat = NULL;
 		}
 	}
+
+    // Import quoted field as text.
+    if (nCount >= 6)
+    {
+        aToken = rString.GetToken(5, ',');
+        bQuotedFieldAsText = aToken.EqualsAscii("true") ? true : false;
+    }
 }
 
 
@@ -357,6 +368,11 @@
 		aOutStr += String::CreateFromInt32(pColFormat[nInfo]);
 	}
 
+    aOutStr += ',';
+
+    // Import quoted field as text.
+    aOutStr += String::CreateFromAscii(bQuotedFieldAsText ? "true" : "false");
+
 	return aOutStr;
 }
 
diff -r fbee84f89f7d sc/source/ui/dbgui/asciiopt.hrc
--- a/sc/source/ui/dbgui/asciiopt.hrc	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/asciiopt.hrc	Fri Feb 19 14:28:21 2010 +0100
@@ -56,4 +56,5 @@
 #define FT_AT_ROW 59
 #define NF_AT_ROW 60
 #define CB_ASONCE 90
+#define CB_QUOTED_AS_TEXT 91
 #define STR_TEXTTOCOLUMNS 100
diff -r fbee84f89f7d sc/source/ui/dbgui/asciiopt.src
--- a/sc/source/ui/dbgui/asciiopt.src	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/asciiopt.src	Fri Feb 19 14:28:21 2010 +0100
@@ -34,24 +34,24 @@
 {
 	OutputSize = TRUE ;
 	SVLook = TRUE ;
-    Size = MAP_APPFONT ( 320 , 247 ) ;
+    Size = MAP_APPFONT ( 320 , 264 ) ;
 	Text [ en-US ] = "Text Import" ;
 	Moveable = TRUE ;
     FixedLine FL_WIDTH
 	{
-        Pos = MAP_APPFONT ( 6 , 132 ) ;
+        Pos = MAP_APPFONT ( 6 , 147 ) ;
         Size = MAP_APPFONT ( 252 , 8 ) ;
 		Text [ en-US ] = "Fields" ;
 	};
 	FixedText FT_TYPE
 	{
-        Pos = MAP_APPFONT ( 12 , 145 ) ;
+        Pos = MAP_APPFONT ( 12 , 160 ) ;
         Size = MAP_APPFONT ( 60 , 8 ) ;
 		Text [ en-US ] = "Column t~ype";
 	};
 	ListBox LB_TYPE1
 	{
-        Pos = MAP_APPFONT ( 76 , 143 ) ;
+        Pos = MAP_APPFONT ( 76 , 158 ) ;
         Size = MAP_APPFONT ( 60 , 68 ) ;
 		TabStop = TRUE ;
 		DropDown = TRUE ;
@@ -194,7 +194,7 @@
 		HelpId = HID_SC_ASCII_TABCTR ;
 		Border = TRUE ;
         DialogControl = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 159 ) ;
+        Pos = MAP_APPFONT ( 12 , 176 ) ;
         Size = MAP_APPFONT ( 243 , 82 ) ;
 	};
 	CheckBox CB_ASONCE
@@ -204,6 +204,13 @@
 		TabStop = TRUE ;
 		Text [ en-US ] = "Merge ~delimiters" ;
 	};
+    CheckBox CB_QUOTED_AS_TEXT
+    {
+        Pos = MAP_APPFONT ( 20 , 129 ) ;
+        Size = MAP_APPFONT ( 130 , 10 ) ;
+        TabStop = TRUE ;
+        Text [ en-US ] = "~Quoted field as text" ;
+    };
     String STR_TEXTTOCOLUMNS
     {
         Text [ en-US ] = "Text to Columns" ;
diff -r fbee84f89f7d sc/source/ui/dbgui/csvgrid.cxx
--- a/sc/source/ui/dbgui/csvgrid.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/csvgrid.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -737,7 +737,8 @@
     while( *pChar && (nColIx < sal::static_int_cast<sal_uInt32>(CSV_MAXCOLCOUNT)) )
     {
         // scan for next cell text
-        pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep );
+        bool bIsQuoted = false;
+        pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted );
 
         // update column width
         sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) );
diff -r fbee84f89f7d sc/source/ui/dbgui/csvruler.cxx
--- a/sc/source/ui/dbgui/csvruler.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/csvruler.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -37,7 +37,75 @@
 #include "AccessibleCsvControl.hxx"
 
 
+#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)
+{
+    String sSplits;
+    // Create a semi-colon separated string to save the splits
+    sal_uInt32 n = aSplits.Count();
+    for (sal_uInt32 i = 0; i < n; ++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 ),
@@ -48,6 +116,13 @@
     InitSizeData();
     maBackgrDev.SetFont( GetFont() );
     maRulerDev.SetFont( GetFont() );
+
+    load_FixedWidthList( maSplits );
+}
+
+ScCsvRuler::~ScCsvRuler()
+{
+    save_FixedWidthList( maSplits );
 }
 
 
diff -r fbee84f89f7d sc/source/ui/dbgui/scuiasciiopt.cxx
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -44,6 +44,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;
@@ -51,6 +57,20 @@
 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 QUOTED_AS_TEXT      "QuotedFieldAsText"
+#define SEP_PATH            "Office.Calc/Dialogs/CSVImport"
+
 // ============================================================================
 
 void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect )
@@ -98,11 +118,82 @@
 	return c;
 }
 
+static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, 
+                             bool &bMergeDelimiters, bool& bQuotedAsText, bool &bFixedWidth, 
+                             sal_Int32 &nFromRow, sal_Int32 &nCharSet )
+{
+    Sequence<Any>aValues;
+    const Any *pProperties;
+    Sequence<OUString> aNames(7);
+    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 );
+    pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
+    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;
+ 
+    if ( pProperties[6].hasValue() )
+        pProperties[6] >>= bQuotedAsText;
+}
+
+static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
+                             bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
+{
+    OUString sFieldSeparators = OUString( maSeparators );
+    OUString sTextSeparators = OUString( maTxtSep );
+    Sequence<Any> aValues;
+    Any *pProperties;
+    Sequence<OUString> aNames(7);
+    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 );
+    pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
+    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;
+    pProperties[6] <<= static_cast<sal_Bool>(bQuotedAsText);
+
+    aItem.PutProperties(aNames, aValues);
+}
 
 // ----------------------------------------------------------------------------
 
 ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
-									SvStream* pInStream, sal_Unicode cSep ) :
+                                    SvStream* pInStream, sal_Unicode /*cSep*/ ) :
 		ModalDialog	( pParent, ScResId( RID_SCDLG_ASCII ) ),
         mpDatStream  ( pInStream ),
         mnStreamPos( pInStream ? pInStream->Tell() : 0 ),
@@ -128,6 +219,7 @@
 		aCkbOther	( this, ScResId( CKB_OTHER ) ),
 		aEdOther	( this, ScResId( ED_OTHER ) ),
 		aCkbAsOnce	( this, ScResId( CB_ASONCE) ),
+        aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ),
 		aFtTextSep	( this, ScResId( FT_TEXTSEP ) ),
 		aCbTextSep	( this, ScResId( CB_TEXTSEP ) ),
 
@@ -146,14 +238,15 @@
 		aFldSepList	( ScResId( SCSTR_FIELDSEP ) ),
 		aTextSepList( ScResId( SCSTR_TEXTSEP ) ),
         mcTextSep   ( ScAsciiOptions::cDefaultTextSep ),
-        maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) )
+        maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ),
+        mbFileImport(true)
 {
 	FreeResource();
+    mbFileImport = aDatName.Len() > 0;
 
 	String aName = GetText();
     // aDatName is empty if invoked during paste from clipboard.
-    BOOL bClipboard = (aDatName.Len() == 0);
-    if (!bClipboard)
+    if (mbFileImport)
     {
         aName.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" - ["));
         aName += aDatName;
@@ -161,20 +254,51 @@
     }
 	SetText( aName );
 
-    switch(cSep)
+
+    OUString sFieldSeparators;
+    OUString sTextSeparators;
+    bool bMergeDelimiters = false;
+    bool bFixedWidth = false;
+    bool bQuotedFieldAsText = true;
+    sal_Int32 nFromRow = 1;
+    sal_Int32 nCharSet = -1;
+    if (mbFileImport)
+        // load separators only when importing csv files.
+        load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, 
+                         bQuotedFieldAsText, bFixedWidth, nFromRow, nCharSet);
+    maFieldSeparators = String(sFieldSeparators);
+
+    if( bMergeDelimiters )
+        aCkbAsOnce.Check();
+    if (bQuotedFieldAsText)
+        aCkbQuotedAsText.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 len = maFieldSeparators.Len();
+    for (int 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();
 
     // Clipboard is always Unicode, else detect.
-	BOOL bPreselectUnicode = bClipboard;
+    bool bPreselectUnicode = !mbFileImport;
 	// Sniff for Unicode / not
     if( !bPreselectUnicode && mpDatStream )
 	{
@@ -210,6 +334,7 @@
 
     // *** Separator characters ***
     lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep );
+    aCbTextSep.SetText( sTextSeparators );
 
     Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl );
     aCbTextSep.SetSelectHdl( aSeparatorHdl );
@@ -218,6 +343,9 @@
     aCkbSemicolon.SetClickHdl( aSeparatorHdl );
     aCkbComma.SetClickHdl( aSeparatorHdl );
     aCkbAsOnce.SetClickHdl( aSeparatorHdl );
+    // aCkbQuotedAsText.SetClickHdl( aSeparatorHdl );
+    // the string is untranslated--better not to show it at all...
+    aCkbQuotedAsText.Show( sal_False );
     aCkbSpace.SetClickHdl( aSeparatorHdl );
     aCkbOther.SetClickHdl( aSeparatorHdl );
     aEdOther.SetModifyHdl( aSeparatorHdl );
@@ -230,6 +358,10 @@
 	aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser );
 	aLbCharSet.SelectTextEncoding( bPreselectUnicode ?
 		RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() );
+
+    if( nCharSet >= 0 )
+        aLbCharSet.SelectEntryPos( nCharSet );
+
     SetSelectedCharSet();
 	aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
 
@@ -261,6 +393,10 @@
 
 ScImportAsciiDlg::~ScImportAsciiDlg()
 {
+    if (mbFileImport)
+        save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), 
+                         aCkbQuotedAsText.IsChecked(), aRbFixed.IsChecked(), 
+                         aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
 	delete[] mpRowPosArray;
 }
 
@@ -346,6 +482,7 @@
     {
         rOpt.SetFieldSeps( GetSeparators() );
         rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() );
+        rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked());
         rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) );
     }
 }
@@ -357,6 +494,10 @@
     aLbCharSet.Disable();
     aFtRow.Disable();
     aNfRow.Disable();
+
+    // Quoted field as text option is not used for text to columns mode.
+    aCkbQuotedAsText.Check(false);
+    aCkbQuotedAsText.Disable();
 }
 
 void ScImportAsciiDlg::SetSelectedCharSet()
@@ -393,6 +534,7 @@
     aCkbOther.Enable( bEnable );
     aEdOther.Enable( bEnable );
     aCkbAsOnce.Enable( bEnable );
+    aCkbQuotedAsText.Enable( bEnable );
     aFtTextSep.Enable( bEnable );
     aCbTextSep.Enable( bEnable );
 }
diff -r fbee84f89f7d sc/source/ui/docshell/impex.cxx
--- a/sc/source/ui/docshell/impex.cxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/docshell/impex.cxx	Fri Feb 19 14:28:21 2010 +0100
@@ -905,12 +905,10 @@
 		//
 
 
-bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
-					const String& rStr, BYTE nColFormat,
-                    ::utl::TransliterationWrapper& rTransliteration,
-					CalendarWrapper& rCalendar,
-                    ::utl::TransliterationWrapper* pSecondTransliteration,
-					CalendarWrapper* pSecondCalendar )
+static bool lcl_PutString( 
+    ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat,
+    ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar,
+    ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar )
 {
     bool bMultiLine = false;
 	if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) )
@@ -1281,7 +1279,8 @@
                 // SC_COL_SKIP.
                 while (*p && nCol <= MAXCOL+1)
                 {
-                    p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge );
+                    bool bIsQuoted = false;
+                    p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted );
 
                     BYTE nFmt = SC_COL_STANDARD;
                     for ( i=nInfoStart; i<nInfoCount; i++ )
@@ -1298,10 +1297,15 @@
                         if (nCol > MAXCOL)
                             bOverflow = TRUE;       // display warning on import
                         else if (!bDetermineRange)
+                        {
+                            if (bIsQuoted && pExtOptions && pExtOptions->IsQuotedAsText())
+                                nFmt = SC_COL_TEXT;
+
                             bMultiLine |= lcl_PutString( pDoc, nCol, nRow,
                                     nTab, aCell, nFmt, aTransliteration,
                                     aCalendar, pEnglishTransliteration,
                                     pEnglishCalendar);
+                        }
                         ++nCol;
                     }
 
@@ -1375,11 +1379,13 @@
 
 // static
 const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p,
-		String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps )
+		String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted )
 {
+    rbIsQuoted = false;
 	rField.Erase();
 	if ( *p == cStr )			// String in Anfuehrungszeichen
 	{
+        rbIsQuoted = true;
         const sal_Unicode* p1;
 		p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE );
 		while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) )
diff -r fbee84f89f7d sc/source/ui/inc/asciiopt.hxx
--- a/sc/source/ui/inc/asciiopt.hxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/inc/asciiopt.hxx	Fri Feb 19 14:28:21 2010 +0100
@@ -65,6 +65,7 @@
 	BOOL		bFixedLen;
 	String		aFieldSeps;
 	BOOL		bMergeFieldSeps;
+    bool        bQuotedFieldAsText;
 	sal_Unicode	cTextSep;
 	CharSet		eCharSet;
 	BOOL		bCharSetSystem;
@@ -93,6 +94,7 @@
 	BOOL				GetCharSetSystem() const	{ return bCharSetSystem; }
 	const String&		GetFieldSeps() const	{ return aFieldSeps; }
 	BOOL				IsMergeSeps() const		{ return bMergeFieldSeps; }
+    bool                IsQuotedAsText() const  { return bQuotedFieldAsText; }
 	sal_Unicode			GetTextSep() const		{ return cTextSep; }
 	BOOL				IsFixedLen() const		{ return bFixedLen; }
 	USHORT				GetInfoCount() const	{ return nInfoCount; }
@@ -105,6 +107,7 @@
 	void	SetFixedLen( BOOL bSet )			{ bFixedLen = bSet; }
 	void	SetFieldSeps( const String& rStr )	{ aFieldSeps = rStr; }
 	void	SetMergeSeps( BOOL bSet )			{ bMergeFieldSeps = bSet; }
+    void    SetQuotedAsText(bool bSet)          { bQuotedFieldAsText = bSet; }
 	void	SetTextSep( sal_Unicode c )			{ cTextSep = c; }
 	void	SetStartRow( long nRow)				{ nStartRow= nRow; }
 
diff -r fbee84f89f7d sc/source/ui/inc/csvruler.hxx
--- a/sc/source/ui/inc/csvruler.hxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/inc/csvruler.hxx	Fri Feb 19 14:28:21 2010 +0100
@@ -71,6 +71,7 @@
     // ------------------------------------------------------------------------
 public:
     explicit                    ScCsvRuler( ScCsvControl& rParent );
+                                ~ScCsvRuler();
 
     // common ruler handling --------------------------------------------------
 public:
diff -r fbee84f89f7d sc/source/ui/inc/impex.hxx
--- a/sc/source/ui/inc/impex.hxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/inc/impex.hxx	Fri Feb 19 14:28:21 2010 +0100
@@ -110,7 +110,7 @@
 
 	static BOOL  IsFormatSupported( ULONG nFormat );
 	static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p,
-			String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps );
+			String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted );
 	static	void	WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE );
 	static	void	WriteUnicodeOrByteEndl( SvStream& rStrm );
 	static	inline	BOOL	IsEndianSwap( const SvStream& rStrm );
diff -r fbee84f89f7d sc/source/ui/inc/scuiasciiopt.hxx
--- a/sc/source/ui/inc/scuiasciiopt.hxx	Thu Feb 18 15:33:38 2010 +0100
+++ b/sc/source/ui/inc/scuiasciiopt.hxx	Fri Feb 19 14:28:21 2010 +0100
@@ -64,6 +64,7 @@
     CheckBox                    aCkbOther;
     Edit                        aEdOther;
     CheckBox                    aCkbAsOnce;
+    CheckBox                    aCkbQuotedAsText;
     FixedText                   aFtTextSep;
     ComboBox                    aCbTextSep;
 
@@ -87,6 +88,7 @@
 
     CharSet                     meCharSet;          /// Selected char set.
     bool                        mbCharSetSystem;    /// Is System char set selected?
+    bool                        mbFileImport;       /// Is this dialog involked for csv file import ?
 
 public:
                                 ScImportAsciiDlg(