sw/inc/fesh.hxx                    |    4 +++-
 sw/source/core/frmedt/feshview.cxx |   18 +++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 9a4e73e28a226b56531471da5e49a2cf0f5a51c4
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Tue Mar 15 17:25:58 2022 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Mon Mar 21 05:17:46 2022 +0100

    Don't display search wrapped message when nothing is found
    
    by a search for Frames, Images, and OLE objects
    
    Fixes the search wrapped message being unnoticeably shown before the
    search not found message when nothing is found by a search for Frames,
    Images, and OLE objects. Also fixes a possible search wrapped message
    being shown when SwFEShell::GetBestObject is used by
    SwTextShell::ExecMoveMisc for SID_FM_TOGGLECONTROLFOCUS case.
    
    Change-Id: I57e518163d9b61dcf9838e5552a0de53f48faa0f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131638
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 3801bac30dd9..8a94960d3e29 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -497,7 +497,9 @@ public:
     bool GetObjAttr( SfxItemSet &rSet ) const;
     void SetObjAttr( const SfxItemSet &rSet );
 
-    const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType, bool bFlat 
= true, const svx::ISdrObjectFilter* pFilter = nullptr );
+    const SdrObject* GetBestObject(bool bNext, GotoObjFlags eType, bool bFlat 
= true,
+                                   const svx::ISdrObjectFilter* pFilter = 
nullptr,
+                                   bool* pbWrapped = nullptr);
     bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny);
 
     /// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
diff --git a/sw/source/core/frmedt/feshview.cxx 
b/sw/source/core/frmedt/feshview.cxx
index 30be64dc9058..898166f0178a 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1560,8 +1560,13 @@ namespace
     };
 }
 
-const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, 
bool bFlat, const svx::ISdrObjectFilter* pFilter )
+const SdrObject* SwFEShell::GetBestObject(bool bNext, GotoObjFlags eType, bool 
bFlat,
+                                          const svx::ISdrObjectFilter* pFilter,
+                                          bool* pbWrapped)
 {
+    if (pbWrapped)
+        *pbWrapped = false;
+
     if( !Imp()->HasDrawView() )
         return nullptr;
 
@@ -1735,7 +1740,8 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, 
GotoObjFlags eType, bool
         if( bNext ? (aBestPos.getX() == LONG_MAX) : (aBestPos.getX() == 0) )
         {
             pBest = pTop;
-            SvxSearchDialogWrapper::SetSearchLabel( bNext ? 
SearchLabel::EndWrapped : SearchLabel::StartWrapped );
+            if (pbWrapped && pBest)
+                *pbWrapped = true;
         }
     }
 
@@ -1746,7 +1752,8 @@ bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType )
 {
     SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
 
-    const SdrObject* pBest = GetBestObject( bNext, eType );
+    bool bWrapped(false);
+    const SdrObject* pBest = GetBestObject(bNext, eType, true, nullptr, 
&bWrapped);
 
     if ( !pBest )
     {
@@ -1769,6 +1776,11 @@ bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType )
             MakeVisible( SwRect(pBest->GetCurrentBoundRect()) );
     }
     CallChgLnk();
+
+    if (bWrapped)
+        SvxSearchDialogWrapper::SetSearchLabel(bNext ? SearchLabel::EndWrapped 
:
+                                                       
SearchLabel::StartWrapped);
+
     return true;
 }
 

Reply via email to