[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sw/inc sw/source

Marco Cecchetti marco.cecchetti at collabora.com
Sun Feb 7 11:24:46 UTC 2016


 sw/inc/view.hxx                      |    3 +++
 sw/source/uibase/uiview/viewsrch.cxx |   12 ++++++++++++
 2 files changed, 15 insertions(+)

New commits:
commit 7f7dc83a31d31bcdcf6e67fd4cead6088c4ea6b3
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sun Feb 7 12:09:36 2016 +0100

    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.
    
    Conflicts:
    	sw/inc/view.hxx
    
    Change-Id: I8c295bcd316c6197154c68ae97eb424ee6cc9904

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 40a9630..b8c1c1a 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -78,6 +78,7 @@ class Graphic;
 class GraphicFilter;
 class SwPostItMgr;
 enum class SotExchangeDest;
+enum class SvxSearchCmd;
 
 namespace com{ namespace sun { namespace star {
     namespace view{ class XSelectionSupplier; }
@@ -239,6 +240,8 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
     sal_uInt16          m_nLeftBorderDistance;
     sal_uInt16          m_nRightBorderDistance;
 
+    SvxSearchCmd        m_eLastSearchCommand;
+
     bool m_bWheelScrollInProgress;
 
     bool            m_bCenterCrsr : 1,
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 6fc549b..27b125d 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -457,6 +457,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:
@@ -548,6 +549,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


More information about the Libreoffice-commits mailing list