summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2017-11-20 16:47:45 +0100
committerEike Rathke <erack@redhat.com>2017-11-21 16:14:21 +0100
commitd9d8ee98338a956d7241f556de7c697919151f39 (patch)
tree6ae41dcbfd9663bec286c90acc3681064108b4b6
parentb1d603444b0229a3b710e27308b32d3484fb5e9e (diff)
tdf#113571, tdf#32213, tdf#50746: Make "paste unformatted text"
Added check for availability of the SotClipboardFormatId::STRING_TSVC that could be used instead of SotClipboardFormatId::STRING. Change-Id: I03de4500affb71270b501b12c14287037cea7c3c Reviewed-on: https://gerrit.libreoffice.org/44975 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/ui/view/cellsh1.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 455c3ac3b1cd..ba1b05f93483 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1646,12 +1646,37 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
// this makes FID_INS_CELL_CONTENTS superfluous
{
WaitObject aWait( GetViewData()->GetDialogParent() );
- bool bRet = pTabViewShell->PasteFromSystem(SotClipboardFormatId::STRING, true); // TRUE: no error messages
+
+ // we should differentiate between SotClipboardFormatId::STRING and SotClipboardFormatId::STRING_TSVC,
+ // and paste the SotClipboardFormatId::STRING_TSVC if it is available.
+ // Which makes a difference if the clipboard contains cells with embedded line breaks.
+
+ SotClipboardFormatId nFormat = SotClipboardFormatId::STRING;
+ {
+ SvxClipboardFormatItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
+ GetPossibleClipboardFormats( aFormats );
+
+ const sal_uInt16 nFormatCount = aFormats.Count();
+ for (sal_uInt16 i=0; i<nFormatCount; i++)
+ {
+ if (SotClipboardFormatId::STRING_TSVC == aFormats.GetClipbrdFormatId( i ))
+ {
+ nFormat = SotClipboardFormatId::STRING_TSVC;
+ break;
+ }
+ }
+ }
+
+ const bool bRet = pTabViewShell->PasteFromSystem(nFormat, true); // TRUE: no error messages
if ( bRet )
{
- rReq.SetReturnValue(SfxInt16Item(nSlot, bRet ? 1 : 0)); // 1 = success, 0 = fail
+ rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success
rReq.Done();
}
+ else
+ {
+ rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail
+ }
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
}