summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uiview/viewsrch.cxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-02-07 12:09:36 +0100
committerMarco Cecchetti <mrcekets@gmail.com>2016-02-07 11:49:02 +0000
commit7f1ccaf62e42a26d48d324bcc6758100c6ec682b (patch)
treee78abf4fd8c3af40275005cb8a24162fddfb323a /sw/source/uibase/uiview/viewsrch.cxx
parent3c9efe213088c3c68bb839473d98643a499481bf (diff)
sw - single search after find all selects the 2nd occurrence - fixed
Now, after a search all action we place the cursor at the beginning of the document so that the single search selects the first matching occurrence in the document instead of the second. Change-Id: I8c295bcd316c6197154c68ae97eb424ee6cc9904 Reviewed-on: https://gerrit.libreoffice.org/22175 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'sw/source/uibase/uiview/viewsrch.cxx')
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index f3f216f7e307..bc922495e0f0 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -441,6 +441,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
rReq.AppendItem(SfxBoolItem(SID_SEARCH_QUIET, true));
rReq.Done();
+ m_eLastSearchCommand = m_pSrchItem->GetCommand();
}
break;
case FID_SEARCH_SEARCHSET:
@@ -532,6 +533,17 @@ bool SwView::SearchAndWrap(bool bApi)
m_pWrtShell->StartAllAction();
m_pWrtShell->Push();
+ // After a search all action we place the cursor at the beginning of
+ // the document so that the single search selects the first matching
+ // occurrence in the document instead of the second.
+ if( m_eLastSearchCommand == SvxSearchCmd::FIND_ALL )
+ {
+ if( DOCPOS_START == aOpts.eEnd )
+ m_pWrtShell->EndDoc();
+ else
+ m_pWrtShell->SttDoc();
+ }
+
// fdo#65014 : Ensure that the point of the cursor is at the extremity of the
// selection closest to the end being searched to as to exclude the selected
// region from the search. (This doesn't work in the case of multiple