filter/source/msfilter/escherex.cxx | 32 ++++++++++++++++++++++++++++++++ include/filter/msfilter/escherex.hxx | 2 ++ oox/source/ole/axcontrol.cxx | 32 ++++++++++++++++++++++++++------ oox/source/ole/olehelper.cxx | 2 +- sd/source/filter/eppt/eppt.cxx | 3 ++- sd/source/filter/eppt/epptso.cxx | 4 ++++ 6 files changed, 67 insertions(+), 8 deletions(-)
New commits: commit 0a686a9bb54b5c1b3a45810e2601a098c0272c33 Author: Noel Power <[email protected]> Date: Wed Jun 26 10:36:53 2013 +0100 tweak ppt ole import for libreoffice codebase a) make sure backcolor is skipped when libreoffice backcolor is default. Libreoffice default is 0 ( but if we write that out mso reads it as black ) b) don't take the label default backcolor in exchange for the libreoffice default. Libreoffice default backcolor for label is white, mso's default is rather different ( and never seems to be used ) c) re-enable compObj export ( seemed this was disabled unintentionally except for buttons ) Change-Id: Ie68267809cee2e92bd06e88e698f17a10eeeb6ad diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index eca6d70..86642dc 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -1033,7 +1033,10 @@ void AxCommandButtonModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) { AxBinaryPropertyWriter aWriter( rOutStrm ); aWriter.writeIntProperty< sal_uInt32 >( mnTextColor ); - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + aWriter.skipProperty(); // default backcolour aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); aWriter.writeStringProperty( maCaption ); aWriter.skipProperty(); // pict pos @@ -1156,7 +1159,12 @@ void AxLabelModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) { AxBinaryPropertyWriter aWriter( rOutStrm ); aWriter.writeIntProperty< sal_uInt32 >( mnTextColor ); - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + // if mnBackColor == 0 then it's the libreoffice default backcolour is + // the MSO Label default which is AX_SYSCOLOR_BUTTONFACE + aWriter.writeIntProperty< sal_uInt32 >( AX_SYSCOLOR_WINDOWBACK ); aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); aWriter.writeStringProperty( maCaption ); aWriter.skipProperty(); // picture position @@ -1299,7 +1307,10 @@ void AxImageModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) aWriter.skipProperty(); //undefined aWriter.skipProperty(); //auto-size aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor ); - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + aWriter.skipProperty(); // default backcolour aWriter.writeIntProperty< sal_uInt8 >( mnBorderStyle ); aWriter.skipProperty(); // mouse pointer aWriter.writeIntProperty< sal_uInt8 >( mnPicSizeMode ); @@ -1500,7 +1511,10 @@ void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm ) aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); else aWriter.skipProperty(); //mnFlags - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + aWriter.skipProperty(); // default backcolour aWriter.writeIntProperty< sal_uInt32 >( mnTextColor ); // only write if different from default @@ -2116,7 +2130,10 @@ void AxSpinButtonModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) { AxBinaryPropertyWriter aWriter( rOutStrm ); aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor ); - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + aWriter.skipProperty(); // default backcolour aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); aWriter.writePairProperty( maSize ); aWriter.skipProperty(); // unused @@ -2261,7 +2278,10 @@ void AxScrollBarModel::exportBinaryModel( BinaryOutputStream& rOutStrm ) { AxBinaryPropertyWriter aWriter( rOutStrm ); aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor ); - aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + if ( mnBackColor ) + aWriter.writeIntProperty< sal_uInt32 >( mnBackColor ); + else + aWriter.skipProperty(); // default backcolour aWriter.writeIntProperty< sal_uInt32 >( mnFlags ); aWriter.writePairProperty( maSize ); aWriter.skipProperty(); // mouse pointer diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 8dc8f7c..433b884 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -461,7 +461,7 @@ void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOu void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& rxOut ) { oox::BinaryXOutputStream aOut( rxOut, false ); - if ( mpModel && mpModel->getControlType() == API_CONTROL_BUTTON ) + if ( mpModel ) mpModel->exportCompObj( aOut ); } commit f38487511957971f9d08dd5c9af8f8128371540e Author: Jianyuan Li <[email protected]> Date: Tue Sep 11 08:00:21 2012 +0000 #119467# Form controls cannot be saved into .ppt file in AOO3.4 Reported by: Du Jing Patch by: Jianyuan Li Review by: sunying diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 3696251..bd6b0e4 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -18,6 +18,7 @@ */ #include "eschesdo.hxx" +#include <svx/svdxcgv.hxx> #include <svx/svdomedia.hxx> #include <svx/xflftrit.hxx> #include <filter/msfilter/escherex.hxx> @@ -3812,6 +3813,37 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi 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() { } diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx index 4b7a0c9..e21805a 100644 --- a/include/filter/msfilter/escherex.hxx +++ b/include/filter/msfilter/escherex.hxx @@ -1262,6 +1262,8 @@ public: 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( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, sal_uInt32 nFlags, diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 861d06a..d7eeb5d 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -1325,7 +1325,8 @@ void PPTWriter::ImplWriteOLE( ) if ( pPtr->xControlModel.is() ) { 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 ) ); sal_Bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName ); if ( bOk ) diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index fa1a46b..3d45f89 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -2573,6 +2573,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a << nPageId; PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() ); pEntry->xControlModel = aXControlModel; + pEntry->xShape = mXShape; maExOleObj.push_back( pEntry ); mnExEmbed++; @@ -2644,6 +2645,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer ); if ( aPropOpt.CreateGraphicProperties( mXPropSet, OUString( "MetaFile" ), sal_False ) ) 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_pictureActive, 0x10000 ); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
