diff options
-rw-r--r-- | oox/inc/oox/export/drawingml.hxx | 5 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 15 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 14 |
3 files changed, 23 insertions, 11 deletions
diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx index 37d579bdd9a8..818531ddc660 100644 --- a/oox/inc/oox/export/drawingml.hxx +++ b/oox/inc/oox/export/drawingml.hxx @@ -27,6 +27,9 @@ #include <com/sun/star/uno/XReference.hpp> #include <tools/poly.hxx> #include <filter/msfilter/escherex.hxx> +#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY +#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) (21600000-input*600) +#endif class Graphic; class String; @@ -111,7 +114,7 @@ public: void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape, - sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 ); + sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false ); void WriteTransformation( const Rectangle& rRectangle, sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e28aa4a15ad0..3f141e584c32 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -67,6 +67,8 @@ #include <filter/msfilter/escherex.hxx> #include <filter/msfilter/util.hxx> #include <editeng/svxenum.hxx> +#include <svx/unoapi.hxx> +#include <svx/svdoashp.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -624,10 +626,11 @@ void DrawingML::WriteTransformation( const Rectangle& rRect, mpFS->endElementNS( nXmlNamespace, XML_xfrm ); } -void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 nXmlNamespace, sal_Bool bFlipH, sal_Bool bFlipV, sal_Int32 nRotation ) +void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 nXmlNamespace, sal_Bool bFlipH, sal_Bool bFlipV, sal_Bool bSuppressRotation ) { DBG(printf( "write shape transformation\n" )); + sal_Int32 nRotation=0; awt::Point aPos = rXShape->getPosition(); awt::Size aSize = rXShape->getSize(); @@ -635,8 +638,14 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 aSize.Width = 1000; if ( aSize.Height < 0 ) aSize.Height = 1000; - - WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, nRotation ); + if (!bSuppressRotation) + { + SdrObject* pShape = (SdrObject*) GetSdrObjectFromXShape( rXShape ); + nRotation=pShape->GetRotateAngle(); + aPos.X-=(1-cos(nRotation*F_PI18000))*aSize.Width/2-sin(nRotation*F_PI18000)*aSize.Height/2; + aPos.Y-=(1-cos(nRotation*F_PI18000))*aSize.Height/2+sin(nRotation*F_PI18000)*aSize.Width/2; + } + WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, PPTX_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); } void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIsField ) diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index e4acb04958c4..191f27fc1f43 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -748,7 +748,7 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); + WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false); if( nAdjustmentValuesIndex != -1 ) { sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0; @@ -795,7 +795,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape ) // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a ); + WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "ellipse" ); Reference< XPropertySet > xProps( xShape, UNO_QUERY ); if( xProps.is() ) @@ -889,7 +889,7 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< XShape > xShape, Graph // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a ); + WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "rect" ); // graphic object can come with the frame (bnc#654525) WriteOutline( xShapeProps ); @@ -1021,7 +1021,7 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape ) // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); + WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, true); WritePresetShape( "line" ); Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); if( xShapeProps.is() ) @@ -1085,7 +1085,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a ); + WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "rect" ); Reference< XPropertySet > xProps( xShape, UNO_QUERY ); if( xProps.is() ) @@ -1258,7 +1258,7 @@ ShapeExport& ShapeExport::WriteTableShape( Reference< XShape > xShape ) FSEND ); pFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr ); - WriteShapeTransformation( xShape, mnXmlNamespace ); + WriteShapeTransformation( xShape, mnXmlNamespace, false); WriteTable( xShape ); pFS->endElementNS( mnXmlNamespace, XML_graphicFrame ); @@ -1281,7 +1281,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) // visual shape properties pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); - WriteShapeTransformation( xShape, XML_a ); + WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "rect" ); WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), S( "GraphicURL" ) ); pFS->endElementNS( mnXmlNamespace, XML_spPr ); |