Blob Blame History Raw
From 418c00d936bad7f4ecc59fc5246a51218026e983 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Tue, 6 Oct 2015 14:17:43 +0200
Subject: [PATCH 186/398] sw tiled rendering: emit LOK_CALLBACK_SEARCH_RESULT*
 for normal search

We used to emit these for find-all only, for no good reason.

Change-Id: Id07dc7649f9a8528b9d4ec16d5f7c651fd607111
(cherry picked from commit 58c38e7ea5debc5440f1d81acf38d8d6ad0883d8)
---
 sw/qa/extras/tiledrendering/tiledrendering.cxx | 7 +++++++
 sw/source/uibase/uiview/viewsrch.cxx           | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 2fd27dd4f8ff..1eb57dea109e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -342,7 +342,10 @@ void lcl_search(bool bBackward)
 void SwTiledRenderingTest::testSearch()
 {
 #if !defined(WNT) && !defined(MACOSX)
+    comphelper::LibreOfficeKit::setActive();
+
     SwXTextDocument* pXTextDocument = createDoc("search.odt");
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
     size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
 
@@ -351,6 +354,8 @@ void SwTiledRenderingTest::testSearch()
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
     size_t nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
+    /// Make sure we get search result selection for normal find as well, not only find all.
+    CPPUNIT_ASSERT(!m_aSearchResultSelection.empty());
 
     // Next hit, in the shape.
     lcl_search(false);
@@ -375,6 +380,8 @@ void SwTiledRenderingTest::testSearch()
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
     nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
+
+    comphelper::LibreOfficeKit::setActive(false);
 #endif
 }
 
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index a22cbdb6528f..c8d3e7a571ea 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -253,7 +253,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
             {
                 bool bRet = SearchAndWrap(bApi);
                 if( bRet )
+                {
                     Scroll(m_pWrtShell->GetCharRect().SVRect());
+                    if (comphelper::LibreOfficeKit::isActive())
+                        lcl_emitSearchResultCallbacks(1, m_pSrchItem, m_pWrtShell);
+                }
                 rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
 #if HAVE_FEATURE_DESKTOP
                 {
-- 
2.12.0