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 /include | |
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 'include')
-rw-r--r-- | include/formula/tokenarray.hxx | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx index 45669d1ad529..2c422d94faf8 100644 --- a/include/formula/tokenarray.hxx +++ b/include/formula/tokenarray.hxx @@ -48,24 +48,26 @@ class SharedStringPool; } -// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode... +// RecalcMode access only via TokenArray SetExclusiveRecalcMode...() / +// IsRecalcMode...() -// Only one of the exclusive bits can be set, -// handled by TokenArray SetRecalcMode... methods +// Only one of the exclusive bits can be set and one must be set, +// handled by TokenArray SetExclusiveRecalcMode...() methods. +// Exclusive bits are ordered by priority, AddRecalcMode() relies on that. enum class ScRecalcMode : sal_uInt8 { - NORMAL = 0x01, // exclusive - ALWAYS = 0x02, // exclusive, always - ONLOAD = 0x04, // exclusive, always after load - ONLOAD_ONCE = 0x08, // exclusive, once after load - FORCED = 0x10, // combined, also if cell isn't visible - ONREFMOVE = 0x20, // combined, if reference was moved - EMask = NORMAL | ALWAYS | ONLOAD | ONLOAD_ONCE // mask of exclusive bits + ALWAYS = 0x01, // exclusive, always + ONLOAD_MUST = 0x02, // exclusive, always after load + 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 + EMask = ALWAYS | ONLOAD_MUST | ONLOAD_LENIENT | ONLOAD_ONCE | NORMAL // mask of exclusive bits }; -// If new bits are to be defined, AddRecalcMode has to be adjusted! namespace o3tl { - template<> struct typed_flags<ScRecalcMode> : is_typed_flags<ScRecalcMode, 0x3f> {}; + template<> struct typed_flags<ScRecalcMode> : is_typed_flags<ScRecalcMode, 0x7f> {}; } namespace formula @@ -281,16 +283,6 @@ public: */ sal_uInt16 RemoveToken( sal_uInt16 nOffset, sal_uInt16 nCount ); - void SetCombinedBitsRecalcMode( ScRecalcMode nBits ) - { nMode |= (nBits & ~ScRecalcMode::EMask); } - ScRecalcMode GetCombinedBitsRecalcMode() const - { return nMode & ~ScRecalcMode::EMask; } - /** Exclusive bits already set in nMode are - zero'ed, nBits may contain combined bits, but - only one exclusive bit may be set! */ - void SetMaskedRecalcMode( ScRecalcMode nBits ) - { nMode = GetCombinedBitsRecalcMode() | nBits; } - FormulaTokenArray(); /** Assignment with incrementing references of FormulaToken entries (not copied!) */ @@ -390,20 +382,28 @@ public: bool IsHyperLink() const { return bHyperLink; } ScRecalcMode GetRecalcMode() const { return nMode; } - /** Bits aren't set directly but validated and - maybe handled according to priority if more - than one exclusive bit was set. */ - void AddRecalcMode( ScRecalcMode nBits ); + + void SetCombinedBitsRecalcMode( ScRecalcMode nBits ) + { nMode |= (nBits & ~ScRecalcMode::EMask); } + ScRecalcMode GetCombinedBitsRecalcMode() const + { return nMode & ~ScRecalcMode::EMask; } + + /** Exclusive bits already set in nMode are zero'ed, nBits + may contain combined bits, but only one exclusive bit + may be set! */ + void SetMaskedRecalcMode( ScRecalcMode nBits ) + { nMode = GetCombinedBitsRecalcMode() | nBits; } + + /** Bits aren't set directly but validated and handled + according to priority if more than one exclusive bit + was set. */ + void AddRecalcMode( ScRecalcMode nBits ); void ClearRecalcMode() { nMode = ScRecalcMode::NORMAL; } void SetExclusiveRecalcModeNormal() { SetMaskedRecalcMode( ScRecalcMode::NORMAL ); } void SetExclusiveRecalcModeAlways() { SetMaskedRecalcMode( ScRecalcMode::ALWAYS ); } - void SetExclusiveRecalcModeOnLoad() - { SetMaskedRecalcMode( ScRecalcMode::ONLOAD ); } - void SetExclusiveRecalcModeOnLoadOnce() - { SetMaskedRecalcMode( ScRecalcMode::ONLOAD_ONCE ); } void SetRecalcModeForced() { nMode |= ScRecalcMode::FORCED; } void SetRecalcModeOnRefMove() @@ -412,14 +412,14 @@ public: { return bool(nMode & ScRecalcMode::NORMAL); } bool IsRecalcModeAlways() const { return bool(nMode & ScRecalcMode::ALWAYS); } - bool IsRecalcModeOnLoad() const - { return bool(nMode & ScRecalcMode::ONLOAD); } - bool IsRecalcModeOnLoadOnce() const - { return bool(nMode & ScRecalcMode::ONLOAD_ONCE); } bool IsRecalcModeForced() const { 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(); |