diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/stlfamily.cxx | 5 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 260 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 114 |
3 files changed, 185 insertions, 194 deletions
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx index 6bc9a7024f65..bae9c8791190 100644 --- a/sd/source/core/stlfamily.cxx +++ b/sd/source/core/stlfamily.cxx @@ -441,10 +441,7 @@ Reference< XInterface > SAL_CALL SdStyleFamily::createInstance() { throw IllegalAccessException(); } - else - { - return Reference< XInterface >( static_cast< XStyle* >( SdStyleSheet::CreateEmptyUserStyle( *mxPool.get(), mnFamily ) ) ); - } + return Reference< XInterface >( static_cast< XStyle* >( SdStyleSheet::CreateEmptyUserStyle( *mxPool.get(), mnFamily ) ) ); } Reference< XInterface > SAL_CALL SdStyleFamily::createInstanceWithArguments( const Sequence< Any >& ) diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 27d80a3f6fac..14c36e4a845f 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -937,80 +937,79 @@ void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, con { throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); } - else + + if( pEntry->nWID == WID_STYLE_HIDDEN ) { - if( pEntry->nWID == WID_STYLE_HIDDEN ) - { - bool bValue = false; - if ( aValue >>= bValue ) - SetHidden( bValue ); - return; - } - if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) - return; // not yet implemented for styles + bool bValue = false; + if ( aValue >>= bValue ) + SetHidden( bValue ); + return; + } + if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) + return; // not yet implemented for styles - if( pEntry->nWID == WID_STYLE_FAMILY ) - throw PropertyVetoException(); + if( pEntry->nWID == WID_STYLE_FAMILY ) + throw PropertyVetoException(); - if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) ) - { - OUString aStr; - const sal_uInt32 nTempHelpId = GetHelpId( aStr ); + if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) ) + { + OUString aStr; + const sal_uInt32 nTempHelpId = GetHelpId( aStr ); - if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) ) - return; - } + if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) ) + return; + } - SfxItemSet &rStyleSet = GetItemSet(); + SfxItemSet &rStyleSet = GetItemSet(); - if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) + if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) + { + BitmapMode eMode; + if( aValue >>= eMode ) { - BitmapMode eMode; - if( aValue >>= eMode ) - { - rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) ); - rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) ); - return; - } - throw IllegalArgumentException(); + rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) ); + rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) ); + return; } + throw IllegalArgumentException(); + } - SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); - aSet.Put( rStyleSet ); + SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); + aSet.Put( rStyleSet ); - if( !aSet.Count() ) - { - if( EE_PARA_NUMBULLET == pEntry->nWID ) - { - vcl::Font aBulletFont; - SdStyleSheetPool::PutNumBulletItem( this, aBulletFont ); - aSet.Put( rStyleSet ); - } - else - { - aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); - } - } - - if( pEntry->nMemberId == MID_NAME && - ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || - pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE || - pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) ) + if( !aSet.Count() ) + { + if( EE_PARA_NUMBULLET == pEntry->nWID ) { - OUString aTempName; - if(!(aValue >>= aTempName )) - throw IllegalArgumentException(); - - SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet ); + vcl::Font aBulletFont; + SdStyleSheetPool::PutNumBulletItem( this, aBulletFont ); + aSet.Put( rStyleSet ); } - else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( pEntry, aValue, aSet )) + else { - SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet ); + aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); } + } - rStyleSet.Put( aSet ); - Broadcast(SfxHint(SfxHintId::DataChanged)); + if( pEntry->nMemberId == MID_NAME && + ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || + pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE || + pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) ) + { + OUString aTempName; + if(!(aValue >>= aTempName )) + throw IllegalArgumentException(); + + SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet ); } + else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( pEntry, aValue, aSet )) + { + SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet ); + } + + rStyleSet.Put( aSet ); + Broadcast(SfxHint(SfxHintId::DataChanged)); + } Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) @@ -1024,99 +1023,98 @@ Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) { throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); } - else - { - Any aAny; - if( pEntry->nWID == WID_STYLE_FAMILY ) + Any aAny; + + if( pEntry->nWID == WID_STYLE_FAMILY ) + { + if( nFamily == SD_STYLE_FAMILY_MASTERPAGE ) { - if( nFamily == SD_STYLE_FAMILY_MASTERPAGE ) - { - const OUString aLayoutName( GetName() ); - aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) ); - } - else - { - aAny <<= GetFamilyString(nFamily); - } + const OUString aLayoutName( GetName() ); + aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) ); } - else if( pEntry->nWID == WID_STYLE_DISPNAME ) + else { - OUString aDisplayName; - if ( nFamily == SD_STYLE_FAMILY_MASTERPAGE ) - { - const SdStyleSheet* pStyleSheet = GetPseudoStyleSheet(); - if (pStyleSheet != nullptr) - aDisplayName = pStyleSheet->GetDisplayName(); - } - - if (aDisplayName.isEmpty()) - aDisplayName = GetDisplayName(); - - aAny <<= aDisplayName; + aAny <<= GetFamilyString(nFamily); } - else if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) + } + else if( pEntry->nWID == WID_STYLE_DISPNAME ) + { + OUString aDisplayName; + if ( nFamily == SD_STYLE_FAMILY_MASTERPAGE ) { - aAny <<= false; + const SdStyleSheet* pStyleSheet = GetPseudoStyleSheet(); + if (pStyleSheet != nullptr) + aDisplayName = pStyleSheet->GetDisplayName(); } - else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) - { - SfxItemSet &rStyleSet = GetItemSet(); - const XFillBmpStretchItem* pStretchItem = rStyleSet.GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH); - const XFillBmpTileItem* pTileItem = rStyleSet.GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE); + if (aDisplayName.isEmpty()) + aDisplayName = GetDisplayName(); - if( pStretchItem && pTileItem ) - { - if( pTileItem->GetValue() ) - aAny <<= BitmapMode_REPEAT; - else if( pStretchItem->GetValue() ) - aAny <<= BitmapMode_STRETCH; - else - aAny <<= BitmapMode_NO_REPEAT; - } - } - else if( pEntry->nWID == WID_STYLE_HIDDEN ) + aAny <<= aDisplayName; + } + else if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) + { + aAny <<= false; + } + else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet &rStyleSet = GetItemSet(); + + const XFillBmpStretchItem* pStretchItem = rStyleSet.GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH); + const XFillBmpTileItem* pTileItem = rStyleSet.GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE); + + if( pStretchItem && pTileItem ) { - aAny <<= IsHidden( ); + if( pTileItem->GetValue() ) + aAny <<= BitmapMode_REPEAT; + else if( pStretchItem->GetValue() ) + aAny <<= BitmapMode_STRETCH; + else + aAny <<= BitmapMode_NO_REPEAT; } - else - { - SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); + } + else if( pEntry->nWID == WID_STYLE_HIDDEN ) + { + aAny <<= IsHidden( ); + } + else + { + SfxItemSet aSet( GetPool().GetPool(), {{pEntry->nWID, pEntry->nWID}}); - const SfxPoolItem* pItem; - SfxItemSet& rStyleSet = GetItemSet(); + const SfxPoolItem* pItem; + SfxItemSet& rStyleSet = GetItemSet(); - if( rStyleSet.GetItemState( pEntry->nWID, true, &pItem ) == SfxItemState::SET ) - aSet.Put( *pItem ); + if( rStyleSet.GetItemState( pEntry->nWID, true, &pItem ) == SfxItemState::SET ) + aSet.Put( *pItem ); - if( !aSet.Count() ) - aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); + if( !aSet.Count() ) + aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); - if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny )) - return aAny; + if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny )) + return aAny; - // Get value of ItemSet - aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet ); - } + // Get value of ItemSet + aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet ); + } - if( pEntry->aType != aAny.getValueType() ) + if( pEntry->aType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( pEntry->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() ) { - // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here - if( ( pEntry->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() ) - { - sal_Int32 nValue = 0; - aAny >>= nValue; - aAny <<= (sal_Int16)nValue; - } - else - { - OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" ); - } + sal_Int32 nValue = 0; + aAny >>= nValue; + aAny <<= (sal_Int16)nValue; + } + else + { + OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" ); } - - return aAny; } + + return aAny; + } void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) {} diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 41e973cf8246..764fb7ed5d9d 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -210,49 +210,47 @@ void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyNa { throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); } - else + + if( mpSet ) { - if( mpSet ) + if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) { - if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) + drawing::BitmapMode eMode; + if( aValue >>= eMode ) { - drawing::BitmapMode eMode; - if( aValue >>= eMode ) - { - mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); - mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); - return; - } - throw lang::IllegalArgumentException(); + mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + return; } + throw lang::IllegalArgumentException(); + } - SfxItemPool& rPool = *mpSet->GetPool(); - SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}}); - aSet.Put( *mpSet ); - - if( !aSet.Count() ) - aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) ); + SfxItemPool& rPool = *mpSet->GetPool(); + SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}}); + aSet.Put( *mpSet ); - if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) ) - { - OUString aName; - if(!(aValue >>= aName )) - throw lang::IllegalArgumentException(); + if( !aSet.Count() ) + aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) ); - SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet ); - } - else - { - SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet ); - } + if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) ) + { + OUString aName; + if(!(aValue >>= aName )) + throw lang::IllegalArgumentException(); - mpSet->Put( aSet ); + SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet ); } else { - if(pEntry && pEntry->nWID) - mpPropSet->setPropertyValue( pEntry, aValue ); + SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet ); } + + mpSet->Put( aSet ); + } + else + { + if(pEntry && pEntry->nWID) + mpPropSet->setPropertyValue( pEntry, aValue ); } } @@ -267,44 +265,42 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& Propert { throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); } - else + + if( mpSet ) { - if( mpSet ) + if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) { - if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) - { - const XFillBmpStretchItem* pStretchItem = mpSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH); - const XFillBmpTileItem* pTileItem = mpSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE); + const XFillBmpStretchItem* pStretchItem = mpSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH); + const XFillBmpTileItem* pTileItem = mpSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE); - if( pStretchItem && pTileItem ) - { - if( pTileItem->GetValue() ) - aAny <<= drawing::BitmapMode_REPEAT; - else if( pStretchItem->GetValue() ) - aAny <<= drawing::BitmapMode_STRETCH; - else - aAny <<= drawing::BitmapMode_NO_REPEAT; - } - } - else + if( pStretchItem && pTileItem ) { - SfxItemPool& rPool = *mpSet->GetPool(); - SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}}); - aSet.Put( *mpSet ); - - if( !aSet.Count() ) - aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) ); - - // get value from ItemSet - aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet ); + if( pTileItem->GetValue() ) + aAny <<= drawing::BitmapMode_REPEAT; + else if( pStretchItem->GetValue() ) + aAny <<= drawing::BitmapMode_STRETCH; + else + aAny <<= drawing::BitmapMode_NO_REPEAT; } } else { - if(pEntry && pEntry->nWID) - aAny = mpPropSet->getPropertyValue( pEntry ); + SfxItemPool& rPool = *mpSet->GetPool(); + SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}}); + aSet.Put( *mpSet ); + + if( !aSet.Count() ) + aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) ); + + // get value from ItemSet + aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet ); } } + else + { + if(pEntry && pEntry->nWID) + aAny = mpPropSet->getPropertyValue( pEntry ); + } return aAny; } |