diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-03-13 19:03:48 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-03-17 22:34:08 +0100 |
commit | 260801511467854a4f9a5cdb3b0aed3661c26fe7 (patch) | |
tree | fafd1d0843bbb4b1752544a1e06696a978349708 /sd | |
parent | f07c91ec42580630eababecfe0513e032871a1aa (diff) |
sd lok: Don't search on master pages & notes in Impress.
Change-Id: I43ed9f53618dca09e0289bffadc2c05056e0eebb
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 17 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 10 |
2 files changed, 24 insertions, 3 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index a23152a5bf86..9eba554cfc27 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -64,6 +64,7 @@ public: void testSearchAllSelections(); void testSearchAllNotifications(); void testSearchAllFollowedBySearch(); + void testDontSearchInMasterPages(); void testInsertDeletePage(); void testInsertTable(); void testPartHash(); @@ -94,6 +95,7 @@ public: CPPUNIT_TEST(testSearchAllSelections); CPPUNIT_TEST(testSearchAllNotifications); CPPUNIT_TEST(testSearchAllFollowedBySearch); + CPPUNIT_TEST(testDontSearchInMasterPages); CPPUNIT_TEST(testInsertDeletePage); CPPUNIT_TEST(testInsertTable); CPPUNIT_TEST(testPartHash); @@ -604,6 +606,21 @@ void SdTiledRenderingTest::testSearchAllFollowedBySearch() CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat)); } +void SdTiledRenderingTest::testDontSearchInMasterPages() +{ + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback, this); + + // This should trigger the not-found callback ("date" is present only on + // the master page) + lcl_search("date"); + CPPUNIT_ASSERT_EQUAL(false, m_bFound); + + comphelper::LibreOfficeKit::setActive(false); +} + namespace { diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 5b02bea8e63d..f3ff21a01449 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -1070,8 +1070,12 @@ void Outliner::ProvideNextTextObject() if (maObjectIterator != ::sd::outliner::OutlinerContainer(this).end()) { maCurrentPosition = *maObjectIterator; + + // LOK: do not descent to notes or master pages when searching + bool bForbiddenPage = comphelper::LibreOfficeKit::isActive() && (maCurrentPosition.mePageKind != PageKind::Standard || maCurrentPosition.meEditMode != EditMode::Page); + // Switch to the current object only if it is a valid text object. - if (IsValidTextObject (maCurrentPosition)) + if (!bForbiddenPage && IsValidTextObject(maCurrentPosition)) { // Don't set yet in case of searching: the text object may not match. if (meMode != SEARCH) @@ -1081,9 +1085,9 @@ void Outliner::ProvideNextTextObject() } ++maObjectIterator; - if (mpObj != nullptr) + if (mpObj) { - PutTextIntoOutliner (); + PutTextIntoOutliner(); std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock()); if (pViewShell != nullptr) |