sw/qa/extras/ooxmlexport/data/tdf83844-hanging.fodt  |  115 +++++++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport22.cxx           |   44 +++++++
 sw/qa/extras/ww8export/data/tdf80596-hanging.fodt    |  115 +++++++++++++++++++
 sw/qa/extras/ww8export/data/tdf80596.fodt            |  115 +++++++++++++++++++
 sw/qa/extras/ww8export/ww8export4.cxx                |   27 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx         |   61 ++++++++--
 sw/source/filter/ww8/ww8atr.cxx                      |   14 ++
 sw/source/filter/ww8/ww8par6.cxx                     |   52 ++++++++
 sw/source/writerfilter/dmapper/DomainMapper.cxx      |   43 ++++++-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   52 ++++++++
 sw/source/writerfilter/dmapper/PropertyIds.cxx       |    3 
 sw/source/writerfilter/dmapper/PropertyIds.hxx       |    3 
 12 files changed, 631 insertions(+), 13 deletions(-)

New commits:
commit fbb46a2fd940d1b5f4b2782708756f67659c0f38
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Thu Mar 13 00:36:07 2025 -0600
Commit:     Jonathan Clark <jonat...@libreoffice.org>
CommitDate: Tue Mar 18 12:36:12 2025 +0100

    tdf#83844 DOCX import: implement Ch-based LR indentation
    
    Adds support for the leftChars, rightChars, hangingChars, and
    firstLineChars attributes, which are used for character-based
    indentation in CJK documents.
    
    This change also updates import/export of DOC Ch-based hanging
    indentation to correctly match the new behavior implemented for DOCX.
    
    Change-Id: Ib9168d4b5fa14f37ae81ba6ebb5402211ff10fd0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183066
    Tested-by: Jenkins
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf83844-hanging.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf83844-hanging.fodt
new file mode 100644
index 000000000000..f4891dcb1963
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf83844-hanging.fodt
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2025-03-12T20:37:42.066695946</meta:creation-date><dc:date>2025-03-12T20:44:29.603461809</dc:date><meta:editing-duration>PT6M47S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/796b1d4af696a6a31aef0dbd0458a192863d0a03</meta:generator><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="1" meta:word-count="24" 
meta:character-count="47" 
meta:non-whitespace-character-count="24"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans2" svg:font-family="'Noto Sans'" 
style:font-adornments="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif 
CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" 
draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" 
draw:start-line-spacing-horizontal="0.1114in" 
draw:start-line-spacing-vertical="0.1114in" 
draw:end-line-spacing-horizontal="0.1114in" 
draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0in" 
style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" 
style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" 
style:line-break="strict" style:tab-stop-distance="0.4925in" 
style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text" style:master-page-name="">
+   <style:paragraph-properties style:auto-text-indent="false" 
style:page-number="auto" loext:margin-left="3ic" loext:margin-right="1ic" 
loext:text-indent="-2ic"/>
+   <style:text-properties style:font-name="Noto Sans2" fo:font-family="'Noto 
Sans'" style:font-style-name="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable" fo:font-size="48pt" style:font-name-asian="Noto 
Sans2" style:font-family-asian="'Noto Sans'" 
style:font-style-name-asian="Regular" style:font-family-generic-asian="swiss" 
style:font-pitch-asian="variable" style:font-size-asian="48pt" 
style:language-asian="zxx" style:country-asian="none" 
style:font-size-complex="48pt" style:language-complex="zxx" 
style:country-complex="none"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.1965in" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="8.2681in" 
fo:page-height="11.6929in" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="0.7874in" 
fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" 
fo:margin-right="0.7874in" style:writing-mode="lr-tb" 
style:footnote-max-height="0in" loext:margin-gutter="0in">
+    <style:footnote-sep style:width="0.0071in" 
style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1">A A A A A A A A A B B B B B B C C C C C C C D 
D</text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ww8export/data/tdf83844.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf83844.fodt
similarity index 100%
rename from sw/qa/extras/ww8export/data/tdf83844.fodt
rename to sw/qa/extras/ooxmlexport/data/tdf83844.fodt
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
index 34408dcc958b..e7d784419ef0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx
@@ -43,6 +43,50 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf165642_glossaryFootnote)
     parseExport(u"word/glossary/footnotes.xml"_ustr);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf83844)
+{
+    createSwDoc("tdf83844.fodt");
+
+    auto fnVerify = [this] {
+        auto pXmlDoc = parseLayoutDump();
+
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[1]", "portion",
+                    u"A A A A ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion",
+                    u"B B B B B B B B ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[3]", "portion",
+                    u"C C C C C C C C ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[4]", "portion",
+                    u"D D D D");
+    };
+
+    fnVerify();
+    saveAndReload(mpFilter);
+    fnVerify();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf83844Hanging)
+{
+    createSwDoc("tdf83844-hanging.fodt");
+
+    auto fnVerify = [this] {
+        auto pXmlDoc = parseLayoutDump();
+
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[1]", "portion",
+                    u"A A A A A A A A A ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion",
+                    u"B B B B B B ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[3]", "portion",
+                    u"C C C C C C C ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[4]", "portion",
+                    u"D D");
+    };
+
+    fnVerify();
+    saveAndReload(mpFilter);
+    fnVerify();
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/qa/extras/ww8export/data/tdf80596-hanging.fodt 
b/sw/qa/extras/ww8export/data/tdf80596-hanging.fodt
new file mode 100644
index 000000000000..f4891dcb1963
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80596-hanging.fodt
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2025-03-12T20:37:42.066695946</meta:creation-date><dc:date>2025-03-12T20:44:29.603461809</dc:date><meta:editing-duration>PT6M47S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/796b1d4af696a6a31aef0dbd0458a192863d0a03</meta:generator><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="1" meta:word-count="24" 
meta:character-count="47" 
meta:non-whitespace-character-count="24"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans2" svg:font-family="'Noto Sans'" 
style:font-adornments="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif 
CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" 
draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" 
draw:start-line-spacing-horizontal="0.1114in" 
draw:start-line-spacing-vertical="0.1114in" 
draw:end-line-spacing-horizontal="0.1114in" 
draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0in" 
style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" 
style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" 
style:line-break="strict" style:tab-stop-distance="0.4925in" 
style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text" style:master-page-name="">
+   <style:paragraph-properties style:auto-text-indent="false" 
style:page-number="auto" loext:margin-left="3ic" loext:margin-right="1ic" 
loext:text-indent="-2ic"/>
+   <style:text-properties style:font-name="Noto Sans2" fo:font-family="'Noto 
Sans'" style:font-style-name="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable" fo:font-size="48pt" style:font-name-asian="Noto 
Sans2" style:font-family-asian="'Noto Sans'" 
style:font-style-name-asian="Regular" style:font-family-generic-asian="swiss" 
style:font-pitch-asian="variable" style:font-size-asian="48pt" 
style:language-asian="zxx" style:country-asian="none" 
style:font-size-complex="48pt" style:language-complex="zxx" 
style:country-complex="none"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.1965in" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="8.2681in" 
fo:page-height="11.6929in" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="0.7874in" 
fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" 
fo:margin-right="0.7874in" style:writing-mode="lr-tb" 
style:footnote-max-height="0in" loext:margin-gutter="0in">
+    <style:footnote-sep style:width="0.0071in" 
style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1">A A A A A A A A A B B B B B B C C C C C C C D 
D</text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ww8export/data/tdf80596.fodt 
b/sw/qa/extras/ww8export/data/tdf80596.fodt
new file mode 100644
index 000000000000..049020dc3625
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf80596.fodt
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2025-03-12T20:37:42.066695946</meta:creation-date><dc:date>2025-03-12T20:44:29.603461809</dc:date><meta:editing-duration>PT6M47S</meta:editing-duration><meta:editing-cycles>4</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/796b1d4af696a6a31aef0dbd0458a192863d0a03</meta:generator><meta:document-statistic
 meta:table-count="0" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="1" meta:word-count="24" 
meta:character-count="47" 
meta:non-whitespace-character-count="24"/></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" 
style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Sans2" svg:font-family="'Noto Sans'" 
style:font-adornments="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable"/>
+  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif 
CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" 
draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" 
draw:start-line-spacing-horizontal="0.1114in" 
draw:start-line-spacing-vertical="0.1114in" 
draw:end-line-spacing-horizontal="0.1114in" 
draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" loext:tab-stop-distance="0in" 
style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" 
loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" 
style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" 
style:line-break="strict" style:tab-stop-distance="0.4925in" 
style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="en" fo:country="US" style:letter-kerning="true" 
style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" 
loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text" style:master-page-name="">
+   <style:paragraph-properties style:auto-text-indent="false" 
style:page-number="auto" loext:margin-left="1ic" loext:margin-right="2ic" 
loext:text-indent="3ic"/>
+   <style:text-properties style:font-name="Noto Sans2" fo:font-family="'Noto 
Sans'" style:font-style-name="Regular" style:font-family-generic="swiss" 
style:font-pitch="variable" fo:font-size="48pt" style:font-name-asian="Noto 
Sans2" style:font-family-asian="'Noto Sans'" 
style:font-style-name-asian="Regular" style:font-family-generic-asian="swiss" 
style:font-pitch-asian="variable" style:font-size-asian="48pt" 
style:language-asian="zxx" style:country-asian="none" 
style:font-size-complex="48pt" style:language-complex="zxx" 
style:country-complex="none"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.1965in" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+  </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard">
+   <style:text-properties/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="8.2681in" 
fo:page-height="11.6929in" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="0.7874in" 
fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" 
fo:margin-right="0.7874in" style:writing-mode="lr-tb" 
style:footnote-max-height="0in" loext:margin-gutter="0in">
+    <style:footnote-sep style:width="0.0071in" 
style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1">A A A A B B B B B B B B C C C C C C C C D D D 
D</text:p>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index b214616f0cc2..612d46439b77 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -634,9 +634,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf54862)
     verify();
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf83844)
+CPPUNIT_TEST_FIXTURE(Test, testTdf80596)
 {
-    createSwDoc("tdf83844.fodt");
+    createSwDoc("tdf80596.fodt");
 
     auto fnVerify = [this]
     {
@@ -657,6 +657,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf83844)
     fnVerify();
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf80596Hanging)
+{
+    createSwDoc("tdf80596-hanging.fodt");
+
+    auto fnVerify = [this]
+    {
+        auto pXmlDoc = parseLayoutDump();
+
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[1]", "portion",
+                    u"A A A A A A A A A ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[2]", "portion",
+                    u"B B B B B B ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[3]", "portion",
+                    u"C C C C C C C ");
+        assertXPath(pXmlDoc, 
"/root/page/body/txt/SwParaPortion/SwLineLayout[4]", "portion",
+                    u"D D");
+    };
+
+    fnVerify();
+    saveAndReload(mpFilter);
+    fnVerify();
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 32e5ca3f5485..4818fb87ec95 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -9329,7 +9329,24 @@ void DocxAttributeOutput::FormatPaperBin(const 
SvxPaperBinItem& rPaperBin)
 
 void DocxAttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& 
rFirstLine)
 {
-    // tdf#83844: TODO: export FONT_CJK_ADVANCE first line indent as 
HangingChars/FirstLineChars
+    // tdf#83844: export FONT_CJK_ADVANCE first line indent as 
hangingChars/firstLineChars
+    auto stValue = rFirstLine.GetTextFirstLineOffset();
+    if (stValue.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE)
+    {
+        if (stValue.m_dValue >= 0.0)
+        {
+            AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, XML_firstLineChars),
+                          OString::number(stValue.m_dValue * 100.0));
+        }
+        else
+        {
+            AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, XML_hangingChars),
+                          OString::number(stValue.m_dValue * -100.0));
+        }
+
+        return;
+    }
+
     sal_Int32 const 
nFirstLineAdjustment(rFirstLine.ResolveTextFirstLineOffset({}));
     if (nFirstLineAdjustment > 0)
     {
@@ -9367,21 +9384,49 @@ void 
DocxAttributeOutput::FormatTextLeftMargin(SvxTextLeftMarginItem const& rTex
         }
     }
     bool const bEcma1st(m_rExport.GetFilter().getVersion() == 
oox::core::ECMA_376_1ST_EDITION);
+
+    // tdf#83844: export FONT_CJK_ADVANCE left margin as leftChars/startChars
+    auto stValue = pTextLeftMargin->GetTextLeft();
+    if (stValue.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE)
+    {
+        // tdf#83844: DOCX stores left and leftChars differently with hanging
+        // indentation. The left margin must be adjusted before exporting.
+        const SfxItemSet* pSet = GetExport().m_pISet;
+        if (pSet && pSet->HasItem(RES_MARGIN_FIRSTLINE))
+        {
+            const SvxFirstLineIndentItem* pItem = 
pSet->GetItem(RES_MARGIN_FIRSTLINE);
+            auto stFirstLine = pItem->GetTextFirstLineOffset();
+            if (stFirstLine.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE
+                && stFirstLine.m_dValue < 0.0)
+            {
+                stValue.m_dValue += stFirstLine.m_dValue;
+            }
+        }
+
+        AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? 
XML_leftChars : XML_startChars)),
+                      OString::number(stValue.m_dValue * 100.0));
+        return;
+    }
+
     AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? XML_left : 
XML_start)),
                   OString::number(pTextLeftMargin->ResolveTextLeft({})));
 }
 
 void DocxAttributeOutput::FormatRightMargin(SvxRightMarginItem const& 
rRightMargin)
 {
-    // (paragraph case, this will be an else branch once others are converted)
-#if 0
-    else
-#endif
+    bool const bEcma1st(m_rExport.GetFilter().getVersion() == 
oox::core::ECMA_376_1ST_EDITION);
+
+    // tdf#83844: export FONT_CJK_ADVANCE right margin as rightChars/endChars
+    auto stValue = rRightMargin.GetRight();
+    if (stValue.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE)
     {
-        bool const bEcma1st(m_rExport.GetFilter().getVersion() == 
oox::core::ECMA_376_1ST_EDITION);
-        AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? XML_right : 
XML_end)),
-                      OString::number(rRightMargin.ResolveRight({})));
+        AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? 
XML_rightChars : XML_endChars)),
+                      OString::number(stValue.m_dValue * 100.0));
+        return;
     }
+
+    AddToAttrList(m_pLRSpaceAttrList, FSNS(XML_w, (bEcma1st ? XML_right : 
XML_end)),
+                  OString::number(rRightMargin.ResolveRight({})));
 }
 
 void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 0f18ea26285f..3b3efccfbbe3 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4370,6 +4370,20 @@ void 
WW8AttributeOutput::FormatTextLeftMargin(SvxTextLeftMarginItem const& rText
     auto stOffset = rTextLeftMargin.GetTextLeft();
     if (stOffset.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE)
     {
+        // tdf#80596: DOC stores sprmPDxaLeft and sprmPDxcLeft differently with
+        // hanging indentation. The left margin must be adjusted before 
exporting.
+        const SfxItemSet* pSet = GetExport().m_pISet;
+        if (pSet && pSet->HasItem(RES_MARGIN_FIRSTLINE))
+        {
+            const SvxFirstLineIndentItem* pItem = 
pSet->GetItem(RES_MARGIN_FIRSTLINE);
+            auto stFirstLine = pItem->GetTextFirstLineOffset();
+            if (stFirstLine.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE
+                && stFirstLine.m_dValue < 0.0)
+            {
+                stOffset.m_dValue += stFirstLine.m_dValue;
+            }
+        }
+
         // sprmPDxcLeft
         m_rWW8Export.InsUInt16(0x4456);
         m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(stOffset.m_dValue * 
100.0));
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 55d58b5165c1..14ead390b50b 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4307,6 +4307,20 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const 
sal_uInt8* pData, short nLe
             ? static_cast<SvxRightMarginItem*>(pItem->Clone())
             : new SvxRightMarginItem(RES_MARGIN_RIGHT));
 
+    // tdf#80596: DOC stores sprmPDxaLeft and sprmPDxcLeft differently with 
hanging
+    // indentation. The left margin must be adjusted before applying changes.
+    if (pFirstLine->GetTextFirstLineOffset().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+        && pLeftMargin->GetTextLeft().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE)
+    {
+        auto dFirstIndent = pFirstLine->GetTextFirstLineOffset().m_dValue;
+        if (dFirstIndent < 0.0)
+        {
+            auto stLeft = pLeftMargin->GetTextLeft();
+            stLeft.m_dValue += dFirstIndent;
+            pLeftMargin->SetTextLeft(stLeft);
+        }
+    }
+
     // Fix the regression issue: #i99822#: Discussion?
     // Since the list level formatting doesn't apply into paragraph style
     // for list levels of mode LABEL_ALIGNMENT.(see ww8par3.cxx
@@ -4466,6 +4480,44 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const 
sal_uInt8* pData, short nLe
             return;
     }
 
+    // tdf#80596: DOC ignores non-Ch indentation if any Ch indentation is set
+    if (pFirstLine->GetTextFirstLineOffset().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+        || pLeftMargin->GetTextLeft().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+        || pRightMargin->GetRight().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE)
+    {
+        SvxIndentValue stCjkZero{ 0.0, 
css::util::MeasureUnit::FONT_CJK_ADVANCE };
+
+        if (pFirstLine->GetTextFirstLineOffset().m_nUnit
+            != css::util::MeasureUnit::FONT_CJK_ADVANCE)
+        {
+            pFirstLine->SetTextFirstLineOffset(stCjkZero);
+        }
+
+        if (pLeftMargin->GetTextLeft().m_nUnit != 
css::util::MeasureUnit::FONT_CJK_ADVANCE)
+        {
+            pLeftMargin->SetTextLeft(stCjkZero);
+        }
+
+        if (pRightMargin->GetRight().m_nUnit != 
css::util::MeasureUnit::FONT_CJK_ADVANCE)
+        {
+            pRightMargin->SetRight(stCjkZero);
+        }
+    }
+
+    // tdf#80596: DOC stores sprmPDxaLeft and sprmPDxcLeft differently with 
hanging
+    // indentation. The left margin must be adjusted after applying changes.
+    if (pFirstLine->GetTextFirstLineOffset().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+        && pLeftMargin->GetTextLeft().m_nUnit == 
css::util::MeasureUnit::FONT_CJK_ADVANCE)
+    {
+        auto dFirstIndent = pFirstLine->GetTextFirstLineOffset().m_dValue;
+        if (dFirstIndent < 0.0)
+        {
+            auto stLeft = pLeftMargin->GetTextLeft();
+            stLeft.m_dValue -= dFirstIndent;
+            pLeftMargin->SetTextLeft(stLeft);
+        }
+    }
+
     NewAttr(*pFirstLine, bFirstLineOfstSet, false); // #i103711#, #i105414#
     NewAttr(*pLeftMargin, false, bLeftIndentSet);
     NewAttr(*pRightMargin, false, false);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 2695f871b2fb..00534057456b 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -555,6 +555,16 @@ void DomainMapper::lcl_attribute(Id nName, const Value & 
val)
                                                  uno::Any(nParaLeftMargin));
             }
             break;
+        case NS_ooxml::LN_CT_Ind_startChars:
+        case NS_ooxml::LN_CT_Ind_leftChars:
+            if (m_pImpl->GetTopContext())
+            {
+                css::beans::Pair<double, sal_Int16> stVal{
+                    static_cast<double>(nIntValue) / 100.0, 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+                };
+                m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN_UNIT, 
uno::Any(stVal));
+            }
+            break;
         case NS_ooxml::LN_CT_Ind_end:
         case NS_ooxml::LN_CT_Ind_right:
             if (m_pImpl->GetTopContext())
@@ -574,6 +584,18 @@ void DomainMapper::lcl_attribute(Id nName, const Value & 
val)
             }
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
u"right"_ustr, OUString::number(nIntValue));
             break;
+        case NS_ooxml::LN_CT_Ind_endChars:
+        case NS_ooxml::LN_CT_Ind_rightChars:
+            if (m_pImpl->GetTopContext())
+            {
+                css::beans::Pair<double, sal_Int16> stVal{
+                    static_cast<double>(nIntValue) / 100.0, 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+                };
+                m_pImpl->GetTopContext()->Insert(PROP_PARA_RIGHT_MARGIN_UNIT, 
uno::Any(stVal));
+            }
+            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
u"rightChars"_ustr,
+                                   OUString::number(nIntValue));
+            break;
         case NS_ooxml::LN_CT_Ind_hanging:
             if (m_pImpl->GetTopContext())
             {
@@ -587,6 +609,17 @@ void DomainMapper::lcl_attribute(Id nName, const Value & 
val)
                     m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, 
uno::Any(nParaLeftMargin), /*bOverwrite=*/false);
             }
             break;
+        case NS_ooxml::LN_CT_Ind_hangingChars:
+            if (m_pImpl->GetTopContext())
+            {
+                css::beans::Pair<double, sal_Int16> stVal{
+                    static_cast<double>(nIntValue) / -100.0,
+                    css::util::MeasureUnit::FONT_CJK_ADVANCE
+                };
+
+                
m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT_UNIT, 
uno::Any(stVal));
+            }
+            break;
         case NS_ooxml::LN_CT_Ind_firstLine:
             if (m_pImpl->GetTopContext())
             {
@@ -601,8 +634,14 @@ void DomainMapper::lcl_attribute(Id nName, const Value & 
val)
                                                  
uno::Any(nParaFirstLineIndent));
             }
             break;
-        case NS_ooxml::LN_CT_Ind_rightChars:
-            m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
u"rightChars"_ustr, OUString::number(nIntValue));
+        case NS_ooxml::LN_CT_Ind_firstLineChars:
+            if (m_pImpl->GetTopContext())
+            {
+                css::beans::Pair<double, sal_Int16> stVal{
+                    static_cast<double>(nIntValue) / 100.0, 
css::util::MeasureUnit::FONT_CJK_ADVANCE
+                };
+                
m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT_UNIT, 
uno::Any(stVal));
+            }
             break;
 
         case NS_ooxml::LN_CT_EastAsianLayout_id:
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 8578d3b1ea3e..cb75797d104e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -3047,10 +3047,60 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
                 // Left, Right, and Hanging settings are also grouped. Ensure 
that all or none are set.
                 if (xParaProps)
                 {
+                    // tdf#83844: DOCX ignores non-Ch indentation if any Ch 
indentation is set
+                    bool bLeftChSet = 
pParaContext->isSet(PROP_PARA_LEFT_MARGIN_UNIT);
+                    bool bRightChSet = 
pParaContext->isSet(PROP_PARA_RIGHT_MARGIN_UNIT);
+                    bool bFirstChSet = 
pParaContext->isSet(PROP_PARA_FIRST_LINE_INDENT_UNIT);
+                    bool bAnyChSet = bLeftChSet || bRightChSet || bFirstChSet;
+                    if (bAnyChSet)
+                    {
+                        // Remove all non-Ch indentation from properties
+                        css::beans::Pair<double, sal_Int16> stZero{
+                            0.0, css::util::MeasureUnit::FONT_CJK_ADVANCE
+                        };
+
+                        auto stLeftCh = stZero;
+                        auto stRightCh = stZero;
+                        auto stFirstCh = stZero;
+
+                        if (bLeftChSet)
+                        {
+                            
pParaContext->getProperty(PROP_PARA_LEFT_MARGIN_UNIT)->second
+                                >>= stLeftCh;
+                        }
+
+                        if (bRightChSet)
+                        {
+                            
pParaContext->getProperty(PROP_PARA_RIGHT_MARGIN_UNIT)->second
+                                >>= stRightCh;
+                        }
+
+                        if (bFirstChSet)
+                        {
+                            
pParaContext->getProperty(PROP_PARA_FIRST_LINE_INDENT_UNIT)->second
+                                >>= stFirstCh;
+                        }
+
+                        // tdf#83844: DOCX stores left and leftChars 
differently with hanging
+                        // indentation. Character-based hanging indentation 
must be pre-added
+                        // to the left margin here.
+                        if (stFirstCh.First < 0.0)
+                        {
+                            stLeftCh.First -= stFirstCh.First;
+                        }
+
+                        
xParaProps->setPropertyValue(u"ParaLeftMarginUnit"_ustr,
+                                                     uno::Any{ stLeftCh });
+                        
xParaProps->setPropertyValue(u"ParaRightMarginUnit"_ustr,
+                                                     uno::Any{ stRightCh });
+                        
xParaProps->setPropertyValue(u"ParaFirstLineIndentUnit"_ustr,
+                                                     uno::Any{ stFirstCh });
+                    }
+
                     const bool bLeftSet  = 
pParaContext->isSet(PROP_PARA_LEFT_MARGIN);
                     const bool bRightSet = 
pParaContext->isSet(PROP_PARA_RIGHT_MARGIN);
                     const bool bFirstSet = 
pParaContext->isSet(PROP_PARA_FIRST_LINE_INDENT);
-                    if (bLeftSet != bRightSet || bRightSet != bFirstSet)
+                    if (!bAnyChSet && (bLeftSet != bRightSet || bRightSet != 
bFirstSet))
                     {
                         if ( !bLeftSet )
                         {
diff --git a/sw/source/writerfilter/dmapper/PropertyIds.cxx 
b/sw/source/writerfilter/dmapper/PropertyIds.cxx
index 9854cf7b0584..1049295a4aec 100644
--- a/sw/source/writerfilter/dmapper/PropertyIds.cxx
+++ b/sw/source/writerfilter/dmapper/PropertyIds.cxx
@@ -89,8 +89,11 @@ const OUString & getPropertyName( PropertyIds eId )
         { PROP_PARA_VERT_ALIGNMENT, u"ParaVertAlignment"_ustr},
         { PROP_PARA_LAST_LINE_ADJUST, u"ParaLastLineAdjust"_ustr},
         { PROP_PARA_RIGHT_MARGIN, u"ParaRightMargin"_ustr},
+        { PROP_PARA_RIGHT_MARGIN_UNIT, u"ParaRightMarginUnit"_ustr},
         { PROP_PARA_LEFT_MARGIN, u"ParaLeftMargin"_ustr},
+        { PROP_PARA_LEFT_MARGIN_UNIT, u"ParaLeftMarginUnit"_ustr},
         { PROP_PARA_FIRST_LINE_INDENT, u"ParaFirstLineIndent"_ustr},
+        { PROP_PARA_FIRST_LINE_INDENT_UNIT, u"ParaFirstLineIndentUnit"_ustr},
         { PROP_PARA_KEEP_TOGETHER, u"ParaKeepTogether"_ustr},
         { PROP_PARA_TOP_MARGIN, u"ParaTopMargin"_ustr},
         { PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, 
u"ParaTopMarginBeforeAutoSpacing"_ustr},
diff --git a/sw/source/writerfilter/dmapper/PropertyIds.hxx 
b/sw/source/writerfilter/dmapper/PropertyIds.hxx
index 6bf8f749a962..f9d5cb52806f 100644
--- a/sw/source/writerfilter/dmapper/PropertyIds.hxx
+++ b/sw/source/writerfilter/dmapper/PropertyIds.hxx
@@ -244,6 +244,7 @@ enum PropertyIds
         ,PROP_PARA_ADJUST
         ,PROP_PARA_BOTTOM_MARGIN
         ,PROP_PARA_FIRST_LINE_INDENT
+        ,PROP_PARA_FIRST_LINE_INDENT_UNIT
         ,PROP_PARA_IS_HANGING_PUNCTUATION
         ,PROP_PARA_IS_HYPHENATION
         ,PROP_PARA_HYPHENATION_NO_CAPS
@@ -254,11 +255,13 @@ enum PropertyIds
         ,PROP_PARA_KEEP_TOGETHER
         ,PROP_PARA_LAST_LINE_ADJUST
         ,PROP_PARA_LEFT_MARGIN
+        ,PROP_PARA_LEFT_MARGIN_UNIT
         ,PROP_PARA_LINE_NUMBER_COUNT
         ,PROP_PARA_LINE_NUMBER_START_VALUE
         ,PROP_PARA_LINE_SPACING
         ,PROP_PARA_ORPHANS
         ,PROP_PARA_RIGHT_MARGIN
+        ,PROP_PARA_RIGHT_MARGIN_UNIT
         ,PROP_PARA_SPLIT
         ,PROP_PARA_STYLE_NAME
         ,PROP_PARA_TAB_STOPS

Reply via email to