[Libreoffice-commits] core.git: sw/qa sw/source

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 12:02:13 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf133701.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx    |   10 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    9 ++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit a2113f5f46921c38a0c4929bb564183009a838e9
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Tue Jun 9 13:38:35 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jun 19 14:01:30 2020 +0200

    tdf#133701 DOXC export: fix frame distance from text
    
    Vertical and horizontal minimum distances of frame
    and the text wrapping around the frame were not exported.
    
    Note: different left/right, top/bottom values aren't
    supported by OOXML hSpace, vSpace, so calculate
    average values to keep the page layout.
    
    Co-authored-by: Attila Bakos (NISZ)
    
    Change-Id: Ieef999003bcc6b9bba0a932ee4dd2b5461380c17
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96110
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf133701.docx b/sw/qa/extras/ooxmlexport/data/tdf133701.docx
new file mode 100644
index 000000000000..dfef409c268c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133701.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 877594f9f2f2..df0ee671c9c1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -42,6 +42,16 @@ protected:
     }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133701, "tdf133701.docx")
+{
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "hSpace", "567");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr", "vSpace", "284");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx")
 {
     CPPUNIT_ASSERT_EQUAL(OUString("Title"), getProperty<OUString>(getShape(1), "Title"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d8479c410a37..0ebda68eed20 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -559,7 +559,6 @@ static void lcl_deleteAndResetTheLists( rtl::Reference<sax_fastparser::FastAttri
 
 void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFormat, const Size& rSize)
 {
-
     sax_fastparser::FastAttributeList* attrList = FastSerializerHelper::createAttrList();
 
     awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(), pFrameFormat->GetVertOrient().GetPos());
@@ -570,6 +569,14 @@ void DocxAttributeOutput::PopulateFrameProperties(const SwFrameFormat* pFrameFor
     attrList->add( FSNS( XML_w, XML_x), OString::number(aPos.X));
     attrList->add( FSNS( XML_w, XML_y), OString::number(aPos.Y));
 
+    sal_Int16 nLeft = pFrameFormat->GetLRSpace().GetLeft();
+    sal_Int16 nRight = pFrameFormat->GetLRSpace().GetRight();
+    sal_Int16 nUpper = pFrameFormat->GetULSpace().GetUpper();
+    sal_Int16 nLower = pFrameFormat->GetULSpace().GetLower();
+
+    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() );
 


More information about the Libreoffice-commits mailing list