[Libreoffice-commits] .: 6 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jan 26 17:35:55 PST 2013


 sc/source/core/data/colorscale.cxx             |   16 ++++++++++++++--
 sc/source/filter/xml/XMLStylesImportHelper.cxx |   19 ++++---------------
 sc/source/filter/xml/XMLStylesImportHelper.hxx |   12 ++++--------
 sc/source/filter/xml/xmlcelli.hxx              |    4 ++--
 sc/source/filter/xml/xmlcondformat.cxx         |    6 ++----
 5 files changed, 26 insertions(+), 31 deletions(-)

New commits:
commit 6a82a9908cc5b911dd6783cab69ed3dcb6ba66bb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jan 27 02:34:00 2013 +0100

    we need to parse the cell address after import, fdo#59843
    
    Otherwise we may have problems with sheet names from sheets that are not
    yet imported.
    
    Change-Id: I99a6507567b7d1018b790a90019cd563fa7323a0

diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index 1f0a31b..571426c 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -578,12 +578,10 @@ ScXMLCondContext::ScXMLCondContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     rtl::OUString aExpr2;
     ScConditionMode eMode;
     GetConditionData(sExpression, eMode, aExpr1, aExpr2);
-    ScAddress aPos;
-    sal_Int32 nIndex = 0;
-    ScRangeStringConverter::GetAddressFromString(aPos, sAddress, GetScImport().GetDocument(), formula::FormulaGrammar::CONV_ODF, nIndex);
 
-    ScCondFormatEntry* pFormatEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, GetScImport().GetDocument(), aPos, sStyle,
+    ScCondFormatEntry* pFormatEntry = new ScCondFormatEntry(eMode, aExpr1, aExpr2, GetScImport().GetDocument(), ScAddress(), sStyle,
                                                         rtl::OUString(), rtl::OUString(), formula::FormulaGrammar::GRAM_ODFF, formula::FormulaGrammar::GRAM_ODFF);
+    pFormatEntry->SetSrcString(sAddress);
 
     pFormat->AddEntry(pFormatEntry);
 }
commit 7bd35614757e4e97913ed9b9d3344f800e8514b2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jan 27 00:04:53 2013 +0100

    prevent some unnecessary cycles for large cond format ranges
    
    Change-Id: I48f03a897d1ca876bba0d0becf6b51a300970346

diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 558b16c..bef5aca 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -291,9 +291,21 @@ std::vector<double>& ScColorFormat::getValues() const
         {
             const ScRange* pRange = aRanges[i];
             SCTAB nTab = pRange->aStart.Tab();
-            for(SCCOL nCol = pRange->aStart.Col(); nCol <= pRange->aEnd.Col(); ++nCol)
+
+            SCCOL nColStart = pRange->aStart.Col();
+            SCROW nRowStart = pRange->aStart.Row();
+            SCCOL nColEnd = pRange->aEnd.Col();
+            SCROW nRowEnd = pRange->aEnd.Row();
+
+            if(nRowEnd == MAXROW)
+            {
+                bool bShrunk = false;
+                mpDoc->ShrinkToUsedDataArea(bShrunk, nTab, nColStart, nRowStart,
+                        nColEnd, nRowEnd, false);
+            }
+            for(SCCOL nCol = nColStart; nCol <= nColEnd; ++nCol)
             {
-                for(SCROW nRow = pRange->aStart.Row(); nRow <= pRange->aEnd.Row(); ++nRow)
+                for(SCROW nRow = nRowStart; nRow <= nRowEnd; ++nRow)
                 {
                     ScAddress aAddr(nCol, nRow, nTab);
                     CellType eType = mpDoc->GetCellType(aAddr);
commit 6033eaf5b85e01da61628c65ee92292eb2974617
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 23:32:03 2013 +0100

    we need to use SCROW for row numbers, fdo#59894
    
    This caused an overflow and resulted in adding endless number of values
    until a bad_alloc was thrown.
    
    Change-Id: I954acd801eb18e2c2fe6a449048856cb95d0d8b0

diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 3d36b4d..558b16c 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -293,7 +293,7 @@ std::vector<double>& ScColorFormat::getValues() const
             SCTAB nTab = pRange->aStart.Tab();
             for(SCCOL nCol = pRange->aStart.Col(); nCol <= pRange->aEnd.Col(); ++nCol)
             {
-                for(SCCOL nRow = pRange->aStart.Row(); nRow <= pRange->aEnd.Row(); ++nRow)
+                for(SCROW nRow = pRange->aStart.Row(); nRow <= pRange->aEnd.Row(); ++nRow)
                 {
                     ScAddress aAddr(nCol, nRow, nTab);
                     CellType eType = mpDoc->GetCellType(aAddr);
commit bfc674c2cedfa8a07a67e71d1ca976e2556bef4d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 15:20:18 2013 +0100

    remove some parameters
    
    Change-Id: Ib812d7092c0f375f253a3db2929b2ea6b63806fa

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index d2cfa21..c725de1 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -49,9 +49,7 @@ ScMyStyleRanges::~ScMyStyleRanges()
     delete pCurrencyList;
 }
 
-void ScMyStyleRanges::AddRange(const ScRange& rRange,
-    const rtl::OUString* /*pStyleName*/, const sal_Int16 nType,
-    ScXMLImport& /*rImport*/)
+void ScMyStyleRanges::AddRange(const ScRange& rRange, const sal_Int16 nType)
 {
     switch (nType)
     {
@@ -112,9 +110,7 @@ void ScMyStyleRanges::AddRange(const ScRange& rRange,
     }
 }
 
-void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange,
-    const rtl::OUString* /*pStyleName*/, const rtl::OUString* pCurrency,
-    ScXMLImport& /*rImport*/)
+void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange, const rtl::OUString* pCurrency)
 {
     if (!pCurrencyList)
         pCurrencyList = new ScMyCurrencyStylesSet();
@@ -354,11 +350,9 @@ void ScMyStylesImportHelper::AddSingleRange(const ScRange& rRange)
     if (aItr != aCellStyles.end())
     {
         if (nPrevCellType != util::NumberFormat::CURRENCY)
-            aItr->xRanges->AddRange(rRange, pPrevStyleName, nPrevCellType,
-                rImport);
+            aItr->xRanges->AddRange(rRange, nPrevCellType);
         else
-            aItr->xRanges->AddCurrencyRange(rRange, pPrevStyleName, pPrevCurrency,
-                rImport);
+            aItr->xRanges->AddCurrencyRange(rRange, pPrevCurrency);
     }
 }
 
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 1d8459e..395a287 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -100,12 +100,8 @@ class ScMyStyleRanges : public SvRefBase
 public:
     ScMyStyleRanges();
     ~ScMyStyleRanges();
-    void AddRange(const ScRange& rRange,
-        const rtl::OUString* pStyleName, const sal_Int16 nType,
-        ScXMLImport& rImport);
-    void AddCurrencyRange(const ScRange& rRange,
-        const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
-        ScXMLImport& rImport);
+    void AddRange(const ScRange& rRange, const sal_Int16 nType);
+    void AddCurrencyRange(const ScRange& rRange, const rtl::OUString* pCurrency);
     void InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* pDoc);
     void SetStylesToRanges(const rtl::OUString* pStyleName, ScXMLImport& rImport);
 };
commit b99893b40297c4e82616bea8dab6bc9d82d25b2d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 15:12:33 2013 +0100

    remove unneeded variable
    
    Change-Id: Ic422a31252d60ddbafdfc05104b704ff9ffc4274

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.cxx b/sc/source/filter/xml/XMLStylesImportHelper.cxx
index ea827ea..d2cfa21 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.cxx
@@ -51,7 +51,7 @@ ScMyStyleRanges::~ScMyStyleRanges()
 
 void ScMyStyleRanges::AddRange(const ScRange& rRange,
     const rtl::OUString* /*pStyleName*/, const sal_Int16 nType,
-    ScXMLImport& /*rImport*/, const sal_uInt32 /*nMaxRanges*/)
+    ScXMLImport& /*rImport*/)
 {
     switch (nType)
     {
@@ -114,7 +114,7 @@ void ScMyStyleRanges::AddRange(const ScRange& rRange,
 
 void ScMyStyleRanges::AddCurrencyRange(const ScRange& rRange,
     const rtl::OUString* /*pStyleName*/, const rtl::OUString* pCurrency,
-    ScXMLImport& /*rImport*/, const sal_uInt32 /*nMaxRanges*/)
+    ScXMLImport& /*rImport*/)
 {
     if (!pCurrencyList)
         pCurrencyList = new ScMyCurrencyStylesSet();
@@ -248,7 +248,6 @@ ScMyStylesImportHelper::ScMyStylesImportHelper(ScXMLImport& rTempImport)
     pPrevStyleName(NULL),
     pCurrency(NULL),
     pPrevCurrency(NULL),
-    nMaxRanges(0),
     bPrevRangeAdded(true)
 {
 }
@@ -351,17 +350,15 @@ void ScMyStylesImportHelper::AddDefaultRange(const ScRange& rRange)
 
 void ScMyStylesImportHelper::AddSingleRange(const ScRange& rRange)
 {
-    if (nMaxRanges == 0)
-        nMaxRanges = aColDefaultStyles.size();
     ScMyStylesSet::iterator aItr(GetIterator(pPrevStyleName));
     if (aItr != aCellStyles.end())
     {
         if (nPrevCellType != util::NumberFormat::CURRENCY)
             aItr->xRanges->AddRange(rRange, pPrevStyleName, nPrevCellType,
-                rImport, nMaxRanges);
+                rImport);
         else
             aItr->xRanges->AddCurrencyRange(rRange, pPrevStyleName, pPrevCurrency,
-                rImport, nMaxRanges);
+                rImport);
     }
 }
 
@@ -472,7 +469,6 @@ void ScMyStylesImportHelper::EndTable()
         AddRange();
         bPrevRangeAdded = true;
     }
-    nMaxRanges = 0;
 }
 
 void ScMyStylesImportHelper::SetStylesToRanges()
@@ -486,7 +482,6 @@ void ScMyStylesImportHelper::SetStylesToRanges()
     }
     aColDefaultStyles.clear();
     aCellStyles.clear();
-    nMaxRanges = 0;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index b64411d..1d8459e 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -102,10 +102,10 @@ public:
     ~ScMyStyleRanges();
     void AddRange(const ScRange& rRange,
         const rtl::OUString* pStyleName, const sal_Int16 nType,
-        ScXMLImport& rImport, const sal_uInt32 nMaxRanges);
+        ScXMLImport& rImport);
     void AddCurrencyRange(const ScRange& rRange,
         const rtl::OUString* pStyleName, const rtl::OUString* pCurrency,
-        ScXMLImport& rImport, const sal_uInt32 nMaxRanges);
+        ScXMLImport& rImport);
     void InsertCol(const sal_Int32 nCol, const sal_Int32 nTab, ScDocument* pDoc);
     void SetStylesToRanges(const rtl::OUString* pStyleName, ScXMLImport& rImport);
 };
commit b02c52b467ff3259501350f2e6cb0de123f5b794
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 26 14:48:25 2013 +0100

    use isEmpty instead of getLength
    
    Change-Id: I9e5ce12776fcb31577a735296ab10b2c98c238f8

diff --git a/sc/source/filter/xml/XMLStylesImportHelper.hxx b/sc/source/filter/xml/XMLStylesImportHelper.hxx
index 12807db..b64411d 100644
--- a/sc/source/filter/xml/XMLStylesImportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesImportHelper.hxx
@@ -156,8 +156,8 @@ class ScMyStylesImportHelper
     {
         return ((pFirst && pSecond && pFirst->equals(*pSecond)) ||
                 (!pFirst && !pSecond) ||
-                (!pFirst && pSecond && !pSecond->getLength()) ||
-                (!pSecond &&  pFirst && !pFirst->getLength()));
+                (!pFirst && pSecond && pSecond->isEmpty()) ||
+                (!pSecond && pFirst && pFirst->isEmpty()));
     }
 public:
     ScMyStylesImportHelper(ScXMLImport& rImport);
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 44d2733..9584d8e 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -19,7 +19,6 @@
 #ifndef SC_XMLCELLI_HXX
 #define SC_XMLCELLI_HXX
 
-#include <memory>
 #include "XMLDetectiveContext.hxx"
 #include "XMLCellRangeSourceContext.hxx"
 #include <xmloff/xmlictxt.hxx>
@@ -27,6 +26,7 @@
 
 #include "formula/grammar.hxx"
 #include <boost/optional.hpp>
+#include <boost/scoped_ptr.hpp>
 
 class ScXMLImport;
 class ScFormulaCell;
@@ -39,7 +39,7 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
     ::boost::optional< rtl::OUString > pOUTextContent;
     ::boost::optional< FormulaWithNamespace > pOUFormula;
     rtl::OUString* pContentValidationName;
-    ::std::auto_ptr< ScXMLAnnotationData > mxAnnotationData;
+    boost::scoped_ptr< ScXMLAnnotationData > mxAnnotationData;
     ScMyImpDetectiveObjVec* pDetectiveObjVec;
     ScMyImpCellRangeSource* pCellRangeSource;
     double      fValue;


More information about the Libreoffice-commits mailing list