From d9d8ee98338a956d7241f556de7c697919151f39 Mon Sep 17 00:00:00 2001 From: Serge Krot Date: Mon, 20 Nov 2017 16:47:45 +0100 Subject: 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 Reviewed-by: Eike Rathke --- sc/source/ui/view/cellsh1.cxx | 29 +++++++++++++++++++++++++++-- 1 file 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; iPasteFromSystem(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() ??? } -- cgit v1.2.3