diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-12 14:40:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-12 15:01:08 +0100 |
commit | 0e149c017d3ecd9523492bcc05d44d39746a4131 (patch) | |
tree | 5dc81a43f3c4a69a719c4d5e4ab49649ca65cde0 | |
parent | a6060e02f7f8c1966e5f54bbe186a445a74942e7 (diff) |
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@collabora.com>
Date: Mon Jan 11 16:43:02 2016 +0100
lool - search all - unit test failure - solved
wanted to solve
Change-Id: I30e7b9c581488b48fa27f138209f291063b459a3
-rw-r--r-- | sd/inc/Outliner.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sd/inc/Outliner.hxx b/sd/inc/Outliner.hxx index 3c7296a8f1de..b0a2192bd9ac 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 c1ac3ced45ff..a9fc0a9a1249 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -826,7 +826,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); } } |