diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2023-01-30 15:32:54 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2023-01-30 20:20:53 +0000 |
commit | fc5ab71bd2b4af535c2bdd2c9ea48be378b66a19 (patch) | |
tree | 1c949d109b841b2110817e2e04d6a5a6da11730f | |
parent | f4a24366dd111c7c7434f4a887d7097ced6b5f55 (diff) |
tdf#153260 VML export write trim value true in any case
LO renders Fontwork shapes always so as if trim=true is set. But the
default value for trim attribute is 'false'. Therefore always write out
'true'. Otherwise the import will treat it as 'false' and apply the
shape height reducing workaround.
Change-Id: I626c5a84627f16011198a9a4e35d8fedf1fd1b3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146361
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
-rw-r--r-- | oox/qa/unit/data/tdf153260_VML_trim_export.odt | bin | 0 -> 19650 bytes | |||
-rw-r--r-- | oox/qa/unit/vml.cxx | 23 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 6 |
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 Binary files differnew file mode 100644 index 000000000000..407a27fff254 --- /dev/null +++ b/oox/qa/unit/data/tdf153260_VML_trim_export.odt 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); } |