You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/03/20 17:37:21 UTC

svn commit: r1458937 - in /openoffice/branches/sidebar/main/svx: inc/svx/svdobj.hxx source/svdraw/svdoashp.cxx source/svdraw/svdobj.cxx source/svdraw/svdopath.cxx source/svdraw/svdotext.cxx

Author: alg
Date: Wed Mar 20 16:37:20 2013
New Revision: 1458937

URL: http://svn.apache.org/r1458937
Log:
i121788 Avoided assertion (GroupProperties::GetObjectItemSet() should never be called) by adding a better method to get the SfxMapUnit from a SdrObject

Modified:
    openoffice/branches/sidebar/main/svx/inc/svx/svdobj.hxx
    openoffice/branches/sidebar/main/svx/source/svdraw/svdoashp.cxx
    openoffice/branches/sidebar/main/svx/source/svdraw/svdobj.cxx
    openoffice/branches/sidebar/main/svx/source/svdraw/svdopath.cxx
    openoffice/branches/sidebar/main/svx/source/svdraw/svdotext.cxx

Modified: openoffice/branches/sidebar/main/svx/inc/svx/svdobj.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/inc/svx/svdobj.hxx?rev=1458937&r1=1458936&r2=1458937&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/inc/svx/svdobj.hxx (original)
+++ openoffice/branches/sidebar/main/svx/inc/svx/svdobj.hxx Wed Mar 20 16:37:20 2013
@@ -40,6 +40,7 @@
 #include <svx/sdrobjectuser.hxx>
 #include "svx/svxdllapi.h"
 #include "svx/shapeproperty.hxx"
+#include <svl/poolitem.hxx>
 
 //************************************************************
 //   Vorausdeklarationen
@@ -855,6 +856,9 @@ protected:
 	void SetObjectItemSet(const SfxItemSet& rSet);
 	const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
 
+    // get SfxMapUnit the object is using
+    SfxMapUnit GetObjectMapUnit() const;
+
 public:
 	// syntactical sugar for ItemSet accesses
 	void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, sal_Bool bClearAllItems = sal_False);

Modified: openoffice/branches/sidebar/main/svx/source/svdraw/svdoashp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/svdraw/svdoashp.cxx?rev=1458937&r1=1458936&r2=1458937&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/svdraw/svdoashp.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/svdraw/svdoashp.cxx Wed Mar 20 16:37:20 2013
@@ -3314,7 +3314,7 @@ void SdrObjCustomShape::TRSetBaseGeometr
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3460,7 +3460,7 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeo
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)

Modified: openoffice/branches/sidebar/main/svx/source/svdraw/svdobj.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/svdraw/svdobj.cxx?rev=1458937&r1=1458936&r2=1458937&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/svdraw/svdobj.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/svdraw/svdobj.cxx Wed Mar 20 16:37:20 2013
@@ -2030,6 +2030,23 @@ const SfxPoolItem& SdrObject::GetObjectI
 	return GetObjectItemSet().Get(nWhich);
 }
 
+SfxMapUnit SdrObject::GetObjectMapUnit() const
+{
+    SfxMapUnit aRetval(SFX_MAPUNIT_100TH_MM);
+    SdrItemPool* pPool = GetObjectItemPool();
+
+    if(pPool)
+    {
+        aRetval = pPool->GetMetric(0);
+    }
+    else
+    {
+        OSL_ENSURE(pPool, "SdrObjects always need a pool (!)");
+    }
+
+    return aRetval;
+}
+
 const SfxPoolItem& SdrObject::GetMergedItem(const sal_uInt16 nWhich) const
 {
 	return GetMergedItemSet().Get(nWhich);
@@ -3010,7 +3027,7 @@ sal_Bool SdrObject::TRGetBaseGeometry(ba
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3061,7 +3078,7 @@ void SdrObject::TRSetBaseGeometry(const 
 	}
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)

Modified: openoffice/branches/sidebar/main/svx/source/svdraw/svdopath.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/svdraw/svdopath.cxx?rev=1458937&r1=1458936&r2=1458937&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/svdraw/svdopath.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/svdraw/svdopath.cxx Wed Mar 20 16:37:20 2013
@@ -2962,7 +2962,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(b
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -3032,7 +3032,7 @@ void SdrPathObj::TRSetBaseGeometry(const
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)

Modified: openoffice/branches/sidebar/main/svx/source/svdraw/svdotext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/svdraw/svdotext.cxx?rev=1458937&r1=1458936&r2=1458937&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/svdraw/svdotext.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/svdraw/svdotext.cxx Wed Mar 20 16:37:20 2013
@@ -1710,7 +1710,7 @@ sal_Bool SdrTextObj::TRGetBaseGeometry(b
 	}
 
 	// force MapUnit to 100th mm
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)
@@ -1772,7 +1772,7 @@ void SdrTextObj::TRSetBaseGeometry(const
 	aGeo.RecalcTan();
 
 	// force metric to pool metric
-	SfxMapUnit eMapUnit = GetObjectItemSet().GetPool()->GetMetric(0);
+	const SfxMapUnit eMapUnit(GetObjectMapUnit());
 	if(eMapUnit != SFX_MAPUNIT_100TH_MM)
 	{
 		switch(eMapUnit)