summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-16 05:25:32 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-16 05:25:32 +0200
commit1cf19ea84794ca065749667b480dfed2d27d47b7 (patch)
tree4aec42e164a4dbdcd752903f3ec6994de96bde77
parent17f6f60c1c20782fb1cde69b949b97c2f3b0d830 (diff)
don't call ScMarkData::GetMarkedRanges in ScColumn, related fdo#79422
This drops the calls to ScMarkData::GetMarkedRanges by a factor of 1k. Change-Id: I12b1ab3877120a1fbccaccaa7996cbb7efe948b6
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/inc/columnspanset.hxx3
-rw-r--r--sc/source/core/data/column2.cxx4
-rw-r--r--sc/source/core/data/columnspanset.cxx12
-rw-r--r--sc/source/core/data/table3.cxx4
5 files changed, 20 insertions, 6 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index fb1eb97d0e33..a14a43f24473 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -24,6 +24,7 @@
#include "global.hxx"
#include "address.hxx"
#include "rangenam.hxx"
+#include "rangelst.hxx"
#include "types.hxx"
#include "mtvelements.hxx"
#include <formula/types.hxx>
@@ -262,7 +263,7 @@ public:
ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
void UpdateSelectionFunction(
- const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows );
+ const ScRangeList& rRanges, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows );
void CopyToColumn(
sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx
index 7c7fdf524010..f397c3e6292e 100644
--- a/sc/inc/columnspanset.hxx
+++ b/sc/inc/columnspanset.hxx
@@ -20,6 +20,7 @@ class ScDocument;
class ScColumn;
class ScMarkData;
class ScRange;
+class ScRangeList;
namespace sc {
@@ -132,6 +133,8 @@ public:
*/
void scan(const ScMarkData& rMark, SCTAB nTab, SCCOL nCol);
+ void scan(const ScRangeList& rRanges, SCTAB nTab, SCCOL nCol);
+
void set(SCROW nRow1, SCROW nRow2, bool bVal);
void getRows(std::vector<SCROW> &rRows) const;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 082d4a16475b..53829134e63a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -3069,10 +3069,10 @@ public:
// multiple selections:
void ScColumn::UpdateSelectionFunction(
- const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows )
+ const ScRangeList& rRanges, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows )
{
sc::SingleColumnSpanSet aSpanSet;
- aSpanSet.scan(rMark, nTab, nCol); // mark all selected rows.
+ aSpanSet.scan(rRanges, nTab, nCol); // mark all selected rows.
// Exclude all hidden rows.
ScFlatBoolRowSegments::RangeData aRange;
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index e431361f9099..faf99add4c63 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -278,9 +278,17 @@ void SingleColumnSpanSet::scan(const ScMarkData& rMark, SCTAB nTab, SCCOL nCol)
return;
ScRangeList aRanges = rMark.GetMarkedRanges();
- for (size_t i = 0, n = aRanges.size(); i < n; ++i)
+ scan(aRanges, nTab, nCol);
+}
+
+void SingleColumnSpanSet::scan(const ScRangeList& rRanges, SCTAB nTab, SCCOL nCol)
+{
+ for (size_t i = 0, n = rRanges.size(); i < n; ++i)
{
- const ScRange* p = aRanges[i];
+ const ScRange* p = rRanges[i];
+ if (nTab < p->aStart.Tab() || p->aEnd.Tab() < nTab)
+ continue;
+
if (nCol < p->aStart.Col() || p->aEnd.Col() < nCol)
// This column is not in this range. Skip it.
continue;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 0409f14e3e07..71c53233ade4 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -61,6 +61,7 @@
#include <refhint.hxx>
#include <listenerquery.hxx>
#include <bcaslot.hxx>
+#include "rangelst.hxx"
#include <svl/sharedstringpool.hxx>
@@ -2971,12 +2972,13 @@ sal_Int32 ScTable::GetMaxNumberStringLen(
void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark )
{
+ ScRangeList aRanges = rMark.GetMarkedRanges();
for (SCCOL nCol = 0; nCol <= MAXCOL && !rData.bError; ++nCol)
{
if (pColFlags && ColHidden(nCol))
continue;
- aCol[nCol].UpdateSelectionFunction(rMark, rData, *mpHiddenRows);
+ aCol[nCol].UpdateSelectionFunction(aRanges, rData, *mpHiddenRows);
}
}