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

Miklos Vajna vmiklos at collabora.co.uk
Mon Oct 5 06:56:42 PDT 2015


 sw/inc/view.hxx                                |    1 
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   32 ++++++++++++++++++++++++-
 sw/source/core/crsr/findtxt.cxx                |    5 +++
 3 files changed, 36 insertions(+), 2 deletions(-)

New commits:
commit b4e75e8f52c17d02a65022303fb6a0e4f1d97592
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 5 15:34:28 2015 +0200

    CppunitTest_sw_tiledrendering: testcase for LOK_CALLBACK_SEARCH_RESULT_COUNT
    
    Change-Id: I9f517bc2f3dfca9a2dc17a229f54c47b7790a355

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e7ab149..c836f4b 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -18,6 +18,7 @@
 #include <vcl/svapp.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/outliner.hxx>
+#include <svl/srchitem.hxx>
 #include <crsskip.hxx>
 #include <drawdoc.hxx>
 #include <ndtxt.hxx>
@@ -42,6 +43,7 @@ public:
     void testSearchTextFrame();
     void testSearchTextFrameWrapAround();
     void testDocumentSizeChanged();
+    void testSearchAll();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -56,6 +58,7 @@ public:
     CPPUNIT_TEST(testSearchTextFrame);
     CPPUNIT_TEST(testSearchTextFrameWrapAround);
     CPPUNIT_TEST(testDocumentSizeChanged);
+    CPPUNIT_TEST(testSearchAll);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -66,10 +69,12 @@ private:
     Size m_aDocumentSize;
     OString m_aTextSelection;
     bool m_bFound;
+    sal_Int32 m_nSearchResultCount;
 };
 
 SwTiledRenderingTest::SwTiledRenderingTest()
-    : m_bFound(true)
+    : m_bFound(true),
+      m_nSearchResultCount(0)
 {
 }
 
@@ -125,6 +130,11 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
         m_bFound = false;
     }
     break;
+    case LOK_CALLBACK_SEARCH_RESULT_COUNT:
+    {
+        m_nSearchResultCount = OString(pPayload).toInt32();
+    }
+    break;
     }
 }
 
@@ -438,6 +448,26 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
 #endif
 }
 
+void SwTiledRenderingTest::testSearchAll()
+{
+#if !defined(WNT) && !defined(MACOSX)
+    comphelper::LibreOfficeKit::setActive();
+
+    SwXTextDocument* pXTextDocument = createDoc("search.odt");
+    pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+    {
+        {"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
+        {"SearchItem.Backward", uno::makeAny(false)},
+        {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))},
+    }));
+    comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+    // This was 0; should be 2 results in the body text.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), m_nSearchResultCount);
+
+    comphelper::LibreOfficeKit::setActive(false);
+#endif
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit dce533e06d641d15c3171cd543875cb9fe835cd2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 5 15:19:06 2015 +0200

    sw: avoid hang with find-all and shape text
    
    We can't easily have editeng & sw selection at the same time, so just
    exlucde shapes in the find-all case for now: better than a hang.
    
    Change-Id: I1090595e8c4bc11eb38ffa486885ad5fab67ab86

diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 8a2d5b7..633d5d2 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -638,6 +638,7 @@ public:
     SAL_DLLPRIVATE virtual bool  HasPrintOptionsPage() const SAL_OVERRIDE;
     SAL_DLLPRIVATE virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window* pParent,
                                                     const SfxItemSet& rSet) SAL_OVERRIDE;
+    static SvxSearchItem* GetSearchItem() { return m_pSrchItem; }
 };
 
 inline long SwView::GetXScroll() const
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 02952b4..b2cf56c 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -49,6 +49,7 @@
 #include <docsh.hxx>
 #include <PostItMgr.hxx>
 #include <viewsh.hxx>
+#include <view.hxx>
 
 using namespace ::com::sun::star;
 using namespace util;
@@ -342,8 +343,10 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
                 }
             }
 
+            // Writer and editeng selections are not supported in parallel.
+            SvxSearchItem* pSearchItem = SwView::GetSearchItem();
             // If we just finished search in shape text, don't attempt to do that again.
-            if (!bEndedTextEdit)
+            if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL))
             {
                 // If there are any shapes anchored to this node, search there.
                 SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent());


More information about the Libreoffice-commits mailing list