LOK: add the search phrase to the search result count callback
We need this to notify the user for which search phrase no results were found Change-Id: I8cc7ab235b9129dfdcb022145456180ff7e4ca92
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <drawdoc.hxx>
|
||||
#include <ndtxt.hxx>
|
||||
#include <wrtsh.hxx>
|
||||
#include <string>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user