diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-05-15 15:06:27 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-05-16 12:35:02 +0200 |
commit | 963b9aaa68b3e7be765a283d74205add9465833f (patch) | |
tree | 0c84daa0ee1013d2a7211afdb71f352df63d31a1 | |
parent | 6f810e3d7dafcd7d0101173a501786226f4d8886 (diff) |
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@collabora.com>
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
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: |