From 6753b7fbba15e631e0b300cfa48cc2d5e859a88f Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 14 Sep 2020 12:56:21 +0530 Subject: Added new command to resolve the comment thread Change-Id: I8a4e5f63ee6ea5e560fae8a5d3602178f2b58b36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102827 Tested-by: Jenkins Reviewed-by: Pranam Lashkari --- desktop/source/lib/init.cxx | 1 + .../data/org/openoffice/Office/UI/GenericCommands.xcu | 8 ++++++++ sfx2/source/control/unoctitm.cxx | 1 + sw/inc/cmdid.h | 1 + sw/sdi/_annotsh.sdi | 6 ++++++ sw/sdi/_textsh.sdi | 5 +++++ sw/sdi/swriter.sdi | 17 +++++++++++++++++ sw/source/uibase/docvw/AnnotationMenuButton.cxx | 6 ++++++ sw/source/uibase/docvw/AnnotationWin2.cxx | 7 +++++++ sw/source/uibase/shells/annotsh.cxx | 15 +++++++++++++++ sw/source/uibase/shells/textfld.cxx | 9 +++++++++ sw/uiconfig/sglobal/menubar/menubar.xml | 1 + sw/uiconfig/sglobal/popupmenu/annotation.xml | 1 + sw/uiconfig/swriter/menubar/menubar.xml | 1 + sw/uiconfig/swriter/popupmenu/annotation.xml | 1 + sw/uiconfig/swriter/ui/annotationmenu.ui | 16 ++++++++++++++++ sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui | 7 +++++++ 17 files changed, 103 insertions(+) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 24b3a1f9c24f..e56a925ccb39 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2705,6 +2705,7 @@ static void doc_iniUnoCommands () OUString(".uno:DeleteAnnotation"), OUString(".uno:ReplyComment"), OUString(".uno:ResolveComment"), + OUString(".uno:ResolveCommentThread"), OUString(".uno:InsertRowsBefore"), OUString(".uno:InsertRowsAfter"), OUString(".uno:InsertColumnsBefore"), diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 97b8e210924c..41b746b81fcd 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -6410,6 +6410,14 @@ 1 + + + Resolved Thread + + + 1 + + Top diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index ea2bb2722b0c..be3b79d1d421 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1074,6 +1074,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, SfxViewFrame* pViewFra aEvent.FeatureURL.Path == "InsertAnnotation" || aEvent.FeatureURL.Path == "DeleteAnnotation" || aEvent.FeatureURL.Path == "ResolveAnnotation" || + aEvent.FeatureURL.Path == "ResolveAnnotationThread" || aEvent.FeatureURL.Path == "InsertRowsBefore" || aEvent.FeatureURL.Path == "InsertRowsAfter" || aEvent.FeatureURL.Path == "InsertColumnsBefore" || diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 0728b983bc89..ac6c43be767e 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -752,6 +752,7 @@ #define FN_REPLY (FN_NOTES+7) #define FN_FORMAT_ALL_NOTES (FN_NOTES+8) #define FN_RESOLVE_NOTE (FN_NOTES+9) +#define FN_RESOLVE_NOTE_THREAD (FN_NOTES+10) // Region: Parameter #define FN_PARAM_MOVE_COUNT (FN_PARAM+2) diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 1a9bd2d45aa4..9a78988dee2a 100644 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -66,6 +66,12 @@ interface _Annotation StateMethod = GetNoteState ; ] + FN_RESOLVE_NOTE_THREAD + [ + ExecMethod = NoteExec ; + StateMethod = GetNoteState ; + ] + FN_POSTIT [ ExecMethod = NoteExec ; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index af090c6bfe24..67fc2776e5d0 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -964,6 +964,11 @@ interface BaseText ExecMethod = ExecField ; StateMethod = StateField; ] + FN_RESOLVE_NOTE_THREAD + [ + ExecMethod = ExecField ; + StateMethod = StateField; + ] FN_DELETE_NOTE_AUTHOR [ ExecMethod = ExecField ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index c815e1285670..843cba4530b9 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7295,6 +7295,23 @@ SfxVoidItem ResolveComment FN_RESOLVE_NOTE GroupId = SfxGroupId::Edit; ] +SfxVoidItem ResolveCommentThread FN_RESOLVE_NOTE_THREAD +(SvxPostItIdItem Id SID_ATTR_POSTIT_ID) +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + SfxStringItem DeleteAuthor FN_DELETE_NOTE_AUTHOR ( SfxStringItem Author FN_DELETE_NOTE_AUTHOR ) [ AutoUpdate = FALSE, diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index 58e4f7a8a610..f80551430d23 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -78,6 +78,8 @@ void AnnotationMenuButton::Select() mrSidebarWin.ExecuteCommand(FN_REPLY); if (sIdent == "resolve" || sIdent == "unresolve") mrSidebarWin.ExecuteCommand(FN_RESOLVE_NOTE); + else if (sIdent == "resolvethread" || sIdent == "unresolvethread") + mrSidebarWin.ExecuteCommand(FN_RESOLVE_NOTE_THREAD); else if (sIdent == "delete") mrSidebarWin.ExecuteCommand(FN_DELETE_COMMENT); else if (sIdent == "deleteby") @@ -96,6 +98,8 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt ) pButtonPopup->EnableItem(pButtonPopup->GetItemId("reply"), false); pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolve"), false); pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolve"), false); + pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), false); + pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), false); pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), false ); pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby"), false ); pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall"), false ); @@ -105,6 +109,8 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt ) { pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolve"), !mrSidebarWin.IsResolved()); pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolve"), mrSidebarWin.IsResolved()); + pButtonPopup->EnableItem(pButtonPopup->GetItemId("resolvethread"), !mrSidebarWin.IsThreadResolved()); + pButtonPopup->EnableItem(pButtonPopup->GetItemId("unresolvethread"), mrSidebarWin.IsThreadResolved()); pButtonPopup->EnableItem(pButtonPopup->GetItemId("delete"), !mrSidebarWin.IsProtected()); pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteby")); pButtonPopup->EnableItem(pButtonPopup->GetItemId("deleteall")); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index fc0289e5bf5f..613f0bf880f0 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1264,6 +1264,13 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) Invalidate(); mrMgr.LayoutPostIts(); break; + case FN_RESOLVE_NOTE_THREAD: + GetTopReplyNote()->SetResolved(!IsThreadResolved()); + mrMgr.UpdateResolvedStatus(GetTopReplyNote()); + DoResize(); + Invalidate(); + mrMgr.LayoutPostIts(); + break; case FN_FORMAT_ALL_NOTES: case FN_DELETE_ALL_NOTES: case FN_HIDE_ALL_NOTES: diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index c08be05edaad..7115c3b4e5ca 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1088,6 +1088,7 @@ void SwAnnotationShell::NoteExec(SfxRequest const &rReq) case FN_POSTIT: case FN_DELETE_COMMENT: case FN_RESOLVE_NOTE: + case FN_RESOLVE_NOTE_THREAD: if ( pPostItMgr->HasActiveSidebarWin() ) pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot); break; @@ -1160,6 +1161,20 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) } break; } + case FN_RESOLVE_NOTE_THREAD: + { + if( !pPostItMgr + || !pPostItMgr->HasActiveAnnotationWin() ) + { + rSet.DisableItem(nWhich); + } + else + { + SfxBoolItem aBool(nWhich, pPostItMgr->GetActiveSidebarWin()->IsThreadResolved()); + rSet.Put( aBool ); + } + break; + } case FN_DELETE_NOTE_AUTHOR: case FN_HIDE_NOTE_AUTHOR: { diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 851e9bd34782..b214a11a2eba 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -336,6 +336,15 @@ void SwTextShell::ExecField(SfxRequest &rReq) } break; } + case FN_RESOLVE_NOTE_THREAD: + { + const SvxPostItIdItem* pIdItem = rReq.GetArg(SID_ATTR_POSTIT_ID); + if (pIdItem && !pIdItem->GetValue().isEmpty() && GetView().GetPostItMgr()) + { + GetView().GetPostItMgr()->ToggleResolvedForThread(pIdItem->GetValue().toUInt32()); + } + break; + } case FN_DELETE_ALL_NOTES: if ( GetView().GetPostItMgr() ) GetView().GetPostItMgr()->Delete(); diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 3d7137ed8e21..34c028540c3e 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -145,6 +145,7 @@ + diff --git a/sw/uiconfig/sglobal/popupmenu/annotation.xml b/sw/uiconfig/sglobal/popupmenu/annotation.xml index 4724bde64c89..1805d2d62f7c 100644 --- a/sw/uiconfig/sglobal/popupmenu/annotation.xml +++ b/sw/uiconfig/sglobal/popupmenu/annotation.xml @@ -20,6 +20,7 @@ + diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 527163742747..4ecdabc774dd 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -150,6 +150,7 @@ + diff --git a/sw/uiconfig/swriter/popupmenu/annotation.xml b/sw/uiconfig/swriter/popupmenu/annotation.xml index e455091a41b1..87a294bc50c0 100644 --- a/sw/uiconfig/swriter/popupmenu/annotation.xml +++ b/sw/uiconfig/swriter/popupmenu/annotation.xml @@ -21,6 +21,7 @@ + diff --git a/sw/uiconfig/swriter/ui/annotationmenu.ui b/sw/uiconfig/swriter/ui/annotationmenu.ui index c21c6bb555a5..7e669fc13f4b 100644 --- a/sw/uiconfig/swriter/ui/annotationmenu.ui +++ b/sw/uiconfig/swriter/ui/annotationmenu.ui @@ -35,6 +35,22 @@ True + + + True + False + Resolve Thread + True + + + + + True + False + Unresolve Thread + True + + True diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui index ea6cf4435792..7a049a001e27 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui @@ -329,6 +329,13 @@ .uno:ResolveComment + + + True + False + .uno:ResolveCommentThread + + True -- cgit