Bugzilla – Attachment 65131 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]
Save settings of Import Text from clipboard
0001-fdo-47674-Save-settings-for-Paste-unformatted-text.patch (text/plain), 13.09 KB, created by
Laurent Balland
on 2012-08-04 20:34:48 UTC
(
hide
)
Description:
Save settings of Import Text from clipboard
Filename:
MIME Type:
Creator:
Laurent Balland
Created:
2012-08-04 20:34:48 UTC
Size:
13.09 KB
patch
obsolete
>From fad6e10eff6ef9f3ad1167534e1d1b0cf7f1c557 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 Paste unformatted text > >First step for this issue. Next step will be to treat also Text to >Column. > >Change-Id: Ia52dc9ddcfe809b66d5d245659e1f38175aaa9d1 >--- > .../registry/schema/org/openoffice/Office/Calc.xcs | 86 ++++++++++++++++++++ > sc/source/ui/dbgui/scuiasciiopt.cxx | 70 ++++++++++++---- > sc/source/ui/inc/scuiasciiopt.hxx | 2 + > sc/source/ui/view/viewfun5.cxx | 1 + > 4 files changed, 143 insertions(+), 16 deletions(-) > >diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >index 0f5898e..b1e3c14 100644 >--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs >@@ -1141,6 +1141,92 @@ > <value></value> > </prop> > </group> >+ <group oor:name="ClipboardTextImport"> >+ <info> >+ <desc>Contains setting for Text CSV 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="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>false</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> > <group oor:name="Calculate"> > <info> >diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx >index 11b2bb3..a0c1a10 100644 >--- a/sc/source/ui/dbgui/scuiasciiopt.cxx >+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx >@@ -63,6 +63,7 @@ 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" > > // ============================================================================ > >@@ -114,13 +115,16 @@ 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, bool bFileImport ) > { > Sequence<Any>aValues; > const Any *pProperties; > Sequence<OUString> aNames(9); > OUString* pNames = aNames.getArray(); >- ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+// ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+ OUString aSepPathFile= OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH)); >+ OUString aSepPathClipboard= OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_CLPBRD)); >+ ScLinkConfigItem aItem( bFileImport?aSepPathFile:aSepPathClipboard ); > > pNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( MERGE_DELIMITERS )); > pNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( SEPARATORS )); >@@ -163,7 +167,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, bool bFileImport ) > { > OUString sFieldSeparators = OUString( maSeparators ); > OUString sTextSeparators = OUString( maTxtSep ); >@@ -171,7 +175,10 @@ static void save_Separators( > Any *pProperties; > Sequence<OUString> aNames(9); > OUString* pNames = aNames.getArray(); >- ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+// ScLinkConfigItem aItem( OUString(RTL_CONSTASCII_USTRINGPARAM( SEP_PATH )) ); >+ OUString aSepPathFile= OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH)); >+ OUString aSepPathClipboard= OUString(RTL_CONSTASCII_USTRINGPARAM(SEP_PATH_CLPBRD)); >+ ScLinkConfigItem aItem( bFileImport?aSepPathFile:aSepPathClipboard ); > > pNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( MERGE_DELIMITERS )); > pNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( SEPARATORS )); >@@ -276,16 +283,16 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > sal_Int32 nFromRow = 1; > sal_Int32 nCharSet = -1; > sal_Int32 nLanguage = 0; >- if (mbFileImport) >+// if (mbFileImport) > // load separators only when importing csv files. > load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, >- bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage); >- else >- { >+ bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage,mbFileImport); >+// else >+// { > // #i115474# otherwise use sensible defaults >- sFieldSeparators = OUString( cSep ); >- sTextSeparators = OUString( ScAsciiOptions::cDefaultTextSep ); >- } >+// sFieldSeparators = OUString( cSep ); >+// sTextSeparators = OUString( ScAsciiOptions::cDefaultTextSep ); >+// } > maFieldSeparators = String(sFieldSeparators); > > if( bMergeDelimiters ) >@@ -299,7 +306,9 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > if( nFromRow != 1 ) > aNfRow.SetValue( nFromRow ); > >- rtl::OString sString(rtl::OUStringToOString(maFieldSeparators, >+ // Set Separators in the dialog from maFiledSeparators >+ SetSeparators(); >+/* rtl::OString sString(rtl::OUStringToOString(maFieldSeparators, > RTL_TEXTENCODING_MS_1252)); > const sal_Char *aSep = sString.getStr(); > int len = maFieldSeparators.Len(); >@@ -315,7 +324,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, > aCkbOther.Check(); > aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) ); > } >- } >+ }*/ > > // Get Separators from the dialog > maFieldSeparators = GetSeparators(); >@@ -537,6 +546,8 @@ void ScImportAsciiDlg::SetTextToColumnsMode() > aLbCustomLang.Disable(); > aFtRow.Disable(); > aNfRow.Disable(); >+ maFieldSeparators = OUString('\t' ); // should also be saved in settings? >+ SetSeparators(); > > // Quoted field as text option is not used for text-to-columns mode. > aCkbQuotedAsText.Check(false); >@@ -549,16 +560,43 @@ void ScImportAsciiDlg::SetTextToColumnsMode() > > void ScImportAsciiDlg::SaveParameters() > { >- if (!mbFileImport) >+// if (!mbFileImport) > // We save parameters only for file import. >- return; >+// 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()),mbFileImport ); >+} >+ >+void ScImportAsciiDlg::SetSeparators() >+{ >+ aCkbTab.Check(false); >+ aCkbSemicolon.Check(false); >+ aCkbComma.Check(false); >+ aCkbSpace.Check(false); >+// aEdOther.SetText('\0'); >+ aCkbOther.Check(false); >+ 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/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx >index c45b9ac..39d32c2 100644 >--- a/sc/source/ui/inc/scuiasciiopt.hxx >+++ b/sc/source/ui/inc/scuiasciiopt.hxx >@@ -109,6 +109,8 @@ public: > private: > /** Sets the selected char set data to meCharSet and mbCharSetSystem. */ > void SetSelectedCharSet(); >+ /** Set separators in ui from maFieldSeprators */ >+ void SetSeparators(); > /** Returns all separator characters in a string. */ > String GetSeparators() const; > >diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx >index 6f7e890..7faeedd 100644 >--- a/sc/source/ui/view/viewfun5.cxx >+++ b/sc/source/ui/view/viewfun5.cxx >@@ -346,6 +346,7 @@ sal_Bool ScViewFunc::PasteDataFormat( sal_uLong nFormatId, > { > 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