oox/inc/oox/export/drawingml.hxx | 5 ++++- oox/source/export/drawingml.cxx | 15 ++++++++++++--- oox/source/export/shapes.cxx | 14 +++++++------- 3 files changed, 23 insertions(+), 11 deletions(-)
New commits: commit a9fc1456719da3cecda6a97454bad0642e493035 Author: Lennard <wassert...@nefkom.net> Date: Wed Nov 28 21:45:22 2012 +0100 fdo#45495 pptx Export saves rotation of pictures,shapes,text and Circular and Rectangular shapes, and Tables drawingml was Pivot corrected. There is still some work to be done concerning customshape pptx export. Tables cannot be rotated anyway, but in contrast to Lines, you don't doubly-save the rotation. Patch Version 2. Here, acquiring of the angle from the shapes is done in WriteShapeTransformation. Change-Id: I0d650e669a690164796150615416fab8bb90242b Signed-off-by: Lennard <wassert...@nefkom.net> Reviewed-on: https://gerrit.libreoffice.org/1030 Reviewed-by: Radek DoulÃk <r...@novell.com> Tested-by: Radek DoulÃk <r...@novell.com> diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx index 37d579b..818531d 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 e28aa4a..3f141e5 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 e4acb04..191f27f 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 );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits