diff options
author | László Németh <nemeth@numbertext.org> | 2018-12-04 21:54:24 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-12-05 08:02:14 +0100 |
commit | 1d65ffc5a37be21e0316019b1c96eb9a1c871ac0 (patch) | |
tree | 83beadbc88b9ff42e123c835e35eef824b483b64 /sw/source/core/edit/edfcol.cxx | |
parent | 9ad04dad665f9bfc054d0db4174f18ce154e20fc (diff) |
tdf#105413 track changes: keep paragraph styles
applied in Show Changes mode, instead of losing them
after saving the document or hiding the changes. The bug
occured in paragraphs with directly preceding tracked deletions.
Change-Id: I9a5fd1b82cb7e99884d8807d0abee1fea59d5df3
Reviewed-on: https://gerrit.libreoffice.org/64518
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/core/edit/edfcol.cxx')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 083ad320fbec..3164e00dd0f0 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -93,6 +93,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <tools/diagnose_ex.h> +#include <IDocumentRedlineAccess.hxx> #define WATERMARK_NAME "PowerPlusWaterMarkObject" #define WATERMARK_AUTO_SIZE sal_uInt32(1) @@ -2173,6 +2174,8 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat, SwTextFormatColl *pLocal = pFormat? pFormat: (*GetDoc()->GetTextFormatColls())[0]; StartAllAction(); + RedlineFlags eRedlMode = GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(), eOldMode = eRedlMode; + SwRewriter aRewriter; aRewriter.AddRule(UndoArg1, pLocal->GetName()); @@ -2182,6 +2185,17 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat, if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) ) { + // tdf#105413 turn off ShowChanges mode for the next loops to apply styles permanently with redlining, + // ie. in all directly preceding deleted paragraphs at the actual cursor positions + if ( IDocumentRedlineAccess::IsShowChanges(eRedlMode) && + // is there redlining at beginning of the position (possible redline block before the modified node) + GetDoc()->getIDocumentRedlineAccess().GetRedlinePos( (*rPaM.Start()).nNode.GetNode(), USHRT_MAX ) < + GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size() ) + { + eRedlMode = RedlineFlags::ShowInsert | RedlineFlags::Ignore; + GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eRedlMode ); + } + // Change the paragraph style to pLocal and remove all direct paragraph formatting. GetDoc()->SetTextFormatColl(rPaM, pLocal, true, bResetListAttrs, GetLayout()); @@ -2198,6 +2212,8 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat, } GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::SETFMTCOLL, &aRewriter); EndAllAction(); + + GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOldMode ); } SwTextFormatColl* SwEditShell::MakeTextFormatColl(const OUString& rFormatCollName, |