summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-01-22 15:59:01 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-02-04 22:22:46 +0100
commit3d2b440cd7207f1f0fe78f449441d1f9c3dafc1e (patch)
tree8d1936f1eccba151c658b6c0f07ad0cfb7b5fcf5 /sc
parent82480ecbe0dc3c99777dcc4e32b63a968a6c2ae7 (diff)
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.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/impex.cxx4
1 files changed, 3 insertions, 1 deletions
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;