diff options
author | Sun Ying <sunying@apache.org> | 2012-09-10 01:56:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-27 10:23:07 +0100 |
commit | c05c16635b15a47591faa737947c2dce3dcb863e (patch) | |
tree | f98b4c7fca28107c54da681cce2e13f62d40a62f /filter/source/msfilter | |
parent | ba8485a9c87a5feca3c2673af532e73ecf517b69 (diff) |
Resolves: #i119753# fix audio video object lost when save .ppt file
Reported by: Li Feng Wang
Patch by: Ying Sun
Review by: Jian Yuan Li
(cherry picked from commit fbb7e8d8957877922f2f3a971e88685589f43939)
Conflicts:
filter/inc/filter/msfilter/escherex.hxx
filter/source/msfilter/escherex.cxx
Change-Id: I545a9e95c23cfba0cc918c9c4243528570734b2d
Diffstat (limited to 'filter/source/msfilter')
-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 ) { |