sw/source/uibase/docvw/PostItMgr.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
New commits: commit 63d82925f9ba4fe2b884523920b36c3f3309c440 Author: Samuel Mehrbrodt <samuel.mehrbr...@collabora.com> AuthorDate: Thu Sep 4 12:36:07 2025 +0200 Commit: Stephan Bergmann <stephan.bergm...@collabora.com> CommitDate: Thu Sep 4 14:43:04 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> diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 75e08c5871d1..118db8096cb6 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -102,7 +102,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<SwSidebarItem>& a, const std::unique_ptr<SwSidebarItem>& b) { @@ -147,7 +147,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) @@ -185,6 +186,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()) { @@ -2596,6 +2606,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; } @@ -2620,6 +2632,7 @@ sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const i18nuti { SetActiveSidebarWin(pWin); MakeVisible(pWin); + lcl_CommentNotification(mpView, CommentNotificationType::SearchHighlight, &pWin->GetSidebarItem(), 0); } } return aResult;