diff options
author | Eike Rathke <erack@redhat.com> | 2013-12-06 22:58:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-12-10 11:27:41 +0000 |
commit | 549310b41fe732283d82dbd3eb313f3c93f15de8 (patch) | |
tree | 3478b2f286d1b5931554deef6eb8c374d86f18d6 | |
parent | 8d7f6a429f66cf9d029cdd70bbf24906509900e2 (diff) |
resolved fdo#66564 calculate formula cell once if AutoCalc disabled
Was lost with 2ce72093cdc68e60fb06ddd4358e0bc7fc8c63a9 and previous
restructuring.
(cherry picked from commit 2212051e792cb5f51f4191afe83c85fc3730a087)
Backported.
Change-Id: Ie4c8bdb287b56448406c873840c26ec4759de375
Reviewed-on: https://gerrit.libreoffice.org/6965
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 61786e2c22dc..b922508ba152 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -948,6 +948,24 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo pDoc->SetFormulaCell(rPos, xCell.release()); + // For performance reasons API calls may disable calculation while + // operating and recalculate once when done. If through user interaction + // and AutoCalc is disabled, calculate the formula (without its + // dependencies) once so the result matches the current document's content. + if (bInteraction && !pDoc->GetAutoCalc() && pCell) + { + // ScDocument/ScTable::SetFormulaCell() may have deleted pCell if + // position address was invalid, so check here again. This is + // backported code, new code handles that smarter.. + if (rPos.Tab() < pDoc->GetTableCount() && ValidColRow( rPos.Col(), rPos.Row())) + { + // calculate just the cell once and set Dirty again + pCell->Interpret(); + pCell->SetDirtyVar(); + pDoc->PutInFormulaTree( pCell); + } + } + if (bUndo) { svl::IUndoManager* pUndoMgr = rDocShell.GetUndoManager(); |