sc/inc/colorscale.hxx                     |    1 +
 sc/source/core/data/colorscale.cxx        |   22 ++++++++++++++++++++++
 sc/source/filter/oox/condformatbuffer.cxx |    2 --
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 7e934dcf1b8a9147ce703658aea655403716e5df
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Fri May 11 07:39:26 2012 +0200

    we need to update the formulas now too
    
    Change-Id: I558e1d53339fc4284e8272342846f7bc108df111

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 8a5b203..2d5839f 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -55,6 +55,7 @@ public:
     const Color& GetColor() const;
     double GetValue() const;
     void SetFormula(const rtl::OUString& rFormula, ScDocument* pDoc, const 
ScAddress& rAddr, formula::FormulaGrammar::Grammar eGrammar = 
formula::FormulaGrammar::GRAM_DEFAULT);
+    void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab, SCTAB nTabNo);
 
     bool GetMin() const;
     bool GetMax() const;
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 33aff61..728d23e 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -74,6 +74,14 @@ double ScColorScaleEntry::GetValue() const
     return mnVal;
 }
 
+void ScColorScaleEntry::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab, SCTAB 
nTabNo )
+{
+    if(mpCell)
+    {
+        mpCell->UpdateMoveTab( nOldTab, nNewTab, nTabNo );
+    }
+}
+
 const Color& ScColorScaleEntry::GetColor() const
 {
     return maColor;
@@ -341,17 +349,22 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
     size_t n = maRanges.size();
     SCTAB nMinTab = std::min<SCTAB>(nOldTab, nNewTab);
     SCTAB nMaxTab = std::max<SCTAB>(nOldTab, nNewTab);
+    SCTAB nThisTab = -1;
     for(size_t i = 0; i < n; ++i)
     {
         ScRange* pRange = maRanges[i];
         SCTAB nTab = pRange->aStart.Tab();
         if(nTab < nMinTab || nTab > nMaxTab)
+        {
+            nThisTab = nTab;
             continue;
+        }
 
         if(nTab == nOldTab)
         {
             pRange->aStart.SetTab(nNewTab);
             pRange->aEnd.SetTab(nNewTab);
+            nThisTab = nNewTab;
             continue;
         }
 
@@ -359,13 +372,22 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, 
SCTAB nNewTab)
         {
             pRange->aStart.IncTab();
             pRange->aEnd.IncTab();
+            nThisTab = nTab + 1;
         }
         else
         {
             pRange->aStart.IncTab(-1);
             pRange->aEnd.IncTab(-1);
+            nThisTab = nTab - 1;
         }
     }
+
+    if(nThisTab == -1)
+        nThisTab = 0;
+    for(iterator itr = begin(); itr != end(); ++itr)
+    {
+        itr->UpdateMoveTab(nOldTab, nNewTab, nThisTab);
+    }
 }
 
 bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index d14ce8a..0c9cc37 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -227,8 +227,6 @@ void ColorScaleRule::importColor( const AttributeList& 
rAttribs )
 
 void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* 
pDoc, const ScAddress& rAddr )
 {
-    //assume that both vectors contain the same entries
-    // TODO: check it
     for(size_t i = 0; i < maColorScaleRuleEntries.size(); ++i)
     {
         ScColorScaleEntry* pEntry = new 
ScColorScaleEntry(maColorScaleRuleEntries[i].mnVal, 
maColorScaleRuleEntries[i].maColor);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to