sw: prefer ODF over RTF when pasting from Writer

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 22 April 2020 18:08 UTC

Regression from commit e9e6d4b058e13165f3dde1ca7822eec97dfe8aa7 (tdf#116685: Make the RICHTEXT take precedence over EMBED_SOURCE., 2019-09-26), the problem was that now we always prefer RTF over ODF when pasting into Writer. The commit made sense for Calc->Writer paste, but it causes formatting loss for Writer -> Writer paste.

The exact use-case was copy&paste of numberings where the pasted content got paragraph indent as direct formatting, so shift-tab at the paragraph start changed only the bullet type, not the indentation -- but it's easy to imagine several other cases where a roundtrip via ODF provides better results than RTF.

Fix the problem by leaving the above commit in place, but extending SwTransferable::Paste() so that it prefers ODF over RTF in case of a Writer->Writer paste (and leaves the non-Writer -> Writer paste behavior unchanged to avoid the unwanted OLE objects).

Change-Id: Ida745bba65c5a210021cea0d267c02900fc6398a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92705

8ad0c29f56e5 sw: prefer ODF over RTF when pasting from Writer
sw/CppunitTest_sw_uibase_dochdl.mk | 73 +++++++++++++++++++++++++++++++++++
sw/Module_sw.mk | 1 +
sw/qa/uibase/dochdl/dochdl.cxx | 75 ++++++++++++++++++++++++++++++++++++
sw/source/uibase/dochdl/swdtflvr.cxx | 40 +++++++++++++++++++
sw/source/uibase/inc/swdtflvr.hxx | 3 ++
5 files changed, 192 insertions(+)

Upstream: cgit.freedesktop.org


  • Share