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

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu May 16 10:35:47 UTC 2019


 sc/source/ui/docshell/impex.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 963b9aaa68b3e7be765a283d74205add9465833f
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 15 15:06:27 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Thu May 16 12:35:02 2019 +0200

    optimize ScImportExport::Doc2Text() for large columns
    
    Again, mdds starts container search always from the beginning, so
    iterating over it is quadratic. Making a large selection triggers
    VclQt5Clipboard::setContents(), which calls this.
    
    Change-Id: Ic027ff7c5507b41d42b9561cd099e01b50055adb
    Reviewed-on: https://gerrit.libreoffice.org/72367
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index f5bba16a5b1c..58d848a3095e 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -50,6 +50,7 @@
 #include <tokenarray.hxx>
 #include <documentimport.hxx>
 #include <refundo.hxx>
+#include <mtvelements.hxx>
 
 #include <globstr.hrc>
 #include <scresid.hxx>
@@ -1654,6 +1655,10 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
 
     bool bConvertLF = (GetSystemLineEnd() != LINEEND_LF);
 
+    // We need to cache sc::ColumnBlockPosition per each column, tab is always nStartTab.
+    std::vector< sc::ColumnBlockPosition > blockPos( nEndCol - nStartCol + 1 );
+    for( SCCOL i = nStartCol; i <= nEndCol; ++i )
+        pDoc->InitColumnBlockPosition( blockPos[ i - nStartCol ], nStartTab, i );
     for (nRow = nStartRow; nRow <= nEndRow; nRow++)
     {
         if (bIncludeFiltered || !pDoc->RowFiltered( nRow, nStartTab ))
@@ -1664,7 +1669,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
                 sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aPos);
                 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
 
-                ScRefCellValue aCell(*pDoc, aPos);
+                ScRefCellValue aCell(*pDoc, aPos, blockPos[ nCol - nStartCol ]);
                 switch (aCell.meType)
                 {
                     case CELLTYPE_FORMULA:


More information about the Libreoffice-commits mailing list