summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/objxtor.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2025-04-07 09:12:57 +0200
committerMiklos Vajna <vmiklos@collabora.com>2025-04-07 17:38:54 +0200
commit94e683b5e18cfa40a65d970b50f03a88ec352b60 (patch)
tree154f1ad642bb84c7eda176541ddc41c0dad873e1 /sfx2/source/doc/objxtor.cxx
parenteee10ae0c83a62b39ae466e4cca433c95f9a9433 (diff)
cool#11226 sw per-view redline on: fix bad record mode change on undo
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. Change-Id: I75697c6b5b3767ad8db899cda080be312eb6c821 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183792 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sfx2/source/doc/objxtor.cxx')
-rw-r--r--sfx2/source/doc/objxtor.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 978bdbd5f579..71b372ca4b5e 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1140,7 +1140,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" );