diff options
author | Eike Rathke <erack@redhat.com> | 2017-11-13 16:41:49 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-13 18:43:35 +0100 |
commit | f435cdba5b4ea98dc30b4b4879de21a542c8a84d (patch) | |
tree | 742c42d3f3a3d170df47838bd756be1a74115e52 /sc/source/ui/docshell/docsh4.cxx | |
parent | 971b81b1c0922ab749eaf620cbf56d9780a15cfb (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
https://www.iana.org/assignments/media-types/text/tab-separated-values)
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: https://gerrit.libreoffice.org/44686
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source/ui/docshell/docsh4.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 7654fdca0459..e5620e8dd74a 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2196,7 +2196,8 @@ bool ScDocShell::DdeGetData( const OUString& rItem, const OUString& rMimeType, css::uno::Any & rValue ) { - if( SotClipboardFormatId::STRING == SotExchange::GetFormatIdFromMimeType( rMimeType ) ) + SotClipboardFormatId eFormatId = SotExchange::GetFormatIdFromMimeType( rMimeType ); + if (SotClipboardFormatId::STRING == eFormatId || SotClipboardFormatId::STRING_TSVC == eFormatId) { if( rItem.equalsIgnoreAsciiCase( "Format" ) ) { @@ -2244,7 +2245,8 @@ bool ScDocShell::DdeSetData( const OUString& rItem, const OUString& rMimeType, const css::uno::Any & rValue ) { - if( SotClipboardFormatId::STRING == SotExchange::GetFormatIdFromMimeType( rMimeType )) + SotClipboardFormatId eFormatId = SotExchange::GetFormatIdFromMimeType( rMimeType ); + if (SotClipboardFormatId::STRING == eFormatId || SotClipboardFormatId::STRING_TSVC == eFormatId) { if( rItem.equalsIgnoreAsciiCase( "Format" ) ) { |