kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0186-sw-tiled-rendering-emit-LOK_CALLBACK_SEARCH_RESULT-f.patch

135360
From 418c00d936bad7f4ecc59fc5246a51218026e983 Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Tue, 6 Oct 2015 14:17:43 +0200
135360
Subject: [PATCH 186/398] sw tiled rendering: emit LOK_CALLBACK_SEARCH_RESULT*
135360
 for normal search
135360
135360
We used to emit these for find-all only, for no good reason.
135360
135360
Change-Id: Id07dc7649f9a8528b9d4ec16d5f7c651fd607111
135360
(cherry picked from commit 58c38e7ea5debc5440f1d81acf38d8d6ad0883d8)
135360
---
135360
 sw/qa/extras/tiledrendering/tiledrendering.cxx | 7 +++++++
135360
 sw/source/uibase/uiview/viewsrch.cxx           | 4 ++++
135360
 2 files changed, 11 insertions(+)
135360
135360
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
index 2fd27dd4f8ff..1eb57dea109e 100644
135360
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
135360
@@ -342,7 +342,10 @@ void lcl_search(bool bBackward)
135360
 void SwTiledRenderingTest::testSearch()
135360
 {
135360
 #if !defined(WNT) && !defined(MACOSX)
135360
+    comphelper::LibreOfficeKit::setActive();
135360
+
135360
     SwXTextDocument* pXTextDocument = createDoc("search.odt");
135360
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
135360
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
135360
     size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
135360
 
135360
@@ -351,6 +354,8 @@ void SwTiledRenderingTest::testSearch()
135360
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
135360
     size_t nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
135360
     CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
135360
+    /// Make sure we get search result selection for normal find as well, not only find all.
135360
+    CPPUNIT_ASSERT(!m_aSearchResultSelection.empty());
135360
 
135360
     // Next hit, in the shape.
135360
     lcl_search(false);
135360
@@ -375,6 +380,8 @@ void SwTiledRenderingTest::testSearch()
135360
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
135360
     nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
135360
     CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
135360
+
135360
+    comphelper::LibreOfficeKit::setActive(false);
135360
 #endif
135360
 }
135360
 
135360
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
135360
index a22cbdb6528f..c8d3e7a571ea 100644
135360
--- a/sw/source/uibase/uiview/viewsrch.cxx
135360
+++ b/sw/source/uibase/uiview/viewsrch.cxx
135360
@@ -253,7 +253,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
135360
             {
135360
                 bool bRet = SearchAndWrap(bApi);
135360
                 if( bRet )
135360
+                {
135360
                     Scroll(m_pWrtShell->GetCharRect().SVRect());
135360
+                    if (comphelper::LibreOfficeKit::isActive())
135360
+                        lcl_emitSearchResultCallbacks(1, m_pSrchItem, m_pWrtShell);
135360
+                }
135360
                 rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
135360
 #if HAVE_FEATURE_DESKTOP
135360
                 {
135360
-- 
135360
2.12.0
135360