diff options
-rw-r--r-- | include/formula/tokenarray.hxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 26 |
2 files changed, 26 insertions, 8 deletions
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index d4111f798d5c..2c422d94faf8 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -58,8 +58,8 @@ enum class ScRecalcMode : sal_uInt8 { ALWAYS = 0x01, // exclusive, always ONLOAD_MUST = 0x02, // exclusive, always after load - ONLOAD_LENIENT = 0x04, // exclusive, lenient after load (eg. macros not always, aliens, ...) - ONLOAD_ONCE = 0x08, // exclusive, once after load, import filter + ONLOAD_ONCE = 0x04, // exclusive, once after load, import filter + ONLOAD_LENIENT = 0x08, // exclusive, lenient after load (eg. macros not always, aliens, ...) NORMAL = 0x10, // exclusive FORCED = 0x20, // combined, also if cell isn't visible, for macros with side effects ONREFMOVE = 0x40, // combined, if reference was moved @@ -416,6 +416,10 @@ public: { return bool(nMode & ScRecalcMode::FORCED); } bool IsRecalcModeOnRefMove() const { return bool(nMode & ScRecalcMode::ONREFMOVE); } + /** Whether recalculation must happen after import, for + example OOXML. */ + bool IsRecalcModeMustAfterImport() const + { return (nMode & ScRecalcMode::EMask) <= ScRecalcMode::ONLOAD_ONCE; } /** Get OpCode of the most outer function */ inline OpCode GetOuterFuncOpCode(); diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 9bec5335a599..53172729ac85 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -159,6 +159,11 @@ void applySharedFormulas( case XML_n: // numeric value. pCell->SetResultDouble(rDesc.maCellValue.toDouble()); + /* TODO: is it on purpose that we never reset dirty here + * and thus recalculate anyway if cell was dirty? Or is it + * never dirty and therefor set dirty below otherwise? This + * is different from the non-shared case in + * applyCellFormulaValues(). */ break; case XML_str: if (bGeneratorKnownGood) @@ -168,8 +173,11 @@ void applySharedFormulas( pCell->SetResultToken(new formula::FormulaStringToken(aSS)); // If we don't reset dirty, then e.g. disabling macros makes all cells // that use macro functions to show #VALUE! - pCell->ResetDirty(); - pCell->SetChanged(false); + if (!pCell->GetCode()->IsRecalcModeMustAfterImport()) + { + pCell->ResetDirty(); + pCell->SetChanged(false); + } break; } SAL_FALLTHROUGH; @@ -270,8 +278,11 @@ void applyCellFormulaValues( case XML_n: { pCell->SetResultDouble(rValueStr.toDouble()); - pCell->ResetDirty(); - pCell->SetChanged(false); + if (!pCell->GetCode()->IsRecalcModeMustAfterImport()) + { + pCell->ResetDirty(); + pCell->SetChanged(false); + } } break; case XML_str: @@ -289,8 +300,11 @@ void applyCellFormulaValues( { svl::SharedString aSS = rStrPool.intern(rValueStr); pCell->SetResultToken(new formula::FormulaStringToken(aSS)); - pCell->ResetDirty(); - pCell->SetChanged(false); + if (!pCell->GetCode()->IsRecalcModeMustAfterImport()) + { + pCell->ResetDirty(); + pCell->SetChanged(false); + } } break; default: |