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

Seyeong Kim seyeong.kim at canonical.com
Wed Oct 8 08:56:44 PDT 2014


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

New commits:
commit 1e721077b43de84edab2a3ed2f316ddcbec6e3ec
Author: Seyeong Kim <seyeong.kim at canonical.com>
Date:   Tue Oct 7 00:22:32 2014 +0900

    fdo#83141: optimize slow performance after when using replaceall or searchall
    
    - problem was hang after replaceall or searchall function
    - fix slow performance by looping only selected cols.
    
    Change-Id: Ic0178af33bf381e52584bd4366bff9e128891b64
    Reviewed-on: https://gerrit.libreoffice.org/11829
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Matthew Francis <mjay.francis at gmail.com>
    Tested-by: Matthew Francis <mjay.francis at gmail.com>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    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 882c481..f603c8b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -50,6 +50,7 @@
 #include "refupdatecontext.hxx"
 #include "scopetools.hxx"
 #include "tabprotection.hxx"
+#include "columnspanset.hxx"
 #include <rowheightcontext.hxx>
 #include <refhint.hxx>
 
@@ -2119,10 +2120,17 @@ bool ScTable::HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
 
 bool ScTable::HasSelectionMatrixFragment( const ScMarkData& rMark ) const
 {
-    bool bFound = false;
-    for (SCCOL i=0; i<=MAXCOL && !bFound; i++)
-        bFound |= aCol[i].HasSelectionMatrixFragment(rMark);
-    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].HasSelectionMatrixFragment(rMark) )
+                return true;
+        }
+    }
+    return false;
 }
 
 bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,


More information about the Libreoffice-commits mailing list