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

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 10 11:41:21 UTC 2020


 sw/qa/extras/uiwriter/data/tdf113877_blank_bold_off.odt |binary
 sw/qa/extras/uiwriter/data/tdf113877_blank_bold_on.odt  |binary
 sw/qa/extras/uiwriter/uiwriter.cxx                      |   88 +++++++---------
 sw/source/core/txtnode/ndtxt.cxx                        |    4 
 sw/source/filter/xml/xmlimp.cxx                         |    1 
 5 files changed, 46 insertions(+), 47 deletions(-)

New commits:
commit 3f425069fc31bd6bac86d98312631321d0ff591f
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Thu Oct 8 09:01:33 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Oct 10 13:40:39 2020 +0200

    tdf#132289 missing styles when inserting file with list
    
    Change-Id: I444997a6cc55cfe287f4c610f538f2f54803646c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104085
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_off.odt b/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_off.odt
new file mode 100644
index 000000000000..f4d58da53b95
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_off.odt differ
diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_on.odt b/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_on.odt
new file mode 100644
index 000000000000..8de77fc6161c
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf113877_blank_bold_on.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 8bacd6781b18..9807343e912c 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -322,10 +322,15 @@ public:
     void testTdf58604();
     void testTdf112025();
     void testTdf72942();
+
+    void testTdf113877_mergeDocs(const char* aDestDoc, const char* aInsertDoc);
     void testTdf113877();
     void testTdf113877NoMerge();
     void testTdf113877_default_style();
     void testTdf113877_Standard_style();
+    void testTdf113877_blank_bold_on();
+    void testTdf113877_blank_bold_off();
+
     void testMsWordCompTrailingBlanks();
     void testCreateDocxAnnotation();
     void testTdf107976();
@@ -546,6 +551,8 @@ public:
     CPPUNIT_TEST(testTdf113877NoMerge);
     CPPUNIT_TEST(testTdf113877_default_style);
     CPPUNIT_TEST(testTdf113877_Standard_style);
+    CPPUNIT_TEST(testTdf113877_blank_bold_on);
+    CPPUNIT_TEST(testTdf113877_blank_bold_off);
     CPPUNIT_TEST(testMsWordCompTrailingBlanks);
     CPPUNIT_TEST(testCreateDocxAnnotation);
     CPPUNIT_TEST(testTdf107976);
@@ -6300,12 +6307,9 @@ void SwUiWriterTest::testTdf114306_2()
     CPPUNIT_ASSERT_EQUAL(4, getPages());
 }
 
-
-// During insert of the document with list inside into the main document inside the list
-// we should merge both lists into one, when they have the same list properties
-void SwUiWriterTest::testTdf113877()
+void SwUiWriterTest::testTdf113877_mergeDocs(const char* aDestDoc, const char* aInsertDoc)
 {
-    load(DATA_DIRECTORY, "tdf113877_insert_numbered_list.odt");
+    load(DATA_DIRECTORY, aDestDoc);
 
     // set a page cursor into the end of the document
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
@@ -6315,10 +6319,17 @@ void SwUiWriterTest::testTdf113877()
 
     // insert the same document at current cursor position
     {
-        const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list.odt";
+        const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(aInsertDoc);
         uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
         dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
     }
+}
+
+// During insert of the document with list inside into the main document inside the list
+// we should merge both lists into one, when they have the same list properties
+void SwUiWriterTest::testTdf113877()
+{
+    testTdf113877_mergeDocs("tdf113877_insert_numbered_list.odt", "tdf113877_insert_numbered_list.odt");
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
     const OUString listId4 = getProperty<OUString>(getParagraph(4), "ListId");
@@ -6338,20 +6349,7 @@ void SwUiWriterTest::testTdf113877()
 // The same test as testTdf113877() but merging of two list should not be performed.
 void SwUiWriterTest::testTdf113877NoMerge()
 {
-    load(DATA_DIRECTORY, "tdf113877_insert_numbered_list.odt");
-
-    // set a page cursor into the end of the document
-    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();
-
-    // insert the same document at current cursor position
-    {
-        const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
-        uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
-    }
+    testTdf113877_mergeDocs("tdf113877_insert_numbered_list.odt", "tdf113877_insert_numbered_list_abcd.odt");
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
     const OUString listId4 = getProperty<OUString>(getParagraph(4), "ListId");
@@ -6377,20 +6375,7 @@ void SwUiWriterTest::testTdf113877NoMerge()
 //
 void SwUiWriterTest::testTdf113877_default_style()
 {
-    load(DATA_DIRECTORY, "tdf113877_blank.odt");
-
-    // set a page cursor into the end of the document
-    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();
-
-    // insert the same document at current cursor position
-    {
-        const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
-        uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
-    }
+    testTdf113877_mergeDocs("tdf113877_blank.odt", "tdf113877_insert_numbered_list_abcd.odt");
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
     const OUString listId2 = getProperty<OUString>(getParagraph(2), "ListId");
@@ -6409,20 +6394,31 @@ void SwUiWriterTest::testTdf113877_default_style()
 //
 void SwUiWriterTest::testTdf113877_Standard_style()
 {
-    load(DATA_DIRECTORY, "tdf113877_blank_ownStandard.odt");
+    testTdf113877_mergeDocs("tdf113877_blank_ownStandard.odt", "tdf113877_insert_numbered_list_abcd.odt");
 
-    // set a page cursor into the end of the document
-    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();
+    const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
+    const OUString listId2 = getProperty<OUString>(getParagraph(2), "ListId");
+    const OUString listId3 = getProperty<OUString>(getParagraph(3), "ListId");
 
-    // insert the same document at current cursor position
-    {
-        const OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113877_insert_numbered_list_abcd.odt";
-        uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({ { "Name", uno::makeAny(insertFileid) } }));
-        dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
-    }
+    CPPUNIT_ASSERT_EQUAL(listId1, listId2);
+    CPPUNIT_ASSERT_EQUAL(listId1, listId3);
+}
+
+void SwUiWriterTest::testTdf113877_blank_bold_on()
+{
+    testTdf113877_mergeDocs("tdf113877_blank_bold_on.odt", "tdf113877_insert_numbered_list_abcd.odt");
+
+    const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
+    const OUString listId2 = getProperty<OUString>(getParagraph(2), "ListId");
+    const OUString listId3 = getProperty<OUString>(getParagraph(3), "ListId");
+
+    CPPUNIT_ASSERT_EQUAL(listId1, listId2);
+    CPPUNIT_ASSERT_EQUAL(listId1, listId3);
+}
+
+void SwUiWriterTest::testTdf113877_blank_bold_off()
+{
+    testTdf113877_mergeDocs("tdf113877_blank_bold_off.odt", "tdf113877_insert_numbered_list_abcd.odt");
 
     const OUString listId1 = getProperty<OUString>(getParagraph(1), "ListId");
     const OUString listId2 = getProperty<OUString>(getParagraph(2), "ListId");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 1d85f8db8370..f62ca8ea33ff 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -2461,11 +2461,13 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
                 do
                 {
                     // check current item
-                    sal_uInt16 nWhich = IsInvalidItem( pItem )
+                    const sal_uInt16 nWhich = IsInvalidItem( pItem )
                         ? pDest->GetpSwAttrSet()->GetWhichByPos( aIter.GetCurPos() )
                         : pItem->Which();
                     if( RES_FRMATR_STYLE_NAME != nWhich &&
                         RES_FRMATR_CONDITIONAL_STYLE_NAME != nWhich &&
+                        RES_PAGEDESC != nWhich &&
+                        RES_BREAK != nWhich &&
                         SfxItemState::SET == pDest->GetpSwAttrSet()->GetItemState( nWhich, false ) )
                     {
                         // check if parent value (original value in style) has the same value as in [pItem]
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 2123f35fad9e..1ce3ec93a63e 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -787,6 +787,7 @@ void SwXMLImport::endDocument()
                     pDelNd->FormatToTextAttr( pTextNode );
                 else
                 {
+                    pTextNode->ResetAttr(RES_CHRATR_BEGIN, RES_CHRATR_END);
                     pTextNode->ChgFormatColl( pDelNd->GetTextColl() );
                     if (!pDelNd->GetNoCondAttr(RES_PARATR_LIST_ID, /*bInParents=*/false))
                     {


More information about the Libreoffice-commits mailing list