include/svx/sdr/properties/properties.hxx |   11 +
 svx/source/sdr/properties/properties.cxx  |   10 +
 svx/source/unodraw/unoshape.cxx           |  167 ++++++++++++++----------------
 3 files changed, 98 insertions(+), 90 deletions(-)

New commits:
commit 808817a27a7cb43a164dab71838132950bb6025d
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Oct 24 15:23:58 2014 -0400

    Make this member private. Nobody accesses it directly.
    
    Change-Id: Id00917198bda71eb80768526375eb83ba46dba11

diff --git a/include/svx/sdr/properties/properties.hxx 
b/include/svx/sdr/properties/properties.hxx
index 4b7e6f2..f0c1065 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -50,19 +50,20 @@ namespace sdr
     {
         class SVX_DLLPUBLIC BaseProperties
         {
-        protected:
+        private:
             // the owner of this Properties. Set from constructor and not
             // to be changed in any way.
             SdrObject&                                      mrObject;
 
+        protected:
+
             // create a new object specific itemset with object specific 
ranges.
             virtual SfxItemSet* CreateObjectSpecificItemSet(SfxItemPool& 
pPool) = 0;
 
             // internal access to SdrObject
-            SdrObject& GetSdrObject() const
-            {
-                return mrObject;
-            }
+            const SdrObject& GetSdrObject() const;
+
+            SdrObject& GetSdrObject();
 
             // Test changeability for a single item. If a implementation wants 
to prevent
             // changing an item this method may be overloaded.
diff --git a/svx/source/sdr/properties/properties.cxx 
b/svx/source/sdr/properties/properties.cxx
index 5865948..e705fd4 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -44,6 +44,16 @@ namespace sdr
         {
         }
 
+        const SdrObject& BaseProperties::GetSdrObject() const
+        {
+            return mrObject;
+        }
+
+        SdrObject& BaseProperties::GetSdrObject()
+        {
+            return mrObject;
+        }
+
         const SfxItemSet& BaseProperties::GetMergedItemSet() const
         {
             // default implementation falls back to GetObjectItemSet()
commit d425dce58875bfa3673c87dda09db8c7aa73a16d
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Oct 24 14:41:45 2014 -0400

    Scope reduction by early bailout.
    
    Change-Id: I3a5c944d6ed863c347da03e0a60ff653232b3e72

diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index c3d17a5..e14c892 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;
+        }
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to