summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-12 11:53:02 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-14 15:42:28 +0200
commit3839eba175e2b4be1544ef02041f32c60398672e (patch)
tree09a9d1f8444efd7dd3f7457bc9fd55af8a95bac9 /sd/source
parentd7db62b7cfe1b993f864c6b288ba6c924b5d4ac6 (diff)
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 (cherry picked from commit aa5f4bb22e6f6b38b60ee45d1079f2bc934c0611)
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/ui/view/Outliner.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index e073118c4a8f..6d59a70d51b7 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -957,7 +957,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;
@@ -983,6 +987,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 ();
}
@@ -1175,6 +1183,9 @@ void Outliner::PrepareSearchAndReplace()
{
if (HasText( *mpSearchItem ))
{
+ // Set the object now that we know it matches.
+ mpObj = SetObject(maCurrentPosition);
+
mbStringFound = true;
mbMatchMayExist = true;