summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-10-27 08:52:38 -0700
committerMichael Meeks <michael.meeks@collabora.com>2014-11-03 12:37:16 +0000
commitf4c179ea7f69e87e55a416c1588ee0aad7c146c0 (patch)
treea7f5af1e1b591cdd4fe477e45258c9e4d39c4792
parent67f3ce3a9df2bc62db5602dd84975047c1137b92 (diff)
fdo#85215: Ensure that formula broadcasting works after sort.
When the reference update on sort is turned off. Change-Id: I547dd1525a638dd447fe331e22583af4a7947308 (cherry picked from commit 1eb82c78a223d9a0b2bb5c3f5c129c1ee8bdf303) Reviewed-on: https://gerrit.libreoffice.org/12113 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--sc/source/core/data/table3.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 589a9b1fb83e..c36b4cdc1b6b 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -802,6 +802,15 @@ void ScTable::SortReorderByRow(
ScSortInfoArray::RowsType* pRows = pArray->GetDataRows();
assert(pRows); // In sort-by-row mode we must have data rows already populated.
+ if (!pArray->IsUpdateRefs())
+ {
+ // When the update ref mode is disabled, we need to detach all formula
+ // cells in the sorted range before reordering, and re-start them
+ // afterward.
+ sc::EndListeningContext aCxt(*pDocument);
+ DetachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
+ }
+
// Split formula groups at the sort range boundaries (if applicable).
std::vector<SCROW> aRowBounds;
aRowBounds.reserve(2);
@@ -1077,6 +1086,12 @@ void ScTable::SortReorderByRow(
// Re-group columns in the sorted range too.
for (SCCOL i = nCol1; i <= nCol2; ++i)
aCol[i].RegroupFormulaCells();
+
+ if (!pArray->IsUpdateRefs())
+ {
+ sc::StartListeningContext aCxt(*pDocument);
+ AttachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
+ }
}
short ScTable::CompareCell(