sc/source/ui/navipi/content.cxx  |   13 ++++++++++++-
 sc/uiconfig/scalc/ui/dropmenu.ui |    8 ++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit ba3627ba899adb896855fddee9a0fdd8968b603a
Author:     Rafael Lima <rafael.palma.l...@gmail.com>
AuthorDate: Tue Jan 9 14:15:21 2024 +0100
Commit:     Rafael Lima <rafael.palma.l...@gmail.com>
CommitDate: Wed Jan 10 12:57:34 2024 +0100

    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 <kelem...@ubuntu.com>
    Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com>

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 @@
         <property name="use-underline">True</property>
       </object>
     </child>
+    <child>
+      <object class="GtkMenuItem" id="delete">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="label" translatable="yes" 
context="dropmenu|SCSTR_DELETE">Delete Comment</property>
+        <property name="use-underline">True</property>
+      </object>
+    </child>
   </object>
 </interface>

Reply via email to