sc/inc/colorscale.hxx | 2 ++ sc/source/core/data/colorscale.cxx | 29 +++++++++++++++++++++++++++++ sc/source/core/data/documen2.cxx | 2 ++ sc/source/core/data/documen3.cxx | 3 +++ sc/source/core/data/document.cxx | 9 +++++++++ 5 files changed, 45 insertions(+)
New commits: commit 03ca37a3034027e9ef4cf80814994007fd595a95 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Fri May 11 23:43:43 2012 +0200 update references in color scales Change-Id: Ie86cbd173a21e79d802a03fd112ea01c0cf44116 diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 2d5839f..54f0c59 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -56,6 +56,8 @@ public: 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); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); bool GetMin() const; bool GetMax() const; diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 728d23e..6a249ff 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -82,6 +82,15 @@ void ScColorScaleEntry::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab, SCTAB nTabN } } +void ScColorScaleEntry::UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) +{ + if(mpCell) + { + mpCell->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz ); + } +} + const Color& ScColorScaleEntry::GetColor() const { return maColor; @@ -390,6 +399,17 @@ void ScColorScaleFormat::UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab) } } +void ScColorScaleFormat::UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) +{ + maRanges.UpdateReference( eUpdateRefMode, mpDoc, rRange, nDx, nDy, nDz ); + + for(iterator itr = begin(); itr != end(); ++itr) + { + itr->UpdateReference(eUpdateRefMode, rRange, nDx, nDy, nDz); + } +} + bool ScColorScaleFormat::CheckEntriesForRel(const ScRange& rRange) const { bool bNeedUpdate = false; @@ -500,4 +520,13 @@ void ScColorScaleFormatList::UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab) } } +void ScColorScaleFormatList::UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) +{ + for(iterator itr = begin(); itr != end(); ++itr) + { + itr->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz ); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 605f9cd..1120f05 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -866,6 +866,8 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM // update conditional formats after table is inserted if ( pCondFormList ) pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); if ( pValidationList ) pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); // sheet names of references may not be valid until sheet is copied diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index f016df5..f1bce7b 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -79,6 +79,7 @@ #include "formulaparserpool.hxx" #include "clipparam.hxx" #include "sheetevents.hxx" +#include "colorscale.hxx" #include "queryentry.hxx" #include "globalnames.hxx" @@ -1006,6 +1007,8 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode, pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz ); UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz ); UpdateRefAreaLinks( eUpdateRefMode, aRange, nDx, nDy, nDz ); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz ); if ( pCondFormList ) pCondFormList->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz ); if ( pValidationList ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 52a8d7d..d24cb7f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -75,6 +75,7 @@ #include "markdata.hxx" #include "drwlayer.hxx" #include "conditio.hxx" +#include "colorscale.hxx" #include "validat.hxx" #include "prnsave.hxx" #include "chgtrack.hxx" @@ -477,6 +478,8 @@ bool ScDocument::InsertTab( SCTAB nPos, const rtl::OUString& rName, // update conditional formats after table is inserted if ( pCondFormList ) pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); if ( pValidationList ) pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); // sheet names of references are not valid until sheet is inserted @@ -565,6 +568,8 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rName // update conditional formats after table is inserted if ( pCondFormList ) pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets); if ( pValidationList ) pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets ); // sheet names of references are not valid until sheet is inserted @@ -629,6 +634,8 @@ bool ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc ) UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1 ); if ( pCondFormList ) pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 ); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 ); if ( pValidationList ) pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 ); if ( pUnoBroadcaster ) @@ -718,6 +725,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets, ScDocument* pRefUndoDoc UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1*nSheets ); if ( pCondFormList ) pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets ); + if ( mpColorScaleList ) + mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets ); if ( pValidationList ) pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets ); if ( pUnoBroadcaster ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits