oox/source/export/drawingml.cxx | 14 +++++++++++++- oox/source/export/shapes.cxx | 5 ++++- sw/qa/extras/ooxmlexport/data/dml-textshape.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-)
New commits: commit 106c82706edc1adc2df8d39d332fd3a3452c5d78 Author: Miklos Vajna <[email protected]> Date: Mon Jan 20 11:19:01 2014 +0100 drawingML export: write TextShape outline properties Change-Id: I3742c960016bbe1d82b58a16d464b329d2612c10 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 37faad5..e55c2f3 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -936,6 +936,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) WritePresetShape( "rect" ); uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY); WriteFill(xPropertySet); + WriteOutline(xPropertySet); WriteBlipFill(xPropertySet, "GraphicURL"); pFS->endElementNS( mnXmlNamespace, XML_spPr ); diff --git a/sw/qa/extras/ooxmlexport/data/dml-textshape.docx b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx new file mode 100644 index 0000000..e5be42c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 56d6acb..8d01930 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2469,6 +2469,22 @@ DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx") CPPUNIT_ASSERT_EQUAL(OUString("ooxml-borderCallout1"), aType); } +DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") +{ + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(1), uno::UNO_QUERY); + // This was drawing::FillStyle_NONE. + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape, "FillStyle")); + // This was drawing::LineStyle_NONE. + CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape, "LineStyle")); + + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + // This was wrap="none". + assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:bodyPr", "wrap", "square"); +} + DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.docx") { xmlDocPtr pXmlDocument = parseExport("word/document.xml"); commit 2d4f0a7d0dd3da34d054ff444e69b10ef015e260 Author: Miklos Vajna <[email protected]> Date: Mon Jan 20 11:16:24 2014 +0100 drawingML export: fix TextShape width for DOCX Change-Id: Ibaf29ed746076fa6ec0bad013cac26debdb2b165 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 6c03b22..2a7d11a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1396,8 +1396,19 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b } if (bBodyPr) + { + const char* pWrap = bHasWrap && !bWrap ? "none" : NULL; + if (GetDocumentType() == DOCUMENT_DOCX) + { + // In case of DOCX, if we want to have the same effect as + // TextShape's automatic word wrapping, then we need to set + // wrapping to square. + uno::Reference<lang::XServiceInfo> xServiceInfo(rXIface, uno::UNO_QUERY); + if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.TextShape")) + pWrap = "square"; + } mpFS->singleElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr, - XML_wrap, bHasWrap && !bWrap ? "none" : NULL, + XML_wrap, pWrap, XML_lIns, (nLeft != DEFLRINS) ? IS( MM100toEMU( nLeft ) ) : NULL, XML_rIns, (nRight != DEFLRINS) ? IS( MM100toEMU( nRight ) ) : NULL, XML_tIns, (nTop != DEFTBINS) ? IS( MM100toEMU( nTop ) ) : NULL, @@ -1406,6 +1417,7 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b XML_anchorCtr, bHorizontalCenter ? "1" : NULL, XML_vert, sWritingMode, FSEND ); + } Reference< XEnumerationAccess > access( xXText, UNO_QUERY ); if( !access.is() || !bText ) commit 243ce7d73acc070194ecf5bb9f97b8a7cbf87ecd Author: Miklos Vajna <[email protected]> Date: Mon Jan 20 10:23:29 2014 +0100 drawingML export: write TextShape fill properties Change-Id: Ibe89e86b19d7633e9a0669ff0574173ac4b633c5 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index cdbe0d6..37faad5 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -934,7 +934,9 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "rect" ); - WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), "GraphicURL" ); + uno::Reference<beans::XPropertySet> xPropertySet(xShape, UNO_QUERY); + WriteFill(xPropertySet); + WriteBlipFill(xPropertySet, "GraphicURL"); pFS->endElementNS( mnXmlNamespace, XML_spPr ); WriteTextBox( xShape, mnXmlNamespace ); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
