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

Eike Rathke erack at redhat.com
Fri Nov 4 16:45:50 UTC 2016


 sc/inc/columnspanset.hxx              |    3 +++
 sc/source/core/data/column2.cxx       |    3 +++
 sc/source/core/data/columnspanset.cxx |    7 +++++++
 3 files changed, 13 insertions(+)

New commits:
commit 44523738f094ff3987e85ea0c47b8c636bbe5786
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Nov 4 17:44:52 2016 +0100

    bail out early in ScColumn::UpdateSelectionFunction() if nothing is marked
    
    ... which happens if there are multi-marks in non-adjacent columns.
    
    Change-Id: Ic8cf0fb0071f793fa91c506a56b01f2833fe5cec

diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 7b42979..fc6f5d4 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -149,6 +149,9 @@ public:
 
     void swap( SingleColumnSpanSet& r );
 
+    /** Whether there isn't any row tagged. */
+    bool empty() const;
+
 private:
     ColumnSpansType maSpans;
 };
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 5567133..f86d23e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -3212,6 +3212,9 @@ void ScColumn::UpdateSelectionFunction(
     sc::SingleColumnSpanSet aSpanSet;
     aSpanSet.scan(rRanges, nTab, nCol); // mark all selected rows.
 
+    if (aSpanSet.empty())
+        return;     // nothing to do, bail out
+
     // Exclude all hidden rows.
     ScFlatBoolRowSegments::RangeData aRange;
     SCROW nRow = 0;
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index f5a224f..255c6fa 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -381,6 +381,13 @@ void SingleColumnSpanSet::swap( SingleColumnSpanSet& r )
     maSpans.swap(r.maSpans);
 }
 
+bool SingleColumnSpanSet::empty() const
+{
+    // Empty if there's only the 0..MAXROW span with false.
+    ColumnSpansType::const_iterator it = maSpans.begin();
+    return (it->first == 0) && (it->second == false) && (++it != maSpans.end()) && (it->first == MAXROWCOUNT);
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list