diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-05-18 18:45:18 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-05-19 00:18:08 +0200 |
commit | 141519233b16353c4998bb826fab11d17dbaf6a3 (patch) | |
tree | 821ca0fc5db7134ab007e293e30fec866313ad7a /sc | |
parent | f3e1ebd309a967d3bb06a7e0fe9b501d1faa124b (diff) |
actually insert the column(s) in ScTable::InsertCol()
This was broken if the all the columns weren't allocated, since
at least in the full-column mode it was swapping the last empty
columns in the place of the new ones, but without all columns
allocated there possibly weren't last empty columns, so it was
instead swapping in last data columns.
Change-Id: I21552f0eb296b0df5507677510a8b85fccb1ae5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134546
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table2.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index ef49854b5c01..2b6706790bdc 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -308,8 +308,11 @@ void ScTable::InsertCol( } } + // Make sure there are enough columns at the end. + CreateColumnIfNotExists(std::min<SCCOL>(rDocument.MaxCol(), std::max(nStartCol, aCol.size()) + nSize - 1 )); if ((nStartRow == 0) && (nEndRow == rDocument.MaxRow())) { + // Move existing columns back, this will swap last empty columns in the inserted place. for (SCCOL nCol = aCol.size() - 1 - nSize; nCol >= nStartCol; --nCol) aCol[nCol].SwapCol(aCol[nCol+nSize]); } |