sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 ++ sw/source/filter/ww8/docxattributeoutput.cxx | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
New commits: commit 1cebe3ef85b4b1f7c34263a2da38f4e1d269ae4b Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Fri Apr 14 12:26:40 2023 -0400 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sun Apr 16 09:47:13 2023 +0200 tdf#154703 docx export framePr: export xAlign/yAlign This fixes a regression in LO 4.4 from commit 1c876f5616522ab695de8c0316cdb0c601081815. The relative positions (left,right, center, inside, outside) (top, bottom...) were simply ignored on export. Change-Id: Ie12eb75483fbc3f05c77e45d40e4a18a7ead5b1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150447 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index f33013413a1c..0e0eaf6375f3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1416,6 +1416,8 @@ 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","xAlign","center"); + assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr","yAlign","bottom"); } CPPUNIT_TEST_FIXTURE(Test, testZOrderInHeader) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5bc2f7ba597f..73d2ec0d703a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -888,7 +888,9 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor { rtl::Reference<sax_fastparser::FastAttributeList> attrList = FastSerializerHelper::createAttrList(); - awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos()); + const SwFormatHoriOrient& rHoriOrient = pFrameFormat->GetHoriOrient(); + const SwFormatVertOrient& rVertOrient = pFrameFormat->GetVertOrient(); + awt::Point aPos(rHoriOrient.GetPos(), rVertOrient.GetPos()); attrList->add( FSNS( XML_w, XML_w), OString::number(rSize.Width())); attrList->add( FSNS( XML_w, XML_h), OString::number(rSize.Height())); @@ -904,8 +906,15 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor attrList->add(FSNS(XML_w, XML_hSpace), OString::number((nLeft + nRight) / 2)); attrList->add(FSNS(XML_w, XML_vSpace), OString::number((nUpper + nLower) / 2)); - OString relativeFromH = convertToOOXMLHoriOrientRel( pFrameFormat->GetHoriOrient().GetRelationOrient() ); - OString relativeFromV = convertToOOXMLVertOrientRel( pFrameFormat->GetVertOrient().GetRelationOrient() ); + OString relativeFromH = convertToOOXMLHoriOrientRel(rHoriOrient.GetRelationOrient()); + OString relativeFromV = convertToOOXMLVertOrientRel(rVertOrient.GetRelationOrient()); + + OString aXAlign = convertToOOXMLHoriOrient(rHoriOrient.GetHoriOrient(), /*bIsPosToggle=*/false); + OString aYAlign = convertToOOXMLVertOrient(rVertOrient.GetVertOrient()); + if (!aXAlign.isEmpty()) + attrList->add(FSNS(XML_w, XML_xAlign), aXAlign); + if (!aYAlign.isEmpty()) + attrList->add(FSNS(XML_w, XML_yAlign), aYAlign); switch (pFrameFormat->GetSurround().GetValue()) {