[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 2 commits - sw/qa sw/source

Jan-Marek Glogowski glogow at fbihome.de
Fri Oct 6 02:25:46 UTC 2017


 sw/qa/extras/uiwriter/data/fdo112025-insert.docx |binary
 sw/qa/extras/uiwriter/data/fdo112025.odt         |binary
 sw/qa/extras/uiwriter/uiwriter.cxx               |   24 +++++++++++++++++++++++
 sw/source/core/doc/SwDocIdle.cxx                 |   13 ++++++++++++
 sw/source/uibase/uiview/view2.cxx                |    1 
 5 files changed, 38 insertions(+)

New commits:
commit 9d3dd7548e8ee7c4bebdf6fad5e565cb7e5deffc
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Thu Oct 5 19:17:00 2017 +0200

    Prevent busy-loop in Writer idle processing
    
    Change-Id: Ic12ff368069ed358f882bfba8c99223c31a5fcc2

diff --git a/sw/source/core/doc/SwDocIdle.cxx b/sw/source/core/doc/SwDocIdle.cxx
index 9461807943d8..6da2ff72e7a3 100644
--- a/sw/source/core/doc/SwDocIdle.cxx
+++ b/sw/source/core/doc/SwDocIdle.cxx
@@ -24,6 +24,7 @@
 #include <vcl/scheduler.hxx>
 
 #include "SwDocIdle.hxx"
+#include "IDocumentLayoutAccess.hxx"
 
 namespace sw
 {
@@ -37,6 +38,18 @@ sal_uInt64 SwDocIdle::UpdateMinPeriod( sal_uInt64 /* nMinPeriod */, sal_uInt64 /
         SwWrtShell& rWrtShell = pView->GetWrtShell();
         bReadyForSchedule = rWrtShell.GetViewOptions()->IsIdle();
     }
+
+    if( bReadyForSchedule )
+    {
+        SwViewShell* pShell( m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() );
+        for( SwViewShell& rSh : pShell->GetRingContainer() )
+            if( rSh.ActionPend() )
+            {
+                bReadyForSchedule = false;
+                break;
+            }
+    }
+
     return bReadyForSchedule
         ? Scheduler::ImmediateTimeoutMs : Scheduler::InfiniteTimeoutMs;
 }
commit a0db1920af42162b3fbfd7093fa05e03fc6c8f99
Author: Manfred Blume <manfred.blume at cib.de>
Date:   Mon Oct 2 13:17:28 2017 +0200

    tdf#112025 insert docx into existing document
    
    unit test
    backport
    
    Change-Id: I58ce9bc3604c09b0fe8d18bc8aa007a5aad21988

diff --git a/sw/qa/extras/uiwriter/data/fdo112025-insert.docx b/sw/qa/extras/uiwriter/data/fdo112025-insert.docx
new file mode 100755
index 000000000000..f915806e42cb
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo112025-insert.docx differ
diff --git a/sw/qa/extras/uiwriter/data/fdo112025.odt b/sw/qa/extras/uiwriter/data/fdo112025.odt
new file mode 100755
index 000000000000..6d20370189c0
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo112025.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6de728ed4e1e..119ff204d179 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -205,6 +205,7 @@ public:
     void testTdf78727();
     void testTdf104814();
     void testTdf105417();
+    void testTdf112025();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -309,6 +310,7 @@ public:
     CPPUNIT_TEST(testTdf78727);
     CPPUNIT_TEST(testTdf104814);
     CPPUNIT_TEST(testTdf105417);
+    CPPUNIT_TEST(testTdf112025);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3758,6 +3760,28 @@ void SwUiWriterTest::testTdf105417()
     aWrap.SpellDocument();
 }
 
+void SwUiWriterTest::testTdf112025()
+{
+    load(DATA_DIRECTORY, "fdo112025.odt");
+    const int numberOfParagraphs = getParagraphs();
+    CPPUNIT_ASSERT_EQUAL(1, numberOfParagraphs);
+
+    // get a page cursor
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+    xCursor->jumpToEndOfPage();
+
+    OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo112025-insert.docx";
+    uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({{ "Name", uno::makeAny(insertFileid) }}));
+    lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+    // something has been inserted + an additional paragraph
+    CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
+
+    uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index bdb977ec7b8f..b9a3a70100bf 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2178,6 +2178,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe
                     else
                     {
                         ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+                        pDoc->getIDocumentContentOperations().SplitNode(*m_pWrtShell->GetCursor()->GetPoint(), false);
                         uno::Reference<text::XTextRange> const xInsertPosition(
                             SwXTextRange::CreateXTextRange(*pDoc,
                                 *m_pWrtShell->GetCursor()->GetPoint(), nullptr));


More information about the Libreoffice-commits mailing list