sw: make it possible to listen to paste events

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 24 January 2019 11:48 EST

The use-case is that the user pastes content and custom postprocessing is necessary for the pasted content. This is not easy by default, since the cursor is at the end of the pasted content, so the start is not known -- even if you intercept the paste UNO command.

Precisely tracking the start is possible when using the internal API, SwReader::Read() does something similar already to track the undo range.

Only expose the text selection after paste (as a start), but design the API in a way so that other pasted content type (e.g. image) can be added in a backwards-compatible way later.

Change-Id: If35bda4244cc417e4858124fb75f7608b95fc556 Reviewed-on: https://gerrit.libreoffice.org/66807

e14fafaafb35 sw: make it possible to listen to paste events
offapi/UnoApi_offapi.mk | 2 +
offapi/com/sun/star/text/XPasteBroadcaster.idl | 42 +++++++++
offapi/com/sun/star/text/XPasteListener.idl | 42 +++++++++
sw/inc/fesh.hxx | 4 +
sw/inc/unotxdoc.hxx | 10 +-
sw/qa/extras/unowriter/unowriter.cxx | 77 ++++++++++++++++
sw/source/core/frmedt/fecopy.cxx | 2 +
sw/source/core/frmedt/fews.cxx | 14 +++
sw/source/uibase/dochdl/swdtflvr.cxx | 121 +++++++++++++++++++++++--
sw/source/uibase/inc/swdtflvr.hxx | 6 +-
sw/source/uibase/uno/unotxdoc.cxx | 17 ++++
11 files changed, 327 insertions(+), 10 deletions(-)

Upstream: cgit.freedesktop.org


  • Share