summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-09 08:08:48 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-09 08:09:16 +0200
commitf0e3fe840b6f103c589f044bbde18b2faa345279 (patch)
treed8049ca5c6695ab1d20b1d21b4985bae1a749780 /libreofficekit/source
parent854af5a574a9d0d3e8e56f83c4853cfad872f456 (diff)
LOK: CALLBACK_SEARCH_RESULT_COUNT is redundant
1) The size of the searchResultSelection array in LOK_CALLBACK_SEARCH_RESULT_SELECTION provides the same information. 2) None of the clients except lokdocview used it. 3) Only sw provided this callback, not sc/sd. Change-Id: I9da639b6693f24634f298f9bc4773f705e944359
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index f6eec2e79779..df78d13cd21a 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -12,6 +12,7 @@
#include <string.h>
#include <vector>
#include <string>
+#include <boost/property_tree/json_parser.hpp>
#include <com/sun/star/awt/Key.hpp>
#define LOK_USE_UNSTABLE_API
@@ -227,8 +228,6 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
case LOK_CALLBACK_SEARCH_NOT_FOUND:
return "LOK_CALLBACK_SEARCH_NOT_FOUND";
- case LOK_CALLBACK_SEARCH_RESULT_COUNT:
- return "LOK_CALLBACK_SEARCH_RESULT_COUNT";
case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
return "LOK_CALLBACK_DOCUMENT_SIZE_CHANGED";
case LOK_CALLBACK_SET_PART:
@@ -661,12 +660,6 @@ callback (gpointer pData)
searchNotFound(pDocView, pCallback->m_aPayload);
}
break;
- case LOK_CALLBACK_SEARCH_RESULT_COUNT:
- {
- size_t nPos = pCallback->m_aPayload.find_first_of(";");
- searchResultCount(pDocView, pCallback->m_aPayload.substr(0, nPos));
- }
- break;
case LOK_CALLBACK_DOCUMENT_SIZE_CHANGED:
{
payloadToSize(pCallback->m_aPayload.c_str(), priv->m_nDocumentWidthTwips, priv->m_nDocumentHeightTwips);
@@ -684,6 +677,11 @@ callback (gpointer pData)
break;
case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
{
+ boost::property_tree::ptree aTree;
+ std::stringstream aStream(pCallback->m_aPayload);
+ boost::property_tree::read_json(aStream, aTree);
+ int nCount = aTree.get_child("searchResultSelection").size();
+ searchResultCount(pDocView, std::to_string(nCount));
}
break;
default: