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

Miklos Vajna vmiklos at collabora.co.uk
Mon Oct 12 02:53:34 PDT 2015


 sd/qa/unit/tiledrendering/tiledrendering.cxx |    1 -
 sd/source/ui/view/Outliner.cxx               |   13 ++++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit aa5f4bb22e6f6b38b60ee45d1079f2bc934c0611
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 12 11:53:02 2015 +0200

    sd: avoid unnecessary invalidations during search
    
    Search works by using sd::outliner::OutlinerContainer to iterate over
    all text objects of the document. We used to switch to each and every
    object, and only then search in it. In large presentations this means
    the number of invalidations during search was dependent on the number of
    slides between the current slide and the first match.
    
    Fix this by not calling sd::Outliner::SetObject() (which would call
    sd::Outliner::SetPage()) right after finding a text object, only later
    when we know it has matching content.
    
    The result is that the number of invalidations is not O(n) but O(1) till
    we find the first match.
    
    Change-Id: I29a11c8737a7e1db6a247eb98617d12495c8bb41

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 9cde9d7..f080488 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -951,7 +951,11 @@ void Outliner::ProvideNextTextObject()
             // Switch to the current object only if it is a valid text object.
             if (IsValidTextObject (maCurrentPosition))
             {
-                mpObj = SetObject (maCurrentPosition);
+                // Don't set yet in case of searching: the text object may not match.
+                if (meMode != SEARCH)
+                    mpObj = SetObject(maCurrentPosition);
+                else
+                    mpObj = maCurrentPosition.mxObject.get();
             }
             ++maObjectIterator;
 
@@ -977,6 +981,10 @@ void Outliner::ProvideNextTextObject()
         }
         else
         {
+            if (meMode == SEARCH)
+                // Instead of doing a full-blown SetObject(), which would do the same -- but would also possibly switch pages.
+                mbStringFound = false;
+
             mbEndOfSearch = true;
             EndOfSearch ();
         }
@@ -1169,6 +1177,9 @@ void Outliner::PrepareSearchAndReplace()
 {
     if (HasText( *mpSearchItem ))
     {
+        // Set the object now that we know it matches.
+        mpObj = SetObject(maCurrentPosition);
+
         mbStringFound = true;
         mbMatchMayExist = true;
 
commit 8d1d280741f62d60fe56cd86da995b08228a1594
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 12 11:34:31 2015 +0200

    Related: tdf#74132 CppunitTest_sd_export_tests: clean up testSearch()
    
    Not needed anymore since the dialog is gone.
    
    Change-Id: Icd3747683d2656a9404b405fc29aae6183dcfe15

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a36cfba..da6d4be 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -389,7 +389,6 @@ void SdTiledRenderingTest::testSearch()
     CPPUNIT_ASSERT_EQUAL(true, m_bFound);
 
     // This should trigger the not-found callback.
-    Application::EnableHeadlessMode(false);
     lcl_search("ccc");
     CPPUNIT_ASSERT_EQUAL(false, m_bFound);
 }


More information about the Libreoffice-commits mailing list