Kaydet (Commit) c2d5b59f authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

fdo#77089 pass shape dimensions to graphicfilter for WMF

Change-Id: I673a76ef85038b1f304ea85faeed5b4a462cb144
üst 4abaaf76
...@@ -115,7 +115,9 @@ public: ...@@ -115,7 +115,9 @@ public:
/** Imports a graphic from the storage stream with the passed path and name. */ /** Imports a graphic from the storage stream with the passed path and name. */
::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > ::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. /** Creates a persistent graphic object from the passed graphic.
@return The URL of the created and internally cached graphic object. */ @return The URL of the created and internally cached graphic object. */
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
#include <vcl/graphicfilter.hxx> #include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/wmf.hxx>
using namespace ::oox::core; using namespace ::oox::core;
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -1153,7 +1155,13 @@ OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rSe ...@@ -1153,7 +1155,13 @@ OUString Shape::finalizeServiceName( XmlFilterBase& rFilter, const OUString& rSe
// import and store the graphic // import and store the graphic
if( !aGraphicPath.isEmpty() ) 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() ) if( xGraphic.is() )
maShapeProperties.setProperty(PROP_Graphic, xGraphic); maShapeProperties.setProperty(PROP_Graphic, xGraphic);
} }
......
...@@ -275,7 +275,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG ...@@ -275,7 +275,7 @@ Reference< XGraphic > GraphicHelper::importGraphic( const StreamDataSequence& rG
return xGraphic; 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; Reference< XGraphic > xGraphic;
OSL_ENSURE( !rStreamName.isEmpty(), "GraphicHelper::importEmbeddedGraphic - empty stream name" ); OSL_ENSURE( !rStreamName.isEmpty(), "GraphicHelper::importEmbeddedGraphic - empty stream name" );
...@@ -284,7 +284,7 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr ...@@ -284,7 +284,7 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( const OUString& rStr
EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( rStreamName ); EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( rStreamName );
if( aIt == maEmbeddedGraphics.end() ) if( aIt == maEmbeddedGraphics.end() )
{ {
xGraphic = importGraphic( mxStorage->openInputStream( rStreamName ) ); xGraphic = importGraphic(mxStorage->openInputStream(rStreamName), pExtHeader);
if( xGraphic.is() ) if( xGraphic.is() )
maEmbeddedGraphics[ rStreamName ] = xGraphic; maEmbeddedGraphics[ rStreamName ] = xGraphic;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include "oox/vml/vmlshape.hxx" #include "oox/vml/vmlshape.hxx"
#include <vcl/wmf.hxx>
#include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
...@@ -997,8 +998,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes ...@@ -997,8 +998,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
// set the replacement graphic // set the replacement graphic
if( !aGraphicPath.isEmpty() ) if( !aGraphicPath.isEmpty() )
{ {
Reference< XGraphic > xGraphic = rFilter.getGraphicHelper().importEmbeddedGraphic( aGraphicPath ); WMF_EXTERNALHEADER aExtHeader;
if( xGraphic.is() ) 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); aOleProps.setProperty( PROP_Graphic, xGraphic);
} }
......
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