summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-05-14 19:46:43 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-05-14 19:48:35 +0200
commitbc584fc5d8b06034f7acf229035483daf78a186e (patch)
tree494e9f9f1e622c25d2b2fe824a4358456581e312 /oox
parentc2703b63fa8d16ce8efaa55e0431ae829fdd23c1 (diff)
detect whether a bezier shape is open or closed
For open shapes e.g. fill does not work. Part of bnc#780044. Change-Id: Id0ce50e94ae86c0398f06b2a67e3fd13d487ae7a
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlshape.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 0af325d52233..2aa3bac1f83d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -692,8 +692,8 @@ BezierShape::BezierShape(Drawing& rDrawing)
Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
{
- Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
awt::Rectangle aCoordSys = getCoordSystem();
+ PolyPolygonBezierCoords aBezierCoords;
if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) )
{
@@ -747,7 +747,6 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
}
}
- PolyPolygonBezierCoords aBezierCoords;
aBezierCoords.Coordinates.realloc( aCoordLists.size() );
for ( unsigned int i = 0; i < aCoordLists.size(); i++ )
aBezierCoords.Coordinates[i] = ContainerHelper::vectorToSequence( aCoordLists[i] );
@@ -756,6 +755,18 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
for ( unsigned int i = 0; i < aFlagLists.size(); i++ )
aBezierCoords.Flags[i] = ContainerHelper::vectorToSequence( aFlagLists[i] );
+ if( aCoordLists.front().front().X == aCoordLists.back().back().X
+ && aCoordLists.front().front().Y == aCoordLists.back().back().Y )
+ { // HACK: If the shape is in fact closed, which can be found out only when the path is known,
+ // force to closed bezier shape (otherwise e.g. fill won't work).
+ const_cast< BezierShape* >( this )->setService( "com.sun.star.drawing.ClosedBezierShape" );
+ }
+ }
+
+ Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
+
+ if( aBezierCoords.Coordinates.hasElements())
+ {
PropertySet aPropSet( xShape );
aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
}