diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/colorscale.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 8a5b203aca05..2d5839f5111e 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 33aff616ce9f..728d23e4f927 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 d14ce8aae467..0c9cc37d1707 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); |