diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-21 16:57:27 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-12-22 08:33:37 +0100 |
commit | 36b7ae36715cbf47b451e41e47aebe28cf594bd8 (patch) | |
tree | 575f512c78e1f8bdb845d7173e5d584071809413 /sc/source/core/data/table2.cxx | |
parent | 68d074fb910de7298cbefb6a3c3e192dae201837 (diff) |
tdf#154044: Also store default column data, when copying to Undo document
And restore from it un Undo.
Change-Id: I3e14b345cff25068d0555c5bceb4d6e97ce7cf76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161127
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source/core/data/table2.cxx')
-rw-r--r-- | sc/source/core/data/table2.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index ed8db48982b6..ec7f96731ac6 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1319,6 +1319,13 @@ void ScTable::CopyToTable( const bool bToUndoDoc = pDestTab->rDocument.IsUndo(); const bool bFromUndoDoc = rDocument.IsUndo(); + if (bToUndoDoc && (nFlags & InsertDeleteFlags::ATTRIB) && nCol2 >= aCol.size()) + { + // tdf#154044: Copy also the default column data + aDefaultColData.AttrArray().CopyArea(nRow1, nRow2, 0, + pDestTab->aDefaultColData.AttrArray()); + } + if ((bToUndoDoc || bFromUndoDoc) && (nFlags & InsertDeleteFlags::CONTENTS) && mpRangeName) { // Copying formulas may create sheet-local named expressions on the @@ -1344,6 +1351,16 @@ void ScTable::CopyToTable( for (SCCOL i = nCol1; i <= ClampToAllocatedColumns(nCol2); i++) aCol[i].CopyToColumn(rCxt, nRow1, nRow2, bToUndoDoc ? nFlags : nTempFlags, bMarked, pDestTab->CreateColumnIfNotExists(i), pMarkData, bAsLink, bGlobalNamesToLocal); + // tdf#154044: Restore from the default column data + if (bFromUndoDoc && (nFlags & InsertDeleteFlags::ATTRIB) && nCol2 >= aCol.size()) + { + aDefaultColData.AttrArray().CopyArea(nRow1, nRow2, 0, + pDestTab->aDefaultColData.AttrArray()); + SCCOL nMaxSetDefault = pDestTab->ClampToAllocatedColumns(nCol2); + for (SCCOL i = aCol.size(); i <= nMaxSetDefault; i++) + aDefaultColData.AttrArray().CopyArea(nRow1, nRow2, 0, + pDestTab->aCol[i].AttrArray()); + } } if (!bColRowFlags) // Column widths/Row heights/Flags |