sw/inc/viewopt.hxx | 10 ++++++++++ sw/source/core/edit/edredln.cxx | 11 +++++++++++ sw/source/uibase/config/viewopt.cxx | 4 ++++ 3 files changed, 25 insertions(+)
New commits: commit 2122ee0502a4c2b155bf88842c3327f10eabe351 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Feb 26 09:14:30 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Feb 26 09:55:24 2025 +0100 cool#11226 sw per-view redline on: add new flag in SwViewOption And set it in SwEditShell::SetRedlineFlags(). Existing usage of RedlineFlags::On is not yet changed to work with SwViewOption::IsRedlineRecordingOn() instead. Change-Id: Ic7c549ef765ebb3667e3ca969fe0e02eb9f5d2b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182201 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index ff0235dd4c2b..52dbda99f953 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -64,6 +64,10 @@ struct ViewOptFlags1 bool bTreatSubOutlineLevelsAsContent : 1; bool bShowInlineTooltips : 1; //tooltips on tracked changes bool bViewMetachars : 1; + + /// Track changes: recording is on + bool bRedlineRecordingOn : 1; + bool bPageback : 1; bool bShowOutlineContentVisibilityButton : 1; bool bShowChangesInMargin : 1; //tracked deletions in margin @@ -97,6 +101,7 @@ struct ViewOptFlags1 , bTreatSubOutlineLevelsAsContent(false) , bShowInlineTooltips(false) , bViewMetachars(false) + , bRedlineRecordingOn(false) , bPageback(true) , bShowOutlineContentVisibilityButton(false) , bShowChangesInMargin(false) @@ -132,6 +137,7 @@ struct ViewOptFlags1 && bTreatSubOutlineLevelsAsContent == rOther.bTreatSubOutlineLevelsAsContent && bShowInlineTooltips == rOther.bShowInlineTooltips && bViewMetachars == rOther.bViewMetachars + && bRedlineRecordingOn == rOther.bRedlineRecordingOn && bPageback == rOther.bPageback && bShowOutlineContentVisibilityButton == rOther.bShowOutlineContentVisibilityButton && bShowChangesInMargin == rOther.bShowChangesInMargin @@ -553,6 +559,10 @@ public: void SetViewMetaChars( bool b) { m_nCoreOptions.bViewMetachars = b; } + bool IsRedlineRecordingOn() const { return m_nCoreOptions.bRedlineRecordingOn; } + + void SetRedlineRecordingOn(bool b) { m_nCoreOptions.bRedlineRecordingOn = b; } + bool IsSynchronize() const { return m_nCoreOptions.bSynchronize; } void SetSynchronize( bool b ) diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx index 1778745f57e4..9eff073c09b6 100644 --- a/sw/source/core/edit/edredln.cxx +++ b/sw/source/core/edit/edredln.cxx @@ -22,6 +22,7 @@ #include <redline.hxx> #include <doc.hxx> #include <editsh.hxx> +#include <viewopt.hxx> #include <frmtool.hxx> RedlineFlags SwEditShell::GetRedlineFlags() const @@ -35,6 +36,16 @@ void SwEditShell::SetRedlineFlags( RedlineFlags eMode ) { CurrShell aCurr( this ); StartAllAction(); + + // Recording is per-view, the rest if per-document. + auto bRedlineRecordingOn = bool(eMode & RedlineFlags::On); + SwViewOption aOpt(*GetViewOptions()); + if (aOpt.IsRedlineRecordingOn() != bRedlineRecordingOn) + { + aOpt.SetRedlineRecordingOn(bRedlineRecordingOn); + ApplyViewOptions(aOpt); + } + GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eMode ); EndAllAction(); } diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 2b1c929b32d4..4983688c7e12 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -743,6 +743,10 @@ void ViewOptFlags1::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(bViewMetachars).getStr())); (void)xmlTextWriterEndElement(pWriter); + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("bRedlineRecordingOn")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), + BAD_CAST(OString::boolean(bRedlineRecordingOn).getStr())); + (void)xmlTextWriterEndElement(pWriter); (void)xmlTextWriterStartElement(pWriter, BAD_CAST("bPageback")); (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(bPageback).getStr()));