diff options
author | Eike Rathke <erack@redhat.com> | 2018-07-13 19:29:12 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-19 01:45:41 +0200 |
commit | 4e5248f32d8fdfd4655bd15bd60d83e9a0c6e540 (patch) | |
tree | f6f75bb2f047d291660dc500d6eaf52d5866db05 /formula | |
parent | cc2c11c2e4a99adf00d184507d6925c9af37e1bd (diff) |
Resolves: tdf#94925 proper recalc mode and dirty broadcast for OOXML import
This is a combination of 4 commits.
Rework FormulaTokenArray ScRecalcMode in preparation for tdf#94925
Strictly order the exclusive bits by priority, let AddRecalcMode()
handle all sets except forced ALWAYS or NORMAL.
Introduce ONLOAD_LENIENT and ONLOAD_MUST splitting ONLOAD to be
able to distinguish later during OOXML import.
Reviewed-on: https://gerrit.libreoffice.org/57402
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Resolves: tdf#94925 do not unset dirty if formula cell must be recalculated
Reviewed-on: https://gerrit.libreoffice.org/57404
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Broadcast formula cells marked for recalc, tdf#94925 related
In fact the ScDocument::CalcFormulaTree() call in
WorkbookFragment::recalcFormulaCells() never did anything because
no formula cell was added to the tree. Only visible dirty cells
were recalculated, but not their dependents.
Reviewed-on: https://gerrit.libreoffice.org/57431
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Remove the check for IsRecalcModeMustAfterImport(), tdf#94925 follow-up
It's now superfluous as we set those cells dirty and broadcast in
ScDocumentImport::broadcastRecalcAfterImport()
Reviewed-on: https://gerrit.libreoffice.org/57439
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
f70860b8babf1cce7fda2ae63412659e72dbb4c3
a9dd4ad16c20b23ee8a1d46b69a4702b1ad4c81f
188de2d53a2d54df32d24eeeb148c4f9e87e7cfc
Change-Id: I11217fa19adb766f509d0d6854502112de547c59
Reviewed-on: https://gerrit.libreoffice.org/57438
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 17 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 28 |
2 files changed, 29 insertions, 16 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index f5e06e77deba..4979310041e7 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -1424,14 +1424,15 @@ void FormulaCompiler::Factor() switch( eOp ) { // Functions recalculated on every document load. - // Don't use SetExclusiveRecalcModeOnLoad() which would - // override ModeAlways, use - // AddRecalcMode(ScRecalcMode::ONLOAD) instead. + // ONLOAD_LENIENT here to be able to distinguish and not + // force a recalc (if not in an ALWAYS or ONLOAD_MUST + // context) but keep an imported result from for example + // OOXML a DDE call. Will be recalculated for ODFF. case ocConvertOOo : case ocDde: case ocMacro: case ocExternal: - pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT ); break; // If the referred cell is moved the value changes. case ocColumn : @@ -1439,15 +1440,15 @@ void FormulaCompiler::Factor() pArr->SetRecalcModeOnRefMove(); break; // ocCell needs recalc on move for some possible type values. - // and recalc mode on load, fdo#60646 + // And recalc mode on load, tdf#60645 case ocCell : pArr->SetRecalcModeOnRefMove(); - pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD_MUST ); break; case ocHyperLink : - // cell with hyperlink needs to be calculated on load to + // Cell with hyperlink needs to be calculated on load to // get its matrix result generated. - pArr->AddRecalcMode( ScRecalcMode::ONLOAD ); + pArr->AddRecalcMode( ScRecalcMode::ONLOAD_MUST ); pArr->SetHyperLink( true); break; default: diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 42b19f8543c0..a8fb0b42541d 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -845,15 +845,27 @@ FormulaToken* FormulaTokenArray::AddStringXML( const OUString& rStr ) void FormulaTokenArray::AddRecalcMode( ScRecalcMode nBits ) { - //! Order is important. - if ( nBits & ScRecalcMode::ALWAYS ) - SetExclusiveRecalcModeAlways(); - else if ( !IsRecalcModeAlways() ) + const unsigned nExclusive = static_cast<sal_uInt8>(nBits & ScRecalcMode::EMask); + if (nExclusive) { - if ( nBits & ScRecalcMode::ONLOAD ) - SetExclusiveRecalcModeOnLoad(); - else if ( nBits & ScRecalcMode::ONLOAD_ONCE && !IsRecalcModeOnLoad() ) - SetExclusiveRecalcModeOnLoadOnce(); + unsigned nExBit; + if (nExclusive & (nExclusive - 1)) + { + // More than one bit set, use highest priority. + for (nExBit = 1; (nExBit & static_cast<sal_uInt8>(ScRecalcMode::EMask)) != 0; nExBit <<= 1) + { + if (nExclusive & nExBit) + break; + } + } + else + { + // Only one bit is set. + nExBit = nExclusive; + } + // Set exclusive bit if priority is higher than existing. + if (nExBit < static_cast<sal_uInt8>(nMode & ScRecalcMode::EMask)) + SetMaskedRecalcMode( static_cast<ScRecalcMode>(nExBit)); } SetCombinedBitsRecalcMode( nBits ); } |