Kaydet (Commit) 2ba62a78 authored tarafından Eike Rathke's avatar Eike Rathke

sc-perf: eliminate unnecessary loops in ScTable::UpdateSelectionFunction()

That looped unconditionally over all columns of a sheet just to let
ScColumn::UpdateSelectionFunction() costly (by creating empty spans) decide
that it doesn't have to do anything. This for *every* cell cursor movement or
switching sheets et al. Instead, use the ScMarkData area to narrow down the
range beforehand, which when travelling with the cell cursor is just one
column.

Change-Id: Ic60928d07bc6cec4f6d8491ab30b99d7b20b8490
üst c1805c48
...@@ -3404,7 +3404,20 @@ sal_Int32 ScTable::GetMaxNumberStringLen( ...@@ -3404,7 +3404,20 @@ sal_Int32 ScTable::GetMaxNumberStringLen(
void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark ) void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark )
{ {
ScRangeList aRanges = rMark.GetMarkedRangesForTab( nTab ); ScRangeList aRanges = rMark.GetMarkedRangesForTab( nTab );
for (SCCOL nCol = 0; nCol <= MAXCOL && !rData.bError; ++nCol) ScRange aMarkArea( ScAddress::UNINITIALIZED );
if (rMark.IsMultiMarked())
rMark.GetMultiMarkArea( aMarkArea );
else if (rMark.IsMarked())
rMark.GetMarkArea( aMarkArea );
else
{
assert(!"ScTable::UpdateSelectionFunction - called without anything marked");
aMarkArea.aStart.SetCol(0);
aMarkArea.aEnd.SetCol(MAXCOL);
}
const SCCOL nStartCol = aMarkArea.aStart.Col();
const SCCOL nEndCol = aMarkArea.aEnd.Col();
for (SCCOL nCol = nStartCol; nCol <= nEndCol && !rData.bError; ++nCol)
{ {
if (pColFlags && ColHidden(nCol)) if (pColFlags && ColHidden(nCol))
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment