[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - editeng/source sd/qa

Katarina Behrens (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 24 10:03:00 UTC 2020


 editeng/source/editeng/impedit2.cxx          |    6 ++++--
 editeng/source/xml/xmltxtimp.cxx             |    5 ++++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   14 ++++++++++----
 3 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 9699108e60698355054d68a3da5a3e84913248cf
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Fri Jan 17 14:30:56 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Jan 24 11:02:29 2020 +0100

    tdf#128046: preserve list levels on paste
    
    done in two steps:
    1) bullet and numbering properties must be included in the property
    list of SvxUnoText on import from ODF clipboard (SvxReadXML)
    2) in ConnectParagraphs, don't merge para attributes if the paragraph
    to be deleted is empty. Paragraph breaks are inserted before paste so
    this would make the last list level of the pasted text take the properties
    of the empty paragraph and thus lose its indentation
    
    Also updated tdf#103083 unit test to be more specific and test that
    bullet properties don't get lost after paste. Previously only count
    of SfxItems was tested which is somehow fragile and fails bc paste
    adds a paragraph style
    
    Change-Id: Ia162adb7abf145a8217f21c7ebfe06b69731e2a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86983
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 66ed51712bb323bba7d1a0b0d21b256e5f5f9ccf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87284
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index c65dc164ea4a..c92cbe85cf98 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2251,7 +2251,9 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
     if ( bBackward )
     {
         pLeft->SetStyleSheet( pRight->GetStyleSheet() );
-        pLeft->GetContentAttribs().GetItems().Set( pRight->GetContentAttribs().GetItems() );
+        // it feels wrong to set pLeft's attribs if pRight is empty, tdf#128046
+        if ( pRight->Len() )
+            pLeft->GetContentAttribs().GetItems().Set( pRight->GetContentAttribs().GetItems() );
         pLeft->GetCharAttribs().GetDefFont() = pRight->GetCharAttribs().GetDefFont();
     }
 
@@ -3508,7 +3510,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable(
     std::filebuf afilebuf;
     afilebuf.open ("gsoc17_clipboard_test.xml",std::ios::out);
     std::ostream os(&afilebuf);
-    os.write((const char*)(pDataObj->GetODFStream().GetBuffer()), pDataObj->GetODFStream().remainingSize());
+    os.write((const char*)(pDataObj->GetODFStream().GetData()), pDataObj->GetODFStream().remainingSize());
     afilebuf.close();
     */
     //dumping ends
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index 51994a323080..7a6b0b494786 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -147,7 +147,10 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection
     {
         SVX_UNOEDIT_CHAR_PROPERTIES,
         SVX_UNOEDIT_FONT_PROPERTIES,
-//      SVX_UNOEDIT_OUTLINER_PROPERTIES,
+//      bullets & numbering props, tdf#128046
+        { OUString(UNO_NAME_NUMBERING_RULES),        EE_PARA_NUMBULLET,  cppu::UnoType<css::container::XIndexReplace>::get(), 0, 0 },
+        { OUString(UNO_NAME_NUMBERING),              EE_PARA_BULLETSTATE,cppu::UnoType<bool>::get(), 0, 0 },
+        { OUString(UNO_NAME_NUMBERING_LEVEL),        EE_PARA_OUTLLEVEL,  ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
         SVX_UNOEDIT_PARA_PROPERTIES,
         { OUString(), 0, css::uno::Type(), 0, 0 }
     };
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index cfcf3241e2b9..ff379531338f 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -24,6 +24,7 @@
 #include <editeng/editids.hrc>
 #include <editeng/editobj.hxx>
 #include <editeng/editview.hxx>
+#include <editeng/numitem.hxx>
 #include <editeng/outliner.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/outlobj.hxx>
@@ -1424,8 +1425,9 @@ void SdTiledRenderingTest::testTdf103083()
     SdrOutliner* pOutliner = pView->GetTextEditOutliner();
     CPPUNIT_ASSERT_EQUAL(OUString("No-Logo Content~LT~Gliederung 2"),
                          pOutliner->GetStyleSheet(2)->GetName());
-    const SfxItemSet& rParagraphItemSet1 = pTextObject->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(2);
-    CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), rParagraphItemSet1.Count());
+    const EditTextObject& aEdit = pTextObject->GetOutlinerParaObject()->GetTextObject();
+    const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET);
+    SvxNumberFormat aNumFmt(pNumFmt->GetNumRule()->GetLevel(2));
 
     // cut contents of bullet item
     comphelper::dispatchCommand(".uno:Cut", uno::Sequence<beans::PropertyValue>());
@@ -1452,8 +1454,12 @@ void SdTiledRenderingTest::testTdf103083()
     CPPUNIT_ASSERT_EQUAL(OUString("No-Logo Content~LT~Gliederung 2"),
                          pOutliner->GetStyleSheet(2)->GetName());
 
-    const SfxItemSet& rParagraphItemSet2 = pTextObject->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(2);
-    CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), rParagraphItemSet2.Count());
+    const EditTextObject& aEdit2 = pTextObject->GetOutlinerParaObject()->GetTextObject();
+    const SvxNumBulletItem* pNumFmt2 = aEdit2.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET);
+    SvxNumberFormat aNumFmt2(pNumFmt2->GetNumRule()->GetLevel(2));
+
+    bool bEqual(aNumFmt2 == aNumFmt);
+    CPPUNIT_ASSERT_MESSAGE("Bullet properties changed after paste", bEqual);
 }
 
 /**


More information about the Libreoffice-commits mailing list