path: root/sc/source/ui/view/gridwin.cxx
diff options
authorEike Rathke <>2017-11-13 16:41:49 +0100
committerEike Rathke <>2017-11-13 18:43:35 +0100
commitf435cdba5b4ea98dc30b4b4879de21a542c8a84d (patch)
tree742c42d3f3a3d170df47838bd756be1a74115e52 /sc/source/ui/view/gridwin.cxx
parent971b81b1c0922ab749eaf620cbf56d9780a15cfb (diff)
Resolves: tdf#113571 paste-special "Unformatted text [TSV-Calc]", tdf#32213
For intra-Calc on-cell pastes using the paste special toolbar button the SotClipboardFormatId::STRING_TSVC format can be used, which preserves embedded line breaks and tabs by enclosing such content in double quotes and escaping quotes by doubling them, similar to CSV. This differs from the IANA text/tab-separated-values MIME type (see that does not allow quoted fields or embedded line breaks or tabs. The text/plain "Unformatted text" format now again (after the change with commit cdcd262ea4aa3c3e407b14ed533e514f75de2d3a for tdf#32213) results in unquoted/unescaped content as expected for external pastes. A follow-up commit probably should distinguish whether the source is one single cell or multiple cells and for multiple cells use a strict TSV (with embedded line breaks and tabs changed to spaces) if a simple "Unformatted text" is requested, which always uses tabs as field separators anyway. Further enhancement could be to offer strict text/tab-separated-values and also text/csv at the clipboard if there are applications that actually handle these MIME types. Change-Id: Ica60f256e26867d854639823c62eedbf13eb4d4b Reviewed-on: Reviewed-by: Eike Rathke <> Tested-by: Jenkins <>
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
1 files changed, 3 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6741839dd5ea..b2b553f24700 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3642,6 +3642,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
IsDropFormatSupported( SotClipboardFormatId::LINK_SOURCE_OLE ) ||
IsDropFormatSupported( SotClipboardFormatId::EMBEDDED_OBJ_OLE ) ||
IsDropFormatSupported( SotClipboardFormatId::STRING ) ||
+ IsDropFormatSupported( SotClipboardFormatId::STRING_TSVC ) ||
IsDropFormatSupported( SotClipboardFormatId::SYLK ) ||
IsDropFormatSupported( SotClipboardFormatId::LINK ) ||
IsDropFormatSupported( SotClipboardFormatId::HTML ) ||
@@ -3791,6 +3792,8 @@ static SotClipboardFormatId lcl_GetDropFormatId( const uno::Reference<datatransf
nFormatId = SotClipboardFormatId::FILE_LIST;
else if ( aDataHelper.HasFormat( SotClipboardFormatId::SIMPLE_FILE ) ) // #i62773# FILE_LIST/FILE before STRING (Unix file managers)
nFormatId = SotClipboardFormatId::SIMPLE_FILE;
+ else if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING_TSVC ) )
+ nFormatId = SotClipboardFormatId::STRING_TSVC;
else if ( aDataHelper.HasFormat( SotClipboardFormatId::STRING ) )
nFormatId = SotClipboardFormatId::STRING;
else if ( aDataHelper.HasFormat( SotClipboardFormatId::GDIMETAFILE ) )