diff options
author | László Németh <nemeth@numbertext.org> | 2020-12-01 19:45:22 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-12-03 10:03:44 +0100 |
commit | 1fd0919d92e792fa4af209a0fc7fde55c9958d1a (patch) | |
tree | cd26dec92d00b407722b928dd00c6fc6ae732b81 /sw | |
parent | ca914b36b36b1fcbbb720388a13abd26d06e7b4d (diff) |
tdf#107870 sw: don't jump to cursor setting Record Changes
Using Edit->Track Changes->Record or Record Tracked Changes on
Track Changes toolbar scrolled the pages back to the text
cursor, breaking the review process of the document.
Change-Id: I890e845ff94b636dd6edae19969d913e8d7a7b65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107005
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 13 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 7 |
3 files changed, 14 insertions, 8 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index d58a3fdb9844..070033306af4 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -311,7 +311,7 @@ public: see also: FN_REDLINE_ON, FN_REDLINE_ON */ virtual bool IsChangeRecording() const override; virtual bool HasChangeRecordProtection() const override; - virtual void SetChangeRecording( bool bActivate ) override; + virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false ) override; virtual void SetProtectionPassword( const OUString &rPassword ) override; virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash ) override; diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 64564cb39c9b..7a9620b876cf 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1339,11 +1339,20 @@ bool SwDocShell::HasChangeRecordProtection() const return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); } -void SwDocShell::SetChangeRecording( bool bActivate ) +void SwDocShell::SetChangeRecording( bool bActivate, bool bLockAllViews ) { RedlineFlags nOn = bActivate ? RedlineFlags::On : RedlineFlags::NONE; RedlineFlags nMode = m_pWrtShell->GetRedlineFlags(); - m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn ); + if (bLockAllViews) + { + // tdf#107870: prevent jumping to cursor + auto aViewGuard(LockAllViews()); + m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn ); + } + else + { + m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn ); + } } void SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index cd8e948c78b7..67a4a1b72c43 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -673,13 +673,10 @@ void SwView::Execute(SfxRequest &rReq) } } - const RedlineFlags nOn = static_cast<const SfxBoolItem*>(pItem)->GetValue() - ? RedlineFlags::On : RedlineFlags::NONE; - const RedlineFlags nMode = m_pWrtShell->GetRedlineFlags(); - m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn); + SwDocShell* pDocShell = GetDocShell(); + pDocShell->SetChangeRecording( static_cast<const SfxBoolItem*>(pItem)->GetValue(), /*bLockAllViews=*/true ); // Notify all view shells of this document, as the track changes mode is document-global. - SwDocShell* pDocShell = GetDocShell(); for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell)) { pViewFrame->GetBindings().Invalidate(FN_REDLINE_ON); |