Blob Blame History Raw
From 72ed4d0614165dc6e70a266f54119e1d62d8ebef Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 5 Oct 2015 11:29:28 +0200
Subject: [PATCH 172/398] LOK: add CALLBACK_SEARCH_RESULT_COUNT and implement
 in sw

Change-Id: I616b3f6d2881aaa479f6498d3121540980256c15
(cherry picked from commit 6c040ad18bd7b5a2d1d11130f4dbfd1c9d90055d)
---
 include/LibreOfficeKit/LibreOfficeKitEnums.h | 4 +++-
 sw/source/uibase/uiview/viewsrch.cxx         | 8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 7038e5fc8cc2..dc3e0f94f3dc 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -155,7 +155,9 @@ typedef enum
      *
      * Payload is a single 0-based integer.
      */
-    LOK_CALLBACK_SET_PART
+    LOK_CALLBACK_SET_PART,
+    /// Number of search results, in case something is found.
+    LOK_CALLBACK_SEARCH_RESULT_COUNT
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 28fc2c920ac3..11764126e165 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -209,7 +209,8 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
             break;
             case SvxSearchCmd::FIND_ALL:
             {
-                bool bRet = SearchAll();
+                sal_uInt16 nFound = 0;
+                bool bRet = SearchAll(&nFound);
                 if( !bRet )
                 {
 #if HAVE_FEATURE_DESKTOP
@@ -222,6 +223,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
 #endif
                     m_bFound = false;
                 }
+                else
+                {
+                    OString aPayload = OString::number(nFound);
+                    m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_COUNT, aPayload.getStr());
+                }
                 rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
 #if HAVE_FEATURE_DESKTOP
                 {
-- 
2.12.0