From 44523738f094ff3987e85ea0c47b8c636bbe5786 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 4 Nov 2016 17:44:52 +0100 Subject: bail out early in ScColumn::UpdateSelectionFunction() if nothing is marked ... which happens if there are multi-marks in non-adjacent columns. Change-Id: Ic8cf0fb0071f793fa91c506a56b01f2833fe5cec --- sc/inc/columnspanset.hxx | 3 +++ sc/source/core/data/column2.cxx | 3 +++ sc/source/core/data/columnspanset.cxx | 7 +++++++ 3 files changed, 13 insertions(+) (limited to 'sc') diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx index 7b4297927796..fc6f5d4f49f2 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 5567133b8846..f86d23ef3a12 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 f5a224fb65c4..255c6fa932f9 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: */ -- cgit