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 | 3 5 files changed, 48 insertions(+), 47 deletions(-)
New commits: commit 92c05bd1f8ef695a56718c4b54babbe757ab9b89 Author: Serge Krot <[email protected]> AuthorDate: Thu Oct 8 09:01:33 2020 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Wed Oct 14 22:59:35 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 <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104319 Tested-by: Thorsten Behrens <[email protected]> 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 be8a972a181a..cd8516d6c29e 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -317,10 +317,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(); @@ -530,6 +535,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); @@ -6250,12 +6257,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); @@ -6265,10 +6269,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) } })); lcl_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"); @@ -6288,20 +6299,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) } })); - lcl_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"); @@ -6327,20 +6325,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) } })); - lcl_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"); @@ -6359,20 +6344,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) } })); - lcl_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 f53c6977ef6f..eb77942b6fe7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2451,11 +2451,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 75766a7f8a64..08cc729a019d 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -811,7 +811,10 @@ void SwXMLImport::endDocument() if (!pTextNode->GetText().isEmpty()) pDelNd->FormatToTextAttr( pTextNode ); else + { + pTextNode->ResetAttr(RES_CHRATR_BEGIN, RES_CHRATR_END); pTextNode->ChgFormatColl( pDelNd->GetTextColl() ); + } pTextNode->JoinNext(); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
