sw/qa/extras/ooxmlexport/data/tdf167082.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport25.cxx | 13 +++++++++++++ sw/source/filter/ww8/wrtw8nds.cxx | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-)
New commits: commit e3da51b84f58a1114fef0d9c5a2881eb05ad8f13 Author: Gülşah Köse <[email protected]> AuthorDate: Fri Jun 27 18:19:35 2025 +0300 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Jul 3 06:28:24 2025 +0200 tdf#167082 Fix the missing style While we tracking change of the document, if action is delete and if it doesn't delete the whole node, we shoud use remaining text parts's style. If delete removes whole node we can use previous node' style. Signed-off-by: Gülşah Köse <[email protected]> Change-Id: Ie5cc40c12b9e2dad521ee35098630c94048d490f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187266 Tested-by: Jenkins Reviewed-by: Szymon Kłos <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf167082.docx b/sw/qa/extras/ooxmlexport/data/tdf167082.docx new file mode 100644 index 000000000000..9be7a19633ca Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf167082.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx index 33465e2c15c7..d9faf3a7287d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx @@ -158,6 +158,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf166620) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf167082) +{ + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Heading 1 + // - Actual : Standard + + createSwDoc("tdf167082.docx"); + saveAndReload(mpFilter); + OUString aStyleName = getProperty<OUString>(getParagraph(3), u"ParaStyleName"_ustr); + + CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"), aStyleName); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index f6a886e1057e..97651227b652 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1903,6 +1903,7 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nCurrentPos, Because of the different style handling for delete operations, the track changes have to be analysed. A deletion, starting in paragraph A with style A, ending in paragraph B with style B, needs a hack. + If paragraph B is not deleted completely, we should preserve the style here. */ static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTextNode* pTextNode ) { @@ -1915,7 +1916,8 @@ static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, con // Looking for deletions, which ends in current pTextNode if( RedlineType::Delete == pRedl->GetRedlineData().GetType() && pEnd->GetNode() == *pTextNode && pStart->GetNode() != *pTextNode && - pStart->GetNode().IsTextNode() ) + pStart->GetNode().IsTextNode() && + pEnd->GetContentIndex() == pEnd->GetNode().GetTextNode()->GetText().getLength()) { pTextNode = pStart->GetNode().GetTextNode(); nMax = nPos;
