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 f438aee9253272197d19e46f8340e428d8af9804 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Feb 26 09:14:30 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Feb 26 16:47:58 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/+/182209 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 252d8fd2b953..feb63a4d03c7 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -65,6 +65,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 @@ -103,6 +107,7 @@ struct ViewOptFlags1 , bTreatSubOutlineLevelsAsContent(false) , bShowInlineTooltips(false) , bViewMetachars(false) + , bRedlineRecordingOn(false) , bPageback(true) , bShowOutlineContentVisibilityButton(false) , bShowChangesInMargin(false) @@ -143,6 +148,7 @@ struct ViewOptFlags1 && bTreatSubOutlineLevelsAsContent == rOther.bTreatSubOutlineLevelsAsContent && bShowInlineTooltips == rOther.bShowInlineTooltips && bViewMetachars == rOther.bViewMetachars + && bRedlineRecordingOn == rOther.bRedlineRecordingOn && bPageback == rOther.bPageback && bShowOutlineContentVisibilityButton == rOther.bShowOutlineContentVisibilityButton && bShowChangesInMargin == rOther.bShowChangesInMargin @@ -566,6 +572,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 625181fb6599..e48fd44595b2 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -738,6 +738,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()));