sw/source/uibase/utlui/content.cxx | 39 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 25 deletions(-)
New commits: commit e07d88403140455b8221045689632ca78922e6cf Author: Mike Kaganski <[email protected]> AuthorDate: Sun Nov 2 22:21:47 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Nov 2 20:45:02 2025 +0100 tdf#108791: also handle deletion of comments in Navigator We should also think, what to do with other cases like Backspace at the comment anchor, which still produces the unwanted result. Change-Id: I348ab1455aef54d7233870c6bab8ec89a93902d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193303 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 66d4088253ad..7163449452a8 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -6424,13 +6424,17 @@ void SwContentTree::EditEntry(const weld::TreeIter& rEntry, EditEntryMode nMode) break; case ContentTypeId::POSTIT: { - auto& rView = m_pActiveShell->GetView(); - auto pPostItMgr = rView.GetPostItMgr(); - pPostItMgr->AssureStdModeAtShell(); - pPostItMgr->SetActiveSidebarWin(nullptr); - rView.GetEditWin().GrabFocus(); - if(nMode == EditEntryMode::DELETE) - m_pActiveShell->DelRight(); + if (nMode == EditEntryMode::DELETE) + { + if (auto pPostItMgr = m_pActiveShell->GetPostItMgr()) + { + if (auto pPostItField = static_cast<SwPostItContent*>(pCnt)->GetPostItField()) + { + pPostItMgr->AssureStdModeAtShell(); + pPostItMgr->Delete(pPostItField->GetPostItId()); + } + } + } else nSlot = FN_POSTIT; } @@ -6737,26 +6741,11 @@ void SwContentTree::DeleteAllContentOfEntryContentType(const weld::TreeIter& rEn } else if (eContentTypeId == ContentTypeId::POSTIT) { - m_pActiveShell->AssureStdMode(); - - const auto nCount = pContentType->GetMemberCount(); - - m_pActiveShell->StartAction(); - SwRewriter aRewriter; - aRewriter.AddRule(UndoArg1, pContentType->GetName()); - m_pActiveShell->StartUndo(SwUndoId::DELETE, &aRewriter); - for (size_t i = 0; i < nCount; i++) + if (auto pPostItMgr = m_pActiveShell->GetPostItMgr()) { - const SwPostItContent* pPostItContent - = static_cast<const SwPostItContent*>(pContentType->GetMember(i)); - if (pPostItContent->GetPostIt()) - { - m_pActiveShell->GotoFormatField(*pPostItContent->GetPostIt()); - } - m_pActiveShell->DelRight(); + pPostItMgr->AssureStdModeAtShell(); + pPostItMgr->Delete(); } - m_pActiveShell->EndUndo(); - m_pActiveShell->EndAction(); } else if (eContentTypeId == ContentTypeId::DRAWOBJECT) {
