sc/inc/column.hxx | 3 ++- sc/inc/columnspanset.hxx | 3 +++ sc/source/core/data/column2.cxx | 4 ++-- sc/source/core/data/columnspanset.cxx | 12 ++++++++++-- sc/source/core/data/table3.cxx | 4 +++- 5 files changed, 20 insertions(+), 6 deletions(-)
New commits: commit 1cf19ea84794ca065749667b480dfed2d27d47b7 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Sat Aug 16 05:25:32 2014 +0200 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 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index fb1eb97..a14a43f 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 7c7fdf5..f397c3e 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 082d4a1..5382913 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 e431361..faf99ad 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 0409f14..71c5323 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits