sw/qa/extras/ww8export/data/tdf83844.fodt | 115 ++++++++++++++++++++++++++++++ sw/qa/extras/ww8export/ww8export4.cxx | 23 ++++++ sw/source/filter/ww8/ww8atr.cxx | 96 +++++++++++++++++++------ sw/source/filter/ww8/ww8par6.cxx | 55 ++++++++++++-- 4 files changed, 260 insertions(+), 29 deletions(-)
New commits: commit 2a7660251c9b584e9b58340d08ade3da96cb2f2c Author: Jonathan Clark <jonat...@libreoffice.org> AuthorDate: Wed Mar 12 03:04:15 2025 -0600 Commit: Jonathan Clark <jonat...@libreoffice.org> CommitDate: Thu Mar 13 05:00:36 2025 +0100 tdf#80596 DOC import: implement Ch-based LR indentation Adds support for the sprmPDxcLeft, sprmPDxcLeft1, and sprmPDxcRight attributes, which are used for character-based indentation in CJK documents. Change-Id: I374f3a85b7163799ca78a4c5bb856da3adb0a945 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182850 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonat...@libreoffice.org> diff --git a/sw/qa/extras/ww8export/data/tdf83844.fodt b/sw/qa/extras/ww8export/data/tdf83844.fodt new file mode 100644 index 000000000000..049020dc3625 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf83844.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 29338986e6d0..b214616f0cc2 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -634,6 +634,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf54862) verify(); } +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(); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d55873fbf242..0f18ea26285f 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4350,28 +4350,51 @@ void WW8AttributeOutput::FormatPaperBin( const SvxPaperBinItem& rPaperBin ) void WW8AttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& rFirstLine) { - // tdf#80596: TODO export sprmPDxcLeft1 for first line indents in ICs - // sprmPDxaLeft1 - m_rWW8Export.InsUInt16( 0x8460 ); //asian version ? - m_rWW8Export.InsUInt16(rFirstLine.ResolveTextFirstLineOffset({})); + auto stOffset = rFirstLine.GetTextFirstLineOffset(); + if (stOffset.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcLeft1 + m_rWW8Export.InsUInt16(0x4457); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(stOffset.m_dValue * 100.0)); + } + else + { + // sprmPDxaLeft1 + m_rWW8Export.InsUInt16(0x8460); + m_rWW8Export.InsUInt16(rFirstLine.ResolveTextFirstLineOffset({})); + } } void WW8AttributeOutput::FormatTextLeftMargin(SvxTextLeftMarginItem const& rTextLeftMargin) -{ // normal paragraphs - // sprmPDxaLeft - m_rWW8Export.InsUInt16( 0x845E ); //asian version ? - m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rTextLeftMargin.ResolveTextLeft({}))); +{ + auto stOffset = rTextLeftMargin.GetTextLeft(); + if (stOffset.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcLeft + m_rWW8Export.InsUInt16(0x4456); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(stOffset.m_dValue * 100.0)); + } + else + { + // sprmPDxaLeft + m_rWW8Export.InsUInt16(0x845E); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rTextLeftMargin.ResolveTextLeft({}))); + } } void WW8AttributeOutput::FormatRightMargin(SvxRightMarginItem const& rRightMargin) { - // (paragraph case, this will be an else branch once others are converted) -#if 0 + auto stOffset = rRightMargin.GetRight(); + if (stOffset.m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcRight + m_rWW8Export.InsUInt16(0x4455); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(stOffset.m_dValue * 100.0)); + } else -#endif - { // normal paragraphs + { // sprmPDxaRight - m_rWW8Export.InsUInt16( 0x845D ); //asian version ? + m_rWW8Export.InsUInt16(0x845D); m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rRightMargin.ResolveRight({}))); } } @@ -4420,18 +4443,45 @@ void WW8AttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLR ) } else { // normal paragraphs - // sprmPDxaLeft - m_rWW8Export.InsUInt16( 0x845E ); //asian version ? - m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.ResolveTextLeft({}))); + if (rLR.GetTextLeft().m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcLeft + m_rWW8Export.InsUInt16(0x4456); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.GetTextLeft().m_dValue * 100.0)); + } + else + { + // sprmPDxaLeft + m_rWW8Export.InsUInt16(0x845E); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.ResolveTextLeft({}))); + } - // sprmPDxaRight - m_rWW8Export.InsUInt16( 0x845D ); //asian version ? - m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.ResolveRight({}))); + if (rLR.GetRight().m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcRight + m_rWW8Export.InsUInt16(0x4455); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.GetRight().m_dValue * 100.0)); + } + else + { + // sprmPDxaRight + m_rWW8Export.InsUInt16(0x845D); + m_rWW8Export.InsUInt16(o3tl::narrowing<sal_uInt16>(rLR.ResolveRight({}))); + } - // sprmPDxaLeft1 - // tdf#80596: TODO export sprmPDxcLeft1 for first line indents in ICs - m_rWW8Export.InsUInt16( 0x8460 ); //asian version ? - m_rWW8Export.InsUInt16(rLR.ResolveTextFirstLineOffset({})); + if (rLR.GetTextFirstLineOffset().m_nUnit == css::util::MeasureUnit::FONT_CJK_ADVANCE) + { + // sprmPDxcLeft1 + m_rWW8Export.InsUInt16(0x4457); + m_rWW8Export.InsUInt16( + o3tl::narrowing<sal_uInt16>(rLR.GetTextFirstLineOffset().m_dValue * 100.0)); + } + else + { + // sprmPDxaLeft1 + m_rWW8Export.InsUInt16(0x8460); + m_rWW8Export.InsUInt16(rLR.ResolveTextFirstLineOffset({})); + } } } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5a7586eae3b3..55d58b5165c1 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4279,6 +4279,21 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe short nPara = SVBT16ToUInt16( pData ); + auto stIndentValue = SvxIndentValue::zero(); + switch (nId) + { + case NS_sprm::PDxcRight::val: + case NS_sprm::PDxcLeft::val: + case NS_sprm::PDxcLeft1::val: + stIndentValue = SvxIndentValue{ static_cast<double>(nPara) / 100.0, + css::util::MeasureUnit::FONT_CJK_ADVANCE }; + break; + + default: + stIndentValue = SvxIndentValue::twips(nPara); + break; + } + SfxPoolItem const* pItem(GetFormatAttr(RES_MARGIN_FIRSTLINE)); ::std::unique_ptr<SvxFirstLineIndentItem> pFirstLine(pItem ? static_cast<SvxFirstLineIndentItem*>(pItem->Clone()) @@ -4348,13 +4363,27 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe bool bFirstLineOfstSet(false); // #i103711# bool bLeftIndentSet( false ); // #i105414# + // tdf#80596: PDxc* always overrides PDxa* + auto fnSelectPDxcOverride = [](SvxIndentValue stPrev, SvxIndentValue stNew) + { + if (stPrev.m_nUnit == css::util::MeasureUnit::TWIP + || stNew.m_nUnit != css::util::MeasureUnit::TWIP) + { + return stNew; + } + + return stPrev; + }; + switch (nId) { //sprmPDxaLeft case NS_sprm::v6::sprmPDxaLeft: case NS_sprm::PDxaLeft80::val: case NS_sprm::PDxaLeft::val: - pLeftMargin->SetTextLeft(SvxIndentValue::twips(nPara)); + case NS_sprm::PDxcLeft::val: + pLeftMargin->SetTextLeft( + fnSelectPDxcOverride(pLeftMargin->GetTextLeft(), stIndentValue)); if (m_pCurrentColl && m_nCurrentColl < m_vColl.size()) { m_vColl[m_nCurrentColl].m_bListRelevantIndentSet = true; @@ -4365,6 +4394,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe case NS_sprm::v6::sprmPDxaLeft1: case NS_sprm::PDxaLeft180::val: case NS_sprm::PDxaLeft1::val: + case NS_sprm::PDxcLeft1::val: /* As part of an attempt to break my spirit ww 8+ formats can contain ww 7- lists. If they do and the list is part of the style, then @@ -4383,13 +4413,22 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe { const SvxFirstLineIndentItem & rFirstLine = m_vColl[m_nCurrentColl].m_pFormat->GetFormatAttr(RES_MARGIN_FIRSTLINE); - // tdf#80596: TODO handle sprmPDxcLeft1 - nPara = nPara - rFirstLine.ResolveTextFirstLineOffset({}); + auto stValue = rFirstLine.GetTextFirstLineOffset(); + + if (stValue.m_nUnit == stIndentValue.m_nUnit) + { + stIndentValue.m_dValue -= stValue.m_dValue; + } + else + { + stIndentValue = SvxIndentValue::twips( + nPara - rFirstLine.ResolveTextFirstLineOffset({})); + } } } - // tdf#80596: TODO handle sprmPDxcLeft1 - pFirstLine->SetTextFirstLineOffset(SvxIndentValue::twips(nPara)); + pFirstLine->SetTextFirstLineOffset( + fnSelectPDxcOverride(pFirstLine->GetTextFirstLineOffset(), stIndentValue)); if (!m_pCurrentColl) { @@ -4420,7 +4459,8 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe case NS_sprm::v6::sprmPDxaRight: case NS_sprm::PDxaRight80::val: case NS_sprm::PDxaRight::val: - pRightMargin->SetRight(SvxIndentValue::twips(nPara)); + case NS_sprm::PDxcRight::val: + pRightMargin->SetRight(fnSelectPDxcOverride(pRightMargin->GetRight(), stIndentValue)); break; default: return; @@ -6194,6 +6234,9 @@ static const wwSprmDispatcher *GetWW8SprmDispatcher() {NS_sprm::PDxaLeft::val, &SwWW8ImplReader::Read_LR}, {NS_sprm::PDxaLeft1::val, &SwWW8ImplReader::Read_LR}, {NS_sprm::PDxaRight::val, &SwWW8ImplReader::Read_LR}, + {NS_sprm::PDxcLeft::val, &SwWW8ImplReader::Read_LR}, + {NS_sprm::PDxcLeft1::val, &SwWW8ImplReader::Read_LR}, + {NS_sprm::PDxcRight::val, &SwWW8ImplReader::Read_LR}, {NS_sprm::TFAutofit::val, nullptr}, {NS_sprm::TPc::val, nullptr}, {NS_sprm::TDxaAbs::val, nullptr},