officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 11 ++ sw/inc/cmdid.h | 2 sw/qa/core/edit/edit.cxx | 37 ++++++++++ sw/sdi/_viewsh.sdi | 6 + sw/sdi/swriter.sdi | 19 +++++ sw/source/uibase/uiview/view2.cxx | 10 +- sw/source/uibase/uiview/viewstat.cxx | 1 sw/uiconfig/swriter/menubar/menubar.xml | 1 8 files changed, 83 insertions(+), 4 deletions(-)
New commits: commit 9f73b6dddaba36105e20fa1bcabd92913fe070f3 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Mar 27 08:58:55 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Mar 27 15:57:26 2025 +0100 cool#11357 sw redline reinstate: add a reinstate-end-next command Accept and reject has a way to do their action & move to the next redline, resinstate is missing this combo. This is because these versions are separate UNO commands and reinstate just has the direct .uno:ReinstateTrackedChange. Fix the problem by adding a new .uno:ReinstateTrackedChangeToNext that does this, together with the command state. Also add it to the menubar. Change-Id: Ica2358b3fc38cc66e801292ab13f8ba3ec4e9ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183363 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index b8dc7c9096dd..ca1ab9750fa0 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -251,6 +251,17 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ReinstateTrackedChangeToNext" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Reinstate and Move to Next</value> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> + <value xml:lang="en-US">Reinstate Track Change and select the next one</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:RejectAllTrackedChanges" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Reject All</value> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index eacd59e18281..839e47a6f8f6 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -144,7 +144,7 @@ class SwUINumRuleItem; #define FN_REDLINE_ACCEPT_DIRECT (FN_EDIT2 + 37) /* accept redline at current position*/ #define FN_REDLINE_REJECT_DIRECT (FN_EDIT2 + 38) /* reject redline at current position*/ #define FN_REDLINE_REINSTATE_DIRECT (FN_EDIT2 + 39) /* reinstate redline at current position*/ -// free +#define FN_REDLINE_REINSTATE_TONEXT (FN_EDIT2 + 40) /* reinstate redline and jump to next */ #define FN_REDLINE_NEXT_CHANGE (FN_EDIT2 + 41) /* Go to the next change */ #define FN_REDLINE_PREV_CHANGE (FN_EDIT2 + 42) /* Go to the previous change */ #define FN_REDLINE_ACCEPT_ALL (FN_EDIT2 + 43) /* Redlining Accept All*/ diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx index 3bf605e565f0..cf96b865ac43 100644 --- a/sw/qa/core/edit/edit.cxx +++ b/sw/qa/core/edit/edit.cxx @@ -330,6 +330,43 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineReinstateDeletesInSelection) CPPUNIT_ASSERT_EQUAL(RedlineType::Insert, rRedlineData4.GetType()); } +CPPUNIT_TEST_FIXTURE(Test, testRedlineReinstateAndNext) +{ + // Given a document with two deletions: + createSwDoc(); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Insert("abbcdde"); + SwModule* pModule = SwModule::get(); + pModule->SetRedlineAuthor("Alice"); + RedlineFlags nMode = pWrtShell->GetRedlineFlags(); + pWrtShell->SetRedlineFlags(nMode | RedlineFlags::On); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); + pWrtShell->DelRight(); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 3, /*bBasicCall=*/false); + pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); + pWrtShell->DelRight(); + pWrtShell->SetRedlineFlags(nMode); + + // When a 2nd user moves into the first deletion and does reinstate-and-next twice: + pModule->SetRedlineAuthor("Bob"); + pWrtShell->SttPara(/*bSelect=*/false); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false); + dispatchCommand(mxComponent, ".uno:ReinstateTrackedChangeToNext", {}); + // Again, without an explicit cursor move: + dispatchCommand(mxComponent, ".uno:ReinstateTrackedChangeToNext", {}); + + // Then make sure we have insertions for both deletions: + SwDoc* pDoc = pWrtShell->GetDoc(); + IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess(); + SwRedlineTable& rRedlines = rIDRA.GetRedlineTable(); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4 + // - Actual : 2 + // i.e. reinstate-and-next didn't create a redline & didn't move to the next one. + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rRedlines.size()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 1e0e325a7376..378cc09cfa0c 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -217,6 +217,12 @@ interface BaseTextEditView StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnMailboxEditor"; ] + FN_REDLINE_REINSTATE_TONEXT + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SfxDisableFlags::SwOnMailboxEditor"; + ] FN_REDLINE_NEXT_CHANGE [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 0d36b07756a1..aa40add805f3 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7990,6 +7990,25 @@ SfxVoidItem ReinstateTrackedChange FN_REDLINE_REINSTATE_DIRECT GroupId = SfxGroupId::Edit; ] +SfxVoidItem ReinstateTrackedChangeToNext FN_REDLINE_REINSTATE_TONEXT +( SfxUInt32Item ReinstateTrackedChangeToNext FN_REDLINE_REINSTATE_TONEXT ) +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + SfxVoidItem AcceptAllTrackedChanges FN_REDLINE_ACCEPT_ALL [ AutoUpdate = FALSE, diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index b0484d704215..892535714861 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -888,6 +888,7 @@ void SwView::Execute(SfxRequest &rReq) case FN_REDLINE_ACCEPT_TONEXT: case FN_REDLINE_REJECT_TONEXT: case FN_REDLINE_REINSTATE_DIRECT: + case FN_REDLINE_REINSTATE_TONEXT: { SwDoc *pDoc = m_pWrtShell->GetDoc(); SwPaM *pCursor = m_pWrtShell->GetCursor(); @@ -906,7 +907,7 @@ void SwView::Execute(SfxRequest &rReq) if( pCursor->HasMark() && nRedline == SwRedlineTable::npos) { bool bAccept = FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot; - bool bReinstate = nSlot == FN_REDLINE_REINSTATE_DIRECT; + bool bReinstate = nSlot == FN_REDLINE_REINSTATE_DIRECT || nSlot == FN_REDLINE_REINSTATE_TONEXT; SwUndoId eUndoId = bAccept ? SwUndoId::ACCEPT_REDLINE : SwUndoId::REJECT_REDLINE; SwWrtShell& rSh = GetWrtShell(); SwRewriter aRewriter; @@ -1072,7 +1073,7 @@ void SwView::Execute(SfxRequest &rReq) { if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot) m_pWrtShell->AcceptRedline(nRedline); - else if (nSlot == FN_REDLINE_REINSTATE_DIRECT) + else if (nSlot == FN_REDLINE_REINSTATE_DIRECT || nSlot == FN_REDLINE_REINSTATE_TONEXT) { m_pWrtShell->ReinstateRedline(nRedline); } @@ -1080,8 +1081,11 @@ void SwView::Execute(SfxRequest &rReq) m_pWrtShell->RejectRedline(nRedline); } } - if (FN_REDLINE_ACCEPT_TONEXT == nSlot || FN_REDLINE_REJECT_TONEXT == nSlot) + switch (nSlot) { + case FN_REDLINE_ACCEPT_TONEXT: + case FN_REDLINE_REJECT_TONEXT: + case FN_REDLINE_REINSTATE_TONEXT: // Go to next change after accepting or rejecting one (tdf#101977) GetViewFrame().GetDispatcher()->Execute(FN_REDLINE_NEXT_CHANGE, SfxCallMode::ASYNCHRON); } diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index a6f49ed91a04..dfc692e11ce2 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -394,6 +394,7 @@ void SwView::GetState(SfxItemSet &rSet) case FN_REDLINE_REINSTATE_DIRECT: case FN_REDLINE_ACCEPT_TONEXT: case FN_REDLINE_REJECT_TONEXT: + case FN_REDLINE_REINSTATE_TONEXT: { SwDoc *pDoc = m_pWrtShell->GetDoc(); SwPaM *pCursor = m_pWrtShell->GetCursor(); diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 76ceac8bf705..d723ae606037 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -139,6 +139,7 @@ <menu:menuitem menu:id=".uno:RejectTrackedChangeToNext"/> <menu:menuitem menu:id=".uno:RejectAllTrackedChanges"/> <menu:menuitem menu:id=".uno:ReinstateTrackedChange"/> + <menu:menuitem menu:id=".uno:ReinstateTrackedChangeToNext"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:CommentChangeTracking"/> <menu:menuitem menu:id=".uno:ProtectTraceChangeMode"/>