diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-04-24 18:39:27 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-04-24 22:51:15 +0200 |
commit | c2d5b59fc6a3b3fbe20a19282538d5f95fa53301 (patch) | |
tree | 019fe5a28daa31dbe76aa8af994e772ac75a6634 | |
parent | 4abaaf7663d053f1c37a34487320246e29e43516 (diff) |
fdo#77089 pass shape dimensions to graphicfilter for WMF
Change-Id: I673a76ef85038b1f304ea85faeed5b4a462cb144
-rw-r--r-- | include/oox/helper/graphichelper.hxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 10 | ||||
-rw-r--r-- | oox/source/helper/graphichelper.cxx | 4 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 10 |
4 files changed, 22 insertions, 6 deletions
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index 8def09e3d31d..f74963cad8b1 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 d3964be2f862..d85ab4fd6f0f 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -70,6 +70,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; @@ -1153,7 +1155,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.setProperty(PROP_Graphic, xGraphic); } diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 71ab8263f43c..135a91c06c0f 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 6167a19e4208..d7783d806cb0 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> @@ -997,8 +998,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.setProperty( PROP_Graphic, xGraphic); } |