diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-10-24 14:41:45 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-04 12:30:38 -0500 |
commit | 3f1b1f7f08effe21a5b7443ab19c5f19fb660ed8 (patch) | |
tree | b76da049af523ff690169c5231d198aaedbe6cde /svx | |
parent | b5f6358c0bf3befd1a40ea993a246d50ee5304bf (diff) |
Scope reduction by early bailout.
Change-Id: I3a5c944d6ed863c347da03e0a60ff653232b3e72
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 167 |
1 files changed, 82 insertions, 85 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 9e45f285492d..f6fab38d5ef2 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1643,112 +1643,109 @@ void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName); - if( mpObj.is() && mpModel ) + if (!mpObj.is() || !mpModel) { - if( pMap == NULL ) - throw beans::UnknownPropertyException(); + // Since we have no actual sdr object right now, remember all + // properties in a list. These properties will be set when the sdr + // object is created. - if( (pMap->nFlags & beans::PropertyAttribute::READONLY ) != 0 ) - throw beans::PropertyVetoException( - ( OUString( - "Readonly property can't be set: " ) - + rPropertyName ), - uno::Reference< drawing::XShape >( this ) ); + if (pMap && pMap->nWID) + { + // FIXME: We should throw a UnknownPropertyException here. + // But since this class is aggregated from classes that + // support additional properties that we don't know here we + // silently store *all* properties, even if they may be not + // supported after creation. + mpPropSet->setPropertyValue( pMap, rVal ); + } + return; + } - mpModel->SetChanged(); + if (!pMap) + throw beans::UnknownPropertyException(); - if(!setPropertyValueImpl( rPropertyName, pMap, rVal ) ) - { - DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" ); - DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" ); + if ((pMap->nFlags & beans::PropertyAttribute::READONLY) != 0) + throw beans::PropertyVetoException( + OUString("Readonly property can't be set: ") + rPropertyName, + uno::Reference<drawing::XShape>(this)); - bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION; + mpModel->SetChanged(); - if( pMap->nWID == SDRATTR_ECKENRADIUS ) - { - sal_Int32 nCornerRadius = 0; - if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000)) - throw IllegalArgumentException(); - } + if (setPropertyValueImpl(rPropertyName, pMap, rVal)) + return; - SfxItemSet* pSet; - if( mbIsMultiPropertyCall && !bIsNotPersist ) - { - if( mpImpl->mpItemSet == NULL ) - { - pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone(); - } - else - { - pSet = mpImpl->mpItemSet; - } - } - else - { - pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); - } + DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST, "Not persist item not handled!" ); + DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" ); - if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) - pSet->Put(mpObj->GetMergedItem(pMap->nWID)); + bool bIsNotPersist = pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST && pMap->nWID != SDRATTR_TEXTDIRECTION; - if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet )) - { - if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) - { - if(bIsNotPersist) - { - // Not-Persistent Attribute, hole diese extra - mpObj->TakeNotPersistAttr(*pSet, false); - } - } + if( pMap->nWID == SDRATTR_ECKENRADIUS ) + { + sal_Int32 nCornerRadius = 0; + if( !(rVal >>= nCornerRadius) || (nCornerRadius < 0) || (nCornerRadius > 5000000)) + throw IllegalArgumentException(); + } - if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) - { - // Default aus ItemPool holen - if(SfxItemPool::IsWhich(pMap->nWID)) - pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID)); - } + SfxItemSet* pSet; + if( mbIsMultiPropertyCall && !bIsNotPersist ) + { + if( mpImpl->mpItemSet == NULL ) + { + pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone(); + } + else + { + pSet = mpImpl->mpItemSet; + } + } + else + { + pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); + } - if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET ) - { - SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet ); - } - } + if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) + pSet->Put(mpObj->GetMergedItem(pMap->nWID)); + if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, rVal, *pSet )) + { + if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) + { if(bIsNotPersist) { - // Not-Persist Attribute extra setzen - mpObj->ApplyNotPersistAttr( *pSet ); - delete pSet; + // Not-Persistent Attribute, hole diese extra + mpObj->TakeNotPersistAttr(*pSet, false); } - else - { - // if we have a XMultiProperty call then the item set - // will be set in setPropertyValues later - if( !mbIsMultiPropertyCall ) - { - mpObj->SetMergedItemSetAndBroadcast( *pSet ); + } - delete pSet; - } - } - return; + if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) + { + // Default aus ItemPool holen + if(SfxItemPool::IsWhich(pMap->nWID)) + pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID)); + } + + if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET ) + { + SvxItemPropertySet_setPropertyValue( *mpPropSet, pMap, rVal, *pSet ); } } + + if(bIsNotPersist) + { + // Not-Persist Attribute extra setzen + mpObj->ApplyNotPersistAttr( *pSet ); + delete pSet; + } else { - // since we have no actual sdr object right now - // remember all properties in a list. These - // properties will be set when the sdr object is - // created + // if we have a XMultiProperty call then the item set + // will be set in setPropertyValues later + if( !mbIsMultiPropertyCall ) + { + mpObj->SetMergedItemSetAndBroadcast( *pSet ); - if(pMap && pMap->nWID) -// Fixme: We should throw a UnknownPropertyException here. -// But since this class is aggregated from classes -// that support additional properties that we don't -// know here we silently store *all* properties, even -// if they may be not supported after creation - mpPropSet->setPropertyValue( pMap, rVal ); + delete pSet; + } } } |