summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/view.hxx3
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx12
2 files changed, 15 insertions, 0 deletions
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 7081637f0536..b271c6d4fe2e 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -79,6 +79,7 @@ class GraphicFilter;
class SwPostItMgr;
enum class SotExchangeDest;
class SwCursorShell;
+enum class SvxSearchCmd;
namespace com{ namespace sun { namespace star {
namespace view{ class XSelectionSupplier; }
@@ -226,6 +227,8 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
sal_uInt16 m_nLeftBorderDistance;
sal_uInt16 m_nRightBorderDistance;
+ SvxSearchCmd m_eLastSearchCommand;
+
bool m_bWheelScrollInProgress;
bool m_bCenterCursor : 1,
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