summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2020-06-09 13:38:35 +0200
committerLászló Németh <nemeth@numbertext.org>2020-06-19 14:01:30 +0200
commita2113f5f46921c38a0c4929bb564183009a838e9 (patch)
treef2a77d2e1b98af3e975b4bf41af74442c1d8d163 /sw
parent833dd75c6956f5a0d395468575aa416a6853a1f9 (diff)
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@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf133701.docxbin0 -> 12392 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx10
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx9
3 files changed, 18 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf133701.docx
Binary files 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() );