diff options
author | Laurent Godard <lgodard.libre@laposte.net> | 2014-10-09 14:44:27 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-15 19:33:53 +0000 |
commit | 91502a72c12c559442e8bf77c27a516b49c2a68d (patch) | |
tree | 19a37cb8feff1443693fe821ef1aab1746d446d6 | |
parent | 165059674ddfb3a4b74e2184be693a6a54fdc1fa (diff) |
fdo#83141: also optimize ScTable::HasAttribSelection
applying same strategy than 1e721077b43de84edab2a3ed2f316ddcbec6e3ec
Change-Id: I8c226d5d66ba8371ea1baec73e72b3e50886bb4f
Reviewed-on: https://gerrit.libreoffice.org/11877
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/core/data/table2.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 5e67a6ac8d1e..98e512171259 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1849,10 +1849,17 @@ bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal bool ScTable::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const { - bool bFound = false; - for (SCCOL i=0; i<=MAXCOL && !bFound; i++) - bFound |= aCol[i].HasAttribSelection( rMark, nMask ); - return bFound; + std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans(); + + for (size_t i = 0; i < aSpans.size(); ++i) + { + for (SCCOLROW j = aSpans[i].mnStart; j < aSpans[i].mnEnd; ++j) + { + if (aCol[j].HasAttribSelection(rMark, nMask)) + return true; + } + } + return false; } bool ScTable::ExtendMerge( SCCOL nStartCol, SCROW nStartRow, |