From 96c2ec57493d647197befcb540bc59e85b2530a1 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 2 Jul 2010 16:52:34 +0200 Subject: [PATCH] impress193: #162822# fixed font size problem with presentation objects and flipping problem of freeform shapes --- oox/inc/oox/drawingml/customshapeproperties.hxx | 4 ++++ oox/source/drawingml/customshapeproperties.cxx | 5 ++++- oox/source/drawingml/shape.cxx | 11 +++++++++-- oox/source/token/properties.txt | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx index 171437095f03..282e0c6009b5 100644 --- a/oox/inc/oox/drawingml/customshapeproperties.hxx +++ b/oox/inc/oox/drawingml/customshapeproperties.hxx @@ -133,6 +133,8 @@ public: OptValue< GeomRect >& getTextRect(){ return maTextRect; }; std::vector< Path2D >& getPath2DList(){ return maPath2DList; }; std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; }; + void setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; }; + void setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; }; double getValue( const std::vector< CustomShapeGuide >&, sal_uInt32 nIndex ) const; static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide ); @@ -150,6 +152,8 @@ private: std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment > maSegments; + sal_Bool mbMirroredX; + sal_Bool mbMirroredY; }; } } diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 62e42701b273..d296a4041fb9 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -50,6 +50,8 @@ using namespace ::com::sun::star::drawing; namespace oox { namespace drawingml { CustomShapeProperties::CustomShapeProperties() +: mbMirroredX ( sal_False ) +, mbMirroredY ( sal_False ) { } CustomShapeProperties::~CustomShapeProperties() @@ -149,7 +151,8 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFi sal_uInt32 i; PropertyMap aPropertyMap; aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "non-primitive" ); - + aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX ); + aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY ); awt::Size aSize( xShape->getSize() ); awt::Rectangle aViewBox( 0, 0, aSize.Width * 360, aSize.Height * 360 ); if ( maPath2DList.size() ) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 97c3b4a5374a..f0ae2ec2a7a3 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -260,6 +260,7 @@ Reference< XShape > Shape::createAndInsert( OUString aServiceName = rServiceName; if( mxCreateCallback.get() ) aServiceName = mxCreateCallback->onCreateXShape( aServiceName, awt::Rectangle( aPosition.X / 360, aPosition.Y / 360, aSize.Width / 360, aSize.Height / 360 ) ); + sal_Bool bIsCustomShape = aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ); basegfx::B2DHomMatrix aTransformation; if( aSize.Width != 1 || aSize.Height != 1) @@ -279,7 +280,7 @@ Reference< XShape > Shape::createAndInsert( // center object at origin aTransformation.translate( -aCenter.getX(), -aCenter.getY() ); - if( mbFlipH || mbFlipV) + if( !bIsCustomShape && ( mbFlipH || mbFlipV ) ) { // mirror around object's center aTransformation.scale( mbFlipH ? -1.0 : 1.0, mbFlipV ? -1.0 : 1.0 ); @@ -469,8 +470,14 @@ Reference< XShape > Shape::createAndInsert( if( aServiceName != OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) aPropSet.setProperties( aShapeProperties ); - if( aServiceName == OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) + if( bIsCustomShape ) + { + if ( mbFlipH ) + mpCustomShapePropertiesPtr->setMirroredX( sal_True ); + if ( mbFlipV ) + mpCustomShapePropertiesPtr->setMirroredY( sal_True ); mpCustomShapePropertiesPtr->pushToPropSet( rFilterBase, xSet, mxShape ); + } // in some cases, we don't have any text body. if( getTextBody() ) diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 2b32b0a14d91..3fbcb7e1deb0 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -257,6 +257,8 @@ MaxFieldCount MaxTextLen MediaType MinorTickmarks +MirroredX +MirroredY MissingValueTreatment Model MultiLine