Kaydet (Commit) d9d8ee98 authored tarafından Serge Krot's avatar Serge Krot Kaydeden (comit) Eike Rathke

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/44975Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst b1d60344
......@@ -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() ???
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment