include/oox/helper/graphichelper.hxx | 4 +++- oox/source/drawingml/shape.cxx | 10 +++++++++- oox/source/helper/graphichelper.cxx | 4 ++-- oox/source/vml/vmlshape.cxx | 10 ++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-)
New commits: commit 9c1da7aa94e2f647570db72b52065525fd699d78 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Thu Apr 24 18:39:27 2014 +0200 fdo#77089 pass shape dimensions to graphicfilter for WMF Conflicts: oox/source/vml/vmlshape.cxx Change-Id: I673a76ef85038b1f304ea85faeed5b4a462cb144 diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index b96e993..d72daa9 100644 --- a/include/oox/helper/graphichelper.hxx +++ b/include/oox/helper/graphichelper.hxx @@ -115,7 +115,9 @@ public: /** Imports a graphic from the storage stream with the passed path and name. */ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > - importEmbeddedGraphic( const OUString& rStreamName ) const; + importEmbeddedGraphic( + const OUString& rStreamName, + const WMF_EXTERNALHEADER* pExtHeader = NULL ) const; /** Creates a persistent graphic object from the passed graphic. @return The URL of the created and internally cached graphic object. */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 54db7bb..8b250b1 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -67,6 +67,8 @@ #include <vcl/graphicfilter.hxx> #include <vcl/svapp.hxx> +#include <vcl/wmf.hxx> + using namespace ::oox::core; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -822,7 +824,13 @@ OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rSe // import and store the graphic if( !aGraphicPath.isEmpty() ) { - Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath ); + // Transfer shape's width and heightto graphicsfilter (can be used by WMF/EMF) + WMF_EXTERNALHEADER aExtHeader; + aExtHeader.mapMode = 8; // MM_ANISOTROPIC + aExtHeader.xExt = rShapeRect.Width; + aExtHeader.yExt = rShapeRect.Height; + + Reference< graphic::XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath, &aExtHeader ); if( xGraphic.is() ) maShapeProperties[ PROP_Graphic ] <<= xGraphic; } diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 5cb2b69..7594096 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -275,7 +275,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG return xGraphic; } -Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName ) const +Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStreamName, const WMF_EXTERNALHEADER* pExtHeader ) const { Reference< XGraphic > xGraphic; OSL_ENSURE( !rStreamName.isEmpty(), "GraphicHelper::importEmbeddedGraphic - empty stream name" ); @@ -284,7 +284,7 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( rStreamName ); if( aIt == maEmbeddedGraphics.end() ) { - xGraphic = importGraphic( mxStorage->openInputStream( rStreamName ) ); + xGraphic = importGraphic(mxStorage->openInputStream(rStreamName), pExtHeader); if( xGraphic.is() ) maEmbeddedGraphics[ rStreamName ] = xGraphic; } diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 7b8c9eb..7879315 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -21,6 +21,7 @@ #include <boost/optional.hpp> #include "oox/vml/vmlshape.hxx" +#include <vcl/wmf.hxx> #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -963,8 +964,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes // set the replacement graphic if( !aGraphicPath.isEmpty() ) { - Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath ); - if( xGraphic.is() ) + WMF_EXTERNALHEADER aExtHeader; + aExtHeader.mapMode = 8; + aExtHeader.xExt = rShapeRect.Width; + aExtHeader.yExt = rShapeRect.Height; + + Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath, &aExtHeader); + if (xGraphic.is()) aOleProps[ PROP_Graphic ] <<= xGraphic; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits