sc/inc/colorscale.hxx | 2 ++ sc/source/core/data/colorscale.cxx | 15 +++++++++++++++ 2 files changed, 17 insertions(+)
New commits: commit 3fc2dce9d332268a93c854e9badf12b9076b1457 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu May 11 16:23:03 2023 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Fri May 12 22:25:16 2023 +0200 sc: copy cache values when clone color conditional format When clone a conditional format list, also copy the cache values that hold the min and max values, otherwise if clone occurs when copying to the clipboard the values have wrong data due to limiting range cells copied. Signed-off-by: Henry Castro <hcas...@collabora.com> Change-Id: Id9085a1488a3bde24842e0d2e062c9b425074157 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151686 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 9923eac4c572..fc5c34dda287 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -224,6 +224,8 @@ public: virtual ~ScColorFormat() override; const ScRangeList& GetRange() const; + void SetCache(const std::vector<double>& aValues); + std::vector<double> GetCache() const; virtual void SetParent(ScConditionalFormat* pParent) override; diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 34cdb91511d2..c8f8d84f1873 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -379,6 +379,9 @@ ScColorScaleFormat::ScColorScaleFormat(ScDocument* pDoc, const ScColorScaleForma { maColorScales.emplace_back(new ScColorScaleEntry(pDoc, *rxEntry)); } + + auto aCache = rFormat.GetCache(); + SetCache(aCache); } ScColorFormat* ScColorScaleFormat::Clone(ScDocument* pDoc) const @@ -440,6 +443,18 @@ const ScRangeList& ScColorFormat::GetRange() const return mpParent->GetRange(); } +std::vector<double> ScColorFormat::GetCache() const +{ + std::vector<double> empty; + return mpCache ? mpCache->maValues : empty; +} + +void ScColorFormat::SetCache(const std::vector<double>& aValues) +{ + mpCache.reset(new ScColorFormatCache); + mpCache->maValues = aValues; +} + std::vector<double>& ScColorFormat::getValues() const { if(!mpCache)