summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2025-04-07 09:12:57 +0200
committerAndras Timar <andras.timar@collabora.com>2025-04-09 14:03:03 +0200
commitcdcd03782bd25d2386546eda84b673742c8c8916 (patch)
treedc05a478c1fca5ac541d302926cecd66e208594f
parentbcb7ef3bc7e070e14aded311a23d8f963ea7122b (diff)
cool#11226 sw per-view redline on: fix bad record mode change on undo cp-24.04.13-3distro/collabora/co-24.04.13
Have 2 Writer views, enable recording for "this view", type a few characters, undo. The recording is now enabled for all views, not just this view. The problem is that sw::DocumentRedlineManager::SetRedlineFlags_intern() only gets flags, so in case UndoRedoRedlineGuard sets new temporary flags & then restores those flags later, then that guard assumes that we return to the old state, but it implicitly calls SetRedlineFlags_intern() with 'bRecordAllViews = true', so the record mode changes from "this view" to "all views" at the end. Fix the problem by changing the RecordAllViews boolean to an enum and introducing a "view agnostic" mode: here we don't care too much about views, since these calls are typically just temporary, but what we care is that 1) if they enable recording, then IsRedlineOn() reports true and 2) if they set new flags & later restore the old flags, the state is unchanged. Alternatives considered: - It would be possible to just touch the model in the "view agnostic" case, but then IsRedlineOn() would still get the recording bool from the view, leading to a stack overflow: lcl_DoWithBreaks() -> sw::DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl() -> sw::DocumentRedlineManager::AppendRedline() -> sw::DocumentContentOperationsManager::DeleteAndJoin() -> lcl_DoWithBreaks() again. - It would be possible to fix this on the undo side (to query the record mode and restore that mode explicitly when restoring flags), but we have many other use-cases for setting & restoring flags: e.g. autocorrect or autoformat. (cherry picked from commit 44dca495bc707339ff23413ad846d9bf3c024866) Conflicts: sw/inc/editsh.hxx sw/qa/extras/tiledrendering/tiledrendering2.cxx sw/source/core/edit/edredln.cxx sw/source/uibase/inc/wrtsh.hxx Change-Id: I75697c6b5b3767ad8db899cda080be312eb6c821 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183871 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 3e37968de803e0ea7990901dd3ce05c28065504d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183927 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--include/sfx2/objsh.hxx3
-rw-r--r--include/sfx2/redlinerecordingmode.hxx24
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/inc/docsh.hxx2
-rw-r--r--sfx2/source/doc/objxtor.cxx2
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx5
-rw-r--r--sw/inc/docsh.hxx2
-rw-r--r--sw/inc/editsh.hxx4
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx27
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx21
-rw-r--r--sw/source/core/edit/edredln.cxx11
-rw-r--r--sw/source/core/inc/DocumentRedlineManager.hxx4
-rw-r--r--sw/source/uibase/app/docsh.cxx6
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx3
-rw-r--r--sw/source/uibase/uiview/view2.cxx8
-rw-r--r--sw/source/uibase/wrtsh/select.cxx4
16 files changed, 103 insertions, 25 deletions
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 4206e26dc8bb..69a0a8615c65 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -44,6 +44,7 @@
#include <o3tl/typed_flags_set.hxx>
#include <functional>
#include <sfx2/AccessibilityIssue.hxx>
+#include <sfx2/redlinerecordingmode.hxx>
namespace weld {class Button; }
namespace model {class ColorSet; }
@@ -690,7 +691,7 @@ public:
// slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
virtual bool IsChangeRecording(SfxViewShell* pViewShell = nullptr, bool bRecordAllViews = true) const;
virtual bool HasChangeRecordProtection() const;
- virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, bool bRecordAllViews = true );
+ virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic );
virtual void SetProtectionPassword( const OUString &rPassword );
virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash );
diff --git a/include/sfx2/redlinerecordingmode.hxx b/include/sfx2/redlinerecordingmode.hxx
new file mode 100644
index 000000000000..fabd741df4b2
--- /dev/null
+++ b/include/sfx2/redlinerecordingmode.hxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+/// Decides how new redline flags affect the views
+enum class SfxRedlineRecordingMode
+{
+ /// Model and current view only: to set new flags & restore old ones later
+ ViewAgnostic,
+ /// Have recording on in this view
+ ThisView,
+ /// Have recording on in all views
+ AllViews,
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 3e13572220dc..2020a15f25af 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -3383,7 +3383,7 @@ bool ScDocShell::HasChangeRecordProtection() const
return bRes;
}
-void ScDocShell::SetChangeRecording( bool bActivate, bool /*bLockAllViews*/, bool /*bRecordAllViews*/ )
+void ScDocShell::SetChangeRecording( bool bActivate, bool /*bLockAllViews*/, SfxRedlineRecordingMode /*eRedlineRecordingMode*/)
{
bool bOldChangeRecording = IsChangeRecording();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 515ee1e4fb0f..d56978d179f9 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -427,7 +427,7 @@ public:
// see also: FID_CHG_RECORD, SID_CHG_PROTECT
virtual bool IsChangeRecording(SfxViewShell* pViewShell = nullptr, bool bRecordAllViews = true) const override;
virtual bool HasChangeRecordProtection() const override;
- virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, bool bRecordAllViews = true ) override;
+ virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic) override;
virtual void SetProtectionPassword( const OUString &rPassword ) override;
virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash ) override;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 6be353114b0b..02862f430f74 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1108,7 +1108,7 @@ bool SfxObjectShell::HasChangeRecordProtection() const
}
-void SfxObjectShell::SetChangeRecording( bool /*bActivate*/, bool /*bLockAllViews*/, bool /*bRecordAllViews*/ )
+void SfxObjectShell::SetChangeRecording( bool /*bActivate*/, bool /*bLockAllViews*/, SfxRedlineRecordingMode /*eRedlineRecordingMode*/)
{
// currently this function needs to be overwritten by Writer and Calc only
SAL_WARN( "sfx.doc", "function not implemented" );
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index 804678479ab1..7861a5858421 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/uno/Sequence.h>
#include <o3tl/typed_flags_set.hxx>
#include <svx/ctredlin.hxx>
+#include <sfx2/redlinerecordingmode.hxx>
#include "docary.hxx"
@@ -107,14 +108,14 @@ public:
@param eMode
[in] the new redline mode.
*/
- virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode, bool bRecordAllViews = true, bool bRecordModeChange = false) = 0;
+ virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic, bool bRecordModeChange = false) = 0;
/** Set a new redline mode.
@param eMode
[in] the new redline mode.
*/
- virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode, bool bRecordAllViews = true, bool bRecordModeChange = false) = 0;
+ virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic, bool bRecordModeChange = false) = 0;
/** Query if redlining is on.
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index bbebb8c2c386..d2993c8b0b3f 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -323,7 +323,7 @@ public:
see also: FN_REDLINE_ON, FN_REDLINE_ON */
virtual bool IsChangeRecording(SfxViewShell* pViewShell = nullptr, bool bRecordAllViews = true) const override;
virtual bool HasChangeRecordProtection() const override;
- virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, bool bRecordAllViews = true ) override;
+ virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic) override;
virtual void SetProtectionPassword( const OUString &rPassword ) override;
virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash ) override;
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index c83839db4431..ff4d8a8cf4ac 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -19,6 +19,8 @@
#ifndef INCLUDED_SW_INC_EDITSH_HXX
#define INCLUDED_SW_INC_EDITSH_HXX
+#include <sfx2/redlinerecordingmode.hxx>
+
#include "crsrsh.hxx"
#include "charfmt.hxx"
@@ -951,7 +953,7 @@ public:
/// For Redlining.
RedlineFlags GetRedlineFlags() const;
- void SetRedlineFlags( RedlineFlags eMode, bool bRecordAllViews = true );
+ void SetRedlineFlags( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic );
bool IsRedlineOn() const;
SwRedlineTable::size_type GetRedlineCount() const;
const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index deb6a3bfa284..14afbd430818 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -5123,6 +5123,33 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTrackChangesStates)
CPPUNIT_ASSERT(dynamic_cast<SfxBoolItem*>(pItem.get())->GetValue());
}
+CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testTrackChangesInsertUndo)
+{
+ // Given a document with 2 views, first view enables redline record for that view only:
+ SwXTextDocument* pXTextDocument = createDoc();
+ CPPUNIT_ASSERT(pXTextDocument);
+ ViewCallback aView1;
+ int nView1 = SfxLokHelper::getView();
+ SwView* pView1 = pXTextDocument->GetDocShell()->GetView();
+ SwWrtShell* pWrtShell1 = pXTextDocument->GetDocShell()->GetWrtShell();
+ SfxLokHelper::createView();
+ ViewCallback aView2;
+ SfxLokHelper::setView(nView1);
+ comphelper::dispatchCommand(".uno:TrackChangesInThisView", {});
+
+ // When typing and undoing:
+ pWrtShell1->Insert(u"A"_ustr);
+ pWrtShell1->Undo();
+
+ // Then make sure the record mode doesn't change:
+ std::unique_ptr<SfxPoolItem> pItem;
+ pView1->GetViewFrame().GetBindings().QueryState(FN_TRACK_CHANGES_IN_THIS_VIEW, pItem);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(FN_TRACK_CHANGES_IN_THIS_VIEW), pItem->Which());
+ // Without the accompanying fix in place, this test would have failed, undo changed "this view"
+ // record mode to "all views", which is unexpected.
+ CPPUNIT_ASSERT(dynamic_cast<SfxBoolItem*>(pItem.get())->GetValue());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index b38b8831f0eb..2c3a1bb8600c 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1174,7 +1174,7 @@ RedlineFlags DocumentRedlineManager::GetRedlineFlags(const SwViewShell* pViewShe
return eRedlineFlags;
}
-void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode, bool bRecordAllViews, bool bRecordModeChange )
+void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode, bool bRecordModeChange )
{
if( GetRedlineFlags() == eMode && !bRecordModeChange )
return;
@@ -1249,7 +1249,7 @@ void DocumentRedlineManager::SetRedlineFlags( RedlineFlags eMode, bool bRecordAl
m_rDoc.SetInXMLImport( bSaveInXMLImportFlag );
}
- SetRedlineFlags_intern(eMode, bRecordAllViews, bRecordModeChange);
+ SetRedlineFlags_intern(eMode, eRedlineRecordingMode, bRecordModeChange);
m_rDoc.getIDocumentState().SetModified();
// #TODO - add 'SwExtraRedlineTable' also ?
@@ -1265,12 +1265,25 @@ bool DocumentRedlineManager::IsIgnoreRedline() const
return bool(RedlineFlags::Ignore & GetRedlineFlags());
}
-void DocumentRedlineManager::SetRedlineFlags_intern(RedlineFlags eMode, bool bRecordAllViews, bool bRecordModeChange)
+void DocumentRedlineManager::SetRedlineFlags_intern(RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode, bool bRecordModeChange)
{
SwDocShell* pDocShell = m_rDoc.GetDocShell();
SwViewShell* pViewShell = pDocShell ? pDocShell->GetWrtShell() : nullptr;
- if (pViewShell)
+ if (pViewShell && eRedlineRecordingMode == SfxRedlineRecordingMode::ViewAgnostic)
+ {
+ // Just set the requested flags on the model and on the current view, so setting flags &
+ // restoring them result in the same state (no matter if that was this-view or all-views).
+ auto bRedlineRecordingOn = bool(eMode & RedlineFlags::On);
+ SwViewOption aOpt(*pViewShell->GetViewOptions());
+ if (aOpt.IsRedlineRecordingOn() != bRedlineRecordingOn)
+ {
+ aOpt.SetRedlineRecordingOn(bRedlineRecordingOn);
+ pViewShell->ApplyViewOptions(aOpt);
+ }
+ }
+ else if (pViewShell)
{
+ bool bRecordAllViews = eRedlineRecordingMode == SfxRedlineRecordingMode::AllViews;
// Recording may be per-view, the rest is per-document.
for(SwViewShell& rSh : pViewShell->GetRingContainer())
{
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index 379f12a6932e..8f278f3659a5 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -30,15 +30,20 @@ RedlineFlags SwEditShell::GetRedlineFlags() const
return GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(this);
}
-void SwEditShell::SetRedlineFlags( RedlineFlags eMode, bool bRecordAllViews )
+void SwEditShell::SetRedlineFlags( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode)
{
SwDocShell* pDocSh = GetDoc()->GetDocShell();
- bool bRecordModeChange = bRecordAllViews != pDocSh->IsChangeRecording(nullptr, bRecordAllViews);
+ bool bRecordModeChange = false;
+ if (eRedlineRecordingMode != SfxRedlineRecordingMode::ViewAgnostic)
+ {
+ bool bRecordAllViews = eRedlineRecordingMode == SfxRedlineRecordingMode::AllViews;
+ bRecordModeChange = bRecordAllViews != pDocSh->IsChangeRecording(nullptr, bRecordAllViews);
+ }
if( eMode != GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() || bRecordModeChange )
{
CurrShell aCurr( this );
StartAllAction();
- GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eMode, bRecordAllViews, bRecordModeChange );
+ GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eMode, eRedlineRecordingMode, bRecordModeChange );
EndAllAction();
}
}
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
index 3651da858126..af0a13358635 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -38,9 +38,9 @@ public:
*/
virtual RedlineFlags GetRedlineFlags(const SwViewShell* pViewShell = nullptr) const override;
- virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode, bool bRecordAllViews = true, bool bRecordModeChange = false) override;
+ virtual void SetRedlineFlags_intern(/*[in]*/RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic, bool bRecordModeChange = false) override;
- virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode, bool bRecordAllViews = true, bool bRecordModeChange = false) override;
+ virtual void SetRedlineFlags(/*[in]*/RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic, bool bRecordModeChange = false) override;
virtual bool IsRedlineOn() const override;
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 5f20ca5b1825..8276e7f5658f 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1389,7 +1389,7 @@ bool SwDocShell::HasChangeRecordProtection() const
return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
}
-void SwDocShell::SetChangeRecording( bool bActivate, bool bLockAllViews, bool bRecordAllViews )
+void SwDocShell::SetChangeRecording( bool bActivate, bool bLockAllViews, SfxRedlineRecordingMode eRedlineRecordingMode)
{
RedlineFlags nOn = bActivate ? RedlineFlags::On : RedlineFlags::NONE;
RedlineFlags nMode = m_pWrtShell->GetRedlineFlags();
@@ -1397,11 +1397,11 @@ void SwDocShell::SetChangeRecording( bool bActivate, bool bLockAllViews, bool bR
{
// tdf#107870: prevent jumping to cursor
auto aViewGuard(LockAllViews());
- m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn, bRecordAllViews );
+ m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn, eRedlineRecordingMode );
}
else
{
- m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn, bRecordAllViews );
+ m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn, eRedlineRecordingMode );
}
}
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index ddbae7f59d3a..c5a92fd0389a 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -29,6 +29,7 @@
#include <o3tl/typed_flags_set.hxx>
#include <svx/swframetypes.hxx>
#include <vcl/weld.hxx>
+#include <sfx2/redlinerecordingmode.hxx>
#include <doc.hxx>
#include <docsh.hxx>
@@ -172,7 +173,7 @@ public:
void SetInsMode( bool bOn = true );
void ToggleInsMode() { SetInsMode( !m_bIns ); }
bool IsInsMode() const { return m_bIns; }
- void SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode, bool bRecordAllViews = true );
+ void SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::ViewAgnostic );
void EnterSelFrameMode(const Point *pStartDrag = nullptr);
void LeaveSelFrameMode();
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index a2eebb647db3..7d961aa72402 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -834,8 +834,12 @@ void SwView::Execute(SfxRequest &rReq)
}
SwDocShell* pDocShell = GetDocShell();
- bool bRecordAllViews = nSlot != FN_TRACK_CHANGES_IN_THIS_VIEW;
- pDocShell->SetChangeRecording( oOn.value(), /*bLockAllViews=*/true, bRecordAllViews );
+ SfxRedlineRecordingMode eRedlineRecordingMode = SfxRedlineRecordingMode::AllViews;
+ if (nSlot == FN_TRACK_CHANGES_IN_THIS_VIEW)
+ {
+ eRedlineRecordingMode = SfxRedlineRecordingMode::ThisView;
+ }
+ pDocShell->SetChangeRecording( oOn.value(), /*bLockAllViews=*/true, eRedlineRecordingMode );
// Notify all view shells of this document, as the track changes mode is document-global.
for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell))
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 13fe4c524837..66a53c7862eb 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -769,9 +769,9 @@ void SwWrtShell::SetInsMode( bool bOn )
}
//Overwrite mode is incompatible with red-lining
-void SwWrtShell::SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode, bool bRecordAllViews )
+void SwWrtShell::SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode, SfxRedlineRecordingMode eRedlineRecordingMode )
{
- SetRedlineFlags( eMode, bRecordAllViews );
+ SetRedlineFlags( eMode, eRedlineRecordingMode );
if (IsRedlineOn())
SetInsMode();
}