Bugzilla – Attachment 65388 Details for
Bug 47674
calc: remember settings in dialogs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-fdo-47674-Save-settings-for-Import-Ascii-Text-Dlg.patch (text/plain), 26.99 KB, created by
Laurent Balland
on 2012-08-10 13:31:13 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Laurent Balland
Created:
2012-08-10 13:31:13 UTC
Size:
26.99 KB
patch
obsolete
>From 98a075dd0ea55635c6c9010fd2dd163483a95c7a Mon Sep 17 00:00:00 2001 >From: Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> >Date: Sat, 4 Aug 2012 22:07:20 +0200 >Subject: [PATCH] fdo#47674 Save settings for Import Ascii Text Dlg > >Add save of settings for Paste Unformatted Text and >Text to Columns. >Remove useless cSep parameter because default are set in Calc.xcs > >Change-Id: Iff4b976f434a63d2d1f56e497852c7c1e763151c >--- > .../registry/schema/org/openoffice/Office/Calc.xcs | 131 ++++++++++++++++ > sc/inc/scabstdlg.hxx | 4 +- > sc/source/ui/attrdlg/scdlgfact.cxx | 9 +- > sc/source/ui/attrdlg/scdlgfact.hxx | 3 +- > sc/source/ui/dbgui/scuiasciiopt.cxx | 156 +++++++++++-------- > sc/source/ui/inc/asciiopt.hxx | 6 + > sc/source/ui/inc/scuiasciiopt.hxx | 7 +- > sc/source/ui/unoobj/filtuno.cxx | 9 +- > sc/source/ui/view/cellsh2.cxx | 4 +- > sc/source/ui/view/viewfun5.cxx | 3 +- > 10 files changed, 241 insertions(+), 91 deletions(-) > >diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >index 0f5898e..f541720 100644 >--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >@@ -1141,6 +1141,137 @@ > <value></value> > </prop> > </group> >+ <group oor:name="ClipboardTextImport"> >+ <info> >+ <desc>Contains setting for Unformatted Text Import from Clipboard</desc> >+ </info> >+ <prop oor:name="MergeDelimiters" oor:type="xs:boolean" oor:nillable="false"> >+ <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" oor:nillable="false"> >+ <info> >+ <author>kyoshida</author> >+ <desc>If true, quoted field is always imported as text >+ with no exception.</desc> >+ <label>QuotedFieldAsText</label> >+ </info> >+ <value>false</value> >+ </prop> >+ <prop oor:name="DetectSpecialNumbers" oor:type="xs:boolean" oor:nillable="false"> >+ <info> >+ <author>kyoshida</author> >+ <desc>If true, Calc tries to detect special number format, such as date and scientific notation.</desc> >+ <label>DetectSpecialNumbers</label> >+ </info> >+ <value>true</value> >+ </prop> >+ <prop oor:name="Language" oor:type="xs:int" oor:nillable="false"> >+ <info> >+ <author>kyoshida</author> >+ <desc>Language to use for CSV import. This determines how the numbers are parsed.</desc> >+ <label>Language</label> >+ </info> >+ <value>0</value> >+ </prop> >+ <prop oor:name="Separators" oor:type="xs:string" oor:nillable="false"> >+ <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" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Text Separators</desc> >+ <label>TextSeparators</label> >+ </info> >+ <value>"</value> >+ </prop> >+ <prop oor:name="FixedWidth" oor:type="xs:boolean" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Fixed width</desc> >+ <label>FixedWidth</label> >+ </info> >+ <value>false</value> >+ </prop> >+ <prop oor:name="FromRow" oor:type="xs:int" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>From Row</desc> >+ <label>FromRow</label> >+ </info> >+ <value>1</value> >+ </prop> >+ <prop oor:name="CharSet" oor:type="xs:int" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Char Set</desc> >+ <label>CharSet</label> >+ </info> >+ <value>-1</value> >+ </prop> >+ <prop oor:name="FixedWidthList" oor:type="xs:string" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Fixed Width List of separators</desc> >+ <label>FixedWidthList</label> >+ </info> >+ <value></value> >+ </prop> >+ </group> >+ <group oor:name="TextToColumnsImport"> >+ <info> >+ <desc>Contains setting for Text to Columns Import</desc> >+ </info> >+ <prop oor:name="MergeDelimiters" oor:type="xs:boolean" oor:nillable="false"> >+ <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" oor:nillable="false"> >+ <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" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Text Separators</desc> >+ <label>TextSeparators</label> >+ </info> >+ <value>"</value> >+ </prop> >+ <prop oor:name="FixedWidth" oor:type="xs:boolean" oor:nillable="false"> >+ <info> >+ <author>muthusuba</author> >+ <desc>Fixed width</desc> >+ <label>FixedWidth</label> >+ </info> >+ <value>false</value> >+ </prop> >+ <prop oor:name="FixedWidthList" oor:type="xs:string" oor:nillable="false"> >+ <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> >diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx >index 7ecad75..ee099cb 100644 >--- a/sc/inc/scabstdlg.hxx >+++ b/sc/inc/scabstdlg.hxx >@@ -40,6 +40,7 @@ > #include "global.hxx" > #include "pivot.hxx" > #include "i18npool/lang.h" >+#include "asciiopt.hxx" > > #include <tabvwsh.hxx> > >@@ -67,7 +68,6 @@ class AbstractScImportAsciiDlg : public VclAbstractDialog //add for ScImportAsc > { > public: > virtual void GetOptions( ScAsciiOptions& rOpt ) = 0; >- virtual void SetTextToColumnsMode() = 0; > virtual void SaveParameters() = 0; > }; > >@@ -344,7 +344,7 @@ public: > > virtual AbstractScImportAsciiDlg * CreateScImportAsciiDlg( Window* pParent, String aDatName, //add for ScImportAsciiDlg > SvStream* pInStream, int nId, >- sal_Unicode cSep = '\t') = 0; >+ ScImportAsciiCall eCall) = 0; > > virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0; > >diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx >index 4dd5292..eb34106 100644 >--- a/sc/source/ui/attrdlg/scdlgfact.cxx >+++ b/sc/source/ui/attrdlg/scdlgfact.cxx >@@ -161,11 +161,6 @@ void AbstractScImportAsciiDlg_Impl::GetOptions( ScAsciiOptions& rOpt ) > pDlg->GetOptions( rOpt ); > } > >-void AbstractScImportAsciiDlg_Impl::SetTextToColumnsMode() >-{ >- pDlg->SetTextToColumnsMode(); >-} >- > void AbstractScImportAsciiDlg_Impl::SaveParameters() > { > pDlg->SaveParameters(); >@@ -657,13 +652,13 @@ bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const > > > AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg ( Window* pParent, String aDatName, >- SvStream* pInStream, int nId, sal_Unicode cSep ) >+ SvStream* pInStream, int nId, ScImportAsciiCall eCall ) > { > ScImportAsciiDlg* pDlg=NULL; > switch ( nId ) > { > case RID_SCDLG_ASCII : >- pDlg = new ScImportAsciiDlg( pParent, aDatName,pInStream, cSep ); >+ pDlg = new ScImportAsciiDlg( pParent, aDatName,pInStream, eCall ); > break; > default: > break; >diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx >index fcf000d..4d7df50 100644 >--- a/sc/source/ui/attrdlg/scdlgfact.hxx >+++ b/sc/source/ui/attrdlg/scdlgfact.hxx >@@ -120,7 +120,6 @@ class AbstractScImportAsciiDlg_Impl : public AbstractScImportAsciiDlg //add for > { > DECL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl, ScImportAsciiDlg) > virtual void GetOptions( ScAsciiOptions& rOpt ); >- virtual void SetTextToColumnsMode(); > virtual void SaveParameters(); > }; > >@@ -413,7 +412,7 @@ public: > > virtual AbstractScImportAsciiDlg * CreateScImportAsciiDlg( Window* pParent, String aDatName, //add for ScImportAsciiDlg > SvStream* pInStream, int nId, >- sal_Unicode cSep = '\t'); >+ ScImportAsciiCall eCall); > > virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ); > >diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx >index 11b2bb3..753bda6 100644 >--- a/sc/source/ui/dbgui/scuiasciiopt.cxx >+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx >@@ -43,6 +43,7 @@ > #include <com/sun/star/uno/Any.hxx> > #include <com/sun/star/uno/Sequence.hxx> > #include "miscuno.hxx" >+#include <tools/urlobj.hxx> > > //! TODO make dynamic > const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT; >@@ -63,6 +64,8 @@ using ::rtl::OUString; > #define DETECT_SPECIAL_NUM "DetectSpecialNumbers" > #define LANGUAGE "Language" > #define SEP_PATH "Office.Calc/Dialogs/CSVImport" >+#define SEP_PATH_CLPBRD "Office.Calc/Dialogs/ClipboardTextImport" >+#define SEP_PATH_TEXT2COL "Office.Calc/Dialogs/TextToColumnsImport" > > // ============================================================================ > >@@ -114,13 +117,24 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList ) > static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, > bool &bMergeDelimiters, bool& bQuotedAsText, bool& bDetectSpecialNum, > bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet, >- sal_Int32& nLanguage ) >+ sal_Int32& nLanguage, ScImportAsciiCall eCall ) > { > Sequence<Any>aValues; > const Any *pProperties; > Sequence<OUString> aNames(9); > OUString* pNames = aNames.getArray(); >- ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+ OUString aSepPath; >+ switch(eCall) >+ { >+ case SC_IMPORTFILE : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH)); >+ break; >+ case SC_PASTETEXT : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_CLPBRD)); >+ break; >+ case SC_TEXTTOCOLUMNS : >+ default : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_TEXT2COL)); >+ break; >+ } >+ ScLinkConfigItem aItem( aSepPath ); > > pNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( MERGE_DELIMITERS )); > pNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( SEPARATORS )); >@@ -163,7 +177,7 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato > > static void save_Separators( > String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText, >- bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet, sal_Int32 nLanguage ) >+ bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet, sal_Int32 nLanguage, ScImportAsciiCall eCall ) > { > OUString sFieldSeparators = OUString( maSeparators ); > OUString sTextSeparators = OUString( maTxtSep ); >@@ -171,7 +185,18 @@ static void save_Separators( > Any *pProperties; > Sequence<OUString> aNames(9); > OUString* pNames = aNames.getArray(); >- ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+ OUString aSepPath; >+ switch(eCall) >+ { >+ case SC_IMPORTFILE : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH)); >+ break; >+ case SC_PASTETEXT : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_CLPBRD)); >+ break; >+ case SC_TEXTTOCOLUMNS : >+ default : aSepPath=OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_TEXT2COL)); >+ break; >+ } >+ ScLinkConfigItem aItem( aSepPath ); > > pNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( MERGE_DELIMITERS )); > pNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( SEPARATORS )); >@@ -200,7 +225,7 @@ static void save_Separators( > // ---------------------------------------------------------------------------- > > ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, >- SvStream* pInStream, sal_Unicode cSep ) : >+ SvStream* pInStream, ScImportAsciiCall eCall ) : > ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ), > mpDatStream ( pInStream ), > mnStreamPos( pInStream ? pInStream->Tell() : 0 ), >@@ -251,41 +276,39 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > aTextSepList( ScResId( SCSTR_TEXTSEP ) ), > mcTextSep ( ScAsciiOptions::cDefaultTextSep ), > maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ), >- mbFileImport(true) >+ meCall(eCall) > { > FreeResource(); >- mbFileImport = aDatName.Len() > 0; > > String aName = GetText(); >- // aDatName is empty if invoked during paste from clipboard. >- if (mbFileImport) >+ if (meCall==SC_IMPORTFILE) > { > aName.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" - [")); > aName += aDatName; > aName += ']'; > } >- SetText( aName ); >+ if(meCall == SC_TEXTTOCOLUMNS) >+ { >+ SetText( maStrTextToColumns ); >+ } >+ else >+ { >+ SetText( aName ); >+ } > >- // Default options >+ // Default options are set in officecfg/registry/schema/org/openoffice/Office/Calc.xcs > OUString sFieldSeparators(RTL_CONSTASCII_USTRINGPARAM(",;\t")); > OUString sTextSeparators(mcTextSep); > bool bMergeDelimiters = false; > bool bFixedWidth = false; > bool bQuotedFieldAsText = false; >- bool bDetectSpecialNum = false; >+ bool bDetectSpecialNum = true; > sal_Int32 nFromRow = 1; > sal_Int32 nCharSet = -1; > sal_Int32 nLanguage = 0; >- if (mbFileImport) >- // load separators only when importing csv files. >- load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, >- bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage); >- else >- { >- // #i115474# otherwise use sensible defaults >- sFieldSeparators = OUString( cSep ); >- sTextSeparators = OUString( ScAsciiOptions::cDefaultTextSep ); >- } >+ load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, >+ bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage, meCall); >+ // load from saved settings > maFieldSeparators = String(sFieldSeparators); > > if( bMergeDelimiters ) >@@ -299,29 +322,14 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > if( nFromRow != 1 ) > aNfRow.SetValue( nFromRow ); > >- rtl::OString sString(rtl::OUStringToOString(maFieldSeparators, >- RTL_TEXTENCODING_MS_1252)); >- const sal_Char *aSep = sString.getStr(); >- int len = maFieldSeparators.Len(); >- for (int i = 0; i < len; ++i) >- { >- 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] ) ); >- } >- } >+ // Set Separators in the dialog from maFieldSeparators (empty are not set) >+ SetSeparators(); > >- // Get Separators from the dialog >+ // Get Separators from the dialog (empty are set from default) > maFieldSeparators = GetSeparators(); > > // Clipboard is always Unicode, else detect. >- rtl_TextEncoding ePreselectUnicode = (mbFileImport ? >+ rtl_TextEncoding ePreselectUnicode = (meCall == SC_IMPORTFILE ? > RTL_TEXTENCODING_DONTKNOW : RTL_TEXTENCODING_UNICODE); > // Sniff for Unicode / not > if( ePreselectUnicode == RTL_TEXTENCODING_DONTKNOW && mpDatStream ) >@@ -430,6 +438,25 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > > aEdOther.SetAccessibleName(aCkbOther.GetText()); > aEdOther.SetAccessibleRelationLabeledBy(&aCkbOther); >+ >+ if(meCall == SC_TEXTTOCOLUMNS) >+ { >+ aFtCharSet.Disable(); >+ aLbCharSet.Disable(); >+ aFtCustomLang.Disable(); >+ aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM); >+ aLbCustomLang.Disable(); >+ aFtRow.Disable(); >+ aNfRow.Disable(); >+ >+ // Quoted field as text option is not used for text-to-columns mode. >+ aCkbQuotedAsText.Check(false); >+ aCkbQuotedAsText.Disable(); >+ >+ // Always detect special numbers for text-to-columns mode. >+ aCkbDetectNumber.Check(); >+ aCkbDetectNumber.Disable(); >+ } > } > > >@@ -527,38 +554,35 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) > rOpt.SetDetectSpecialNumber(aCkbDetectNumber.IsChecked()); > } > >-void ScImportAsciiDlg::SetTextToColumnsMode() >-{ >- SetText( maStrTextToColumns ); >- aFtCharSet.Disable(); >- aLbCharSet.Disable(); >- aFtCustomLang.Disable(); >- aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM); >- aLbCustomLang.Disable(); >- aFtRow.Disable(); >- aNfRow.Disable(); >- >- // Quoted field as text option is not used for text-to-columns mode. >- aCkbQuotedAsText.Check(false); >- aCkbQuotedAsText.Disable(); >- >- // Always detect special numbers for text-to-columns mode. >- aCkbDetectNumber.Check(); >- aCkbDetectNumber.Disable(); >-} >- > void ScImportAsciiDlg::SaveParameters() > { >- if (!mbFileImport) >- // We save parameters only for file import. >- return; >- > save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), > aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), > aRbFixed.IsChecked(), > static_cast<sal_Int32>(aNfRow.GetValue()), > static_cast<sal_Int32>(aLbCharSet.GetSelectEntryPos()), >- static_cast<sal_Int32>(aLbCustomLang.GetSelectLanguage()) ); >+ static_cast<sal_Int32>(aLbCustomLang.GetSelectLanguage()), meCall ); >+} >+ >+void ScImportAsciiDlg::SetSeparators() >+{ >+ rtl::OString sString(rtl::OUStringToOString(maFieldSeparators, >+ RTL_TEXTENCODING_MS_1252)); >+ const sal_Char *aSep = sString.getStr(); >+ int len = maFieldSeparators.Len(); >+ for (int i = 0; i < len; ++i) >+ { >+ 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] ) ); >+ } >+ } > } > > void ScImportAsciiDlg::SetSelectedCharSet() >diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx >index 53a22dd..45107c1 100644 >--- a/sc/source/ui/inc/asciiopt.hxx >+++ b/sc/source/ui/inc/asciiopt.hxx >@@ -107,6 +107,12 @@ public: > void SetColumnInfo( const ScCsvExpDataVec& rDataVec ); > }; > >+/// How ScImportAsciiDlg is called >+enum ScImportAsciiCall { >+ SC_IMPORTFILE, // with File > Open: Text - CSV >+ SC_PASTETEXT, // with Paste > Unformatted Text >+ SC_TEXTTOCOLUMNS }; // with Data > Text to Columns >+ > #endif > > /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ >diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx >index c45b9ac..e95103c 100644 >--- a/sc/source/ui/inc/scuiasciiopt.hxx >+++ b/sc/source/ui/inc/scuiasciiopt.hxx >@@ -94,21 +94,22 @@ class ScImportAsciiDlg : public ModalDialog > > CharSet meCharSet; /// Selected char set. > bool mbCharSetSystem; /// Is System char set selected? >- bool mbFileImport; /// Is this dialog involked for csv file import ? >+ ScImportAsciiCall meCall; /// How the dialog is called (see asciiopt.hxx) > > public: > ScImportAsciiDlg( > Window* pParent, String aDatName, >- SvStream* pInStream, sal_Unicode cSep = '\t' ); >+ SvStream* pInStream, ScImportAsciiCall eCall ); > ~ScImportAsciiDlg(); > > void GetOptions( ScAsciiOptions& rOpt ); >- void SetTextToColumnsMode(); > void SaveParameters(); > > private: > /** Sets the selected char set data to meCharSet and mbCharSetSystem. */ > void SetSelectedCharSet(); >+ /** Set separators in ui from maFieldSeparators */ >+ void SetSeparators(); > /** Returns all separator characters in a string. */ > String GetSeparators() const; > >diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx >index 6180743..1d35a9c 100644 >--- a/sc/source/ui/unoobj/filtuno.cxx >+++ b/sc/source/ui/unoobj/filtuno.cxx >@@ -211,19 +211,12 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) > // ascii import is special... > > INetURLObject aURL( aFileName ); >- String aExt(aURL.getExtension()); > String aPrivDatName(aURL.getName()); >- sal_Unicode cAsciiDel; >- if (aExt.EqualsIgnoreCaseAscii("CSV")) >- cAsciiDel = ','; >- else >- cAsciiDel = '\t'; >- > SvStream* pInStream = NULL; > if ( xInputStream.is() ) > pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); > >- AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII, cAsciiDel); >+ AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII,SC_IMPORTFILE); > OSL_ENSURE(pDlg, "Dialog create fail!"); > if ( pDlg->Execute() == RET_OK ) > { >diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx >index 65f89f8..325e713 100644 >--- a/sc/source/ui/view/cellsh2.cxx >+++ b/sc/source/ui/view/cellsh2.cxx >@@ -936,9 +936,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) > ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); > OSL_ENSURE( pFact, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pFact is null!" ); > AbstractScImportAsciiDlg *pDlg = pFact->CreateScImportAsciiDlg( >- NULL, String(), &aStream, RID_SCDLG_ASCII ); >+ NULL, String(), &aStream, RID_SCDLG_ASCII,SC_TEXTTOCOLUMNS); > OSL_ENSURE( pDlg, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDlg is null!" ); >- pDlg->SetTextToColumnsMode(); > > if ( pDlg->Execute() == RET_OK ) > { >@@ -951,6 +950,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) > ScImportExport aImport( pDoc, aRange.aStart ); > ScAsciiOptions aOptions; > pDlg->GetOptions( aOptions ); >+ pDlg->SaveParameters(); > aImport.SetExtOptions( aOptions ); > aImport.SetApi( false ); > aStream.Seek( 0 ); >diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx >index 6f7e890..be970f4 100644 >--- a/sc/source/ui/view/viewfun5.cxx >+++ b/sc/source/ui/view/viewfun5.cxx >@@ -340,12 +340,13 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, > ScAbstractDialogFactory::Create(); > AbstractScImportAsciiDlg *pDlg = > pFact->CreateScImportAsciiDlg( NULL, String(), &aStrm, >- RID_SCDLG_ASCII); >+ RID_SCDLG_ASCII, SC_PASTETEXT); > > if (pDlg->Execute() == RET_OK) > { > ScAsciiOptions aOptions; > pDlg->GetOptions( aOptions ); >+ pDlg->SaveParameters(); > aObj.SetExtOptions( aOptions ); > > bRet = aObj.ImportString( aStr, nFormatId ); >-- >1.7.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 47674
:
65131
| 65388