diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2025-03-24 08:40:40 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2025-03-24 16:37:43 +0100 |
commit | db541619cb1ca83598ec479eb9f52e559a8fe72d (patch) | |
tree | 9d1fb2df64748fb1c864417ee081a94848f3ec01 /sw/inc | |
parent | 4da4617266bc816256b6c1d898046ab51080af35 (diff) |
cool#11357 sw redline reinstate: handle a single rich delete
In case the cursor is inside a delete redline (single-paragraph, plain
text), then .uno:ReinstateTrackedChange works for that change. If the
change contains formatting, then that formatting is not copied to the
insertion.
This is simply because SwEditShell::ReinstatePaM() gets the content of
the delete redline as an OUString. Doing a rich copy would preserve
formatting, but then
sw::DocumentContentOperationsManager::CopyImplImpl() would use
lcl_DeleteRedlines() to strip away content which is inside a delete
redline, so that won't work out of the box, either.
Fix the problem by copying the content of the delete redline to a
clipboard doc and inserting from there, and by introducing a new
bDeleteRedlines flag (defaults to true). When that flag is off, the copy
does what we need here: it preserves formatting, but doesn't strip away
content which was originally inside a delete redline.
Go via SwTransferable instead of invoking
sw::DocumentContentOperationsManager::CopyRange() directly, because this
way the inserted content will be inside an insert redline & we get
working undo/redo out of the box.
Change-Id: Id853844b7282c6b1c36cb0f4f8cc75d968e53dcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183270
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/fesh.hxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index e5c114474425..6b5dd4e47707 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -256,7 +256,8 @@ public: virtual ~SwFEShell() override; /// Copy and Paste methods for internal clipboard. - SW_DLLPUBLIC void Copy( SwDoc& rClpDoc, const OUString* pNewClpText = nullptr ); + /// bDeleteRedlines: if content inside a delete redline should be stripped away in rClpDoc. + SW_DLLPUBLIC void Copy( SwDoc& rClpDoc, const OUString* pNewClpText = nullptr, bool bDeleteRedlines = true ); SW_DLLPUBLIC bool Paste( SwDoc& rClpDoc, bool bNestedTable = false ); /// Paste some pages into another doc - used in mailmerge. |