summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-11-04 17:44:52 +0100
committerEike Rathke <erack@redhat.com>2016-11-04 17:45:25 +0100
commit44523738f094ff3987e85ea0c47b8c636bbe5786 (patch)
tree6a6310f66f3cc55863714e0c49d7c9d51aa2055a /sc
parent54dc3dd96bf720a81eef81864848e58c5db860f8 (diff)
bail out early in ScColumn::UpdateSelectionFunction() if nothing is marked
... which happens if there are multi-marks in non-adjacent columns. Change-Id: Ic8cf0fb0071f793fa91c506a56b01f2833fe5cec
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/columnspanset.hxx3
-rw-r--r--sc/source/core/data/column2.cxx3
-rw-r--r--sc/source/core/data/columnspanset.cxx7
3 files changed, 13 insertions, 0 deletions
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: */