oox/source/drawingml/customshapeproperties.cxx | 16 +++++++++++ oox/source/token/properties.txt | 1 sd/qa/unit/data/pptx/tdf156829.pptx |binary sd/qa/unit/data/xml/n762695_0.xml | 1 sd/qa/unit/data/xml/n762695_1.xml | 2 + sd/qa/unit/data/xml/tdf109317_0.xml | 3 ++ sd/qa/unit/import-tests.cxx | 30 ++++++++++++++++++++++ svx/source/customshapes/EnhancedCustomShape2d.cxx | 2 - 8 files changed, 54 insertions(+), 1 deletion(-)
New commits: commit 7058ee63c0a3baba177dd719d4b7265cfd3b5ede Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Sun Aug 27 18:39:17 2023 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Tue Feb 20 07:11:43 2024 +0100 tdf#156829 PPTX import: fix connector regression at missing glue points Glue points weren't imported if the custom shape type is "non-primitive", resulting broken line connectors, moreover broken graphic design, as attached to the original bug report. ~Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8 "tdf#89449 PPTX import: fix line connectors". Change-Id: I9908a23f8e6997bc1384aaeb3e8ba43c08d20d42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156171 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit a126f499bd4bef203f26b251d85ee30ce5dc4f91) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156222 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit d13505b8ef7459d97e9f90ee099ca54354d99922) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163609 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 9cdbb4ee8801..3483969f716d 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -228,6 +228,22 @@ void CustomShapeProperties::pushToPropSet( aPath.setProperty( PROP_TextFrames, aTextFrames); } + if (!maConnectionSiteList.empty()) + { + css::uno::Sequence<EnhancedCustomShapeParameterPair> seqGluePoints; + seqGluePoints.realloc(maConnectionSiteList.size()); + sal_Int32 nId = 0; + for (auto& rGluePoint : asNonConstRange(seqGluePoints)) + { + rGluePoint.First.Value = maConnectionSiteList[nId].pos.First.Value; + rGluePoint.First.Type = maConnectionSiteList[nId].pos.First.Type; + rGluePoint.Second.Value = maConnectionSiteList[nId].pos.Second.Value; + rGluePoint.Second.Type = maConnectionSiteList[nId].pos.Second.Type; + nId++; + } + aPath.setProperty(PROP_GluePoints, seqGluePoints); + } + sal_uInt32 nParameterPairs = 0; for ( auto const & i: maPath2DList ) nParameterPairs += i.parameter.size(); diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index a6de5458b663..b5a3478f45b0 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -224,6 +224,7 @@ GenerateVbaEvents Geometry3D GlowEffect GlowEffectRadius +GluePoints GradientName HatchName Graphic diff --git a/sd/qa/unit/data/pptx/tdf156829.pptx b/sd/qa/unit/data/pptx/tdf156829.pptx new file mode 100644 index 000000000000..423588377279 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf156829.pptx differ diff --git a/sd/qa/unit/data/xml/n762695_0.xml b/sd/qa/unit/data/xml/n762695_0.xml index ae755e644de7..59b226e0d5f8 100644 --- a/sd/qa/unit/data/xml/n762695_0.xml +++ b/sd/qa/unit/data/xml/n762695_0.xml @@ -63,6 +63,7 @@ </EnhancedCustomShapeParameterPair> </Coordinates> </PropertyValue> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Segments"> <Segments> <EnhancedCustomShapeSegment command="1" count="1"/> diff --git a/sd/qa/unit/data/xml/n762695_1.xml b/sd/qa/unit/data/xml/n762695_1.xml index a43924138f45..02d3b735da86 100644 --- a/sd/qa/unit/data/xml/n762695_1.xml +++ b/sd/qa/unit/data/xml/n762695_1.xml @@ -67,6 +67,7 @@ </EnhancedCustomShapeParameterPair> </Coordinates> </PropertyValue> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Segments"> <Segments> <EnhancedCustomShapeSegment command="1" count="1"/> @@ -151,6 +152,7 @@ </EnhancedCustomShapeParameterPair> </Coordinates> </PropertyValue> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Segments"> <Segments> <EnhancedCustomShapeSegment command="1" count="1"/> diff --git a/sd/qa/unit/data/xml/tdf109317_0.xml b/sd/qa/unit/data/xml/tdf109317_0.xml index f34beafbdc80..745ffff59e74 100644 --- a/sd/qa/unit/data/xml/tdf109317_0.xml +++ b/sd/qa/unit/data/xml/tdf109317_0.xml @@ -22,6 +22,7 @@ <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Path"> <Path> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="SubViewSize" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Coordinates"> @@ -130,6 +131,7 @@ <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Path"> <Path> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="SubViewSize" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Coordinates"> @@ -406,6 +408,7 @@ <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Path"> <Path> + <PropertyValue name="GluePoints" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="SubViewSize" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/> <PropertyValue name="Coordinates"> diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 706214950411..8b885b0ad3ab 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -85,6 +85,7 @@ public: void testDocumentLayout(); void testTdf154363(); + void testFreeformShapeGluePoints(); void testTdf153466(); void testTdf152434(); void testStandardConnectors(); @@ -165,6 +166,7 @@ public: CPPUNIT_TEST(testDocumentLayout); CPPUNIT_TEST(testTdf154363); + CPPUNIT_TEST(testFreeformShapeGluePoints); CPPUNIT_TEST(testTdf153466); CPPUNIT_TEST(testTdf152434); CPPUNIT_TEST(testStandardConnectors); @@ -362,6 +364,34 @@ void SdImportTest::testDocumentLayout() } } +void SdImportTest::testFreeformShapeGluePoints() +{ + createSdImpressDoc("pptx/tdf156829.pptx"); + uno::Reference<beans::XPropertySet> xFreeformShape(getShapeFromPage(0, 0)); + uno::Sequence<beans::PropertyValue> aProps; + xFreeformShape->getPropertyValue("CustomShapeGeometry") >>= aProps; + + uno::Sequence<beans::PropertyValue> aPathProps; + for (beans::PropertyValue const& rProp : std::as_const(aProps)) + { + if (rProp.Name == "Path") + aPathProps = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); + } + + uno::Sequence<drawing::EnhancedCustomShapeParameterPair> seqGluePoints; + for (beans::PropertyValue const& rProp : std::as_const(aPathProps)) + { + if (rProp.Name == "GluePoints") + { + seqGluePoints + = rProp.Value.get<uno::Sequence<drawing::EnhancedCustomShapeParameterPair>>(); + } + } + + sal_Int32 nCountGluePoints = seqGluePoints.getLength(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nCountGluePoints); +} + void SdImportTest::testTdf154363() { sal_Int32 nGlueId; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index bca864f05fe3..148fe9e07cfe 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -3034,7 +3034,7 @@ void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj ) { SdrGluePoint aGluePoint; - aGluePoint.SetPos( GetPoint( rGluePoint, true, true ) ); + aGluePoint.SetPos( GetPoint( rGluePoint, !bOOXMLShape, true ) ); aGluePoint.SetPercent( false ); aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT ); aGluePoint.SetEscDir( SdrEscapeDirection::SMART );