diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-14 01:21:59 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-14 10:28:03 +0200 |
commit | 1ce2d70bc29b348f2f819d616a897e1dcb6a1a9f (patch) | |
tree | 7e51fe672a128ab42fc1e61ec3ef70623c8c1677 /sc | |
parent | 064c86b817c5d122af13f1bde26b51a992bf1fd9 (diff) |
tdf#91385, recalc cond format formulas during hard recalc
Change-Id: I54b650d228c89a15eb37294eb108ab736163a000
Reviewed-on: https://gerrit.libreoffice.org/57409
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/conditio.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/conditio.cxx | 33 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 2 |
3 files changed, 42 insertions, 0 deletions
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 31ca3531bf20..be9c1362742c 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -401,6 +401,7 @@ public: virtual void startRendering() override; bool NeedsRepaint() const; + void CalcAll(); protected: virtual void DataChanged() const; @@ -589,6 +590,9 @@ public: void startRendering(); void endRendering(); + + // Forced recalculation for formulas + void CalcAll(); }; // List of all conditional formats in a sheet @@ -654,6 +658,9 @@ public: void endRendering(); sal_uInt32 getMaxKey() const; + + /// Forced recalculation of formulas + void CalcAll(); }; #endif diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 018d9757c058..a13ccf622e4c 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1532,6 +1532,18 @@ ScFormatEntry* ScCondFormatEntry::Clone( ScDocument* pDoc ) const return new ScCondFormatEntry( pDoc, *this ); } +void ScConditionEntry::CalcAll() +{ + if (pFCell1 || pFCell2) + { + if (pFCell1) + pFCell1->SetDirty(); + if (pFCell2) + pFCell2->SetDirty(); + pCondFormat->DoRepaint(); + } +} + ScCondDateFormatEntry::ScCondDateFormatEntry( ScDocument* pDoc ) : ScFormatEntry( pDoc ) , meType(condformat::TODAY) @@ -2028,6 +2040,18 @@ void ScConditionalFormat::endRendering() } } +void ScConditionalFormat::CalcAll() +{ + for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr) + { + if ((*itr)->GetType() == ScFormatEntry::Type::Condition) + { + ScCondFormatEntry& rFormat = static_cast<ScCondFormatEntry&>(**itr); + rFormat.CalcAll(); + } + } +} + ScConditionalFormatList::ScConditionalFormatList(const ScConditionalFormatList& rList) { for(const_iterator itr = rList.begin(); itr != rList.end(); ++itr) @@ -2281,4 +2305,13 @@ sal_uInt32 ScConditionalFormatList::getMaxKey() const return nMax; } +void ScConditionalFormatList::CalcAll() +{ + for (const auto& aEntry : m_ConditionalFormats) + { + aEntry->CalcAll(); + } + +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index fe8b69035ad6..d2aa2a0a4d6e 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1877,6 +1877,8 @@ void ScTable::CalcAll() { for (SCCOL i=0; i < aCol.size(); i++) aCol[i].CalcAll(); + + mpCondFormatList->CalcAll(); } void ScTable::CompileAll( sc::CompileFormulaContext& rCxt ) |