From c816729beb6ad79fedf3566dbfccdc17f4dc1584 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 26 Feb 2014 07:05:42 +0100 Subject: fix OOXML validation error for text shapes, related fdo#31551 blipFill and other fill elements are not allowed to appear together. See EG_FillProperties in the OOXML spec. See fdo31551-2.ods Change-Id: If5869ab9dc69815938c1f4c6fb180b0c1652ddcc --- include/oox/export/drawingml.hxx | 3 +++ oox/source/export/drawingml.cxx | 11 +++++++++++ oox/source/export/shapes.cxx | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index 758f9bfa58a3..cf2de85e2ad5 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -135,6 +135,9 @@ public: void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); void WriteGradientFill( ::com::sun::star::awt::Gradient rGradient ); void WriteGrabBagGradientFill( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aGradientStops, ::com::sun::star::awt::Gradient rGradient); + + void WriteBlipOrNormalFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, + const OUString& rURLPropName ); void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& sBitmapURL, sal_Int32 nXmlNamespace, bool bWriteMode, bool bRelPathToMedia = false ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 3e5b9f0afcdd..cd67e57b0c56 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -847,6 +847,17 @@ void DrawingML::WriteBlipMode( Reference< XPropertySet > rXPropSet, const OUStri } } +void DrawingML::WriteBlipOrNormalFill( Reference< XPropertySet > xPropSet, const OUString& rURLPropName ) +{ + // check for blip and otherwise fall back to normal fill + // we always store normal fill properties but OOXML + // uses a choice between our fill props and BlipFill + if (GetProperty ( xPropSet, rURLPropName )) + WriteBlipFill( xPropSet, rURLPropName ); + else + WriteFill(xPropSet); +} + void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, const OUString& sURLPropName ) { WriteBlipFill( rXPropSet, sURLPropName, XML_a ); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b62f8a35ec93..2a8fe7ee432d 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -943,8 +943,7 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) WriteShapeTransformation( xShape, XML_a,0,0,false); WritePresetShape( "rect" ); uno::Reference xPropertySet(xShape, UNO_QUERY); - WriteFill(xPropertySet); - WriteBlipFill(xPropertySet, "GraphicURL"); + WriteBlipOrNormalFill(xPropertySet, "GraphicURL"); WriteOutline(xPropertySet); pFS->endElementNS( mnXmlNamespace, XML_spPr ); -- cgit v1.2.3