[Libreoffice-commits] core.git: sc/source

Laurent Godard lgodard.libre at laposte.net
Wed Oct 15 12:34:18 PDT 2014


 sc/source/core/data/table2.cxx |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 91502a72c12c559442e8bf77c27a516b49c2a68d
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Thu Oct 9 14:44:27 2014 +0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 5e67a6a..98e5121 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,


More information about the Libreoffice-commits mailing list