diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-10-30 22:53:55 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-02 11:57:35 +0100 |
commit | f0a86f50516c1f887b054fe0d042bf9be8c83975 (patch) | |
tree | 25d118a5f05d5c764e73c62705026ab3a51e7b02 | |
parent | 66806942e246b5aa72677807e1a290e4bbf6bcea (diff) |
tdf#113187 exclude angle conversion from count of maGuideList
The ooxml import uses the special viewBox value '0 0 0 0' to indicate
that the point coordinates are relative to shape size and not to
viewBox and need special treatment. To detect this case the number of
guides in maGuideList was used. But that number might be larger than
the guides in ooxml because each arcTo command introduces two
additional guides for the conversion from 1/60000 degree in ooxml to
degree in LibreOffice.
The patch excludes these guides from count. Thus now a path which has
no references in its points will get a viewBox with non-zero width
and height in all cases and is rendered now.
Change-Id: I410638a1fe02f692fd46313c88b5ea518f1d094f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142050
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142109
-rw-r--r-- | oox/inc/drawingml/customshapeproperties.hxx | 1 | ||||
-rw-r--r-- | oox/qa/unit/data/tdf113187_arcTo_withoutReferences.pptx | bin | 0 -> 14733 bytes | |||
-rw-r--r-- | oox/qa/unit/drawingml.cxx | 20 | ||||
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 4 |
4 files changed, 24 insertions, 1 deletions
diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx index ea9b9e9d53af..10251de2474f 100644 --- a/oox/inc/drawingml/customshapeproperties.hxx +++ b/oox/inc/drawingml/customshapeproperties.hxx @@ -122,6 +122,7 @@ public: static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, std::u16string_view rFormulaName ); sal_Int32 getArcNum() { return mnArcNum++; } + sal_Int32 countArcTo() { return mnArcNum; } /** Returns whether or not the current CustomShapeProperties diff --git a/oox/qa/unit/data/tdf113187_arcTo_withoutReferences.pptx b/oox/qa/unit/data/tdf113187_arcTo_withoutReferences.pptx Binary files differnew file mode 100644 index 000000000000..1862c0257f29 --- /dev/null +++ b/oox/qa/unit/data/tdf113187_arcTo_withoutReferences.pptx diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 4dc066f98039..dedea55b9723 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -541,6 +541,26 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testThemeTint) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(-1), nFillColorTheme); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTdf113187ConstantArcTo) +{ + OUString aURL + = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf113187_arcTo_withoutReferences.pptx"; + load(aURL); + // Get ViewBox of shape + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aGeoPropSeq; + xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeoPropSeq; + comphelper::SequenceAsHashMap aGeoPropMap(aGeoPropSeq); + // Without the fix width and height of the ViewBox were 0 and thus the shape was not shown. + auto aViewBox = aGeoPropMap["ViewBox"].get<css::awt::Rectangle>(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3600000), aViewBox.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3600000), aViewBox.Height); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 59d8a8775fb6..f56b8bfb17c3 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -194,7 +194,9 @@ void CustomShapeProperties::pushToPropSet( // This size specifically affects scaling. // Note 2: Width and Height are set to 0 to force scaling to 1. awt::Rectangle aViewBox( 0, 0, aSize.Width, aSize.Height ); - if( !maGuideList.empty() ) + // tdf#113187 Each ArcTo introduces two additional equations for converting start and swing + // angles. They do not count for test for use of standard ooxml coordinates + if (maGuideList.size() - 2 * countArcTo() > 0) aViewBox = awt::Rectangle( 0, 0, 0, 0 ); aPropertyMap.setProperty( PROP_ViewBox, aViewBox); |