diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index dc3e0f94f3dc..97c089ffef50 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -156,7 +156,11 @@ typedef enum * Payload is a single 0-based integer. */ LOK_CALLBACK_SET_PART, - /// Number of search results, in case something is found. + + /** + * Number of search results followed by the original searched phrase. + * count;phrase + */ LOK_CALLBACK_SEARCH_RESULT_COUNT } LibreOfficeKitCallbackType; diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 2d34e581ae73..2aa1916f409a 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -658,6 +658,16 @@ callback (gpointer pData) searchNotFound(pDocView, pCallback->m_aPayload); } break; + case LOK_CALLBACK_SEARCH_RESULT_COUNT: + { + size_t nPos = pCallback->m_aPayload.find_first_of(";"); + int nSearchResultCount = std::stoi(pCallback->m_aPayload.substr(0, nPos)); + if (nSearchResultCount == 0) + { + searchNotFound(pDocView, pCallback->m_aPayload.substr(nPos + 1)); + } + } + break; case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED: { payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index c836f4bc5eab..bcc328e366a3 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -23,6 +23,7 @@ #include #include #include +#include static const char* DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/"; @@ -132,7 +133,8 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) break; case LOK_CALLBACK_SEARCH_RESULT_COUNT: { - m_nSearchResultCount = OString(pPayload).toInt32(); + std::string aStrPayload(pPayload); + m_nSearchResultCount = std::stoi(aStrPayload.substr(0, aStrPayload.find_first_of(";"))); } break; } diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index dcb445256df9..20ffed6c2c8f 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -225,7 +225,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) } else { - OString aPayload = OString::number(nFound); + OString aPayload = OString::number(nFound) + ";" + m_pSrchItem->GetSearchString().toUtf8(); m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr()); } rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));