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

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Mon Sep 12 18:33:19 PDT 2011


 sc/inc/document.hxx               |    1 +
 sc/qa/unit/filters-test.cxx       |    2 ++
 sc/qa/unit/helper/csv_handler.hxx |   21 ++++++++++++++++++---
 sc/source/core/data/document.cxx  |    8 ++++++++
 4 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 52f56d24019255561e60ea6375acf16462948300
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Sep 13 03:21:42 2011 +0200

    force always a full recalculation for ods, xls and xlsx in unit test
    
    we can't assume that always all formulas are recalculated, we might used
    cached results

diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index b07af3a..464cbff 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -196,6 +196,8 @@ ScDocShellRef FiltersTest::load(const rtl::OUString &rFilter, const rtl::OUStrin
     if (!xDocShRef->DoLoad(&aSrcMed))
         // load failed.
         xDocShRef.Clear();
+    else if (nFormat)
+        xDocShRef->DoHardRecalc(true);
 
     return xDocShRef;
 }
commit e7cd70302caec7d3cd06b4e72d3425b21cede3c0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Sep 13 03:11:09 2011 +0200

    make it possible to est formula string in csv files

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 64ceab9..77439d1 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -787,6 +787,7 @@ public:
     SC_DLLPUBLIC void           GetNumberFormatInfo( short& nType, sal_uLong& nIndex,
                         const ScAddress& rPos, const ScBaseCell* pCell ) const;
     void            GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula ) const;
+    SC_DLLPUBLIC void           GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rFormula ) const;
     SC_DLLPUBLIC void           GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const;
     SC_DLLPUBLIC CellType       GetCellType( const ScAddress& rPos ) const;
     SC_DLLPUBLIC void           GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const;
diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx
index 5626984..59436e2 100644
--- a/sc/qa/unit/helper/csv_handler.hxx
+++ b/sc/qa/unit/helper/csv_handler.hxx
@@ -32,11 +32,15 @@
 class csv_handler
 {
 public:
-    csv_handler(ScDocument* pDoc, SCTAB nTab):
+
+    enum StringType { PureString, FormulaString };
+
+    csv_handler(ScDocument* pDoc, SCTAB nTab, StringType aType = PureString):
             mpDoc(pDoc),
             mnCol(0),
             mnRow(0),
-            mnTab(nTab)     {}
+            mnTab(nTab),
+            maStringType(aType)  {}
 
     void begin_parse()
     {
@@ -70,7 +74,17 @@ public:
         if (*pRemainingChars)
         {
             rtl::OUString aString;
-            mpDoc->GetString(mnCol, mnRow, mnTab, aString);
+            switch (maStringType)
+            {
+                case PureString:
+                    mpDoc->GetString(mnCol, mnRow, mnTab, aString);
+                    break;
+                case FormulaString:
+                    mpDoc->GetFormula(mnCol, mnRow, mnTab, aString);
+                    break;
+                default:
+                    break;
+            }
             rtl::OUString aCSVString(p, n, RTL_TEXTENCODING_UTF8);
 #if DEBUG_CSV_HANDLER
             std::cout << "String: " << rtl::OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
@@ -94,4 +108,5 @@ private:
     SCCOL mnCol;
     SCROW mnRow;
     SCTAB mnTab;
+    StringType maStringType;
 };
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 0b561ab..e06f650 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3154,6 +3154,14 @@ void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormul
 }
 
 
+void ScDocument::GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rFormula) const
+{
+    String aString;
+    GetFormula(nCol, nRow, nTab, aString);
+    rFormula = aString;
+}
+
+
 CellType ScDocument::GetCellType( const ScAddress& rPos ) const
 {
     SCTAB nTab = rPos.Tab();


More information about the Libreoffice-commits mailing list