sw/source/uibase/docvw/PostItMgr.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 9370e23fdfda65b76717ad17d93393506f4a93fa Author: Samuel Mehrbrodt <samuel.mehrbr...@collabora.com> AuthorDate: Thu Sep 4 12:36:07 2025 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@collabora.com> CommitDate: Mon Sep 8 07:52:03 2025 +0200 Send search selection for comments to LOKit client This helps with highlighting search results within comments. Change-Id: I6c474dea70b6ec14c42d7dc70802c622152e0d1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190581 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Stephan Bergmann <stephan.bergm...@collabora.com> (cherry picked from commit 63d82925f9ba4fe2b884523920b36c3f3309c440) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190585 Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 4fb7a9f33406..cbfe8c625316 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -107,7 +107,7 @@ using namespace sw::annotation; namespace { - enum class CommentNotificationType { Add, Remove, Modify, Resolve, RedlinedDeletion }; + enum class CommentNotificationType { Add, Remove, Modify, Resolve, SearchHighlight, RedlinedDeletion }; bool comp_pos(const std::unique_ptr<SwAnnotationItem>& a, const std::unique_ptr<SwAnnotationItem>& b) { @@ -152,7 +152,8 @@ namespace { (nType == CommentNotificationType::Remove ? "Remove" : (nType == CommentNotificationType::Modify ? "Modify" : (nType == CommentNotificationType::RedlinedDeletion ? "RedlinedDeletion" : - (nType == CommentNotificationType::Resolve ? "Resolve" : "???")))))); + (nType == CommentNotificationType::SearchHighlight ? "SearchHighlight" : + (nType == CommentNotificationType::Resolve ? "Resolve" : "???"))))))); aAnnotation.put("id", nPostItId); if (nType != CommentNotificationType::Remove && pItem != nullptr) @@ -190,6 +191,15 @@ namespace { aAnnotation.put("anchorPos", aSVRect.toString()); aAnnotation.put("textRange", sRects.getStr()); aAnnotation.put("layoutStatus", pItem->mLayoutStatus); + if (nType == CommentNotificationType::SearchHighlight) + { + ESelection aSel = pWin->GetOutlinerView()->GetSelection(); + OString sSelStr = OString::Concat(OString::number(aSel.start.nPara)) + "," + + OString::number(aSel.start.nIndex) + "," + + OString::number(aSel.end.nPara) + "," + + OString::number(aSel.end.nIndex); + aAnnotation.put("searchSelection", sSelStr); + } } if (nType == CommentNotificationType::Remove && comphelper::LibreOfficeKit::isActive()) { @@ -2646,6 +2656,8 @@ sal_uInt16 SwPostItMgr::FinishSearchReplace(const i18nutil::SearchOptions2& rSea sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem ); if (!aResult) SetActiveSidebarWin(nullptr); + else + lcl_CommentNotification(mpView, CommentNotificationType::SearchHighlight, &pWin->GetSidebarItem(), 0); return aResult; } @@ -2670,6 +2682,7 @@ sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const i18nuti { SetActiveSidebarWin(pWin); MakeVisible(pWin); + lcl_CommentNotification(mpView, CommentNotificationType::SearchHighlight, &pWin->GetSidebarItem(), 0); } } return aResult;