Kaydet (Commit) a9fc1456 authored tarafından Lennard's avatar Lennard Kaydeden (comit) Radek Doulík

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: 's avatarLennard <Wasserthal@nefkom.net>
Reviewed-on: https://gerrit.libreoffice.org/1030Reviewed-by: 's avatarRadek Doulík <rodo@novell.com>
Tested-by: 's avatarRadek Doulík <rodo@novell.com>
üst 954ce6f1
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
#include <com/sun/star/uno/XReference.hpp> #include <com/sun/star/uno/XReference.hpp>
#include <tools/poly.hxx> #include <tools/poly.hxx>
#include <filter/msfilter/escherex.hxx> #include <filter/msfilter/escherex.hxx>
#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) (21600000-input*600)
#endif
class Graphic; class Graphic;
class String; class String;
...@@ -111,7 +114,7 @@ public: ...@@ -111,7 +114,7 @@ public:
void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); 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, 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, void WriteTransformation( const Rectangle& rRectangle,
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_Int32 nRotation = 0 );
......
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
#include <filter/msfilter/escherex.hxx> #include <filter/msfilter/escherex.hxx>
#include <filter/msfilter/util.hxx> #include <filter/msfilter/util.hxx>
#include <editeng/svxenum.hxx> #include <editeng/svxenum.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdoashp.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
...@@ -624,10 +626,11 @@ void DrawingML::WriteTransformation( const Rectangle& rRect, ...@@ -624,10 +626,11 @@ void DrawingML::WriteTransformation( const Rectangle& rRect,
mpFS->endElementNS( nXmlNamespace, XML_xfrm ); 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" )); DBG(printf( "write shape transformation\n" ));
sal_Int32 nRotation=0;
awt::Point aPos = rXShape->getPosition(); awt::Point aPos = rXShape->getPosition();
awt::Size aSize = rXShape->getSize(); awt::Size aSize = rXShape->getSize();
...@@ -635,8 +638,14 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 ...@@ -635,8 +638,14 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32
aSize.Width = 1000; aSize.Width = 1000;
if ( aSize.Height < 0 ) if ( aSize.Height < 0 )
aSize.Height = 1000; aSize.Height = 1000;
if (!bSuppressRotation)
WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, nRotation ); {
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 ) void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIsField )
......
...@@ -748,7 +748,7 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) ...@@ -748,7 +748,7 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false);
if( nAdjustmentValuesIndex != -1 ) if( nAdjustmentValuesIndex != -1 )
{ {
sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0; sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
...@@ -795,7 +795,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape ) ...@@ -795,7 +795,7 @@ ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape )
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a ); WriteShapeTransformation( xShape, XML_a,0,0,false);
WritePresetShape( "ellipse" ); WritePresetShape( "ellipse" );
Reference< XPropertySet > xProps( xShape, UNO_QUERY ); Reference< XPropertySet > xProps( xShape, UNO_QUERY );
if( xProps.is() ) if( xProps.is() )
...@@ -889,7 +889,7 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< XShape > xShape, Graph ...@@ -889,7 +889,7 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< XShape > xShape, Graph
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a ); WriteShapeTransformation( xShape, XML_a,0,0,false);
WritePresetShape( "rect" ); WritePresetShape( "rect" );
// graphic object can come with the frame (bnc#654525) // graphic object can come with the frame (bnc#654525)
WriteOutline( xShapeProps ); WriteOutline( xShapeProps );
...@@ -1021,7 +1021,7 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape ) ...@@ -1021,7 +1021,7 @@ ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape )
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV ); WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, true);
WritePresetShape( "line" ); WritePresetShape( "line" );
Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
if( xShapeProps.is() ) if( xShapeProps.is() )
...@@ -1085,7 +1085,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) ...@@ -1085,7 +1085,7 @@ ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape )
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a ); WriteShapeTransformation( xShape, XML_a,0,0,false);
WritePresetShape( "rect" ); WritePresetShape( "rect" );
Reference< XPropertySet > xProps( xShape, UNO_QUERY ); Reference< XPropertySet > xProps( xShape, UNO_QUERY );
if( xProps.is() ) if( xProps.is() )
...@@ -1258,7 +1258,7 @@ ShapeExport& ShapeExport::WriteTableShape( Reference< XShape > xShape ) ...@@ -1258,7 +1258,7 @@ ShapeExport& ShapeExport::WriteTableShape( Reference< XShape > xShape )
FSEND ); FSEND );
pFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr ); pFS->endElementNS( mnXmlNamespace, XML_nvGraphicFramePr );
WriteShapeTransformation( xShape, mnXmlNamespace ); WriteShapeTransformation( xShape, mnXmlNamespace, false);
WriteTable( xShape ); WriteTable( xShape );
pFS->endElementNS( mnXmlNamespace, XML_graphicFrame ); pFS->endElementNS( mnXmlNamespace, XML_graphicFrame );
...@@ -1281,7 +1281,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) ...@@ -1281,7 +1281,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape )
// visual shape properties // visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
WriteShapeTransformation( xShape, XML_a ); WriteShapeTransformation( xShape, XML_a,0,0,false);
WritePresetShape( "rect" ); WritePresetShape( "rect" );
WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), S( "GraphicURL" ) ); WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), S( "GraphicURL" ) );
pFS->endElementNS( mnXmlNamespace, XML_spPr ); pFS->endElementNS( mnXmlNamespace, XML_spPr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment