diff options
author | Jianyuan Li <lijiany@apache.org> | 2012-09-11 08:00:21 +0000 |
---|---|---|
committer | Jianyuan Li <lijiany@apache.org> | 2012-09-11 08:00:21 +0000 |
commit | f1ecd5ff46a217ee9f4323a08f03e59a53ef551e (patch) | |
tree | 0855affeb69eef5ad4d6a14826ce8f6dddf523dc /filter | |
parent | 4960217394334be14d6d7172119cee7c8e78479f (diff) |
#119467# Form controls cannot be saved into .ppt file in AOO3.4
Reported by: Du Jing
Patch by: Jianyuan Li
Review by: sunying
Notes
merged as: f38487511957971f9d08dd5c9af8f8128371540e
Diffstat (limited to 'filter')
-rw-r--r-- | filter/inc/filter/msfilter/escherex.hxx | 2 | ||||
-rw-r--r-- | filter/inc/filter/msfilter/msocximex.hxx | 5 | ||||
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 32 | ||||
-rw-r--r-- | filter/source/msfilter/msocximex.cxx | 62 |
4 files changed, 86 insertions, 15 deletions
diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx index e00dd51c1899..740ce1f61a87 100644 --- a/filter/inc/filter/msfilter/escherex.hxx +++ b/filter/inc/filter/msfilter/escherex.hxx @@ -1219,7 +1219,7 @@ class MSFILTER_DLLPUBLIC EscherPropertyContainer 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 ); diff --git a/filter/inc/filter/msfilter/msocximex.hxx b/filter/inc/filter/msfilter/msocximex.hxx index 4fbda6e3f213..c45acc185c1d 100644 --- a/filter/inc/filter/msfilter/msocximex.hxx +++ b/filter/inc/filter/msfilter/msocximex.hxx @@ -172,7 +172,7 @@ class OCX_FontData { 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 @@ public: 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 @@ public: msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); mnForeColor = 0x80000012L; mnBackColor = 0x8000000FL; + aFontData.SetHasAlign(sal_True); } ~OCX_CommandButton() { diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 5cb5f0f450c6..db7fcd14893a 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -24,6 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_filter.hxx" #include "eschesdo.hxx" +#include <svx/svdxcgv.hxx> #include <svx/svdomedia.hxx> #include <svx/xflftrit.hxx> #include <filter/msfilter/escherex.hxx> @@ -3661,6 +3662,37 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< drawi } // --------------------------------------------------------------------------------------------- +//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() { diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx index c21fc5f6ef27..11441009dade 100644 --- a/filter/source/msfilter/msocximex.cxx +++ b/filter/source/msfilter/msocximex.cxx @@ -1370,10 +1370,11 @@ sal_Bool OCX_CommandButton::Import( com::sun::star::uno::Reference< 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 @@ sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents, 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 @@ sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents, mbTakeFocus = any2bool( rPropSet->getPropertyValue( WW8_ASCII2STR( "FocusOnClick" ) ) ); nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4); - + aFontData.nDefaultAlign = 1; bRet = aFontData.Export(rContents,rPropSet); rContents->Seek(nOldPos); @@ -5078,13 +5082,46 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, 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; + } + + 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; + } - if (nBold >= 150) + 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 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, 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 @@ sal_Bool OCX_SpinButton::Export( 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, |