Index: filter/inc/filter/msfilter/escherex.hxx =================================================================== --- filter/inc/filter/msfilter/escherex.hxx (revision 1380199) +++ filter/inc/filter/msfilter/escherex.hxx (working copy) @@ -1215,7 +1215,7 @@ sal_Bool CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, const String& rSource, const sal_Bool bCreateFillBitmap, const sal_Bool bCreateCroppingAttributes = sal_False, 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, sal_Bool bBezier, ::com::sun::star::awt::Rectangle& rGeoRect, Polygon* pPolygon = NULL ); Index: filter/inc/filter/msfilter/msocximex.hxx =================================================================== --- filter/inc/filter/msfilter/msocximex.hxx (revision 1380199) +++ filter/inc/filter/msfilter/msocximex.hxx (working copy) @@ -172,7 +172,7 @@ { public: OCX_FontData() : nFontNameLen(0), fBold(0), fItalic(0), fUnderline(0), - fStrike(0), nFontSize(12), nJustification(1), pFontName(0), + fStrike(0), nFontSize(12), nJustification(1), nDefaultAlign(0), pFontName(0), bHasAlign(sal_False), bHasFont(sal_True) {} ~OCX_FontData() { if (pFontName) @@ -206,7 +206,7 @@ sal_uInt16 nLanguageID; sal_uInt8 nJustification; sal_uInt16 nFontWeight; - + sal_Int16 nDefaultAlign; char *pFontName; void SetHasAlign(sal_Bool bIn) {bHasAlign=bIn;} void SetHasFont(sal_Bool bIn) {bHasFont=bIn;} @@ -1115,6 +1115,7 @@ msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); mnForeColor = 0x80000012L; mnBackColor = 0x8000000FL; + aFontData.SetHasAlign(sal_True); } ~OCX_CommandButton() { Index: filter/source/msfilter/escherex.cxx =================================================================== --- filter/source/msfilter/escherex.cxx (revision 1380199) +++ filter/source/msfilter/escherex.cxx (working copy) @@ -24,6 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_filter.hxx" #include "eschesdo.hxx" +#include #include #include #include @@ -3616,7 +3617,38 @@ } // --------------------------------------------------------------------------------------------- +//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; + ByteString aUniqueId = aGraphicObject.GetUniqueID(); + if ( aUniqueId.Len() ) + { + 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() { } Index: filter/source/msfilter/msocximex.cxx =================================================================== --- filter/source/msfilter/msocximex.cxx (revision 1380199) +++ filter/source/msfilter/msocximex.cxx (working copy) @@ -1370,10 +1370,11 @@ aTmp <<= ImportColor(mnForeColor); rPropSet->setPropertyValue( WW8_ASCII2STR("TextColor"), aTmp); - // fake transparent push button by setting window background color - if( !fBackStyle ) - mnBackColor = 0x80000005; - aTmp <<= ImportColor(mnBackColor); + //fBackStyle is a flag. 1 means with background color. 0 means default. + if( fBackStyle ) + aTmp <<= ImportColor(mnBackColor); + else + aTmp = uno::Any(); rPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp); sal_Bool bTemp; @@ -1432,18 +1433,21 @@ aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); + //fBackStyle is a flag. 1 means with background color. 0 means default. aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; + else + fBackStyle = 0; *rContents << ExportColor(mnBackColor); aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=0;//fEnabled; if (fEnabled) - nTemp |= 0x02; + nTemp |= 0x02;//has enabled prop if (fBackStyle) - nTemp |= 0x08; + nTemp |= 0x08;//has background color *rContents << nTemp; *rContents << sal_uInt8(0x00); @@ -1468,7 +1472,7 @@ mbTakeFocus = any2bool( rPropSet->getPropertyValue( WW8_ASCII2STR( "FocusOnClick" ) ) ); nFixedAreaLen = static_cast(rContents->Tell()-nOldPos-4); - + aFontData.nDefaultAlign = 1; bRet = aFontData.Export(rContents,rPropSet); rContents->Seek(nOldPos); @@ -5078,13 +5082,46 @@ if (bHasFont) { aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontWeight")); - float nBold = 0; - aTmp >>= nBold; + //Export font related props + if ( aTmp.hasValue() ) + { + float nBold = 0.0; + aTmp >>= nBold; + if ( nBold >= 150 ) + fBold = 1; + } - if (nBold >= 150) + aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontSlant")); + if ( aTmp.hasValue() ) { + short eItalic = 0 ; + aTmp >>= eItalic ; + if ( eItalic == awt::FontSlant_ITALIC ) + fItalic = 1; + } + + aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontUnderline")); + if ( aTmp.hasValue() ) + { + short eUnderline = 0 ; + aTmp >>= eUnderline; + if ( eUnderline == awt::FontUnderline::SINGLE ) + fUnderline = 1; + } + + aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontStrikeout")); + if ( aTmp.hasValue() ) + { + short eLtStrikeout = 0; + aTmp >>= eLtStrikeout; + if ( eLtStrikeout == awt::FontStrikeout::SINGLE ) + fStrike = 1; + } + + sal_uInt8 nTmp= 1 * fBold + 2* fItalic + 4* fUnderline + 8 * fStrike; + if ( nTmp > 0 ) + { nFlags |= 0x02; - sal_uInt8 nTmp=0x01; *rContent << nTmp; nTmp=0x00; *rContent << nTmp; @@ -5114,7 +5151,7 @@ aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Align")); nFlags |= 0x40; - sal_Int16 nAlign(0); + sal_Int16 nAlign = nDefaultAlign; if (aTmp.hasValue()) aTmp >>= nAlign; nJustification = ExportAlign(nAlign); @@ -5588,6 +5625,7 @@ 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46, + 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x70, 0x69,//Add those to avoid MS crash when open 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, Index: sd/source/filter/eppt/eppt.cxx =================================================================== --- sd/source/filter/eppt/eppt.cxx (revision 1380199) +++ sd/source/filter/eppt/eppt.cxx (working copy) @@ -1826,7 +1826,8 @@ if ( pPtr->xControlModel.is() ) { String 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 = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel, aSize, aName ); if ( bOk ) Index: sd/source/filter/eppt/epptso.cxx =================================================================== --- sd/source/filter/eppt/epptso.cxx (revision 1380199) +++ sd/source/filter/eppt/epptso.cxx (working copy) @@ -4543,6 +4543,7 @@ << nPageId; PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() ); pEntry->xControlModel = aXControlModel; + pEntry->xShape = mXShape; maExOleObj.Insert( pEntry ); mnExEmbed++; @@ -4616,6 +4617,9 @@ ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer ); if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "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 );