[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 9 commits - include/LibreOfficeKit libreofficekit/source sd/source solenv/gdb sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed May 27 02:01:54 PDT 2015


 include/LibreOfficeKit/LibreOfficeKitEnums.h   |    9 +++
 libreofficekit/source/gtk/lokdocview.cxx       |   29 +++++++++---
 sd/source/ui/view/drviews1.cxx                 |    6 ++
 solenv/gdb/libreoffice/sw.py                   |    2 
 sw/qa/extras/tiledrendering/data/search.odt    |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   55 +++++++++++++++++++++++
 sw/source/core/crsr/findtxt.cxx                |   58 +++++++++++++++++++------
 7 files changed, 138 insertions(+), 21 deletions(-)

New commits:
commit 3cd822d98d766a0528e94419874ff9c79c9feb6b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri May 22 13:34:47 2015 +0100

    lokdocview: it's enough to query the document size once
    
    Change-Id: Id99c9f1a814bc5f935eeb4e301ef3014ccb0bd07
    (cherry picked from commit 124c937f3bd6a7538dc6664ab9556fcfb3f27088)

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 904760d..7b2d4c9 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -50,6 +50,8 @@ struct LOKDocView_Impl
 
     LibreOfficeKit* m_pOffice;
     LibreOfficeKitDocument* m_pDocument;
+    long m_nDocumentWidthTwips;
+    long m_nDocumentHeightTwips;
     /// View or edit mode.
     bool m_bEdit;
     /// Position and size of the visible cursor.
@@ -237,6 +239,8 @@ LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
     m_fZoom(1),
     m_pOffice(0),
     m_pDocument(0),
+    m_nDocumentWidthTwips(0),
+    m_nDocumentHeightTwips(0),
     m_bEdit(false),
     m_aVisibleCursor({0, 0, 0, 0}),
     m_bCursorOverlayVisible(false),
@@ -743,11 +747,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
 {
     const int nTileSizePixels = 256;
 
-    // Get document size and find out how many rows / columns we need.
-    long nDocumentWidthTwips, nDocumentHeightTwips;
-    m_pDocument->pClass->getDocumentSize(m_pDocument, &nDocumentWidthTwips, &nDocumentHeightTwips);
-    long nDocumentWidthPixels = twipToPixel(nDocumentWidthTwips);
-    long nDocumentHeightPixels = twipToPixel(nDocumentHeightTwips);
+    long nDocumentWidthPixels = twipToPixel(m_nDocumentWidthTwips);
+    long nDocumentHeightPixels = twipToPixel(m_nDocumentHeightTwips);
     // Total number of rows / columns in this document.
     guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
@@ -1172,6 +1173,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
     {
         pDocView->m_pImpl->m_pDocument->pClass->initializeForRendering(pDocView->m_pImpl->m_pDocument);
         pDocView->m_pImpl->m_pDocument->pClass->registerCallback(pDocView->m_pImpl->m_pDocument, &LOKDocView_Impl::callbackWorker, pDocView);
+        pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips);
         g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView);
         pDocView->m_pImpl->renderDocument(0);
     }
commit d6ea25d094258402a27c74a0938e014236c822b7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 26 17:00:20 2015 +0200

    lokdocview: handle LOK_CALLBACK_SET_PART
    
    Change-Id: I47fc389590d581155074fec63cca79bea3596860
    (cherry picked from commit 96041179d4aa5e0eb543c3c5da8e493beb0ed133)

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 3203b48..904760d 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -910,6 +910,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType)
         return "LOK_CALLBACK_SEARCH_NOT_FOUND";
     case LOK_CALLBACK_PAGE_COUNT_CHANGED:
         return "LOK_CALLBACK_PAGE_COUNT_CHANGED";
+    case LOK_CALLBACK_SET_PART:
+        return "LOK_CALLBACK_SET_PART";
     }
     return 0;
 }
@@ -1009,6 +1011,11 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
         m_pDocument->pClass->getDocumentSize(m_pDocument, &m_nDocumentWidthTwips, &m_nDocumentHeightTwips);
     }
     break;
+    case LOK_CALLBACK_SET_PART:
+    {
+        renderDocument(0);
+    }
+    break;
     default:
         g_assert(false);
         break;
@@ -1203,7 +1210,6 @@ SAL_DLLPUBLIC_EXPORT int lok_docview_get_part( LOKDocView* pDocView )
 SAL_DLLPUBLIC_EXPORT void lok_docview_set_part( LOKDocView* pDocView, int nPart)
 {
     pDocView->m_pImpl->m_pDocument->pClass->setPart( pDocView->m_pImpl->m_pDocument, nPart );
-    pDocView->m_pImpl->renderDocument(0);
 }
 
 SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int nPart )
commit 05e4e065b04f1d0e120802f9f74d1017f16431c6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat May 23 10:44:07 2015 +0100

    lokdocview: update doc size on LOK_CALLBACK_PAGE_COUNT_CHANGED
    
    No need to do any actual rendering, the invalidation callback takes care
    of that.
    
    Change-Id: I9a3e45cab5250fc45eccb4577fe76377f76354eb
    (cherry picked from commit 490365b2452cb6fa96749475d996c6033b0d6407)

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 2cbd450..3203b48 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -908,6 +908,8 @@ const char* LOKDocView_Impl::callbackTypeToString(int nType)
         return "LOK_CALLBACK_STATUS_INDICATOR_FINISH";
     case LOK_CALLBACK_SEARCH_NOT_FOUND:
         return "LOK_CALLBACK_SEARCH_NOT_FOUND";
+    case LOK_CALLBACK_PAGE_COUNT_CHANGED:
+        return "LOK_CALLBACK_PAGE_COUNT_CHANGED";
     }
     return 0;
 }
@@ -1002,6 +1004,11 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
     break;
     case LOK_CALLBACK_SEARCH_NOT_FOUND:
     break;
+    case LOK_CALLBACK_PAGE_COUNT_CHANGED:
+    {
+        m_pDocument->pClass->getDocumentSize(m_pDocument, &m_nDocumentWidthTwips, &m_nDocumentHeightTwips);
+    }
+    break;
     default:
         g_assert(false);
         break;
@@ -1025,7 +1032,7 @@ void LOKDocView_Impl::globalCallbackWorker(int nType, const char* pPayload, void
 
 void LOKDocView_Impl::callbackWorkerImpl(int nType, const char* pPayload)
 {
-    LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload, m_pDocView);
+    LOKDocView_Impl::CallbackData* pCallback = new LOKDocView_Impl::CallbackData(nType, pPayload ? pPayload : "(nil)", m_pDocView);
     g_info("lok_docview_callback_worker: %s, '%s'", LOKDocView_Impl::callbackTypeToString(nType), pPayload);
 #if GTK_CHECK_VERSION(2,12,0)
     gdk_threads_add_idle(LOKDocView_Impl::callback, pCallback);
commit f9fcc569db6d55212f60ebc35416b7d0ec386ab8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 26 16:58:36 2015 +0200

    sd: fix LOK search result highlight when result is not on the current slide
    
    By adding a new callback event, so clients can switch to the correct
    slide.
    
    Change-Id: I6c2388eb11ef97811cc644fe3a9d3866aa82fd75
    (cherry picked from commit 67a37be9969d8b5a0bc8ae081bc1aba697ea6ba5)

diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 54862e1..9ad7636 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -151,7 +151,14 @@ typedef enum
      * Clients should assume that data returned by an earlier
      * lok::Document::getDocumentSize() call is no longer valid.
      */
-    LOK_CALLBACK_PAGE_COUNT_CHANGED
+    LOK_CALLBACK_PAGE_COUNT_CHANGED,
+
+    /**
+     * The current part number is changed.
+     *
+     * Payload is a single 0-based integer.
+     */
+    LOK_CALLBACK_SET_PART
 }
 LibreOfficeKitCallbackType;
 
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 9aa19da..74a77c4 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -81,6 +81,7 @@
 
 #include <sfx2/request.hxx>
 #include <boost/bind.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace com::sun::star;
 
@@ -1098,6 +1099,11 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
         mpDrawView->AdjustMarkHdl();
     }
 
+    if (bOK)
+    {
+        OString aPayload = OString::number(nSelectedPage);
+        GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
+    }
     return bOK;
 }
 
commit 3333d3e01e8ae9142f2e9ead1eb862af163bd843
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 26 15:14:39 2015 +0200

    SwPaM::Find: fix backwards-search in shape text
    
    Change-Id: I79157853d16ead4cb4147763ef0590702b3d8be6
    (cherry picked from commit 122b149826d270b8cbb26e2044f8da25b1d29c25)

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 756fb9b..4d6cc99 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -226,12 +226,12 @@ void SwTiledRenderingTest::testResetSelection()
 }
 
 #if !(defined WNT || defined MACOSX)
-void lcl_search()
+void lcl_search(bool bBackward)
 {
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
     {
         {"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
-        {"SearchItem.Backward", uno::makeAny(false)}
+        {"SearchItem.Backward", uno::makeAny(bBackward)}
     }));
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
 }
@@ -245,24 +245,34 @@ void SwTiledRenderingTest::testSearch()
     size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
 
     // First hit, in the second paragraph, before the shape.
-    lcl_search();
+    lcl_search(false);
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
     size_t nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
 
     // Next hit, in the shape.
-    lcl_search();
+    lcl_search(false);
     CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
 
     // Next hit, in the shape, still.
-    lcl_search();
+    lcl_search(false);
     CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
 
     // Last hit, in the last paragraph, after the shape.
-    lcl_search();
+    lcl_search(false);
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
     nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(nNode + 7, nActual);
+
+    // Now change direction and make sure that the first 2 hits are in the shape, but not the 3rd one.
+    lcl_search(true);
+    CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
+    lcl_search(true);
+    CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
+    lcl_search(true);
+    CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
+    nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
+    CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
 #endif
 }
 
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index c15e5d1..741e307 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -38,6 +38,7 @@
 #include <IDocumentUndoRedo.hxx>
 #include <IDocumentState.hxx>
 #include <IDocumentDrawModelAccess.hxx>
+#include <dcontact.hxx>
 #include <pamtyp.hxx>
 #include <ndtxt.hxx>
 #include <swundo.hxx>
@@ -302,9 +303,23 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
             aSearchItem.SetBackward(!bSrchForward);
 
             // If there is an active text edit, then search there.
-            if (SdrView* pSdrView = pWrtShell->GetDrawView())
+            bool bEndedTextEdit = false;
+            SdrView* pSdrView = pWrtShell->GetDrawView();
+            if (pSdrView)
             {
-                if (pSdrView->GetTextEditObject())
+                // If the edited object is not anchored to this node, then ignore it.
+                SdrObject* pObject = pSdrView->GetTextEditObject();
+                if (pObject)
+                {
+                    if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject))
+                    {
+                        const SwPosition* pPosition = pFrameFormat->GetAnchor().GetContentAnchor();
+                        if (!pPosition || pPosition->nNode.GetIndex() != pNode->GetIndex())
+                            pObject = 0;
+                    }
+                }
+
+                if (pObject)
                 {
                     sal_uInt16 nResult = pSdrView->GetTextEditOutlinerView()->StartSearchAndReplace(aSearchItem);
                     if (!nResult)
@@ -315,6 +330,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
                         pSdrView->UnmarkAll();
                         pWrtShell->SetCursor(&aPoint, true);
                         pWrtShell->Edit();
+                        bEndedTextEdit = true;
                     }
                     else
                     {
@@ -324,17 +340,35 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
                 }
             }
 
-            // If there are any shapes anchored to this node, search there.
-            SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent());
-            aPaM.GetPoint()->nNode = rTextNode;
-            aPaM.GetPoint()->nContent.Assign(aPaM.GetPoint()->nNode.GetNode().GetTextNode(), nStart);
-            aPaM.SetMark();
-            aPaM.GetMark()->nNode = rTextNode.GetIndex() + 1;
-            aPaM.GetMark()->nContent.Assign(aPaM.GetMark()->nNode.GetNode().GetTextNode(), 0);
-            if (pNode->GetDoc()->getIDocumentDrawModelAccess().Search(aPaM, aSearchItem))
+            // If we just finished search in shape text, don't attept to do that again.
+            if (!bEndedTextEdit)
             {
-                bFound = true;
-                break;
+                // If there are any shapes anchored to this node, search there.
+                SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent());
+                aPaM.GetPoint()->nNode = rTextNode;
+                aPaM.GetPoint()->nContent.Assign(aPaM.GetPoint()->nNode.GetNode().GetTextNode(), nStart);
+                aPaM.SetMark();
+                aPaM.GetMark()->nNode = rTextNode.GetIndex() + 1;
+                aPaM.GetMark()->nContent.Assign(aPaM.GetMark()->nNode.GetNode().GetTextNode(), 0);
+                if (pNode->GetDoc()->getIDocumentDrawModelAccess().Search(aPaM, aSearchItem) && pSdrView)
+                {
+                    if (SdrObject* pObject = pSdrView->GetTextEditObject())
+                    {
+                        if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject))
+                        {
+                            const SwPosition* pPosition = pFrameFormat->GetAnchor().GetContentAnchor();
+                            if (pPosition)
+                            {
+                                // Set search position to the shape's anchor point.
+                                *GetPoint() = *pPosition;
+                                GetPoint()->nContent.Assign(pPosition->nNode.GetNode().GetContentNode(), 0);
+                                SetMark();
+                                bFound = true;
+                                break;
+                            }
+                        }
+                    }
+                }
             }
 
             sal_Int32 aStart = 0;
commit e2e7e4f277ed1cf1776499af0b5f6dc17010877d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon May 25 23:26:19 2015 +0200

    loplugin:unreffun
    
    Change-Id: Ib7311448e15d23b041ebb4552df80046523a32f2
    (cherry picked from commit 077cd88f2da8538e4e89bce2614d6662ccfedce2)

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 2990d9a..756fb9b 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -225,6 +225,7 @@ void SwTiledRenderingTest::testResetSelection()
     CPPUNIT_ASSERT(!pWrtShell->IsSelFrmMode());
 }
 
+#if !(defined WNT || defined MACOSX)
 void lcl_search()
 {
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
@@ -234,6 +235,7 @@ void lcl_search()
     }));
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
 }
+#endif
 
 void SwTiledRenderingTest::testSearch()
 {
commit 8bc4d119b7ca984f1ac9ee10e0797537712cca1c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu May 21 11:29:04 2015 +0100

    CppunitTest_sw_tiledrendering: disable the search test on non-Linux for now
    
    Change-Id: Iae2de9b9ada2046beca29990a8abda09947d7b34

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 3ba4dbd..2990d9a 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -237,6 +237,7 @@ void lcl_search()
 
 void SwTiledRenderingTest::testSearch()
 {
+#if !defined(WNT) && !defined(MACOSX)
     SwXTextDocument* pXTextDocument = createDoc("search.odt");
     SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
     size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
@@ -260,6 +261,7 @@ void SwTiledRenderingTest::testSearch()
     CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
     nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
     CPPUNIT_ASSERT_EQUAL(nNode + 7, nActual);
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
commit f17081ea4e063cceaf74ffc68842db4c55b5a9ce
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed May 20 17:56:33 2015 +0200

    Add SwTiledRenderingTest::testSearch() testcase.
    
    Fails if the last hunk of commit
    bdc1824ea7acfa2fe9d71cdbe57882acce155577 (SwPaM::Find: search in shapes
    anchored to the range, 2015-05-19) is reverted.
    
    Change-Id: Id239e781ce493ee8952bcd9a018aa78146933433
    (cherry picked from commit 01d422d8659d1b19676de16b199c3438a148506f)

diff --git a/sw/qa/extras/tiledrendering/data/search.odt b/sw/qa/extras/tiledrendering/data/search.odt
new file mode 100644
index 0000000..5fb02fa
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/search.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index da6fdb5..3ba4dbd 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -9,6 +9,8 @@
 
 #include <swmodeltestbase.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/propertysequence.hxx>
 #include <comphelper/string.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
@@ -30,6 +32,7 @@ public:
     void testSetTextSelection();
     void testSetGraphicSelection();
     void testResetSelection();
+    void testSearch();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -38,6 +41,7 @@ public:
     CPPUNIT_TEST(testSetTextSelection);
     CPPUNIT_TEST(testSetGraphicSelection);
     CPPUNIT_TEST(testResetSelection);
+    CPPUNIT_TEST(testSearch);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -221,6 +225,43 @@ void SwTiledRenderingTest::testResetSelection()
     CPPUNIT_ASSERT(!pWrtShell->IsSelFrmMode());
 }
 
+void lcl_search()
+{
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+    {
+        {"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
+        {"SearchItem.Backward", uno::makeAny(false)}
+    }));
+    comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
+}
+
+void SwTiledRenderingTest::testSearch()
+{
+    SwXTextDocument* pXTextDocument = createDoc("search.odt");
+    SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+    size_t nNode = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
+
+    // First hit, in the second paragraph, before the shape.
+    lcl_search();
+    CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
+    size_t nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
+    CPPUNIT_ASSERT_EQUAL(nNode + 1, nActual);
+
+    // Next hit, in the shape.
+    lcl_search();
+    CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
+
+    // Next hit, in the shape, still.
+    lcl_search();
+    CPPUNIT_ASSERT(pWrtShell->GetDrawView()->GetTextEditObject());
+
+    // Last hit, in the last paragraph, after the shape.
+    lcl_search();
+    CPPUNIT_ASSERT(!pWrtShell->GetDrawView()->GetTextEditObject());
+    nActual = pWrtShell->getShellCrsr(false)->Start()->nNode.GetNode().GetIndex();
+    CPPUNIT_ASSERT_EQUAL(nNode + 7, nActual);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit d1c8970e09f6c871254640ea2d7e271dbda7f787
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 26 12:48:13 2015 +0200

    gdb: SwTxtNode -> SwTextNode
    
    Fixes the unexpected ' ~DeletedNode' lines in the output.
    
    Change-Id: I1f59c2cd986addd08e632d0bc1cc53b33048db77
    (cherry picked from commit 390aa6277af88ef6d0f4c38a503848d01e801875)

diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py
index 71445d5..fa73759 100644
--- a/solenv/gdb/libreoffice/sw.py
+++ b/solenv/gdb/libreoffice/sw.py
@@ -209,7 +209,7 @@ class BigPtrArrayPrinter(object):
 
         def _node_value(self, node):
             cur_indent = self.indent
-            if str(node.dynamic_type.target()) == "SwTxtNode":
+            if str(node.dynamic_type.target()) == "SwTextNode":
                 # accessing this is completely non-obvious...
                 # also, node.dynamic_cast(node.dynamic_type) is null?
                 value = "    TextNode " + \


More information about the Libreoffice-commits mailing list