[Libreoffice-commits] core.git: sc/inc sc/source

Eike Rathke erack at redhat.com
Thu Nov 2 11:59:37 UTC 2017


 sc/inc/mtvelements.hxx              |    2 ++
 sc/source/core/data/column.cxx      |    4 ++++
 sc/source/core/data/mtvelements.cxx |    5 +++++
 3 files changed, 11 insertions(+)

New commits:
commit 423df1fa929784c14e3a133c06468589fe9269cd
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Nov 2 12:53:14 2017 +0100

    Resolves: tdf#111428 implement CellStoreEvent::swap() in ScColumn::SwapCol()
    
    CellStoreEvent remembered the original ScColumn* and corresponding
    ScColumn::mnBlkCountFormula, hence after inserting a column to the
    left the quick check of ScColumn::HasFormulaCell() whether there
    are any formula cells worked on the swapped in column (originally
    the one to the right) that happens to be empty in the scenario.
    Things worked correctly by accident if the next column to the
    right already contained a formula cell.
    
    Regression from
    
        commit e57a5905fb2975307af654710430d0a876dbd061
        Date:   Sat Jul 16 20:01:48 2016 -0400
    
    Change-Id: If993856ceee657736f516a81c293506041a6b7eb

diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index f13562d47fbd..2809b7a621c5 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -97,6 +97,8 @@ public:
 
     void element_block_acquired(const mdds::mtv::base_element_block* block);
     void element_block_released(const mdds::mtv::base_element_block* block);
+
+    void swap(CellStoreEvent& r);
 };
 
 /// Cell note container
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 48a551462c60..3afcc2bce2ec 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1895,6 +1895,10 @@ void ScColumn::SwapCol(ScColumn& rCol)
     maCellTextAttrs.swap(rCol.maCellTextAttrs);
     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
     UpdateNoteCaptions(0, MAXROW);
     rCol.UpdateNoteCaptions(0, MAXROW);
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index e34010af54d8..199284cad878 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -54,6 +54,11 @@ void CellStoreEvent::element_block_released(const mdds::mtv::base_element_block*
     }
 }
 
+void CellStoreEvent::swap(CellStoreEvent& r)
+{
+    std::swap( mpCol, r.mpCol);
+}
+
 ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {}
 
 ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)


More information about the Libreoffice-commits mailing list