diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 73 |
1 files changed, 48 insertions, 25 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 4c8fec021af0..68bd12dd6352 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -18,6 +18,7 @@ */ #include "eschesdo.hxx" +#include <svx/svdomedia.hxx> #include <svx/xflftrit.hxx> #include <filter/msfilter/escherex.hxx> #include <svx/unoapi.hxx> @@ -1283,38 +1284,60 @@ sal_Bool EscherPropertyContainer::CreateOLEGraphicProperties( if ( pGraphic ) { GraphicObject aGraphicObject( *pGraphic ); - OString aUniqueId( aGraphicObject.GetUniqueID() ); - if ( !aUniqueId.isEmpty() ) - { - AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture ); - uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY ); + bRetValue = CreateGraphicProperties( rXShape,aGraphicObject ); + } + } + } + return bRetValue; +} - if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect && aXPropSet.is() ) - { - ::com::sun::star::uno::Any aAny; - ::com::sun::star::awt::Rectangle* pVisArea = NULL; - if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString( "VisibleArea" ) ) ) - { - pVisArea = new ::com::sun::star::awt::Rectangle; - aAny >>= (*pVisArea); - } - Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() ); - sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, pVisArea, NULL ); - if ( nBlibId ) - { - AddOpt( ESCHER_Prop_pib, nBlibId, sal_True ); - ImplCreateGraphicAttributes( aXPropSet, nBlibId, sal_False ); - bRetValue = sal_True; - } - delete pVisArea; - } - } +sal_Bool EscherPropertyContainer::CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, const GraphicObject& rGraphicObj ) +{ + sal_Bool bRetValue = sal_False; + OString aUniqueId( rGraphicObj.GetUniqueID() ); + if ( !aUniqueId.isEmpty() ) + { + AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture ); + uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY ); + + if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect && aXPropSet.is() ) + { + ::com::sun::star::uno::Any aAny; + ::com::sun::star::awt::Rectangle* pVisArea = NULL; + if ( EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString("VisibleArea" ) ) ) + { + pVisArea = new ::com::sun::star::awt::Rectangle; + aAny >>= (*pVisArea); } + Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() ); + sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, pVisArea, NULL ); + if ( nBlibId ) + { + AddOpt( ESCHER_Prop_pib, nBlibId, sal_True ); + ImplCreateGraphicAttributes( aXPropSet, nBlibId, sal_False ); + bRetValue = sal_True; + } + delete pVisArea; } } return bRetValue; } +sal_Bool EscherPropertyContainer::CreateMediaGraphicProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape ) +{ + sal_Bool bRetValue = sal_False; + if ( rXShape.is() ) + { + SdrObject* pSdrMedia( GetSdrObjectFromXShape( rXShape ) ); // SJ: leaving unoapi, because currently there is + if ( pSdrMedia && pSdrMedia->ISA( SdrMediaObj ) ) // no access to the native graphic object + { + GraphicObject aGraphicObject( ((SdrMediaObj*)pSdrMedia)->getSnapshot() ); + bRetValue = CreateGraphicProperties( rXShape, aGraphicObject ); + } + } + return bRetValue; +} sal_Bool EscherPropertyContainer::ImplCreateEmbeddedBmp( const OString& rUniqueId ) { |