summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table3.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-27 14:35:37 -0400
committerEike Rathke <erack@redhat.com>2014-07-28 08:17:20 +0000
commit290d0d779551b84dfa42e0c026ce4d7c0f00ea7a (patch)
tree52a222778b58b26238eb3cf9fd5dbeeb4301f050 /sc/source/core/data/table3.cxx
parent9b2e8ef138a7c287bfd4534e4c115003c3c56575 (diff)
fdo#81617: Split formula groups at sort range boundaries.
Otherwise, partially sorting a range may crash, or at best incorrectly update formula references. Change-Id: Iefcb86d205d83ccc5b684048bfd9aadabf6e13eb (cherry picked from commit a3fc7f20089062afa4f778e70ba8be84032a30a7) Reviewed-on: https://gerrit.libreoffice.org/10583 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core/data/table3.cxx')
-rw-r--r--sc/source/core/data/table3.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 31cfe2eb225e..3b63f7e4b4dd 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -755,6 +755,14 @@ void ScTable::SortReorderByRow(
ScSortInfoArray::RowsType* pRows = pArray->GetDataRows();
assert(pRows); // In sort-by-row mode we must have data rows already populated.
+ // Split formula groups at the sort range boundaries (if applicable).
+ std::vector<SCROW> aRowBounds;
+ aRowBounds.reserve(2);
+ aRowBounds.push_back(nRow1);
+ aRowBounds.push_back(nRow2+1);
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+ SplitFormulaGroups(nCol, aRowBounds);
+
// Cells in the data rows only reference values in the document. Make
// a copy before updating the document.