writerfilter/source/dmapper/DomainMapper_Impl.cxx | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-)
New commits: commit 2ab9a2e4166264be83300e7ed038be1b803a5ac8 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Mar 11 19:04:06 2023 -0500 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Mar 15 09:43:15 2023 +0000 tdf#154129 writerfilter framePr: check whole style inheritance: v/hSpace This patch depends on HAnchor, which created vProps. A style can inherit its properties from another style, but the code was naively just checking the first paragraph style, and not any of the parents. There were no existing sw.check tests where the old and new method produced different values. Change-Id: I66ea366fae933c29587aa0fa9fff3abab6d8666b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148718 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5d9906ee97b1..786cc0f39de2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1787,22 +1787,28 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) Swapped the array elements 11,12 & 13,14 since 11 & 12 are LEFT & RIGHT margins and 13,14 are TOP and BOTTOM margins respectively. */ - sal_Int32 nRightDist; - sal_Int32 nLeftDist = nRightDist = - rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ? - rAppendContext.pLastParagraphProperties->GethSpace() : - pStyleProperties->props().GethSpace() >= 0 - ? pStyleProperties->props().GethSpace() : 0; + sal_Int32 nRightDist = 0; + sal_Int32 nLeftDist = 0; + for (const auto pProp : vProps) + { + if (pProp->GethSpace() < 0) + continue; + nLeftDist = nRightDist = pProp->GethSpace(); + break; + } aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist)); aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist)); - sal_Int32 nBottomDist; - sal_Int32 nTopDist = nBottomDist = - rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ? - rAppendContext.pLastParagraphProperties->GetvSpace() : - pStyleProperties->props().GetvSpace() >= 0 - ? pStyleProperties->props().GetvSpace() : 0; + sal_Int32 nBottomDist = 0; + sal_Int32 nTopDist = 0; + for (const auto pProp : vProps) + { + if (pProp->GetvSpace() < 0) + continue; + nTopDist = nBottomDist = pProp->GetvSpace(); + break; + } aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN), nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist)); aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN), nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));