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 34e8b0d8efce9d44b75421577f46ca6c30d6e06d
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Fri Jun 27 18:19:35 2025 +0300
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Jul 3 06:30:15 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 88769ef361ac..ebf0e1f3570f 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);
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index fe499c5f3dc8..4a53aaf4dd51 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