summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-14 15:39:07 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-14 15:39:07 +0200
commitad280b67f8fda8f832a6a83bc5665df448c6ad00 (patch)
treee029285dafeba4276bb66c224ecc734b54367a97 /sd
parentdd1fc2242a64a0b9ae8031a5edc7ecfcde4ec3df (diff)
LOK: include part numbers in CALLBACK_SEARCH_RESULT_SELECTION payload
Without that, the result in Calc/Impress is ambiguous. Change-Id: I8dfd8dafc996102ed583688fddd721c7600dc48c
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx9
-rw-r--r--sd/source/ui/view/Outliner.cxx6
2 files changed, 12 insertions, 3 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1313b0ac2149..4a5c81b7498a 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -80,6 +80,7 @@ private:
bool m_bFound;
sal_Int32 m_nPart;
std::vector<OString> m_aSearchResultSelection;
+ std::vector<int> m_aSearchResultPart;
#endif
};
@@ -187,11 +188,15 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
{
m_aSearchResultSelection.clear();
+ m_aSearchResultPart.clear();
boost::property_tree::ptree aTree;
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<std::string>("rectangles").c_str());
+ m_aSearchResultPart.push_back(std::atoi(rValue.second.get<std::string>("part").c_str()));
+ }
}
break;
}
@@ -401,6 +406,8 @@ void SdTiledRenderingTest::testSearch()
CPPUNIT_ASSERT_EQUAL(true, m_bFound);
// This was 0; should be 1 match for "find".
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), m_aSearchResultSelection.size());
+ // Result is on the second slide.
+ CPPUNIT_ASSERT_EQUAL(1, m_aSearchResultPart[0]);
// This should trigger the not-found callback.
lcl_search("ccc");
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index a18b022d0c10..f51c91f62995 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -637,7 +637,8 @@ bool Outliner::SearchAndReplaceAll()
for (const SearchSelection& rSelection : aSelections)
{
boost::property_tree::ptree aChild;
- aChild.put("", rSelection.m_aRectangles.getStr());
+ aChild.put("part", OString::number(rSelection.m_nPage).getStr());
+ aChild.put("rectangles", rSelection.m_aRectangles.getStr());
aChildren.push_back(std::make_pair("", aChild));
}
aTree.add_child("searchResultSelection", aChildren);
@@ -764,7 +765,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
boost::property_tree::ptree aChildren;
boost::property_tree::ptree aChild;
- aChild.put("", sRectangles.getStr());
+ aChild.put("part", OString::number(maCurrentPosition.mnPageIndex).getStr());
+ aChild.put("rectangles", sRectangles.getStr());
aChildren.push_back(std::make_pair("", aChild));
aTree.add_child("searchResultSelection", aChildren);