sw/qa/extras/ooxmlexport/data/tdf112287.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 1 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 29 +++++++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-)
New commits: commit 1bc004f67feb51beb00113cedd5f98a1e6e2bcdd Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Mar 11 16:00:27 2023 -0500 Commit: Justin Luth <jl...@mail.com> CommitDate: Tue Mar 14 12:03:06 2023 +0000 tdf#154129 writerfilter framePr: check whole style inheritance: X/XAlign This patch depends on HAnchor, which created vProps. XAlign is not like YAlign - which is invalid with a text anchor. XAlign is still valid with a text anchor, and so doesn't need to copy YAlign's special vAnchor default. A unit test was added just to pre-emptively assert that. There were no existing unit tests where the old and new method produced different values. Change-Id: Ib3066f3d67c01a1bca972c6a114bb726bccac5af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148714 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf112287.docx b/sw/qa/extras/ooxmlexport/data/tdf112287.docx index 3464e28985da..ca22693186e0 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf112287.docx and b/sw/qa/extras/ooxmlexport/data/tdf112287.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index adfaca7aaf0f..84d8b45cddf0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1416,6 +1416,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112287) xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml"); assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","vAnchor","margin"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","hAnchor","text"); } CPPUNIT_TEST_FIXTURE(Test, testTdf112287B) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 3fcabf1ccb37..bc1f7f8452ed 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1667,18 +1667,29 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION), *nDirection)); } - sal_Int16 nHoriOrient = sal_Int16( - rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ? - rAppendContext.pLastParagraphProperties->GetxAlign() : - pStyleProperties->props().GetxAlign() >= 0 ? pStyleProperties->props().GetxAlign() : text::HoriOrientation::NONE ); + sal_Int16 nHoriOrient = text::HoriOrientation::NONE; + for (const auto pProp : vProps) + { + if (pProp->GetxAlign() < 0) + continue; + nHoriOrient = pProp->GetxAlign(); + break; + } aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), nHoriOrient)); //set a non negative default value - aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), - rAppendContext.pLastParagraphProperties->IsxValid() ? - rAppendContext.pLastParagraphProperties->Getx() : - pStyleProperties->props().IsxValid() - ? pStyleProperties->props().Getx() : DEFAULT_VALUE)); + bool bValidX = false; + sal_Int32 nX = DEFAULT_VALUE; + for (const auto pProp : vProps) + { + bValidX = pProp->IsxValid(); + if (!bValidX) + continue; + nX = pProp->Getx(); + break; + } + aFrameProperties.push_back( + comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), nX)); //Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11 sal_Int16 nHAnchor = text::RelOrientation::FRAME;