summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-12-01 19:45:22 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-03 10:03:44 +0100
commit1fd0919d92e792fa4af209a0fc7fde55c9958d1a (patch)
treecd26dec92d00b407722b928dd00c6fc6ae732b81
parentca914b36b36b1fcbbb720388a13abd26d06e7b4d (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>
-rw-r--r--include/sfx2/objsh.hxx2
-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/docsh.hxx2
-rw-r--r--sw/source/uibase/app/docsh.cxx13
-rw-r--r--sw/source/uibase/uiview/view2.cxx7
7 files changed, 18 insertions, 12 deletions
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 8d3897b29d07..42070bd4c090 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -671,7 +671,7 @@ public:
// slots used for Calc: FID_CHG_RECORD, SID_CHG_PROTECT
virtual bool IsChangeRecording() const;
virtual bool HasChangeRecordProtection() const;
- virtual void SetChangeRecording( bool bActivate );
+ virtual void SetChangeRecording( bool bActivate, bool bLockAllViews = false );
virtual void SetProtectionPassword( const OUString &rPassword );
virtual bool GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPasswordHash );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 1e74a5c01a9e..5a9915580725 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -3191,7 +3191,7 @@ bool ScDocShell::HasChangeRecordProtection() const
return bRes;
}
-void ScDocShell::SetChangeRecording( bool bActivate )
+void ScDocShell::SetChangeRecording( bool bActivate, bool /*bLockAllViews*/ )
{
bool bOldChangeRecording = IsChangeRecording();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 80ae6022ba6f..849b05f95def 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -418,7 +418,7 @@ public:
// see also: FID_CHG_RECORD, SID_CHG_PROTECT
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/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index d97731486ccf..a746d1ac89fb 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1092,7 +1092,7 @@ bool SfxObjectShell::HasChangeRecordProtection() const
}
-void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ )
+void SfxObjectShell::SetChangeRecording( bool /*bActivate*/, bool /*bLockAllViews*/ )
{
// currently this function needs to be overwritten by Writer and Calc only
SAL_WARN( "sfx.doc", "function not implemented" );
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);