include/svx/srchdlg.hxx              |    4 +++-
 include/svx/strings.hrc              |    2 ++
 svx/source/dialog/srchdlg.cxx        |    4 ++++
 sw/source/core/crsr/crstrvl.cxx      |   35 +++++++++++++++++++++++++++++------
 sw/source/uibase/ribbar/workctrl.cxx |    3 +++
 5 files changed, 41 insertions(+), 7 deletions(-)

New commits:
commit 0b859bf33ed722c5c90f41cb08099fecfe494272
Author: Jim Raykowski <rayk...@gmail.com>
Date:   Thu Mar 22 09:23:58 2018 -0800

    tdf#115600 Display messages in Findbar for Headings navigation
    
    ...and make Headings navigation wrap
    
    Change-Id: Ia06caba9b93064c63750c54c1061d781811ed62a
    Reviewed-on: https://gerrit.libreoffice.org/52139
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index cf0168ca3eea..f655931008da 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -86,7 +86,9 @@ enum class SearchLabel
     End,
     Start,
     EndSheet,
-    NotFound
+    NotFound,
+    StartWrapped,
+    EndWrapped
 };
 
 class SvxSearchDialog;
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 16dbd5f4673e..9593cf515623 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1252,9 +1252,11 @@
 #define RID_SVXSTR_SEARCH                                   
NC_("RID_SVXSTR_SEARCH", "Search for formatting")
 #define RID_SVXSTR_REPLACE                                  
NC_("RID_SVXSTR_REPLACE", "Replace with formatting")
 #define RID_SVXSTR_SEARCH_END                               
NC_("RID_SVXSTR_SEARCH_END", "Reached the end of the document")
+#define RID_SVXSTR_SEARCH_END_WRAPPED                       
NC_("RID_SVXSTR_SEARCH_END_WRAPPED", "Reached the end of the document, 
continued from the beginning")
 #define RID_SVXSTR_SEARCH_END_SHEET                         
NC_("RID_SVXSTR_SEARCH_END_SHEET", "Reached the end of the sheet")
 #define RID_SVXSTR_SEARCH_NOT_FOUND                         
NC_("RID_SVXSTR_SEARCH_NOT_FOUND", "Search key not found")
 #define RID_SVXSTR_SEARCH_START                             
NC_("RID_SVXSTR_SEARCH_START", "Reached the beginning of the document")
+#define RID_SVXSTR_SEARCH_START_WRAPPED                     
NC_("RID_SVXSTR_SEARCH_START_WRAPPED", "Reached the beginning of the document, 
continued from the end")
 
 #define RID_SVXDLG_BMPMASK_STR_PALETTE                      
NC_("RID_SVXDLG_BMPMASK_STR_PALETTE", "Color Palette")
 
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 3b7fca06a673..eb5787575771 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2440,6 +2440,10 @@ void SvxSearchDialogWrapper::SetSearchLabel(const 
SearchLabel& rSL)
         sStr = SvxResId(RID_SVXSTR_SEARCH_END);
     else if (rSL == SearchLabel::Start)
         sStr = SvxResId(RID_SVXSTR_SEARCH_START);
+    else if (rSL == SearchLabel::EndWrapped)
+        sStr = SvxResId(RID_SVXSTR_SEARCH_END_WRAPPED);
+    else if (rSL == SearchLabel::StartWrapped)
+        sStr = SvxResId(RID_SVXSTR_SEARCH_START_WRAPPED);
     else if (rSL == SearchLabel::EndSheet)
         sStr = SvxResId(RID_SVXSTR_SEARCH_END_SHEET);
     else if (rSL == SearchLabel::NotFound)
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index cd08869de125..6218f5a460d3 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -70,6 +70,7 @@
 #include <unotools/intlwrapper.hxx>
 #include <vcl/window.hxx>
 #include <docufld.hxx>
+#include <svx/srchdlg.hxx>
 
 using namespace ::com::sun::star;
 
@@ -940,16 +941,27 @@ bool SwCursorShell::GotoOutline( const OUString& rName )
 /// jump to next node with outline num.
 bool SwCursorShell::GotoNextOutline()
 {
-    SwCursor* pCursor = getShellCursor( true );
     const SwNodes& rNds = GetDoc()->GetNodes();
 
+    if ( rNds.GetOutLineNds().size() == 0 )
+    {
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+        return false;
+    }
+
+    SwCursor* pCursor = getShellCursor( true );
     SwNode* pNd = &(pCursor->GetNode());
     SwOutlineNodes::size_type nPos;
     if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
         ++nPos;
 
     if( nPos == rNds.GetOutLineNds().size() )
-        return false;
+    {
+        nPos = 0;
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
+    }
+    else
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
 
     pNd = rNds.GetOutLineNds()[ nPos ];
 
@@ -968,20 +980,31 @@ bool SwCursorShell::GotoNextOutline()
 /// jump to previous node with outline num.
 bool SwCursorShell::GotoPrevOutline()
 {
-    SwCursor* pCursor = getShellCursor( true );
     const SwNodes& rNds = GetDoc()->GetNodes();
 
+    if ( rNds.GetOutLineNds().size() == 0 )
+    {
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+        return false;
+    }
+
+    SwCursor* pCursor = getShellCursor( true );
     SwNode* pNd = &(pCursor->GetNode());
     SwOutlineNodes::size_type nPos;
     bool bRet = false;
-    (void)rNds.GetOutLineNds().Seek_Entry(pNd, &nPos);
+    if ( rNds.GetOutLineNds().Seek_Entry(pNd, &nPos) && nPos == 0 )
+    {
+        nPos = rNds.GetOutLineNds().size();
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
+    }
+    else
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+
     if (nPos)
     {
         --nPos; // before
 
         pNd = rNds.GetOutLineNds()[ nPos ];
-        if( pNd->GetIndex() > pCursor->GetPoint()->nNode.GetIndex() )
-            return false;
 
         SET_CURR_SHELL( this );
         SwCallLink aLk( *this ); // watch Cursor-Moves
diff --git a/sw/source/uibase/ribbar/workctrl.cxx 
b/sw/source/uibase/ribbar/workctrl.cxx
index 76d2a0eee08b..dd6c87ef4b97 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -50,6 +50,7 @@
 #include <svx/strings.hrc>
 #include <bitmaps.hlst>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <svx/srchdlg.hxx>
 
 // Size check
 #define NAVI_ENTRIES 20
@@ -750,6 +751,8 @@ void NavElementBox_Impl::Select()
 
     if ( !IsTravelSelect() )
     {
+        SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
+
         sal_uInt16 nPos = GetSelectedEntryPos();
         // adjust array index for Ids after NID_PREV in aNavigationInsertIds
         if ( nPos >= NID_COUNT/2 - 1 )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to