editeng/source/editeng/impedit3.cxx | 5 ++++- sd/qa/unit/tiledrendering/data/search-all.odp |binary sd/qa/unit/tiledrendering/tiledrendering.cxx | 14 ++++++++++++++ sd/source/ui/view/Outliner.cxx | 15 ++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-)
New commits: commit 186f32f63434e16ff5776251657f902d5808ed3d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Oct 16 11:24:11 2015 +0200 sd tiled rendering: emit CALLBACK_TEXT_SELECTION on multiple search results Change-Id: Ib6be973bf7c911907c793571b84021dc317dcc80 diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp b/sd/qa/unit/tiledrendering/data/search-all.odp index 0fd069c..46ddaf4 100644 Binary files a/sd/qa/unit/tiledrendering/data/search-all.odp and b/sd/qa/unit/tiledrendering/data/search-all.odp differ diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 1073d14..d3e39b6 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -53,6 +53,7 @@ public: void testResetSelection(); void testSearch(); void testSearchAll(); + void testSearchAllSelections(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -66,6 +67,7 @@ public: CPPUNIT_TEST(testResetSelection); CPPUNIT_TEST(testSearch); CPPUNIT_TEST(testSearchAll); + CPPUNIT_TEST(testSearchAllSelections); #endif CPPUNIT_TEST_SUITE_END(); @@ -436,6 +438,18 @@ void SdTiledRenderingTest::testSearchAll() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), m_nPart); } +void SdTiledRenderingTest::testSearchAllSelections() +{ + SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); + pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this); + + lcl_search("third", /*bFindAll=*/true); + // Make sure this is found on the 3rd slide. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), m_nPart); + // This was 1: only the first match was highlighted. + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), m_aSelection.size()); +} + #endif CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 4ccd33c..71656bb 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -605,6 +605,7 @@ bool Outliner::SearchAndReplaceAll() return true; } + std::vector<SearchSelection> aSelections; if( 0 != dynamic_cast< const OutlineViewShell *>( pViewShell.get() )) { // Put the cursor to the beginning/end of the outliner. @@ -627,7 +628,6 @@ bool Outliner::SearchAndReplaceAll() // Search/replace until the end of the document is reached. bool bFoundMatch; - std::vector<SearchSelection> aSelections; do { bFoundMatch = ! SearchAndReplaceOnce(&aSelections); @@ -673,6 +673,19 @@ bool Outliner::SearchAndReplaceAll() // Find-all, tiled rendering and we have at least one match. OString aPayload = OString::number(mnStartPageIndex); pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + + // Emit a selection callback here: + // 1) The original one is no longer valid, as we there was a SET_PART in between + // 2) The underlying editeng will only talk about the first match till + // it doesn't support multi-selection. + std::vector<OString> aRectangles; + for (const SearchSelection& rSelection : aSelections) + { + if (rSelection.m_nPage == mnStartPageIndex) + aRectangles.push_back(rSelection.m_aRectangles); + } + OString sRectangles = comphelper::string::join("; ", aRectangles); + pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); } mnStartPageIndex = (sal_uInt16)-1; commit 11754fd7923c727e921bb6cbaf88d2765082667c Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Oct 16 09:45:52 2015 +0200 editeng tiled rendering: avoid selections callbacks in Paint() Given that we emit selection callbacks on each logical operations (set selection, deselect all, etc) already, it's not necessary to emit callbacks in DrawSelection() when it's called from Paint(). Change-Id: I6781c71ee2f292de2a1c7d129fc49b514aca2be1 diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 99a9829..3fa08b4f 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3882,7 +3882,10 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRect, OutputDev else pTarget->SetClipRegion(); - pView->DrawSelection(pView->GetEditSelection(), 0, pTarget); + // In case of tiled rendering pass a region to DrawSelection(), so that + // selection callbacks are not emitted during every repaint. + vcl::Region aRegion; + pView->DrawSelection(pView->GetEditSelection(), pView->isTiledRendering() ? &aRegion : 0, pTarget); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits