From 5f0d16b1dc8db77aaca3d13091d61ad862648f49 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 14 Oct 2015 15:39:07 +0200 Subject: LOK: include part numbers in CALLBACK_SEARCH_RESULT_SELECTION payload Without that, the result in Calc/Impress is ambiguous. Change-Id: I8dfd8dafc996102ed583688fddd721c7600dc48c (cherry picked from commit ad280b67f8fda8f832a6a83bc5665df448c6ad00) --- sw/qa/extras/tiledrendering/tiledrendering.cxx | 8 +++++++- sw/source/uibase/uiview/viewsrch.cxx | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index eb59b62b9208..523c9d2a1757 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -73,6 +73,7 @@ private: OString m_aTextSelection; bool m_bFound; std::vector m_aSearchResultSelection; + std::vector m_aSearchResultPart; }; SwTiledRenderingTest::SwTiledRenderingTest() @@ -139,7 +140,10 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) std::stringstream aStream(pPayload); boost::property_tree::read_json(aStream, aTree); for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("searchResultSelection")) - m_aSearchResultSelection.push_back(rValue.second.data().c_str()); + { + m_aSearchResultSelection.push_back(rValue.second.get("rectangles").c_str()); + m_aSearchResultPart.push_back(std::atoi(rValue.second.get("part").c_str())); + } } break; } @@ -478,6 +482,8 @@ void SwTiledRenderingTest::testSearchAll() comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); // This was 0; should be 2 results in the body text. CPPUNIT_ASSERT_EQUAL(static_cast(2), m_aSearchResultSelection.size()); + // Writer documents are always a single part. + CPPUNIT_ASSERT_EQUAL(0, m_aSearchResultPart[0]); comphelper::LibreOfficeKit::setActive(false); #endif diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index c0a045868d11..30a2d0cf0a39 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -96,7 +96,8 @@ static void lcl_addContainerToJson(boost::property_tree::ptree& rTree, const OSt for (const OString& rMatch : rMatches) { boost::property_tree::ptree aChild; - aChild.put("", rMatch.getStr()); + aChild.put("part", "0"); + aChild.put("rectangles", rMatch.getStr()); aChildren.push_back(std::make_pair("", aChild)); } -- cgit