From ba3627ba899adb896855fddee9a0fdd8968b603a Mon Sep 17 00:00:00 2001 From: Rafael Lima Date: Tue, 9 Jan 2024 14:15:21 +0100 Subject: [PATCH] tdf#158704 Add "Delete Comment" command to the Navigator context menu Change-Id: Ied128145ab0e171e536233dda2d31ec3eace1543 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161766 Tested-by: Jenkins Tested-by: Gabor Kelemen Reviewed-by: Rafael Lima --- sc/source/ui/navipi/content.cxx | 13 ++++++++++++- sc/uiconfig/scalc/ui/dropmenu.ui | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 6c472e97dc2e..af8b64b6fdba 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -601,9 +601,12 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) sActive = sId; xDocMenu->set_active(sActive, true); - // Edit Comments entry is only visible for comments + // Edit/Delete Comments are only visible for comments if (nType != ScContentId::NOTE) + { xPop->set_visible("edit", false); + xPop->set_visible("delete", false); + } OUString sIdent = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1))); if (sIdent == "hyperlink") @@ -632,6 +635,14 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) bDone = true; } } + else if (sIdent == "delete") + { + ScAddress aPos = GetNotePos(nChild); + pParentWindow->SetCurrentTable(aPos.Tab()); + pParentWindow->SetCurrentCell(aPos.Col(), aPos.Row()); + ScTabViewShell* pScTabViewShell = ScNavigatorDlg::GetTabViewShell(); + pScTabViewShell->DeleteContents(InsertDeleteFlags::NOTE); + } } break; default: break; diff --git a/sc/uiconfig/scalc/ui/dropmenu.ui b/sc/uiconfig/scalc/ui/dropmenu.ui index 7ed44d4093d0..cc585c5ab735 100644 --- a/sc/uiconfig/scalc/ui/dropmenu.ui +++ b/sc/uiconfig/scalc/ui/dropmenu.ui @@ -86,5 +86,13 @@ True + + + True + False + Delete Comment + True + +