[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jun 8 15:45:58 PDT 2009


 patches/dev300/apply                                      |    3 
 patches/dev300/calc-csv-import-custom-lang-officecfg.diff |   27 +++
 patches/dev300/calc-csv-import-custom-lang-sc.diff        |  115 +++++++++++---
 3 files changed, 126 insertions(+), 19 deletions(-)

New commits:
commit 90aabf700d090b7a085b99b7aef4a3fb3ba3519d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Jun 8 18:35:31 2009 -0400

    Store the new CSV import options to user configuration.
    
    See n#510168 for details.
    
    * patches/dev300/calc-csv-import-custom-lang-officecfg.diff:
    * patches/dev300/calc-csv-import-custom-lang-sc.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index ec44f87..e9a66cd 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1966,7 +1966,8 @@ calc-html-import-custom-lang-filter.diff,  n#484272, kohei
 calc-html-import-custom-lang-sc.diff,      n#484272, kohei
 
 # support alternative language & number options for csv import.
-calc-csv-import-custom-lang-sc.diff, n#510168, i#97416, kohei
+calc-csv-import-custom-lang-sc.diff,        n#510168, i#97416, kohei
+calc-csv-import-custom-lang-officecfg.diff, n#510168, i#97416, kohei
 
 # Don't duplicate merge flags when inserting a new row, to avoid merge flag 
 # corruption.
diff --git a/patches/dev300/calc-csv-import-custom-lang-officecfg.diff b/patches/dev300/calc-csv-import-custom-lang-officecfg.diff
new file mode 100644
index 0000000..4a42f00
--- /dev/null
+++ b/patches/dev300/calc-csv-import-custom-lang-officecfg.diff
@@ -0,0 +1,27 @@
+diff --git officecfg/registry/schema/org/openoffice/Office/Calc.xcs officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+index ef0bd3d..2f811b6 100644
+--- officecfg/registry/schema/org/openoffice/Office/Calc.xcs
++++ officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+@@ -1044,6 +1044,22 @@
+                     </info>
+                     <value>true</value>
+                 </prop>
++                <prop oor:name="DetectSpecialNumbers" oor:type="xs:boolean">
++                    <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">
++                    <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">
+                     <info>
+                         <author>muthusuba</author>
diff --git a/patches/dev300/calc-csv-import-custom-lang-sc.diff b/patches/dev300/calc-csv-import-custom-lang-sc.diff
index 6a962f8..ce7f8d3 100644
--- a/patches/dev300/calc-csv-import-custom-lang-sc.diff
+++ b/patches/dev300/calc-csv-import-custom-lang-sc.diff
@@ -612,33 +612,90 @@ index 5e9ba11..d08eedf 100644
      {
          Text [ en-US ] = "Text to Columns" ;
 diff --git sc/source/ui/dbgui/scuiasciiopt.cxx sc/source/ui/dbgui/scuiasciiopt.cxx
-index 83f051d..15d34c8 100644
+index 83f051d..c2a75b2 100644
 --- sc/source/ui/dbgui/scuiasciiopt.cxx
 +++ sc/source/ui/dbgui/scuiasciiopt.cxx
-@@ -119,8 +119,8 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
+@@ -69,6 +69,8 @@ using namespace com::sun::star::uno;
+ #define TEXT_SEPARATORS     "TextSeparators"
+ #define MERGE_DELIMITERS    "MergeDelimiters"
+ #define QUOTED_AS_TEXT      "QuotedFieldAsText"
++#define DETECT_SPECIAL_NUM  "DetectSpecialNumbers"
++#define LANGUAGE            "Language"
+ #define SEP_PATH            "Office.Calc/Dialogs/CSVImport"
+ 
+ // ============================================================================
+@@ -119,12 +121,13 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
  }
  
  static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, 
 -                             bool &bMergeDelimiters, bool& bQuotedAsText, bool &bFixedWidth, 
 -                             sal_Int32 &nFromRow, sal_Int32 &nCharSet )
 +                             bool &bMergeDelimiters, bool& bQuotedAsText, bool& bDetectSpecialNum, 
-+                             bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet )
++                             bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet,
++                             sal_Int32& nLanguage )
  {
      Sequence<Any>aValues;
      const Any *pProperties;
-@@ -159,8 +159,9 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato
+-    Sequence<OUString> aNames(7);
++    Sequence<OUString> aNames(9);
+     OUString* pNames = aNames.getArray();
+     ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+ 
+@@ -135,6 +138,8 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato
+     pNames[4] = OUString::createFromAscii( FROM_ROW );
+     pNames[5] = OUString::createFromAscii( CHAR_SET );
+     pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
++    pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM );
++    pNames[8] = OUString::createFromAscii( LANGUAGE );
+     aValues = aItem.GetProperties( aNames );
+     pProperties = aValues.getConstArray();
+     if( pProperties[1].hasValue() )
+@@ -157,16 +162,23 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato
+  
+     if ( pProperties[6].hasValue() )
          pProperties[6] >>= bQuotedAsText;
++
++    if ( pProperties[7].hasValue() )
++        pProperties[7] >>= bDetectSpecialNum;
++
++    if ( pProperties[8].hasValue() )
++        pProperties[8] >>= nLanguage;
  }
  
 -static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
 -                             bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
 +static void save_Separators( 
 +    String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
-+    bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet )
++    bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet, sal_Int32 nLanguage )
  {
      OUString sFieldSeparators = OUString( maSeparators );
      OUString sTextSeparators = OUString( maTxtSep );
-@@ -204,6 +205,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
+     Sequence<Any> aValues;
+     Any *pProperties;
+-    Sequence<OUString> aNames(7);
++    Sequence<OUString> aNames(9);
+     OUString* pNames = aNames.getArray();
+     ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) );
+ 
+@@ -177,6 +189,8 @@ static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDe
+     pNames[4] = OUString::createFromAscii( FROM_ROW );
+     pNames[5] = OUString::createFromAscii( CHAR_SET );
+     pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT );
++    pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM );
++    pNames[8] = OUString::createFromAscii( LANGUAGE );
+     aValues = aItem.GetProperties( aNames );
+     pProperties = aValues.getArray();
+     pProperties[1] <<= sFieldSeparators;
+@@ -186,6 +200,8 @@ static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDe
+     pProperties[4] <<= nFromRow;
+     pProperties[5] <<= nCharSet;
+     pProperties[6] <<= static_cast<sal_Bool>(bQuotedAsText);
++    pProperties[7] <<= static_cast<sal_Bool>(bDetectSpecialNum);
++    pProperties[8] <<= nLanguage;
+ 
+     aItem.PutProperties(aNames, aValues);
+ }
+@@ -204,6 +220,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
          aFlFieldOpt ( this, ScResId( FL_FIELDOPT ) ),
          aFtCharSet	( this, ScResId( FT_CHARSET ) ),
          aLbCharSet	( this, ScResId( LB_CHARSET ) ),
@@ -647,7 +704,7 @@ index 83f051d..15d34c8 100644
  
          aFtRow		( this, ScResId( FT_AT_ROW	) ),
          aNfRow		( this,	ScResId( NF_AT_ROW	) ),
-@@ -219,7 +222,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
+@@ -219,7 +237,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
          aCkbOther	( this, ScResId( CKB_OTHER ) ),
          aEdOther	( this, ScResId( ED_OTHER ) ),
          aCkbAsOnce	( this, ScResId( CB_ASONCE) ),
@@ -658,22 +715,31 @@ index 83f051d..15d34c8 100644
          aFtTextSep	( this, ScResId( FT_TEXTSEP ) ),
          aCbTextSep	( this, ScResId( CB_TEXTSEP ) ),
  
-@@ -260,12 +266,13 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
+@@ -260,18 +281,22 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
      bool bMergeDelimiters = false;
      bool bFixedWidth = false;
      bool bQuotedFieldAsText = true;
 +    bool bDetectSpecialNum = false;
      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, bFixedWidth, nFromRow, nCharSet);
-+                         bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet);
++                         bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage);
      maFieldSeparators = String(sFieldSeparators);
  
      if( bMergeDelimiters )
-@@ -344,6 +351,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
+         aCkbAsOnce.Check();
+     if (bQuotedFieldAsText)
+         aCkbQuotedAsText.Check();
++    if (bDetectSpecialNum)
++        aCkbDetectNumber.Check();
+     if( bFixedWidth )
+         aRbFixed.Check();
+     if( nFromRow != 1 )
+@@ -344,6 +369,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
      aCkbComma.SetClickHdl( aSeparatorHdl );
      aCkbAsOnce.SetClickHdl( aSeparatorHdl );
      aCkbQuotedAsText.SetClickHdl( aSeparatorHdl );
@@ -681,30 +747,31 @@ index 83f051d..15d34c8 100644
      aCkbSpace.SetClickHdl( aSeparatorHdl );
      aCkbOther.SetClickHdl( aSeparatorHdl );
      aEdOther.SetModifyHdl( aSeparatorHdl );
-@@ -363,6 +371,11 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
+@@ -363,6 +389,11 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName,
      SetSelectedCharSet();
      aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) );
  
 +    aLbCustomLang.SetLanguageList(
 +        LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
 +    aLbCustomLang.InsertLanguage(LANGUAGE_SYSTEM);
-+    aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM, true);
++    aLbCustomLang.SelectLanguage(static_cast<LanguageType>(nLanguage), true);
 +
      // *** column type ListBox ***
      xub_StrLen nCount = aColumnUser.GetTokenCount();
      for (xub_StrLen i=0; i<nCount; i++)
-@@ -393,8 +406,8 @@ ScImportAsciiDlg::~ScImportAsciiDlg()
+@@ -393,8 +424,9 @@ ScImportAsciiDlg::~ScImportAsciiDlg()
  {
      if (mbFileImport)
          save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), 
 -                         aCkbQuotedAsText.IsChecked(), aRbFixed.IsChecked(), 
 -                         aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
 +                         aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), 
-+                         aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos());
++                         aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos(),
++                         static_cast<sal_Int32>(aLbCustomLang.GetSelectLanguage()) );
      delete[] mpRowPosArray;
  }
  
-@@ -473,6 +486,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
+@@ -473,6 +505,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
  {
      rOpt.SetCharSet( meCharSet );
      rOpt.SetCharSetSystem( mbCharSetSystem );
@@ -712,7 +779,7 @@ index 83f051d..15d34c8 100644
      rOpt.SetFixedLen( aRbFixed.IsChecked() );
      rOpt.SetStartRow( (long)aNfRow.GetValue() );
      maTableBox.FillColumnData( rOpt );
-@@ -480,9 +494,11 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
+@@ -480,9 +513,11 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt )
      {
          rOpt.SetFieldSeps( GetSeparators() );
          rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() );
@@ -725,16 +792,28 @@ index 83f051d..15d34c8 100644
  }
  
  void ScImportAsciiDlg::SetTextToColumnsMode()
-@@ -490,6 +506,8 @@ void ScImportAsciiDlg::SetTextToColumnsMode()
+@@ -490,12 +525,19 @@ void ScImportAsciiDlg::SetTextToColumnsMode()
      SetText( maStrTextToColumns );
      aFtCharSet.Disable();
      aLbCharSet.Disable();
++    aFtCustomLang.Disable();
 +    aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM);
 +    aLbCustomLang.Disable();
      aFtRow.Disable();
      aNfRow.Disable();
  
-@@ -532,7 +550,6 @@ void ScImportAsciiDlg::SetupSeparatorCtrls()
+-    // Quoted field as text option is not used for text to columns mode.
++    // 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::SetSelectedCharSet()
+@@ -532,7 +574,6 @@ void ScImportAsciiDlg::SetupSeparatorCtrls()
      aCkbOther.Enable( bEnable );
      aEdOther.Enable( bEnable );
      aCkbAsOnce.Enable( bEnable );


More information about the ooo-build-commit mailing list