diff options
Diffstat (limited to 'sd/source/ui/view')
-rwxr-xr-x | sd/source/ui/view/Outliner.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index a7c9786dd160..fd07d966ad47 100755 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -568,7 +568,8 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem) void Outliner::Initialize (bool bDirectionIsForward) { - bool bOldDirectionIsForward = mbDirectionIsForward; + const bool bIsAtEnd (maObjectIterator == ::sd::outliner::OutlinerContainer(this).end()); + const bool bOldDirectionIsForward = mbDirectionIsForward; mbDirectionIsForward = bDirectionIsForward; if (maObjectIterator == ::sd::outliner::Iterator()) @@ -603,10 +604,19 @@ void Outliner::Initialize (bool bDirectionIsForward) { // Requested iteration direction has changed. Turn arround the iterator. maObjectIterator.Reverse(); - // The iterator has pointed to the object one ahead/before the current - // one. Now move it to the one before/ahead the current one. - ++maObjectIterator; - ++maObjectIterator; + if (bIsAtEnd) + { + // The iterator has pointed to end(), which after the search + // direction is reversed, becomes begin(). + maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); + } + else + { + // The iterator has pointed to the object one ahead/before the current + // one. Now move it to the one before/ahead the current one. + ++maObjectIterator; + ++maObjectIterator; + } mbMatchMayExist = true; } |