summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei@libreoffice.org>2022-02-24 21:06:50 -0500
committerKohei Yoshida <kohei@libreoffice.org>2022-02-26 00:16:58 +0100
commit7d64ec7d342da64e050ed9ac326b1af33d5c6955 (patch)
tree6f765df3e054acaaedd77b4d0a35849ec47a1480 /sc
parenta25c88daab20f1b7fc82b54171f260c4f20b9ba0 (diff)
tdf#147298: When swapping the cell stores, swap back the event handlers.
Swapping the cell stores also swap the event handlers stored therein. But we do want the event handlers to stay with the original column instances as they store pointers to their host column instances. Change-Id: Id35b89db641e94dbaa341b33d0b64dce19a99465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130510 Reviewed-by: Kohei Yoshida <kohei@libreoffice.org> Tested-by: Kohei Yoshida <kohei@libreoffice.org> (cherry picked from commit 8f25d42938977b34f3281238a92fb34ebea5838c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130464 Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/mtvelements.hxx2
-rw-r--r--sc/source/core/data/column.cxx1
-rw-r--r--sc/source/core/data/mtvelements.cxx5
3 files changed, 8 insertions, 0 deletions
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 05a0970bd64d..75cdea9483bd 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -98,6 +98,8 @@ public:
/** Stop processing events. */
void stop();
+
+ void swap(CellStoreEvent& other);
};
struct CellStoreTrait
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 20cfc194b8b4..9d5643073f70 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1970,6 +1970,7 @@ void ScColumn::SwapCol(ScColumn& rCol)
maCellNotes.swap(rCol.maCellNotes);
// Swap all CellStoreEvent mdds event_func related.
+ maCells.event_handler().swap(rCol.maCells.event_handler());
std::swap( mnBlkCountFormula, rCol.mnBlkCountFormula);
// notes update caption
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index ee6c9cf1499c..a06e86dcae16 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -56,6 +56,11 @@ void CellStoreEvent::stop()
mpCol = nullptr;
}
+void CellStoreEvent::swap(CellStoreEvent& other)
+{
+ std::swap(mpCol, other.mpCol);
+}
+
ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {}
ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)