sc/source/ui/view/cellsh1.cxx | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
New commits: commit d9d8ee98338a956d7241f556de7c697919151f39 Author: Serge Krot <serge.k...@cib.de> Date: Mon Nov 20 16:47:45 2017 +0100 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 <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> 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() ??? } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits