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

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 12 12:11:23 UTC 2021


 sc/source/ui/navipi/content.cxx          |    7 ++++++-
 sc/source/ui/navipi/navipi.cxx           |    1 -
 sw/qa/extras/uiwriter/data/tdf129270.odt |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx      |   26 ++++++++++++++++++++++++++
 sw/source/core/txtnode/ndtxt.cxx         |   10 +++++++++-
 5 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit a72f2dcf73df9b9f4420cc93aa57a77c165a0fcb
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Mon Aug 9 18:42:02 2021 +0300
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Thu Aug 12 14:10:46 2021 +0200

    tdf#129270: sw: do not copy list level on paragraph cut
    
    Current list level (RES_PARATR_LIST_LEVEL) is initialized
    before, but current value can overwrite it with invalid
    in given context. So we could have mismatch of outline
    style (which are not overwritten) and actual list level.
    
    Change-Id: Ibf34a6f35b922493c4a1477326ea6c1599b4938f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120212
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/sw/qa/extras/uiwriter/data/tdf129270.odt b/sw/qa/extras/uiwriter/data/tdf129270.odt
new file mode 100644
index 000000000000..e86c1f872153
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf129270.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index d93447d71dc2..e079ff006aea 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -278,6 +278,7 @@ public:
     void testRedlineAutoCorrect();
     void testRedlineAutoCorrect2();
     void testEmojiAutoCorrect();
+    void testTdf129270();
     void testInsertPdf();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest4);
@@ -393,6 +394,7 @@ public:
     CPPUNIT_TEST(testRedlineAutoCorrect);
     CPPUNIT_TEST(testRedlineAutoCorrect2);
     CPPUNIT_TEST(testEmojiAutoCorrect);
+    CPPUNIT_TEST(testTdf129270);
     CPPUNIT_TEST(testInsertPdf);
     CPPUNIT_TEST_SUITE_END();
 };
@@ -3602,6 +3604,30 @@ void SwUiWriterTest4::testInsertLongDateFormat()
     CPPUNIT_ASSERT(xField->getString().indexOf(" ") > -1);
 }
 
+void SwUiWriterTest4::testTdf129270()
+{
+    SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf129270.odt");
+    CPPUNIT_ASSERT(pDoc);
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell);
+    SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pXTextDocument);
+
+    // Go to document end
+    pWrtShell->SttEndDoc(/*bStt=*/false);
+
+    // Press enter
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
+    Scheduler::ProcessEventsToIdle();
+
+    // Numbering for previous outline should remain the same "2"
+    CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty<OUString>(getParagraph(4), "ListLabelString"));
+
+    // Numbering for newly created outline should be "2.1"
+    CPPUNIT_ASSERT_EQUAL(OUString("2.1"),
+                         getProperty<OUString>(getParagraph(5), "ListLabelString"));
+}
+
 void SwUiWriterTest4::testInsertPdf()
 {
     auto pPdfium = vcl::pdf::PDFiumLibrary::get();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c65455722c85..626b3b21bdd0 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2497,7 +2497,15 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
         }
         else
         {
-            GetpSwAttrSet()->CopyToModify( *pDest );
+            // Copy all attrs except RES_PARATR_LIST_LEVEL: it was initialized before
+            // and current SwTextNode can contain not suitable for pDest value
+            SfxItemSet aCharSet(
+                pDest->GetDoc().GetAttrPool(),
+                                svl::Items<RES_CHRATR_BEGIN, RES_PARATR_LIST_LEVEL - 1,
+                                           RES_PARATR_LIST_LEVEL + 1, HINT_END>);
+            aCharSet.Put(*GetpSwAttrSet());
+            if (aCharSet.Count())
+                pDest->SetAttr(aCharSet, nDestStart, nDestStart + nLen);
         }
     }
 
commit 38027099e773403ffd3314a5b54493adc65150ec
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 12 12:36:23 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 12 14:10:37 2021 +0200

    tdf#95549 speed up navigator tree load
    
    (*) inline the load loop
    
    (*) remove Refresh call from ScNavigatorDlg constructor, the SetListMode
    call at the bottom will trigger a load of the tree content
    
    Change-Id: I27f1d1bde89d8dcb5cc111ae132fbb05abc2fc7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120383
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index a5d464821f12..fe7c7f04f3e9 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -960,8 +960,13 @@ void ScContentTree::GetNoteStrings()
     // loop over cell notes
     std::vector<sc::NoteEntry> aEntries;
     pDoc->GetAllNoteEntries(aEntries);
+    weld::TreeIter* pParent = m_aRootNodes[ScContentId::NOTE].get();
     for (const auto& rEntry : aEntries)
-        InsertContent(ScContentId::NOTE, lcl_NoteString(*rEntry.mpNote));
+    {
+        OUString aValue = lcl_NoteString(*rEntry.mpNote);
+        m_xTreeView->insert(pParent, -1, &aValue, nullptr, nullptr, nullptr, false, m_xScratchIter.get());
+        m_xTreeView->set_sensitive(*m_xScratchIter, true);
+    }
 }
 
 ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index f56b730a6ea2..756f89426fe4 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -402,7 +402,6 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, weld::Widget* pParent, SfxNaviga
     if ( nLastRoot != ScContentId::ROOT )
         m_xLbEntries->SetRootType( nLastRoot );
 
-    m_xLbEntries->Refresh();
     GetDocNames(nullptr);
 
     UpdateButtons();


More information about the Libreoffice-commits mailing list