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 | 28 ++++++++++++++++++++++ svx/source/customshapes/EnhancedCustomShape2d.cxx | 2 - 8 files changed, 52 insertions(+), 1 deletion(-)
New commits: commit 7b93531ba7f3edf98a54392cfc83dcf3185888bd Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Sun Aug 27 18:39:17 2023 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed Aug 30 11:57:11 2023 +0200 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> diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index ac6fba8e7d53..766876385c64 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 2345e17ee7a4..adc7c12e4632 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -203,6 +203,34 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testDocumentLayout) } } +CPPUNIT_TEST_FIXTURE(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); +} + CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf154363) { sal_Int32 nGlueId; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 5666d8e5885d..6bbd898ad24a 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, !m_bOOXMLShape, true ) ); aGluePoint.SetPercent( false ); aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT ); aGluePoint.SetEscDir( SdrEscapeDirection::SMART );