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/source/uibase/inc/swdtflvr.hxx | |
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/source/uibase/inc/swdtflvr.hxx')
-rw-r--r-- | sw/source/uibase/inc/swdtflvr.hxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx index c643aa052b0b..e301fa0d7540 100644 --- a/sw/source/uibase/inc/swdtflvr.hxx +++ b/sw/source/uibase/inc/swdtflvr.hxx @@ -179,8 +179,8 @@ public: // copy - methods and helper methods for the copy SW_DLLPUBLIC int Cut(); - SW_DLLPUBLIC int Copy( bool bIsCut = false ); - int PrepareForCopy( bool bIsCut = false ); + SW_DLLPUBLIC int Copy( bool bIsCut = false, bool bDeleteRedlines = true ); + int PrepareForCopy( bool bIsCut = false, bool bDeleteRedlines = true ); void PrepareForCopyTextRange(SwPaM & rPaM); void CalculateAndCopy(); // special for Calculator bool CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr ); |