Kaydet (Commit) 963b9aaa authored tarafından Luboš Luňák's avatar Luboš Luňák

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: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst 6f810e3d
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment