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

New commits:
commit 3d2b440cd7207f1f0fe78f449441d1f9c3dafc1e
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Wed Jan 22 15:59:01 2020 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Feb 4 22:22:46 2020 +0100

    tdf#125440 When inserting TSV, consider quotes as field markers
    
    The problem is that this is "plain text" from the clipboard format,
    but actually contains TSV (tab separated values). So treat them accordingly,
    so that each value gets its own cell.
    
    Change-Id: I0029e6ace90fc542c3269dd82bb7531654157a69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87950
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 9af724054c25..e675de0e0e64 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -880,6 +880,8 @@ bool ScImportExport::Text2Doc( SvStream& rStrm )
         for( ;; )
         {
             rStrm.ReadUniOrByteStringLine( aLine, rStrm.GetStreamCharSet(), 
nArbitraryLineLengthLimit );
+            // tdf#125440 When inserting tab separated string, consider quotes 
as field markers
+            DoubledQuoteMode mode = aLine.indexOf("\t") >= 0 ? 
DoubledQuoteMode::ESCAPE : DoubledQuoteMode::KEEP_ALL;
             if( rStrm.eof() )
                 break;
             SCCOL nCol = nStartCol;
@@ -892,7 +894,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm )
                 {
                     // Always look for a pairing quote and ignore separator in 
between.
                     while (*p && *p == cStr)
-                        q = p = lcl_ScanString( p, aCell, pSeps, cStr, 
DoubledQuoteMode::KEEP_ALL, bOverflowCell );
+                        q = p = lcl_ScanString( p, aCell, pSeps, cStr, mode, 
bOverflowCell );
                     // All until next separator or quote.
                     while (*p && *p != cSep && *p != cStr)
                         ++p;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to