From 30b052e7b65434d2a78ab36d8f4475abe0c86a2a Mon Sep 17 00:00:00 2001 From: Muthu Subramanian Date: Fri, 2 Dec 2011 22:48:27 +0530 Subject: n#719989/97: Connector shape fixes. Note that rotation needs to be done post flipping. --- oox/source/drawingml/shape.cxx | 22 ++++++++++++---------- oox/source/drawingml/shapepropertiescontext.cxx | 7 +++++++ 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'oox/source') diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index d7168233e865..2b81eac2db75 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -509,6 +509,18 @@ Reference< XShape > Shape::createAndInsert( aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr ); aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr ); + // Moved here because the properties like Flip needs to be applied before + // applying the rotation property + if( bIsCustomShape ) + { + if ( mbFlipH ) + mpCustomShapePropertiesPtr->setMirroredX( sal_True ); + if ( mbFlipV ) + mpCustomShapePropertiesPtr->setMirroredY( sal_True ); + OSL_TRACE("==cscode== shape name: '%s'", rtl::OUStringToOString(msName, RTL_TEXTENCODING_UTF8 ).getStr()); + mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape ); + } + // applying autogrowheight property before setting shape size, because // the shape size might be changed if currently autogrowheight is true // we must also check that the PropertySet supports the property. @@ -522,16 +534,6 @@ Reference< XShape > Shape::createAndInsert( if( aServiceName != OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GroupShape")) ) PropertySet( xSet ).setProperties( aShapeProps ); - if( bIsCustomShape ) - { - if ( mbFlipH ) - mpCustomShapePropertiesPtr->setMirroredX( sal_True ); - if ( mbFlipV ) - mpCustomShapePropertiesPtr->setMirroredY( sal_True ); - OSL_TRACE("==cscode== shape name: '%s'", rtl::OUStringToOString(msName, RTL_TEXTENCODING_UTF8 ).getStr()); - mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape ); - } - // in some cases, we don't have any text body. if( getTextBody() ) { diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx index a6687bc73078..1d2a216b4853 100644 --- a/oox/source/drawingml/shapepropertiescontext.cxx +++ b/oox/source/drawingml/shapepropertiescontext.cxx @@ -81,11 +81,18 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( case A_TOKEN( prstGeom ): // preset geometry "CT_PresetGeometry2D" { sal_Int32 nToken = xAttribs->getOptionalValueToken( XML_prst, 0 ); + // TODO: Move the following checks to a separate place or as a separate function if ( nToken == XML_line ) { static const OUString sLineShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineShape" ) ); mrShape.getServiceName() = sLineShape; } + if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) || + nToken == XML_straightConnector1 ) + { + static const OUString sCustomShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.CustomShape" ) ); + mrShape.getServiceName() = sCustomShape; + } xRet.set( new PresetShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) ); } break; -- cgit