sc/inc/colorscale.hxx | 1 + sc/inc/conditio.hxx | 5 +++++ sc/source/core/data/colorscale.cxx | 6 ++++++ sc/source/core/data/conditio.cxx | 20 ++++++++++++++++++++ sc/source/core/data/table2.cxx | 3 +++ 5 files changed, 35 insertions(+)
New commits: commit 7ba30bc3eb03d2e4be7190496e42291a599cc304 Author: Henry Castro <[email protected]> AuthorDate: Thu May 11 16:07:10 2023 -0400 Commit: Henry Castro <[email protected]> CommitDate: Fri May 12 20:02:05 2023 +0200 sc: add "updateValues" method to conditional format list When copying a range cells to a clipboard, if exists a color scale conditional format from different ranges, it should update the min and max values, otherwise the color scale conditional format could not calculate min and max values due to limiting range cell copied. Signed-off-by: Henry Castro <[email protected]> Change-Id: I660e18090a60b99ddf2b55ce1f713fd41121290e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151685 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index de74030dbc85..9923eac4c572 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -229,6 +229,7 @@ public: virtual void startRendering() override; virtual void endRendering() override; + virtual void updateValues() override; protected: std::vector<double>& getValues() const; diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 5a131e5f6a10..08f188a7c5a9 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -252,6 +252,7 @@ public: virtual void startRendering(); virtual void endRendering(); + virtual void updateValues(); protected: ScDocument* mpDoc; @@ -599,6 +600,8 @@ public: void startRendering(); void endRendering(); + void updateValues(); + // Forced recalculation for formulas void CalcAll(); }; @@ -684,6 +687,8 @@ public: void startRendering(); void endRendering(); + void updateValues(); + sal_uInt32 getMaxKey() const; /// Forced recalculation of formulas diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 74b80ef2ecf3..34cdb91511d2 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -512,6 +512,12 @@ void ScColorFormat::endRendering() mpCache.reset(); } +void ScColorFormat::updateValues() +{ + getMinValue(); + getMaxValue(); +} + namespace { sal_uInt8 GetColorValue( double nVal, double nVal1, sal_uInt8 nColVal1, double nVal2, sal_uInt8 nColVal2 ) diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 3634a5b07c0a..dba0710f2448 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -74,6 +74,10 @@ void ScFormatEntry::endRendering() { } +void ScFormatEntry::updateValues() +{ +} + static bool lcl_HasRelRef( ScDocument* pDoc, const ScTokenArray* pFormula, sal_uInt16 nRecursion = 0 ) { if (pFormula) @@ -2063,6 +2067,14 @@ void ScConditionalFormat::endRendering() } } +void ScConditionalFormat::updateValues() +{ + for(auto& rxEntry : maEntries) + { + rxEntry->updateValues(); + } +} + void ScConditionalFormat::CalcAll() { for(const auto& rxEntry : maEntries) @@ -2310,6 +2322,14 @@ void ScConditionalFormatList::endRendering() } } +void ScConditionalFormatList::updateValues() +{ + for (auto const& it : m_ConditionalFormats) + { + it->updateValues(); + } +} + void ScConditionalFormatList::clear() { m_ConditionalFormats.clear(); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 543944c18a25..a7d073c89966 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -529,7 +529,10 @@ void ScTable::CopyToClip( for (SCCOL i = nCol1; i <= nCol2; i++) pTable->aCol[i].RemoveProtected(nRow1, nRow2); + mpCondFormatList->startRendering(); + mpCondFormatList->updateValues(); pTable->mpCondFormatList.reset(new ScConditionalFormatList(pTable->rDocument, *mpCondFormatList)); + mpCondFormatList->endRendering(); } void ScTable::CopyToClip(
