tdf#90338 tdf#84254 DrawingML export fix

Change-Id: I610d8099f057a2a34a1f9573d8ac16b5b8da9fc7
Reviewed-on: https://gerrit.libreoffice.org/15918
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2707852..3b9d847 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -177,6 +177,7 @@ public:

    void WritePresetShape( const char* pShape );
    void WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
    void WriteCustomGeometry( css::uno::Reference<css::drawing::XShape> rXShape );
    void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon );
    void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
    void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d202f12..55e87e9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -43,6 +43,10 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/drawing/LineJoint.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
@@ -2198,6 +2202,208 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool b
    mpFS->endElementNS(  XML_a, XML_prstGeom );
}

void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape )
{
    uno::Reference< beans::XPropertySet > aXPropSet;
    uno::Any aAny( rXShape->queryInterface(cppu::UnoType<beans::XPropertySet>::get()));

    if ( ! (aAny >>= aXPropSet) )
        return;

    try
    {
        aAny = aXPropSet->getPropertyValue( "CustomShapeGeometry" );
        if ( !aAny.hasValue() )
            return;
    }
    catch( const ::uno::Exception& )
    {
        return;
    }


    mpFS->startElementNS( XML_a, XML_custGeom, FSEND );
    mpFS->singleElementNS( XML_a, XML_avLst, FSEND );
    mpFS->singleElementNS( XML_a, XML_gdLst, FSEND );
    mpFS->singleElementNS( XML_a, XML_ahLst, FSEND );
    mpFS->singleElementNS( XML_a, XML_rect,
                           XML_l, "l",
                           XML_t, "t",
                           XML_r, "r",
                           XML_b, "b",
                           FSEND );

    mpFS->startElementNS( XML_a, XML_pathLst, FSEND );

    uno::Sequence< beans::PropertyValue > const * pGeometrySeq =
        static_cast<uno::Sequence< beans::PropertyValue > const *>(aAny.getValue());

    if ( pGeometrySeq )
    {
        for( int i = 0; i < pGeometrySeq->getLength(); ++i )
        {
            const beans::PropertyValue& rProp = (*pGeometrySeq)[ i ];
            if ( rProp.Name == "Path" )
            {
                uno::Sequence<beans::PropertyValue> aPathProp;
                rProp.Value >>= aPathProp;

                uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs;
                uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments;
                uno::Sequence<awt::Size> aPathSize;
                bool bHasSubViewSize = false;
                for (int j = 0; j < aPathProp.getLength(); ++j )
                {
                    const beans::PropertyValue& rPathProp = aPathProp[j];
                    if (rPathProp.Name == "Coordinates")
                        rPathProp.Value >>= aPairs;
                    else if (rPathProp.Name == "Segments")
                        rPathProp.Value >>= aSegments;
                    else if (rPathProp.Name == "SubViewSize")
                    {
                        rPathProp.Value >>= aPathSize;
                        bHasSubViewSize = true;
                    }
                }

                if ( bHasSubViewSize )
                {
                    mpFS->startElementNS( XML_a, XML_path,
                          XML_w, I64S( aPathSize[0].Width ),
                          XML_h, I64S( aPathSize[0].Height ),
                          FSEND );
                }
                else
                {
                    sal_Int32 nXMin = aPairs[0].First.Value.get<sal_Int32>();
                    sal_Int32 nXMax = nXMin;
                    sal_Int32 nYMin = aPairs[0].Second.Value.get<sal_Int32>();
                    sal_Int32 nYMax = nYMin;

                    for ( int j = 0; j < aPairs.getLength(); ++j )
                    {
                        if ( aPairs[j].First.Value.get<sal_Int32>() < nXMin )
                            nXMin = aPairs[j].First.Value.get<sal_Int32>();
                        if ( aPairs[j].Second.Value.get<sal_Int32>() < nYMin )
                            nYMin = aPairs[j].Second.Value.get<sal_Int32>();
                        if ( aPairs[j].First.Value.get<sal_Int32>() > nXMax )
                            nXMax = aPairs[j].First.Value.get<sal_Int32>();
                        if ( aPairs[j].Second.Value.get<sal_Int32>() > nYMax )
                            nYMax = aPairs[j].Second.Value.get<sal_Int32>();
                    }
                    mpFS->startElementNS( XML_a, XML_path,
                          XML_w, I64S( nXMax - nXMin ),
                          XML_h, I64S( nYMax - nYMin ),
                          FSEND );
                }


                int nPairIndex = 0;
                for( int j = 0; j < aSegments.getLength(); ++j )
                {
                    if ( aSegments[ j ].Command == drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH )
                    {
                        mpFS->singleElementNS( XML_a, XML_close, FSEND );
                    }
                    for ( int k = 0; k < aSegments[j].Count; ++k )
                    {
                        switch( aSegments[ j ].Command )
                        {
                            case drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
                            {
                                mpFS->startElementNS( XML_a, XML_moveTo, FSEND );

                                mpFS->singleElementNS( XML_a, XML_pt,
                                   XML_x, I64S( aPairs[nPairIndex].First.Value.get<sal_Int32>() ),
                                   XML_y, I64S( aPairs[nPairIndex].Second.Value.get<sal_Int32>() ),
                                   FSEND );

                                mpFS->endElementNS( XML_a, XML_moveTo );
                                nPairIndex++;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::LINETO :
                            {
                                mpFS->startElementNS( XML_a, XML_lnTo, FSEND );
                                mpFS->singleElementNS( XML_a, XML_pt,
                                   XML_x, I64S( aPairs[nPairIndex].First.Value.get<sal_Int32>() ),
                                   XML_y, I64S( aPairs[nPairIndex].Second.Value.get<sal_Int32>() ),
                                   FSEND );
                                mpFS->endElementNS( XML_a, XML_lnTo );
                                nPairIndex++;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
                            {
                                mpFS->startElementNS( XML_a, XML_cubicBezTo, FSEND );
                                for( sal_uInt8 l = 0; l <= 2; ++l )
                                {
                                    mpFS->singleElementNS( XML_a, XML_pt,
                                    XML_x, I64S( aPairs[nPairIndex+l].First.Value.get<sal_Int32>() ),
                                    XML_y, I64S( aPairs[nPairIndex+l].Second.Value.get<sal_Int32>() ),
                                    FSEND );

                                }
                                mpFS->endElementNS( XML_a, XML_cubicBezTo );
                                nPairIndex += 3;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
                            case drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
                            {
                                nPairIndex += 3;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
                            case drawing::EnhancedCustomShapeSegmentCommand::ARC :
                            case drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
                            case drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
                            {
                                nPairIndex += 4;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
                            case drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
                            {
                                nPairIndex++;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
                            {
                                mpFS->startElementNS( XML_a, XML_quadBezTo, FSEND );
                                for( sal_uInt8 l = 0; l < 2; ++l )
                                {
                                    mpFS->singleElementNS( XML_a, XML_pt,
                                    XML_x, I64S( aPairs[nPairIndex+l].First.Value.get<sal_Int32>() ),
                                    XML_y, I64S( aPairs[nPairIndex+l].Second.Value.get<sal_Int32>() ),
                                    FSEND );

                                }
                                mpFS->endElementNS( XML_a, XML_quadBezTo );
                                nPairIndex += 2;
                                break;
                            }
                            case drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
                            {
                                nPairIndex += 2;
                                break;
                            }
                            default:
                                // do nothing
                                break;
                        }
                    }
                }
                mpFS->endElementNS( XML_a, XML_path );
            }
        }
    }

    mpFS->endElementNS( XML_a, XML_pathLst );

    mpFS->endElementNS( XML_a, XML_custGeom );
}

void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
{
    if( rPolyPolygon.Count() < 1 )
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index fb311b2..fedeefb 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -291,6 +291,7 @@ static bool lcl_IsOnBlacklist(OUString& rShapeType)
    static
#endif
    const std::initializer_list<OUStringLiteral> vBlacklist = {
        OUStringLiteral("ellipse"),
        OUStringLiteral("ring"),
        OUStringLiteral("can"),
        OUStringLiteral("cube"),
@@ -478,17 +479,13 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
    else if( bHasHandles )
        bCustGeom = true;

    if (bCustGeom && pShape)
    if (bHasHandles && bCustGeom && pShape)
    {
        basegfx::B2DPolyPolygon aB2DPolyPolygon = pShape->GetLineGeometry(true);
        tools::PolyPolygon aPolyPolygon;
        for( sal_uInt32 i = 0; i < aB2DPolyPolygon.count(); ++i )
        {
            basegfx::B2DPolygon aB2DPolygon = aB2DPolyPolygon.getB2DPolygon(i);
            aPolyPolygon.Insert( Polygon( aB2DPolygon ), POLYPOLY_APPEND );
        }

        WritePolyPolygon( aPolyPolygon );
        WritePolyPolygon( tools::PolyPolygon( pShape->GetLineGeometry(true) ) );
    }
    else if (bCustGeom && pShape)
    {
        WriteCustomGeometry( xShape );
    }
    else // preset geometry
    {
diff --git a/sd/qa/unit/data/tdf90338.odp b/sd/qa/unit/data/tdf90338.odp
new file mode 100644
index 0000000..55739bb
--- /dev/null
+++ b/sd/qa/unit/data/tdf90338.odp
Binary files differ
diff --git a/sd/qa/unit/data/xml/tdf90338_0.xml b/sd/qa/unit/data/xml/tdf90338_0.xml
new file mode 100644
index 0000000..7821ceb
--- /dev/null
+++ b/sd/qa/unit/data/xml/tdf90338_0.xml
@@ -0,0 +1,561 @@
<?xml version="1.0"?>
<XShapes>
 <XShape positionX="5498" positionY="2715" sizeX="11630" sizeY="8623" type="com.sun.star.drawing.CustomShape" name="CustomShape 1" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="e7e6e6" fillTransparence="0" fillTransparenceGradientName="">
  <FillTransparenceGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
  <FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
  <FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
  <FillBitmap width="32" height="32"/>
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart/>
  <LineEnd/>
  <Transformation>
   <Line1 column1="11631.000000" column2="0.000000" column3="5498.000000"/>
   <Line2 column1="0.000000" column2="8624.000000" column3="2715.000000"/>
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
  <CustomShapeGeometry>
   <PropertyValue name="AdjustmentValues">
    <AdjustmentValues/>
   </PropertyValue>
   <PropertyValue name="Equations" handle="0" propertyState="DIRECT_VALUE"/>
   <PropertyValue name="Handles">
    <Handles/>
   </PropertyValue>
   <PropertyValue name="MirroredX" value="true" handle="0" propertyState="DIRECT_VALUE"/>
   <PropertyValue name="MirroredY" value="false" handle="0" propertyState="DIRECT_VALUE"/>
   <PropertyValue name="Path">
    <Path>
     <PropertyValue name="Coordinates">
      <Coordinates>
       <EnhancedCustomShapeParameterPair>
        <First value="626694" type="0"/>
        <Second value="500766" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="658274" type="0"/>
        <Second value="500766" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="526366" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="557947" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="589527" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="658274" type="0"/>
        <Second value="615128" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="626694" type="0"/>
        <Second value="615128" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="595113" type="0"/>
        <Second value="615128" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="569513" type="0"/>
        <Second value="589527" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="569513" type="0"/>
        <Second value="557947" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="569513" type="0"/>
        <Second value="526366" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="595113" type="0"/>
        <Second value="500766" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="626694" type="0"/>
        <Second value="500766" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="352919" type="0"/>
        <Second value="500765" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="384499" type="0"/>
        <Second value="500765" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="410100" type="0"/>
        <Second value="526366" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="410100" type="0"/>
        <Second value="557946" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="410100" type="0"/>
        <Second value="589527" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="384499" type="0"/>
        <Second value="615127" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="352919" type="0"/>
        <Second value="615127" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="321338" type="0"/>
        <Second value="615127" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295737" type="0"/>
        <Second value="589527" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295737" type="0"/>
        <Second value="557946" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295737" type="0"/>
        <Second value="526366" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="321338" type="0"/>
        <Second value="500765" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="352919" type="0"/>
        <Second value="500765" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="202385" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="523492" type="0"/>
        <Second value="202385" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="550800" type="0"/>
        <Second value="229692" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="550800" type="0"/>
        <Second value="263378" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="550800" type="0"/>
        <Second value="297063" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="523492" type="0"/>
        <Second value="324371" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="324371" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="456122" type="0"/>
        <Second value="324371" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="428814" type="0"/>
        <Second value="297063" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="428814" type="0"/>
        <Second value="263378" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="428814" type="0"/>
        <Second value="229692" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="456122" type="0"/>
        <Second value="202385" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="202385" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="175791" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="137652" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="106735" type="0"/>
        <Second value="246628" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="106735" type="0"/>
        <Second value="303972" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="106735" type="0"/>
        <Second value="361316" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="137652" type="0"/>
        <Second value="407802" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="175791" type="0"/>
        <Second value="407802" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="154055" type="0"/>
        <Second value="383291" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="141263" type="0"/>
        <Second value="344823" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="141263" type="0"/>
        <Second value="303972" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="141263" type="0"/>
        <Second value="263120" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="154055" type="0"/>
        <Second value="224653" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="175791" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="803821" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="825557" type="0"/>
        <Second value="224653" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="838349" type="0"/>
        <Second value="263120" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="838349" type="0"/>
        <Second value="303972" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="838349" type="0"/>
        <Second value="344823" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="825557" type="0"/>
        <Second value="383291" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="803821" type="0"/>
        <Second value="407802" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="841960" type="0"/>
        <Second value="407802" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="872877" type="0"/>
        <Second value="361316" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="872877" type="0"/>
        <Second value="303972" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="872877" type="0"/>
        <Second value="246628" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="841960" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="803821" type="0"/>
        <Second value="200142" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="97034" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="397937" type="0"/>
        <Second value="97034" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="323463" type="0"/>
        <Second value="171509" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="323463" type="0"/>
        <Second value="263378" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="323463" type="0"/>
        <Second value="355247" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="397937" type="0"/>
        <Second value="429722" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="429722" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="581676" type="0"/>
        <Second value="429722" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="656151" type="0"/>
        <Second value="355247" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="656151" type="0"/>
        <Second value="263378" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="656151" type="0"/>
        <Second value="171509" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="581676" type="0"/>
        <Second value="97034" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489807" type="0"/>
        <Second value="97034" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="139849" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="62613" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="0" type="0"/>
        <Second value="187842" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="0" type="0"/>
        <Second value="303971" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="0" type="0"/>
        <Second value="420100" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="62613" type="0"/>
        <Second value="514242" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="139849" type="0"/>
        <Second value="514242" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="80774" type="0"/>
        <Second value="482466" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="41350" type="0"/>
        <Second value="398306" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="41350" type="0"/>
        <Second value="303971" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="41350" type="0"/>
        <Second value="209636" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="80774" type="0"/>
        <Second value="125476" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="139849" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="839763" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="898838" type="0"/>
        <Second value="125476" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="938262" type="0"/>
        <Second value="209636" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="938262" type="0"/>
        <Second value="303971" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="938262" type="0"/>
        <Second value="398306" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="898838" type="0"/>
        <Second value="482466" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="839763" type="0"/>
        <Second value="514242" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="916999" type="0"/>
        <Second value="514242" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="979612" type="0"/>
        <Second value="420100" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="979612" type="0"/>
        <Second value="303971" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="979612" type="0"/>
        <Second value="187842" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="916999" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="839763" type="0"/>
        <Second value="93700" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489806" type="0"/>
        <Second value="69310" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="596987" type="0"/>
        <Second value="69310" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="156198" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="263379" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="683875" type="0"/>
        <Second value="370560" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="596987" type="0"/>
        <Second value="457447" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489806" type="0"/>
        <Second value="457447" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="382625" type="0"/>
        <Second value="457447" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295738" type="0"/>
        <Second value="370560" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295738" type="0"/>
        <Second value="263379" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="295738" type="0"/>
        <Second value="156198" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="382625" type="0"/>
        <Second value="69310" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="489806" type="0"/>
        <Second value="69310" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="735857" type="0"/>
        <Second value="0" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="243755" type="0"/>
        <Second value="0" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="243755" type="0"/>
        <Second value="658446" type="0"/>
       </EnhancedCustomShapeParameterPair>
       <EnhancedCustomShapeParameterPair>
        <First value="735857" type="0"/>
        <Second value="658446" type="0"/>
       </EnhancedCustomShapeParameterPair>
      </Coordinates>
     </PropertyValue>
     <PropertyValue name="Segments">
      <Segments>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="3" count="4"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="1" count="1"/>
       <EnhancedCustomShapeSegment command="2" count="3"/>
       <EnhancedCustomShapeSegment command="4" count="0"/>
       <EnhancedCustomShapeSegment command="5" count="0"/>
      </Segments>
     </PropertyValue>
     <PropertyValue name="SubViewSize" handle="0" propertyState="DIRECT_VALUE"/>
     <PropertyValue name="TextFrames" handle="0" propertyState="DIRECT_VALUE"/>
    </Path>
   </PropertyValue>
   <PropertyValue name="Type" value="ooxml-non-primitive" handle="0" propertyState="DIRECT_VALUE"/>
   <PropertyValue name="ViewBox">
    <ViewBox x="0" y="0" width="0" height="0"/>
   </PropertyValue>
  </CustomShapeGeometry>
 </XShape>
</XShapes>
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6b7f993..440271e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -192,6 +192,7 @@ void SdImportTest::testDocumentLayout()
        { "fdo71434.pptx", "xml/fdo71434_", PPTX, -1 },
        { "n902652.pptx", "xml/n902652_", PPTX, -1 },
        { "tdf90403.pptx", "xml/tdf90403_", PPTX, -1 },
        { "tdf90338.odp", "xml/tdf90338_", ODP, PPTX },
        // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX, PPTX }, // Example
    };