sw/qa/extras/ooxmlexport/ooxmlexport5.cxx    |    2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit e07d5c089ab2e8fe8a5cfa2a11cef3f1cf3afab3
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Apr 14 12:26:40 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Apr 15 02:42:17 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/+/150430
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 84d8b45cddf0..ef1e15eafea5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1417,6 +1417,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf112287)
 
     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");
+    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, testTdf112287B)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0f34bc7b645b..d83cc1cdcc63 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -904,7 +904,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()));
@@ -920,8 +922,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())
     {

Reply via email to