diff options
Diffstat (limited to 'oox/source/drawingml/shape.cxx')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 59b3f35dc8cc..1a32d6a206a0 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -26,6 +26,7 @@ ************************************************************************/ #include "oox/drawingml/shape.hxx" +#include "oox/drawingml/customshapeproperties.hxx" #include "oox/drawingml/theme.hxx" #include "oox/drawingml/fillproperties.hxx" #include "oox/drawingml/lineproperties.hxx" @@ -218,8 +219,8 @@ void Shape::addChildren( aIter = rMaster.maChildren.begin(); while( aIter != rMaster.maChildren.end() ) { - Rectangle aShapeRect; - Rectangle* pShapeRect = 0; + awt::Rectangle aShapeRect; + awt::Rectangle* pShapeRect = 0; if ( ( nGlobalLeft != SAL_MAX_INT32 ) && ( nGlobalRight != SAL_MIN_INT32 ) && ( nGlobalTop != SAL_MAX_INT32 ) && ( nGlobalBottom != SAL_MIN_INT32 ) ) { sal_Int32 nGlobalWidth = nGlobalRight - nGlobalLeft; @@ -298,6 +299,35 @@ Reference< XShape > Shape::createAndInsert( aTransformation.translate( aPosition.X / 360.0, aPosition.Y / 360.0 ); } + if ( mpCustomShapePropertiesPtr && mpCustomShapePropertiesPtr->getPolygon().count() ) + { + ::basegfx::B2DPolyPolygon& rPolyPoly = mpCustomShapePropertiesPtr->getPolygon(); + + if( rPolyPoly.count() > 0 ) { + if( rPolyPoly.areControlPointsUsed() ) { + // TODO Beziers + } else { + uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( rPolyPoly.count() ); + + for (sal_uInt32 j = 0; j < rPolyPoly.count(); j++ ) { + ::basegfx::B2DPolygon aPoly = rPolyPoly.getB2DPolygon( j ); + + // now creating the corresponding PolyPolygon + sal_Int32 i, nNumPoints = aPoly.count(); + uno::Sequence< awt::Point > aPointSequence( nNumPoints ); + awt::Point* pPoints = aPointSequence.getArray(); + for( i = 0; i < nNumPoints; ++i ) + { + const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); + pPoints[ i ] = awt::Point( static_cast< sal_Int32 >( aPoint.getX() ), static_cast< sal_Int32 >( aPoint.getY() ) ); + } + aPolyPolySequence.getArray()[ j ] = aPointSequence; + } + maShapeProperties[ PROP_PolyPolygon ] <<= aPolyPolySequence; + } + } + } + // special for lineshape if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) { @@ -422,7 +452,6 @@ Reference< XShape > Shape::createAndInsert( PropertyMap aShapeProperties; PropertyMap::const_iterator aShapePropIter; - aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); if( mxCreateCallback.get() ) { for ( aShapePropIter = mxCreateCallback->getShapeProperties().begin(); @@ -438,6 +467,7 @@ Reference< XShape > Shape::createAndInsert( aShapeProperties[ (*aShapePropIter).first ] = (*aShapePropIter).second; } + aShapeProperties.insert( getShapeProperties().begin(), getShapeProperties().end() ); // applying properties PropertySet aPropSet( xSet ); if ( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) |