Kaydet (Commit) f3848751 authored tarafından Jianyuan Li's avatar Jianyuan Li Kaydeden (comit) Noel Power

#119467# Form controls cannot be saved into .ppt file in AOO3.4

Reported by: Du Jing
Patch by: Jianyuan Li
Review by: sunying
üst 55162d74
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "eschesdo.hxx" #include "eschesdo.hxx"
#include <svx/svdxcgv.hxx>
#include <svx/svdomedia.hxx> #include <svx/svdomedia.hxx>
#include <svx/xflftrit.hxx> #include <svx/xflftrit.hxx>
#include <filter/msfilter/escherex.hxx> #include <filter/msfilter/escherex.hxx>
...@@ -3812,6 +3813,37 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi ...@@ -3812,6 +3813,37 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi
return GetCustomShapeType( rXShape, nMirrorFlags, aShapeType ); return GetCustomShapeType( rXShape, nMirrorFlags, aShapeType );
} }
//Implement for form control export
sal_Bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape)
{
SdrObject* pShape = GetSdrObjectFromXShape( rXShape );
if ( pShape )
{
SdrModel* pMod = pShape->GetModel();
Graphic aGraphic(SdrExchangeView::GetObjGraphic( pMod, pShape));
GraphicObject aGraphicObject = aGraphic;
OString aUniqueId = aGraphicObject.GetUniqueID();
if ( aUniqueId.getLength() )
{
if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
{
Rectangle aRect( Point( 0, 0 ), pShapeBoundRect->GetSize() );
sal_uInt32 nBlibId = pGraphicProvider->GetBlibID( *pPicOutStrm, aUniqueId, aRect, NULL );
if ( nBlibId )
{
AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
ImplCreateGraphicAttributes( rXPropSet, nBlibId, sal_False );
return sal_True;
}
}
}
}
return sal_False;
}
EscherPersistTable::EscherPersistTable() EscherPersistTable::EscherPersistTable()
{ {
} }
......
...@@ -1262,6 +1262,8 @@ public: ...@@ -1262,6 +1262,8 @@ public:
const sal_Bool bFillBitmapModeAllowed = sal_True const sal_Bool bFillBitmapModeAllowed = sal_True
); );
sal_Bool CreateBlipPropertiesforOLEControl( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape);
sal_Bool CreatePolygonProperties( sal_Bool CreatePolygonProperties(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
sal_uInt32 nFlags, sal_uInt32 nFlags,
......
...@@ -1325,7 +1325,8 @@ void PPTWriter::ImplWriteOLE( ) ...@@ -1325,7 +1325,8 @@ void PPTWriter::ImplWriteOLE( )
if ( pPtr->xControlModel.is() ) if ( pPtr->xControlModel.is() )
{ {
OUString aName; OUString aName;
::com::sun::star::awt::Size aSize; //Initialize the graphic size which will be used on export
::com::sun::star::awt::Size aSize( pPtr->xShape->getSize() );
SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) ); SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
sal_Bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName ); sal_Bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName );
if ( bOk ) if ( bOk )
......
...@@ -2573,6 +2573,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ...@@ -2573,6 +2573,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
<< nPageId; << nPageId;
PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() ); PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
pEntry->xControlModel = aXControlModel; pEntry->xControlModel = aXControlModel;
pEntry->xShape = mXShape;
maExOleObj.push_back( pEntry ); maExOleObj.push_back( pEntry );
mnExEmbed++; mnExEmbed++;
...@@ -2644,6 +2645,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ...@@ -2644,6 +2645,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer ); ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), sal_False ) ) if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), sal_False ) )
aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 ); aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
//export form control graphic
else if ( aPropOpt.CreateBlipPropertiesforOLEControl(mXPropSet,mXShape))
aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed ); aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 ); aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
......
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