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 3fce77c3638694ec6cb745a45bbff3fd5491e1f1
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Fri Jun 27 18:19:35 2025 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Jul 14 19:17:56 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 <gulsah.k...@collabora.com>
    Change-Id: Ie5cc40c12b9e2dad521ee35098630c94048d490f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187120
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

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 0ab86ddaf8b3..f8e43d79c68c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport25.cxx
@@ -125,6 +125,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);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFloatingTableAnchorPosExport)
 {
     // Given a document with two floating tables after each other:
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 3e0fd1bd50f8..feedee5f0e69 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;

Reply via email to