summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/qa/unit/data/tdf153260_VML_trim_export.odtbin0 -> 19650 bytes
-rw-r--r--oox/qa/unit/vml.cxx23
-rw-r--r--oox/source/export/vmlexport.cxx6
3 files changed, 27 insertions, 2 deletions
diff --git a/oox/qa/unit/data/tdf153260_VML_trim_export.odt b/oox/qa/unit/data/tdf153260_VML_trim_export.odt
new file mode 100644
index 000000000000..407a27fff254
--- /dev/null
+++ b/oox/qa/unit/data/tdf153260_VML_trim_export.odt
Binary files differ
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index 6a8eab8098ab..be99a281af04 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -17,6 +17,7 @@
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
#include <com/sun/star/drawing/PolygonKind.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/drawing/ColorMode.hpp>
@@ -201,6 +202,28 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWatermark)
CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, eMode);
}
+CPPUNIT_TEST_FIXTURE(OoxVmlTest, testWriterFontworkTrimTrue)
+{
+ // The document contains a shape, that will be exported as VML shape to docx. Error was that the
+ // attribute trim was not written out and thus import had treated it as the default 'false' and
+ // had reduced the shape height.
+ loadFromURL(u"tdf153260_VML_trim_export.odt");
+
+ // FIXME: tdf#153183 validation error in OOXML export: Errors: 1
+ // Attribute 'ID' is not allowed to appear in element 'v:shape'.
+ skipValidation();
+ saveAndReload("Office Open XML Text");
+
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xDrawPageSupplier->getDrawPage()->getByIndex(0),
+ uno::UNO_QUERY);
+
+ // Make sure the shape height is not changed.
+ // Without the fix the test would have failed with expected 4999 actual 1732.
+ awt::Size aSize = xShape->getSize();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4999, aSize.Height, 2);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 62b102a8fa2d..ebe30bce0223 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -997,8 +997,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
if (!aStyle.isEmpty())
pAttrList->add(XML_style, aStyle);
- if (IsWaterMarkShape(m_pSdrObject->GetName()))
- pAttrList->add(XML_trim, "t");
+ // tdf#153260. LO renders all Fontwork shapes as if trim="t" is set. Default
+ // value is "f". So always write out "t", otherwise import will reduce the
+ // shape height as workaround for "f".
+ pAttrList->add(XML_trim, "t");
m_pSerializer->singleElementNS(XML_v, XML_textpath, pAttrList);
}