sc/source/ui/docshell/impex.cxx |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 0b8a3d1f5fd339d0c77f4e074b3c8ea649407326
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sun Mar 20 18:21:44 2022 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Mon Mar 21 01:09:12 2022 +0100

    ExtText2Doc: fixed width columns don't need to be determined for each row
    
    Change-Id: Ie68f5d80a9fb0946c45cc89f89f25ea0995a7806
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131879
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 5efa54703d73..ef581f19d5a2 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1583,6 +1583,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
     // Determine range for Undo.
     // We don't need this during import of a file to a new sheet or document...
     bool bDetermineRange = bUndo;
+    bool bColumnsAreDetermined = false;
 
     // Row heights don't need to be adjusted on the fly if EndPaste() is called
     // afterwards, which happens only if bDetermineRange. This variable also
@@ -1622,19 +1623,23 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
             {
                 if (bDetermineRange)
                 {
-                    // Yes, the check is nCol<=rDoc.MaxCol()+1, +1 because it
-                    // is only an overflow if there is really data following to
-                    // be put behind the last column, which doesn't happen if
-                    // info is SC_COL_SKIP.
-                    for (i=0; i < nInfoCount && nCol <= rDoc.MaxCol()+1; ++i)
+                    if (!bColumnsAreDetermined)
                     {
-                        const sal_uInt8 nFmt = pColFormat[i];
-                        if (nFmt != SC_COL_SKIP)        // otherwise don't 
increment nCol either
+                        // Yes, the check is nCol<=rDoc.MaxCol()+1, +1 because 
it
+                        // is only an overflow if there is really data 
following to
+                        // be put behind the last column, which doesn't happen 
if
+                        // info is SC_COL_SKIP.
+                        for (i=0; i < nInfoCount && nCol <= rDoc.MaxCol()+1; 
++i)
                         {
-                            if (nCol > rDoc.MaxCol())
-                                bOverflowCol = true;    // display warning on 
import
-                            ++nCol;
+                            const sal_uInt8 nFmt = pColFormat[i];
+                            if (nFmt != SC_COL_SKIP)        // otherwise don't 
increment nCol either
+                            {
+                                if (nCol > rDoc.MaxCol())
+                                    bOverflowCol = true;    // display warning 
on import
+                                ++nCol;
+                            }
                         }
+                        bColumnsAreDetermined = true;
                     }
                 }
                 else

Reply via email to