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 <kelemeng@ubuntu.com>
Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
This commit is contained in:
Rafael Lima 2024-01-09 14:15:21 +01:00
parent 9df028306f
commit ba3627ba89
2 changed files with 20 additions and 1 deletions

View file

@ -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;

View file

@ -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>