[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon May 18 07:47:14 PDT 2015


 sw/source/core/crsr/findtxt.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 07355d267013ad2ea31479d4d745fbc8f88e232e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 18 16:27:14 2015 +0200

    SwPaM::Find: if there is an active text edit, then search there
    
    Change-Id: Ic5d81aa1faca8f2190f87fc51eccdd7695d2c0ef

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1d0c30e..dd1edd2 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -22,6 +22,10 @@
 #include <comphelper/string.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
+#include <svx/svdview.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <editeng/outliner.hxx>
 
 #include <editsh.hxx>
 #include <txatritr.hxx>
@@ -291,6 +295,26 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
             SwViewShell *const pWrtShell = (pDocShell) ? pDocShell->GetEditShell() : 0;
             SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : 0;
 
+            // If there is an active text edit, then search there.
+            if (SdrView* pSdrView = pWrtShell->GetDrawView())
+            {
+                if (pSdrView->GetTextEditObject())
+                {
+                    SvxSearchItem aSearchItem(SID_SEARCH_ITEM);
+                    aSearchItem.SetSearchOptions(rSearchOpt);
+                    aSearchItem.SetBackward(!bSrchForward);
+                    sal_uInt16 nResult = pSdrView->GetTextEditOutlinerView()->StartSearchAndReplace(aSearchItem);
+                    if (!nResult)
+                        // If not found, end the text edit.
+                        pSdrView->SdrEndTextEdit();
+                    else
+                    {
+                        bFound = true;
+                        break;
+                    }
+                }
+            }
+
             sal_Int32 aStart = 0;
             // do we need to finish a note?
             if (pPostItMgr && pPostItMgr->HasActiveSidebarWin())


More information about the Libreoffice-commits mailing list