summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-01-15 17:22:35 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-01-15 14:07:55 +0100
commit96493091a80fb01c33ea9153b737fdc554de61f0 (patch)
tree31e7b6b06ab01ffe81930b2d0ffbadd04e87eab6 /sc
parent784efd860788b1cdbddd363abafe74b463e080f3 (diff)
tdf#140330: do not deduplicate conditional formatting in undo context
Change-Id: If9c64a7af46ca601b3c47a80642d914facafdc62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162084 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/table2.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9dd864363df4..9dac5733fd41 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -637,6 +637,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
{
ScRange aOldRange( nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, pTable->nTab);
ScRange aNewRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
+ // Don't deduplicate when undoing or creating an Undo document! It would disallow correct undo
+ bool bUndoContext = rDocument.IsUndo() || pTable->rDocument.IsUndo();
+ // Note that Undo documents use same pool as the original document
bool bSameDoc = rDocument.GetStyleSheetPool() == pTable->rDocument.GetStyleSheetPool();
for(const auto& rxCondFormat : *pTable->mpCondFormatList)
@@ -657,7 +660,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
aRefCxt.mnTabDelta = nTab - pTable->nTab;
pNewFormat->UpdateReference(aRefCxt, true);
- if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab))
+ if (!bUndoContext && bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab))
{
continue;
}
@@ -667,7 +670,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
{
// Check if there is the same format in the destination
// If there is, then simply expand its range
- if (CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab))
+ if (!bUndoContext && CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab))
{
bDuplicate = true;
break;