[Libreoffice-commits] .: Branch 'feature/gsoc-calc-perf2' - 4 commits - sc/source

Daniel Bankston dbank at kemper.freedesktop.org
Sat Jul 21 01:06:30 PDT 2012


 sc/source/core/tool/scmatrix.cxx               |   11 ++++++++---
 sc/source/filter/xml/XMLStylesImportHelper.cxx |   16 ----------------
 sc/source/filter/xml/XMLStylesImportHelper.hxx |    1 -
 sc/source/filter/xml/xmlcelli.cxx              |    3 ++-
 sc/source/filter/xml/xmlimprt.cxx              |    3 +--
 5 files changed, 11 insertions(+), 23 deletions(-)

New commits:
commit 1283ad599c6ecb8dbfaefd1d74d948de9c2def96
Author: Daniel Bankston <daniel.e.bankston at gmail.com>
Date:   Sat Jul 21 03:03:42 2012 -0500

    Use correct date/datetime format for formula cells and value cells.
    
    Change-Id: I37816eba909caa71aca95c5181daeea1751b6c5a

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index e619d10..21c2d14 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -260,6 +260,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
     {
         if (nCellType == util::NumberFormat::TEXT)
             bFormulaTextResult = true;
+        if(nCellType == util::NumberFormat::DATETIME)
+            nCellType = util::NumberFormat::UNDEFINED;
     }
     rXMLImport.GetStylesImportHelper()->SetAttributes(pStyleName, pCurrencySymbol, nCellType);
 }
commit ed3cf367e82de833d91ce7f6612941700979b6a0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jul 20 23:31:06 2012 -0400

    It's much faster to pass value array in one go than individually.
    
    Change-Id: Iaf58915ab5c56ef5707f3a90a308c8b57cdc4fe9

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index d0d3fce..ccf786c 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -38,6 +38,8 @@
 
 #include <math.h>
 
+#include <vector>
+
 #include <mdds/multi_type_matrix.hpp>
 #include <mdds/multi_type_vector_types.hpp>
 #include <mdds/multi_type_vector_trait.hpp>
@@ -856,9 +858,12 @@ void ScMatrixImpl::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2,
 {
     if (ValidColRow( nC1, nR1) && ValidColRow( nC2, nR2))
     {
-        for (SCSIZE i = nR1; i <= nR2; ++i)
-            for (SCSIZE j = nC1; j <= nC2; ++j)
-                maMat.set(i, j, fVal);
+        for (SCSIZE j = nC1; j <= nC2; ++j)
+        {
+            // Passing value array is much faster.
+            std::vector<double> aVals(nR2-nR1+1, fVal);
+            maMat.set(nR1, j, aVals.begin(), aVals.end());
+        }
     }
     else
     {
commit ec8d713b1e44a37d86322bb451e9011d88fcb42d
Author: Daniel Bankston <daniel.e.bankston at gmail.com>
Date:   Fri Jul 20 18:20:54 2012 -0500

    Revert "Distinguish between DATE and DATETIME formats in ODS import"
    
    This reverts commit 4e5c55afee36d02bdfe4c0fb09e3b42e9eadb6c5.

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 26d01aa..e619d10 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -876,7 +876,6 @@ void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress& rCellPos,
                             case util::NumberFormat::PERCENT:
                             case util::NumberFormat::CURRENCY:
                             case util::NumberFormat::TIME:
-                            case util::NumberFormat::DATE:
                             case util::NumberFormat::DATETIME:
                             case util::NumberFormat::LOGICAL:
                             {
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 8168b54..4ff2c88 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1979,8 +1979,7 @@ ScXMLImport::ScXMLImport(
         { XML_FLOAT,        util::NumberFormat::NUMBER },
         { XML_STRING,       util::NumberFormat::TEXT },
         { XML_TIME,         util::NumberFormat::TIME },
-        { XML_DATE,         util::NumberFormat::DATE },
-        { XML_DATE_TIME,    util::NumberFormat::DATETIME },
+        { XML_DATE,         util::NumberFormat::DATETIME },
         { XML_PERCENTAGE,   util::NumberFormat::PERCENT },
         { XML_CURRENCY,     util::NumberFormat::CURRENCY },
         { XML_BOOLEAN,      util::NumberFormat::LOGICAL }
commit f727c87eb5c440fb50c5ef783a3bfdd0720cbe6c
Author: Daniel Bankston <daniel.e.bankston at gmail.com>
Date:   Fri Jul 20 18:17:24 2012 -0500

    Revert "Fix cause of osl warning"
    
    This reverts commit 59b32886a48954f9dad96b3329d172ac73aaa065.

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index 2f54d6b..438ac0e 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -85,13 +85,6 @@ void ScMyStyleRanges::AddRange(const ScRange& rRange,
             mpTimeList->addRange(rRange);
         }
         break;
-        case util::NumberFormat::DATE:
-        {
-            if (!mpDateList)
-                mpDateList.reset(new ScSimpleRangeList);
-            mpDateList->addRange(rRange);
-        }
-        break;
         case util::NumberFormat::DATETIME:
         {
             if (!mpDateTimeList)
@@ -159,8 +152,6 @@ void ScMyStyleRanges::InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDo
         mpNumberList->insertCol(static_cast<SCCOL>(nCol), static_cast<SCTAB>(nTab));
     if (mpTimeList)
         mpTimeList->insertCol(static_cast<SCCOL>(nCol), static_cast<SCTAB>(nTab));
-    if (mpDateList)
-        mpDateList->insertCol(static_cast<SCCOL>(nCol), static_cast<SCTAB>(nTab));
     if (mpDateTimeList)
         mpDateTimeList->insertCol(static_cast<SCCOL>(nCol), static_cast<SCTAB>(nTab));
     if (mpPercentList)
@@ -214,13 +205,6 @@ void ScMyStyleRanges::SetStylesToRanges(const rtl::OUString* pStyleName, ScXMLIm
         SetStylesToRanges(aList, pStyleName, util::NumberFormat::TIME, NULL, rImport);
         mpTimeList->clear();
     }
-    if (mpDateList)
-    {
-        list<ScRange> aList;
-        mpDateList->getRangeList(aList);
-        SetStylesToRanges(aList, pStyleName, util::NumberFormat::DATE, NULL, rImport);
-        mpDateList->clear();
-    }
     if (mpDateTimeList)
     {
         list<ScRange> aList;
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 87765f3..6a988d0 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -97,7 +97,6 @@ class ScMyStyleRanges : public SvRefBase
     ::boost::shared_ptr<ScSimpleRangeList> mpTextList;
     ::boost::shared_ptr<ScSimpleRangeList> mpNumberList;
     ::boost::shared_ptr<ScSimpleRangeList> mpTimeList;
-    ::boost::shared_ptr<ScSimpleRangeList> mpDateList;
     ::boost::shared_ptr<ScSimpleRangeList> mpDateTimeList;
     ::boost::shared_ptr<ScSimpleRangeList> mpPercentList;
     ::boost::shared_ptr<ScSimpleRangeList> mpLogicalList;


More information about the Libreoffice-commits mailing list