[Libreoffice-commits] core.git: include/LibreOfficeKit libreofficekit/source sw/qa sw/source

Mihai Varga mihai.varga at collabora.com
Mon Oct 5 07:51:55 PDT 2015


 include/LibreOfficeKit/LibreOfficeKitEnums.h   |    6 +++++-
 libreofficekit/source/gtk/lokdocview.cxx       |   10 ++++++++++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    4 +++-
 sw/source/uibase/uiview/viewsrch.cxx           |    2 +-
 4 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit c30defcf8e34daec6ea0455d772fe296cc26ecc9
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Oct 5 17:07:06 2015 +0300

    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

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index dc3e0f9..97c089f 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 2d34e58..2aa1916 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 c836f4b..bcc328e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -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;
     }
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index dcb4452..20ffed6 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));


More information about the Libreoffice-commits mailing list