summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-03-11 19:04:06 -0500
committerJustin Luth <jluth@mail.com>2023-03-15 09:43:15 +0000
commit2ab9a2e4166264be83300e7ed038be1b803a5ac8 (patch)
treea09af4d70397a58a1608eed8a235f1de55738e82 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parent5f661a23346858c6162356d92a9f026f288ce31d (diff)
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 <jluth@mail.com> Tested-by: Jenkins
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx30
1 files changed, 18 insertions, 12 deletions
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));