[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sd/inc sd/source

Caolán McNamara caolanm at redhat.com
Fri Jul 15 12:55:33 UTC 2016


 sd/inc/Outliner.hxx            |    5 +++++
 sd/source/ui/view/Outliner.cxx |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit c943fbbfcf8ece052be14c6bc06c161f1e9321ef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 12 14:40:09 2016 +0100

    Resolves: tdf#100861 replace all doesn't work
    
    Revert "lool - search all - unit test failure - solved"
    
    This reverts commit d6f1ca24932ba85607ba3e526c5721132cd39252.
    
    Change-Id: I328ece1029955ff9f4e5043084d649898e3e8809
    (cherry picked from commit a563758746a6cd3900c88928c115275229617ed0)
    
    Related: tdf#100861 same selection recorded multiple times...
    
    in FindAll libreofficekit impress test
    
    on find all we loop through the textboxes searching for the string.
    
    We start by searching into the first textbox with the string in it.
    mbStringFound gets set to true and this first selection is reported.
    Now the current pos is still in that textbox at the end of the string.
    
    The next loop will find nothing in this textbox, but because mbStringFound
    was set in the earlier pass, the same selection gets reported again.
    
    The next loop will move to the next textbox.
    
    To keep this fix as simple as possible just check if the selection was
    the previously reported one and skip it if it is.
    
    I believe this is the problem that
    
    commit d6f1ca24932ba85607ba3e526c5721132cd39252
    Author: Marco Cecchetti <marco.cecchetti at collabora.com>
    Date:   Mon Jan 11 16:43:02 2016 +0100
    
        lool - search all - unit test failure - solved
    
    wanted to solve
    
    Change-Id: I30e7b9c581488b48fa27f138209f291063b459a3
    (cherry picked from commit 0e149c017d3ecd9523492bcc05d44d39746a4131)
    Reviewed-on: https://gerrit.libreoffice.org/27151
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx
index 3c7296a..b0a2192 100644
--- a/sd/inc/Outliner.hxx
+++ b/sd/inc/Outliner.hxx
@@ -50,6 +50,11 @@ struct SearchSelection
     OString m_aRectangles;
 
     SearchSelection(int nPage, const OString& rRectangles);
+
+    bool operator==(const SearchSelection& rOther) const
+    {
+        return m_nPage == rOther.m_nPage && m_aRectangles == rOther.m_aRectangles;
+    }
 };
 
 /** The main purpose of this class is searching and replacing as well as
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 5cae4f9..f4d6839 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -593,8 +593,6 @@ void Outliner::Initialize (bool bDirectionIsForward)
 
 bool Outliner::SearchAndReplaceAll()
 {
-    DetectChange();
-
     bool bRet = true;
     // Save the current position to be restored after having replaced all
     // matches.
@@ -820,7 +818,10 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
         }
         else
         {
-            pSelections->push_back(SearchSelection(maCurrentPosition.mnPageIndex, sRectangles));
+            SearchSelection aSelection(maCurrentPosition.mnPageIndex, sRectangles);
+            bool bDuplicate = !pSelections->empty() && pSelections->back() == aSelection;
+            if (!bDuplicate)
+                pSelections->push_back(aSelection);
         }
     }
 


More information about the Libreoffice-commits mailing list