diff options
author | Justin Luth <justin.luth@collabora.com> | 2023-04-14 12:26:40 -0400 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2023-04-16 09:47:13 +0200 |
commit | 1cebe3ef85b4b1f7c34263a2da38f4e1d269ae4b (patch) | |
tree | cadfad92316c705a48dfbca2d71117b5cce8446d | |
parent | 71c7c3dddb1291e262b1f8132b75e95fc6f9fa02 (diff) |
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 <jluth@mail.com>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 15 |
2 files changed, 14 insertions, 3 deletions
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()) { |