diff options
author | Seyeong Kim <seyeong.kim@canonical.com> | 2014-10-07 00:22:32 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-08 15:56:24 +0000 |
commit | 1e721077b43de84edab2a3ed2f316ddcbec6e3ec (patch) | |
tree | 40386b88c8616e5f658e28e2a44520dd1ca72cc6 | |
parent | c3b4c17cd6b91c7e0115b1c701e4fb45ece7658e (diff) |
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@libreoffice.org>
Reviewed-by: Matthew Francis <mjay.francis@gmail.com>
Tested-by: Matthew Francis <mjay.francis@gmail.com>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
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 | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 882c481bc70b..f603c8b6c961 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, |