[Libreoffice-commits] .: 4 commits - sc/inc sc/qa sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Fri Jul 20 12:03:00 PDT 2012


 sc/inc/orcus/csv_parser.hpp                           |    3 +
 sc/qa/unit/data/contentCSV/conditionalFormatting.csv  |    4 +-
 sc/qa/unit/data/contentCSV/information-functions.csv  |   32 +++++++++---------
 sc/qa/unit/data/contentCSV/logical-functions.csv      |    8 ++--
 sc/qa/unit/data/contentCSV/mathematical-functions.csv |   26 +++++++-------
 sc/qa/unit/data/contentCSV/numberFormat.csv           |   10 ++---
 sc/qa/unit/data/contentCSV/spreadsheet-functions.csv  |    8 ++--
 sc/qa/unit/helper/qahelper.hxx                        |    1 
 sc/qa/unit/subsequent_filters-test.cxx                |    2 -
 sc/source/core/data/column2.cxx                       |   11 +++---
 10 files changed, 53 insertions(+), 52 deletions(-)

New commits:
commit 58d4ab69112ca1e1125b59a908fc48bb2f92c08f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jul 20 20:57:43 2012 +0200

    adapt csv parser, don't trim whitespaces
    
    Change-Id: Iff43b5971bbbd2fd31e7dac5e99f2c94c5d75f4c

diff --git a/sc/qa/unit/data/contentCSV/conditionalFormatting.csv b/sc/qa/unit/data/contentCSV/conditionalFormatting.csv
index 6b43e46..ac8d212 100644
--- a/sc/qa/unit/data/contentCSV/conditionalFormatting.csv
+++ b/sc/qa/unit/data/contentCSV/conditionalFormatting.csv
@@ -1,2 +1,2 @@
--$2,$0, 1 1/5, 1.23E+004
-05:35, 0.00 USD, 1500%, 01/02/00
+-$2,$0,1 1/5,1.23E+004
+05:35,0.00 USD,1500%,01/02/00
diff --git a/sc/qa/unit/data/contentCSV/information-functions.csv b/sc/qa/unit/data/contentCSV/information-functions.csv
index e332b8f..660c910 100644
--- a/sc/qa/unit/data/contentCSV/information-functions.csv
+++ b/sc/qa/unit/data/contentCSV/information-functions.csv
@@ -1,18 +1,18 @@
-27, 1, 4, $E$1, $Logical.$A$1, 4, b, v, l
+27,1,4,$E$1,$Logical.$A$1,4,b,v,l
 6
-"=CELL(""ROW"",AA1)", "=ADDRESS(2,3)"
-FALSE, TRUE, FALSE
-FALSE, TRUE, FALSE, TRUE
-TRUE, FALSE, TRUE, TRUE
-1, 0, 0, 1
-TRUE, FALSE, FALSE
-FALSE, FALSE, FALSE, TRUE
-TRUE, FALSE, FALSE, FALSE
-TRUE, TRUE, FALSE
-TRUE, FALSE, TRUE
-1, 0, 0, 1, 0
-TRUE, TRUE, FALSE, FALSE, FALSE, FALSE
-FALSE, TRUE, FALSE, TRUE
-0, 1, 42, 0
+"=CELL(""ROW"",AA1)","=ADDRESS(2,3)"
+FALSE,TRUE,FALSE
+FALSE,TRUE,FALSE,TRUE
+TRUE,FALSE,TRUE,TRUE
+1,0,0,1
+TRUE,FALSE,FALSE
+FALSE,FALSE,FALSE,TRUE
+TRUE,FALSE,FALSE,FALSE
+TRUE,TRUE,FALSE
+TRUE,FALSE,TRUE
+1,0,0,1,0
+TRUE,TRUE,FALSE,FALSE,FALSE,FALSE
+FALSE,TRUE,FALSE,TRUE
+0,1,42,0
 #N/A
-1, 2, 8, 64, 16
+1,2,8,64,16
diff --git a/sc/qa/unit/data/contentCSV/logical-functions.csv b/sc/qa/unit/data/contentCSV/logical-functions.csv
index 2223baf..fd348f7 100644
--- a/sc/qa/unit/data/contentCSV/logical-functions.csv
+++ b/sc/qa/unit/data/contentCSV/logical-functions.csv
@@ -1,6 +1,6 @@
-FALSE, FALSE, FALSE, TRUE, FALSE
+FALSE,FALSE,FALSE,TRUE,FALSE
 FALSE
-TRUE, FALSE
-TRUE, FALSE
-FALSE, TRUE, TRUE, TRUE, TRUE
+TRUE,FALSE
+TRUE,FALSE
+FALSE,TRUE,TRUE,TRUE,TRUE
 TRUE
diff --git a/sc/qa/unit/data/contentCSV/mathematical-functions.csv b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
index cebf207..639bc2e 100644
--- a/sc/qa/unit/data/contentCSV/mathematical-functions.csv
+++ b/sc/qa/unit/data/contentCSV/mathematical-functions.csv
@@ -1,20 +1,20 @@
-0, 1, 10
-0.5, 0, 1
-0, Err:502
-0.5, 0.75, 0.25
+0,1,10
+0.5,0,1
+0,Err:502
+0.5,0.75,0.25
 3.1415926536
 1,1,3,-3,-5,5
 0,2,12,-4,-6,4
-4, Err:502, Err:502
-14, Err:502
-10, Err:502
-3, 48
-48, 3
-0.7071067812, "0.00"
-0.7071067812, -1
+4,Err:502,Err:502
+14,Err:502
+10,Err:502
+3,48
+48,3
+0.7071067812,"0.00"
+0.7071067812,-1
 8
 12
 5
-"1.2", "1", "0", "1000"
-2, 4, Err:502
+"1.2","1","0","1000"
+2,4,Err:502
 
diff --git a/sc/qa/unit/data/contentCSV/numberFormat.csv b/sc/qa/unit/data/contentCSV/numberFormat.csv
index 8120173..001d70f 100644
--- a/sc/qa/unit/data/contentCSV/numberFormat.csv
+++ b/sc/qa/unit/data/contentCSV/numberFormat.csv
@@ -1,6 +1,6 @@
-2.00, -3.00
-40.10%, -22%
-"$12,345.00", "-$1,234.00"
-2.59E+005, -2.35E+03
+2.00,-3.00
+40.10%,-22%
+"$12,345.00","-$1,234.00"
+2.59E+005,-2.35E+03
 25 31/82
-FALSE, TRUE
+FALSE,TRUE
diff --git a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
index 83a33b2..6dbc97a 100644
--- a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
+++ b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv
@@ -1,4 +1,4 @@
-$C$2, $A$1, Sheet.B$2, Sheet!R2C2
-2, 4, 4, 5, 6, 15, 15, 6, 9
-1, 3, 4, 4, 2, 2
-2, 4, 7, 8, 4
+$C$2,$A$1,Sheet.B$2,Sheet!R2C2
+2,4,4,5,6,15,15,6,9
+1,3,4,4,2,2
+2,4,7,8,4
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 0974e70..e29415c 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -78,6 +78,7 @@ void testFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab, StringType
     aConfig.delimiters.push_back(',');
     aConfig.delimiters.push_back(';');
     aConfig.text_qualifier = '"';
+    aConfig.trim_cell_value = false;
 
 
     std::string aContent;
commit dbad63f5a48b037c0187ea63888bd43a42796917
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jul 20 20:57:24 2012 +0200

    enable the csv import test
    
    Change-Id: I15d5a66bbd6daf91f01bc6c075978aea83e04b9d

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 6688e0f..23b298f 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -165,9 +165,7 @@ public:
     CPPUNIT_TEST(testMergedCellsODS);
     CPPUNIT_TEST(testRepeatedColumnsODS);
     CPPUNIT_TEST(testDataValidityODS);
-#if 0
     CPPUNIT_TEST(testBrokenQuotesCSV);
-#endif
     CPPUNIT_TEST(testSharedFormulaXLSX);
     CPPUNIT_TEST(testCellValueXLSX);
     CPPUNIT_TEST(testControlImport);
commit 7e3df9695ca5bd74fe16953510a5670cb806ac39
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jul 20 20:55:12 2012 +0200

    don't trim whitespaces in csv parser if not requested
    
    Change-Id: Icf8cfec3093651661c0a2b477e955bbc0fac93fe

diff --git a/sc/inc/orcus/csv_parser.hpp b/sc/inc/orcus/csv_parser.hpp
index 77f8a3c..d1bb596 100644
--- a/sc/inc/orcus/csv_parser.hpp
+++ b/sc/inc/orcus/csv_parser.hpp
@@ -196,7 +196,8 @@ void csv_parser<_Handler>::row()
 
         assert(is_delim(c));
         next();
-        skip_blanks();
+        if(m_config.trim_cell_value)
+            skip_blanks();
     }
 }
 
commit 3ccd2a487ab2f2550dc33dd87df045917b0c13c9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jul 20 18:57:22 2012 +0200

    cache calls to size
    
    Change-Id: I7bb009e1250111f1c05c421ecfb5b62a75ab88d0

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 57a4e87..dba0fc6 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1317,22 +1317,23 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
     if (bThere && maItems[nIndex].pCell->IsBlank())
         bThere = false;
 
+    size_t nLastIndex = maItems.size() - 1;
     if (bThere)
     {
         SCROW nLast = rRow;
         SCSIZE nOldIndex = nIndex;
         if (bForward)
         {
-            if (nIndex<maItems.size()-1)
+            if (nIndex<nLastIndex)
             {
                 ++nIndex;
-                while (nIndex<maItems.size()-1 && maItems[nIndex].nRow==nLast+1
+                while (nIndex<nLastIndex && maItems[nIndex].nRow==nLast+1
                                         && !maItems[nIndex].pCell->IsBlank())
                 {
                     ++nIndex;
                     ++nLast;
                 }
-                if (nIndex==maItems.size()-1)
+                if (nIndex==nLastIndex)
                     if (maItems[nIndex].nRow==nLast+1 && !maItems[nIndex].pCell->IsBlank())
                         ++nLast;
             }
@@ -1366,9 +1367,9 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, long nMovY) const
     {
         if (bForward)
         {
-            while (nIndex<maItems.size() && maItems[nIndex].pCell->IsBlank())
+            while (nIndex<nLastIndex+1 && maItems[nIndex].pCell->IsBlank())
                 ++nIndex;
-            if (nIndex<maItems.size())
+            if (nIndex<nLastIndex+1)
                 rRow = maItems[nIndex].nRow;
             else
                 rRow = MAXROW;


More information about the Libreoffice-commits mailing list