[Libreoffice-commits] core.git: include/svx sd/source svx/source

Stephan Bergmann sbergman at redhat.com
Tue Aug 5 14:04:35 PDT 2014


 include/svx/svdobj.hxx                              |    2 -
 sd/source/ui/dlg/morphdlg.cxx                       |    6 ++---
 sd/source/ui/func/fumorph.cxx                       |    4 +--
 svx/source/sdr/properties/customshapeproperties.cxx |    2 -
 svx/source/sdr/properties/defaultproperties.cxx     |    8 +++----
 svx/source/sdr/properties/emptyproperties.cxx       |    2 -
 svx/source/sdr/properties/pageproperties.cxx        |    2 -
 svx/source/svdraw/svdoattr.cxx                      |    4 +--
 svx/source/svdraw/svdobj.cxx                        |   22 ++++----------------
 svx/source/svdraw/svdogrp.cxx                       |    4 +--
 10 files changed, 22 insertions(+), 34 deletions(-)

New commits:
commit 42172ea6478023d94d4f76f3b525180d2ff25695
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 5 23:04:07 2014 +0200

    Let GetObjectItemPool return a reference
    
    Change-Id: Ibbcfa3452afcf88dbb6050765e081a1be2381334

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 6dfc816..3eac84f 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -467,7 +467,7 @@ public:
 
     virtual void SetModel(SdrModel* pNewModel);
     SdrModel* GetModel() const { return pModel;}
-    SfxItemPool* GetObjectItemPool() const;
+    SfxItemPool & GetObjectItemPool() const;
 
     void AddListener(SfxListener& rListener);
     void RemoveListener(SfxListener& rListener);
diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx
index f8895e2..301ef79 100644
--- a/sd/source/ui/dlg/morphdlg.cxx
+++ b/sd/source/ui/dlg/morphdlg.cxx
@@ -44,9 +44,9 @@ MorphDlg::MorphDlg( ::Window* pParent, const SdrObject* pObj1, const SdrObject*
 
     LoadSettings();
 
-    SfxItemPool*    pPool = (SfxItemPool*) pObj1->GetObjectItemPool();
-    SfxItemSet      aSet1( *pPool );
-    SfxItemSet      aSet2( *pPool );
+    SfxItemPool & pPool = pObj1->GetObjectItemPool();
+    SfxItemSet      aSet1( pPool );
+    SfxItemSet      aSet2( pPool );
 
     aSet1.Put(pObj1->GetMergedItemSet());
     aSet2.Put(pObj2->GetMergedItemSet());
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 5aa763a..272a95d 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -342,8 +342,8 @@ void FuMorph::ImpInsertPolygons(
     long                nStartLineWidth = 0;
     long                nEndLineWidth = 0;
     SdrPageView*        pPageView = mpView->GetSdrPageView();
-    SfxItemPool*        pPool = pObj1->GetObjectItemPool();
-    SfxItemSet          aSet1( *pPool,SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,EE_ITEMS_START,EE_ITEMS_END,0 );
+    SfxItemPool &       pPool = pObj1->GetObjectItemPool();
+    SfxItemSet          aSet1( pPool,SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,EE_ITEMS_START,EE_ITEMS_END,0 );
     SfxItemSet          aSet2( aSet1 );
     bool            bLineColor = false;
     bool            bFillColor = false;
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
index 97d4921..716dfb5 100644
--- a/svx/source/sdr/properties/customshapeproperties.cxx
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -109,7 +109,7 @@ namespace sdr
                     TextProperties::ClearObjectItemDirect( nWhich2 );
                     nWhich2 = aIter.NextWhich();
                 }
-                SfxItemSet aSet((SfxItemPool&)(*GetSdrObject().GetObjectItemPool()));
+                SfxItemSet aSet(GetSdrObject().GetObjectItemPool());
                 ItemSetChanged(aSet);
             }
             else
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
index 47b32c6..a7d60a4 100644
--- a/svx/source/sdr/properties/defaultproperties.cxx
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -81,7 +81,7 @@ namespace sdr
         {
             if(!mpItemSet)
             {
-                ((DefaultProperties*)this)->mpItemSet = &(((DefaultProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+                ((DefaultProperties*)this)->mpItemSet = &(((DefaultProperties*)this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
                 ((DefaultProperties*)this)->ForceDefaultAttributes();
             }
 
@@ -99,7 +99,7 @@ namespace sdr
                 ItemChange(nWhichID, &rItem);
                 PostItemChange(nWhichID);
 
-                SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID);
+                SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID);
                 aSet.Put(rItem);
                 ItemSetChanged(aSet);
             }
@@ -124,7 +124,7 @@ namespace sdr
 
                 if(nWhich)
                 {
-                    SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0);
+                    SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0);
                     ItemSetChanged(aSet);
                 }
             }
@@ -145,7 +145,7 @@ namespace sdr
             const SfxPoolItem *pPoolItem;
             std::vector< sal_uInt16 > aPostItemChangeList;
             bool bDidChange(false);
-            SfxItemSet aSet(*GetSdrObject().GetObjectItemPool(), SDRATTR_START, EE_ITEMS_END);
+            SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), SDRATTR_START, EE_ITEMS_END);
 
             // give a hint to STL_Vector
             aPostItemChangeList.reserve(rSet.Count());
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
index 6c76e62..a13036c 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -71,7 +71,7 @@ namespace sdr
         {
             if(!mpEmptyItemSet)
             {
-                ((EmptyProperties*)this)->mpEmptyItemSet = &(((EmptyProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+                ((EmptyProperties*)this)->mpEmptyItemSet = &(((EmptyProperties*)this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
             }
 
             DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
index ece177a..fd8a71d 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -60,7 +60,7 @@ namespace sdr
         {
             if(!mpEmptyItemSet)
             {
-                ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
+                ((PageProperties*)this)->mpEmptyItemSet = &(((PageProperties*)this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
             }
 
             DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx
index 0ecea69..24146a18 100644
--- a/svx/source/svdraw/svdoattr.cxx
+++ b/svx/source/svdraw/svdoattr.cxx
@@ -107,9 +107,9 @@ void SdrAttrObj::SetModel(SdrModel* pNewModel)
     SdrModel* pOldModel = pModel;
 
     // test for correct pool in ItemSet; move to new pool if necessary
-    if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
+    if(pNewModel && &GetObjectItemPool() != &pNewModel->GetItemPool())
     {
-        MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
+        MigrateItemPool(&GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
     }
 
     // call parent
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 39d20d5..9ab9a97 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -614,13 +614,13 @@ SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool()
     return *mpGlobalItemPool;
 }
 
-SfxItemPool* SdrObject::GetObjectItemPool() const
+SfxItemPool & SdrObject::GetObjectItemPool() const
 {
     if(pModel)
-        return &pModel->GetItemPool();
+        return pModel->GetItemPool();
 
     // use a static global default pool
-    return &SdrObject::GetGlobalDrawObjectItemPool();
+    return SdrObject::GetGlobalDrawObjectItemPool();
 }
 
 sal_uInt32 SdrObject::GetObjInventor()   const
@@ -1214,7 +1214,7 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const
             }
         }
 
-        SfxItemSet aNewSet(*GetObjectItemPool());
+        SfxItemSet aNewSet(GetObjectItemPool());
 
         // #i101980# ignore LineWidth; that's what the old implementation
         // did. With line width, the result may be huge due to fat/thick
@@ -2093,19 +2093,7 @@ const SfxPoolItem& SdrObject::GetObjectItem(const sal_uInt16 nWhich) const
 
 SfxMapUnit SdrObject::GetObjectMapUnit() const
 {
-    SfxMapUnit aRetval(SFX_MAPUNIT_100TH_MM);
-    SfxItemPool* pPool = GetObjectItemPool();
-
-    if(pPool)
-    {
-        aRetval = pPool->GetMetric(0);
-    }
-    else
-    {
-        OSL_ENSURE(pPool, "SdrObjects always need a pool (!)");
-    }
-
-    return aRetval;
+    return GetObjectItemPool().GetMetric(0);
 }
 
 const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 3c30b4d..4185458 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -200,9 +200,9 @@ void SdrObjGroup::SetModel(SdrModel* pNewModel)
         SdrModel* pOldModel = pModel;
 
         // test for correct pool in ItemSet; move to new pool if necessary
-        if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
+        if(pNewModel && &GetObjectItemPool() != &pNewModel->GetItemPool())
         {
-            MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
+            MigrateItemPool(&GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
         }
 
         // call parent


More information about the Libreoffice-commits mailing list