[Libreoffice-commits] core.git: sd/qa sd/source

Jan Holesovsky kendy at collabora.com
Tue Mar 14 09:37:18 UTC 2017


 sd/qa/unit/tiledrendering/tiledrendering.cxx |   17 +++++++++++++++++
 sd/source/ui/view/Outliner.cxx               |   10 +++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 986ab0b771e8e921d132059fda4971b18064c1aa
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Mar 13 19:03:48 2017 +0100

    sd lok: Don't search on master pages & notes in Impress.
    
    Change-Id: I43ed9f53618dca09e0289bffadc2c05056e0eebb
    Reviewed-on: https://gerrit.libreoffice.org/35149
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 10fb24b..58e146a 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -72,6 +72,7 @@ public:
     void testSearchAllSelections();
     void testSearchAllNotifications();
     void testSearchAllFollowedBySearch();
+    void testDontSearchInMasterPages();
     void testInsertDeletePage();
     void testInsertTable();
     void testPartHash();
@@ -106,6 +107,7 @@ public:
     CPPUNIT_TEST(testSearchAllSelections);
     CPPUNIT_TEST(testSearchAllNotifications);
     CPPUNIT_TEST(testSearchAllFollowedBySearch);
+    CPPUNIT_TEST(testDontSearchInMasterPages);
     CPPUNIT_TEST(testInsertDeletePage);
     CPPUNIT_TEST(testInsertTable);
     CPPUNIT_TEST(testPartHash);
@@ -624,6 +626,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 55f0f37..0858912 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1073,8 +1073,12 @@ void SdOutliner::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)
@@ -1084,9 +1088,9 @@ void SdOutliner::ProvideNextTextObject()
             }
             ++maObjectIterator;
 
-            if (mpObj != nullptr)
+            if (mpObj)
             {
-                PutTextIntoOutliner ();
+                PutTextIntoOutliner();
 
                 std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
                 if (pViewShell != nullptr)


More information about the Libreoffice-commits mailing list