incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1347716 [4/6] - in /incubator/ooo/branches/alg/aw080/main: basctl/source/dlged/ basctl/source/inc/ chart2/source/controller/main/ cui/source/tabpages/ filter/source/msfilter/ reportdesign/source/core/sdr/ reportdesign/source/ui/inc/ report...
Date Thu, 07 Jun 2012 17:08:12 GMT
Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdocirc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdocirc.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdocirc.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdocirc.cxx Thu Jun  7 17:08:07 2012
@@ -118,14 +118,14 @@ namespace
     }
 
 	basegfx::B2DPolygon ImpCalcXPolyCirc(
-		const SdrObjKind eCicrleKind, 
+		const SdrCircleObjType eSdrCircleObjType, 
 		const basegfx::B2DHomMatrix& rTransform, 
 		double fStart, 
 		double fEnd)
 	{
 		basegfx::B2DPolygon aCircPolygon;
 
-		if(OBJ_CIRC == eCicrleKind || basegfx::fTools::equal(fStart, fEnd))
+		if(CircleType_Circle == eSdrCircleObjType || basegfx::fTools::equal(fStart, fEnd))
         {
 			// create full circle. Do not use createPolygonFromEllipse; it's necessary 
 			// to get the start point to the bottom of the circle to keep compatible to 
@@ -141,8 +141,8 @@ namespace
 			aCircPolygon = basegfx::tools::createPolygonFromUnitEllipseSegment(fEnd, fStart);
 
 			// check closing states
-			const bool bCloseSegment(OBJ_CARC != eCicrleKind);
-			const bool bCloseUsingCenter(OBJ_SECT == eCicrleKind);
+			const bool bCloseSegment(CircleType_Arc != eSdrCircleObjType);
+			const bool bCloseUsingCenter(CircleType_Sector == eSdrCircleObjType);
 
 			if(bCloseSegment)
             {
@@ -179,7 +179,7 @@ namespace
 class SdrCircObjGeoData : public SdrObjGeoData
 {
 public:
-    SdrObjKind					meCircleKind;	// OBJ_CIRC || OBJ_CCUT || OBJ_CARC || OBJ_SECT
+    SdrCircleObjType			meSdrCircleObjType;
 	double						mfStartAngle;	// [-F_PI .. F_PI]
 	double						mfEndAngle;		// [-F_PI .. F_PI]
 };
@@ -194,14 +194,14 @@ sdr::contact::ViewContact* SdrCircObj::C
 
 SdrCircObj::SdrCircObj(
 	SdrModel& rSdrModel,
-	SdrObjKind eNewKind, 
+	SdrCircleObjType eSdrCircleObjType, 
 	const basegfx::B2DHomMatrix& rTransform, 
 	double fNewStartWink, 
 	double fNewEndWink)
 :	SdrRectObj(
 		rSdrModel, 
 		rTransform),
-	meCircleKind(eNewKind),
+	meSdrCircleObjType(eSdrCircleObjType),
 	mfStartAngle(fNewStartWink),
 	mfEndAngle(fNewEndWink)
 {
@@ -215,13 +215,6 @@ SdrCircObj::SdrCircObj(
     {
 		mfEndAngle = basegfx::snapToZeroRange(mfEndAngle, F_2PI);
     }
-
-	// ensure (and correct) circle kind
-	if(!(OBJ_CIRC == meCircleKind || OBJ_CCUT == meCircleKind || OBJ_CARC == meCircleKind || OBJ_SECT == meCircleKind))
-    {
-		OSL_ENSURE(false, "SdrCircObj::SdrCircObj with wrong SdrObjKind (!)");
-		meCircleKind = OBJ_CIRC;
-	}
 }
 
 SdrCircObj::~SdrCircObj()
@@ -240,7 +233,7 @@ void SdrCircObj::copyDataFromSdrObject(c
 			SdrRectObj::copyDataFromSdrObject(rSource);
 
 			// copy local data
-			meCircleKind = pSource->meCircleKind;
+			meSdrCircleObjType = pSource->meSdrCircleObjType;
 			mfStartAngle = pSource->mfStartAngle;
 			mfEndAngle = pSource->mfEndAngle;
 		}
@@ -263,7 +256,7 @@ SdrObject* SdrCircObj::CloneSdrObject(Sd
 
 bool SdrCircObj::IsClosedObj() const
 {
-	return (OBJ_CARC != meCircleKind);
+	return (CircleType_Arc != meSdrCircleObjType);
 }
 
 double SdrCircObj::GetStartAngle() const 
@@ -276,41 +269,44 @@ double SdrCircObj::GetEndAngle() const 
 	return mfEndAngle; 
 }
 
-SdrObjKind SdrCircObj::GetCircleKind() const 
+SdrCircleObjType SdrCircObj::GetSdrCircleObjType() const 
 { 
-	return meCircleKind; 
+	return meSdrCircleObjType; 
 }
 
-void SdrCircObj::SetStartAngle(double fNew)
+void SdrCircObj::SetSdrCircleObjType(SdrCircleObjType eNew)
 {
-	fNew = basegfx::snapToZeroRange(fNew, F_2PI);
-
-	if(!basegfx::fTools::equal(fNew, mfStartAngle))
+	if(eNew != meSdrCircleObjType)
 	{
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-		mfStartAngle = fNew;
+
+        meSdrCircleObjType = eNew;
 		SetChanged();
 	}
 }
 
-void SdrCircObj::SetEndAngle(double fNew)
+void SdrCircObj::SetStartAngle(double fNew)
 {
 	fNew = basegfx::snapToZeroRange(fNew, F_2PI);
 
-	if(!basegfx::fTools::equal(fNew, mfEndAngle))
+	if(!basegfx::fTools::equal(fNew, mfStartAngle))
 	{
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-		mfEndAngle = fNew;
+		
+        mfStartAngle = fNew;
 		SetChanged();
 	}
 }
 
-void SdrCircObj::SetCircleKind(SdrObjKind eNew)
+void SdrCircObj::SetEndAngle(double fNew)
 {
-	if(eNew != meCircleKind && (OBJ_CIRC == eNew || OBJ_CCUT == eNew || OBJ_CARC == eNew || OBJ_SECT == eNew))
+	fNew = basegfx::snapToZeroRange(fNew, F_2PI);
+
+	if(!basegfx::fTools::equal(fNew, mfEndAngle))
 	{
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-		meCircleKind = eNew;
+		
+        mfEndAngle = fNew;
 		SetChanged();
 	}
 }
@@ -327,7 +323,7 @@ void SdrCircObj::TakeObjInfo(SdrObjTrans
 
 sal_uInt16 SdrCircObj::GetObjIdentifier() const
 {
-	return sal_uInt16(meCircleKind);
+	return sal_uInt16(OBJ_CIRC);
 }
 
 void SdrCircObj::TakeObjNameSingul(XubString& rName) const
@@ -338,31 +334,64 @@ void SdrCircObj::TakeObjNameSingul(XubSt
 
 	if(bOrthoScaled && !isSheared())
 	{		
-		switch (meCircleKind) 
+		switch (meSdrCircleObjType) 
 		{
-			case OBJ_CIRC: nID=STR_ObjNameSingulCIRC; break;
-			case OBJ_SECT: nID=STR_ObjNameSingulSECT; break;
-			case OBJ_CARC: nID=STR_ObjNameSingulCARC; break;
-			case OBJ_CCUT: nID=STR_ObjNameSingulCCUT; break;
+			case CircleType_Circle: 
+            {
+                nID = STR_ObjNameSingulCIRC; 
+                break;
+            }
+			case CircleType_Sector: 
+            {
+                nID = STR_ObjNameSingulSECT; 
+                break;
+            }
+			case CircleType_Arc: 
+            {
+                nID = STR_ObjNameSingulCARC; 
+                break;
+            }
+			case CircleType_Segment: 
+            {
+                nID = STR_ObjNameSingulCCUT; 
+                break;
+            }
 			default: break;
 		}
 	} 
 	else 
 	{
-		switch (meCircleKind) 
+		switch (meSdrCircleObjType) 
 		{
-			case OBJ_CIRC: nID=STR_ObjNameSingulCIRCE; break;
-			case OBJ_SECT: nID=STR_ObjNameSingulSECTE; break;
-			case OBJ_CARC: nID=STR_ObjNameSingulCARCE; break;
-			case OBJ_CCUT: nID=STR_ObjNameSingulCCUTE; break;
+			case CircleType_Circle: 
+            {
+                nID = STR_ObjNameSingulCIRCE; 
+                break;
+            }
+			case CircleType_Sector: 
+            {
+                nID = STR_ObjNameSingulSECTE; 
+                break;
+            }
+			case CircleType_Arc: 
+            {
+                nID = STR_ObjNameSingulCARCE; 
+                break;
+            }
+			case CircleType_Segment: 
+            {
+                nID = STR_ObjNameSingulCCUTE; 
+                break;
+            }
 			default: break;
 		}
 	}
 
-	rName=ImpGetResStr(nID);
+	rName = ImpGetResStr(nID);
 
 	String aName( GetName() );
-	if(aName.Len())
+
+    if(aName.Len())
 	{
 		rName += sal_Unicode(' ');
 		rName += sal_Unicode('\'');
@@ -379,35 +408,67 @@ void SdrCircObj::TakeObjNamePlural(XubSt
 
 	if(bOrthoScaled && !isSheared())
 	{
-		switch (meCircleKind) 
+		switch (meSdrCircleObjType) 
 		{
-			case OBJ_CIRC: nID=STR_ObjNamePluralCIRC; break;
-			case OBJ_SECT: nID=STR_ObjNamePluralSECT; break;
-			case OBJ_CARC: nID=STR_ObjNamePluralCARC; break;
-			case OBJ_CCUT: nID=STR_ObjNamePluralCCUT; break;
+			case CircleType_Circle: 
+            {
+                nID = STR_ObjNamePluralCIRC; 
+                break;
+            }
+			case CircleType_Sector: 
+            {
+                nID = STR_ObjNamePluralSECT; 
+                break;
+            }
+			case CircleType_Arc: 
+            {
+                nID = STR_ObjNamePluralCARC; 
+                break;
+            }
+			case CircleType_Segment: 
+            {
+                nID = STR_ObjNamePluralCCUT; 
+                break;
+            }
 			default: break;
 		}
 	} 
 	else 
 	{
-		switch (meCircleKind) 
+		switch (meSdrCircleObjType) 
 		{
-			case OBJ_CIRC: nID=STR_ObjNamePluralCIRCE; break;
-			case OBJ_SECT: nID=STR_ObjNamePluralSECTE; break;
-			case OBJ_CARC: nID=STR_ObjNamePluralCARCE; break;
-			case OBJ_CCUT: nID=STR_ObjNamePluralCCUTE; break;
+			case CircleType_Circle: 
+            {
+                nID = STR_ObjNamePluralCIRCE; 
+                break;
+            }
+			case CircleType_Sector: 
+            {
+                nID = STR_ObjNamePluralSECTE; 
+                break;
+            }
+			case CircleType_Arc: 
+            {
+                nID = STR_ObjNamePluralCARCE; 
+                break;
+            }
+			case CircleType_Segment: 
+            {
+                nID = STR_ObjNamePluralCCUTE; 
+                break;
+            }
 			default: break;
 		}
 	}
 
-	rName=ImpGetResStr(nID);
+	rName = ImpGetResStr(nID);
 }
 
 basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const
 {
 	const basegfx::B2DPolygon aCircPolygon(
 		ImpCalcXPolyCirc(
-			GetCircleKind(),
+			GetSdrCircleObjType(),
 			getSdrObjectTransformation(), 
 			GetStartAngle(), 
 			GetEndAngle()));
@@ -417,7 +478,7 @@ basegfx::B2DPolyPolygon SdrCircObj::Take
 
 void SdrCircObj::AddToHdlList(SdrHdlList& rHdlList) const
 {
-	if(OBJ_CIRC != meCircleKind) 
+	if(CircleType_Circle != meSdrCircleObjType) 
 	{
 		// start angle handle
 		basegfx::B2DPoint aStart(0.5 + (cos(GetStartAngle()) * 0.5), 0.5 + (sin(GetStartAngle()) * 0.5));
@@ -508,7 +569,7 @@ String SdrCircObj::getSpecialDragComment
 		TakeMarkedDescriptionString(STR_ViewCreateObj, aStr);
 		const sal_uInt32 nPntAnz(rDrag.GetPointAnz());
 
-		if(OBJ_CIRC != meCircleKind && nPntAnz > 2)
+		if(CircleType_Circle != meSdrCircleObjType && nPntAnz > 2)
 		{
 			double fWink(0.0);
 
@@ -582,10 +643,10 @@ bool SdrCircObj::EndCreate(SdrDragStat& 
 
 	if(SDRCREATE_FORCEEND == eCmd && nPntAnz < 4) 
     {
-		meCircleKind = OBJ_CIRC;
+		meSdrCircleObjType = CircleType_Circle;
     }
 
-	if(OBJ_CIRC == meCircleKind) 
+	if(CircleType_Circle == meSdrCircleObjType) 
     {
 		bRet = (nPntAnz >= 2);
 
@@ -621,7 +682,7 @@ bool SdrCircObj::BckCreate(SdrDragStat& 
 	rStat.SetNoSnap(nPntAnz >= 3);
 	rStat.SetOrtho4Possible(nPntAnz < 3);
 
-	return (OBJ_CIRC != meCircleKind);
+	return (CircleType_Circle != meSdrCircleObjType);
 }
 
 basegfx::B2DPolyPolygon SdrCircObj::TakeCreatePoly(const SdrDragStat& rDrag) const
@@ -630,10 +691,10 @@ basegfx::B2DPolyPolygon SdrCircObj::Take
 
 	if(nPntAnz < 4)
 	{
-		// force to OBJ_CIRC to get full visualisation
+		// force to CircleType_Circle to get full visualisation
 		basegfx::B2DPolyPolygon aRetval(
 			ImpCalcXPolyCirc(
-				OBJ_CIRC, 
+				CircleType_Circle, 
 				getSdrObjectTransformation(), 
 				0.0, 
 				0.0));
@@ -656,7 +717,7 @@ basegfx::B2DPolyPolygon SdrCircObj::Take
 	{
 		return basegfx::B2DPolyPolygon(
 			ImpCalcXPolyCirc(
-				GetCircleKind(),
+				GetSdrCircleObjType(),
 				getSdrObjectTransformation(), 
 				GetStartAngle(), 
 				GetEndAngle()));
@@ -665,12 +726,12 @@ basegfx::B2DPolyPolygon SdrCircObj::Take
 
 Pointer SdrCircObj::GetCreatePointer(const SdrView& /*rSdrView*/) const
 {
-	switch (meCircleKind) 
+	switch (meSdrCircleObjType) 
     {
-		case OBJ_CIRC: return Pointer(POINTER_DRAW_ELLIPSE);
-		case OBJ_SECT: return Pointer(POINTER_DRAW_PIE);
-		case OBJ_CARC: return Pointer(POINTER_DRAW_ARC);
-		case OBJ_CCUT: return Pointer(POINTER_DRAW_CIRCLECUT);
+		case CircleType_Circle: return Pointer(POINTER_DRAW_ELLIPSE);
+		case CircleType_Sector: return Pointer(POINTER_DRAW_PIE);
+		case CircleType_Arc: return Pointer(POINTER_DRAW_ARC);
+		case CircleType_Segment: return Pointer(POINTER_DRAW_CIRCLECUT);
 		default: break;
     }
 
@@ -689,7 +750,7 @@ void SdrCircObj::SaveGeoData(SdrObjGeoDa
 
 	if(pCGeo)
 	{
-		pCGeo->meCircleKind = GetCircleKind();
+		pCGeo->meSdrCircleObjType = GetSdrCircleObjType();
 		pCGeo->mfStartAngle = GetStartAngle();
 		pCGeo->mfEndAngle = GetEndAngle();
 	}
@@ -702,7 +763,7 @@ void SdrCircObj::RestGeoData(const SdrOb
 
 	if(pCGeo)
     {
-		SetCircleKind(pCGeo->meCircleKind);
+		SetSdrCircleObjType(pCGeo->meSdrCircleObjType);
 		SetStartAngle(pCGeo->mfStartAngle);
 		SetEndAngle(pCGeo->mfEndAngle);
 	}
@@ -710,7 +771,7 @@ void SdrCircObj::RestGeoData(const SdrOb
 
 sal_uInt32 SdrCircObj::GetSnapPointCount() const
 {
-	if(OBJ_CIRC == meCircleKind) 
+	if(CircleType_Circle == meSdrCircleObjType) 
     {
 		return 1;
     }
@@ -748,10 +809,10 @@ basegfx::B2DPoint SdrCircObj::GetSnapPoi
 
 SdrObject* SdrCircObj::DoConvertToPolygonObject(bool bBezier, bool bAddText) const
 {
-	const bool bCanBeFilled(OBJ_CARC != meCircleKind);
+	const bool bCanBeFilled(CircleType_Arc != meSdrCircleObjType);
 	const basegfx::B2DPolygon aCircPolygon(
 		ImpCalcXPolyCirc(
-			GetCircleKind(),
+			GetSdrCircleObjType(),
 			getSdrObjectTransformation(), 
 			GetStartAngle(), 
 			GetEndAngle()));

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdomeas.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdomeas.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdomeas.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdomeas.cxx Thu Jun  7 17:08:07 2012
@@ -1051,7 +1051,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
 
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 		pGroup->InsertObjectToSdrObjList(*pPath);
@@ -1068,7 +1068,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 
@@ -1079,7 +1079,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 
@@ -1097,7 +1097,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[0].getB2DPolygon());
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 
@@ -1108,7 +1108,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[1].getB2DPolygon());
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 
@@ -1122,7 +1122,7 @@ SdrObject* SdrMeasureObj::DoConvertToPol
 	{
 		aPolyPoly.clear();
 		aPolyPoly.append(aTmpPolyPolygon[nLoopStart].getB2DPolygon());
-		pPath = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPoly);
+		pPath = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPoly);
 		pPath->SetMergedItemSet(aSet);
         pPath->SetStyleSheet(pStyleSheet, true);
 

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx Thu Jun  7 17:08:07 2012
@@ -160,7 +160,7 @@ ImpSdrPathDragData::ImpSdrPathDragData(c
 	else
 	{
 		bValid = false;
-		bClosed=rPO.IsClosed();          // geschlossenes Objekt?
+		bClosed=rPO.isClosed();          // geschlossenes Objekt?
 		nPoly=(sal_uInt16)rHdl.GetPolyNum();            // Nummer des Polygons im PolyPolygon
 		nPnt=(sal_uInt16)rHdl.GetPointNum();            // Punktnummer innerhalb des obigen Polygons
 		const XPolygon aTmpXP(rPO.getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(nPoly));
@@ -1626,83 +1626,93 @@ SdrPathObjGeoData::~SdrPathObjGeoData()
 //////////////////////////////////////////////////////////////////////////////
 // DrawContact section
 
-bool ImpIsLine(const basegfx::B2DPolyPolygon& rPolyPolygon)
-{
-	return (1L == rPolyPolygon.count() && 2L == rPolyPolygon.getB2DPolygon(0L).count());
-}
-
 void SdrPathObj::impAdaptTransformation()
 {
 	basegfx::B2DHomMatrix aHelpMatrix;
 
 	if(maPathPolygon.count())
 	{
-		// get range
-		basegfx::B2DRange aRange(maPathPolygon.getB2DRange());
-
-		if(!aRange.isEmpty())
-		{
-			// break up current transformation
-			basegfx::B2DTuple aScale;
-			basegfx::B2DTuple aTranslate;
-			double fRotate, fShearX;
-			getSdrObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
-
-			// to keep mirrorX, mirrorY, rotation and shear, create a transformation
-			// containing those values
-			if(basegfx::fTools::less(aScale.getX(), 0.0))
-			{
-				aHelpMatrix.scale(-1.0, 1.0);
-				aScale.setX(-1.0);
-			}
-
-			if(basegfx::fTools::less(aScale.getY(), 0.0))
-            {
-				aHelpMatrix.scale(1.0, -1.0);
-				aScale.setY(-1.0);
-            }
-
-			if(!basegfx::fTools::equalZero(fShearX))
-			{
-				aHelpMatrix.shearX(fShearX);
-			}
-
-			if(!basegfx::fTools::equalZero(fRotate))
-			{
-				aHelpMatrix.rotate(fRotate);
-			}
-
-			if(!aHelpMatrix.isIdentity())
-			{
-				// create inverse from it and back-transform polygon
-				basegfx::B2DPolyPolygon aBackTransformed(maPathPolygon);
-				basegfx::B2DHomMatrix aInverseHelpMatrix(aHelpMatrix);
-				aInverseHelpMatrix.invert();
-				aBackTransformed.transform(aInverseHelpMatrix);
+        if(isLine())
+        {
+            // create unit transformation so that (0,0) is 1st point and (1,0) is 2nd point
+            const basegfx::B2DPoint aPointA(maPathPolygon.getB2DPolygon(0).getB2DPoint(0));
+            const basegfx::B2DPoint aPointB(maPathPolygon.getB2DPolygon(0).getB2DPoint(1));
+            const basegfx::B2DVector aDelta(aPointB - aPointA);
+
+            aHelpMatrix = basegfx::tools::createScaleRotateTranslateB2DHomMatrix(
+                basegfx::B2DTuple(aDelta.getLength(), 0.0),
+                atan2(aDelta.getY(), aDelta.getX()),
+                aPointA);
+        }
+        else
+        {
+		    // get range
+		    basegfx::B2DRange aRange(maPathPolygon.getB2DRange());
 
-				// update range
-				aRange = aBackTransformed.getB2DRange();
+		    if(!aRange.isEmpty())
+		    {
+			    // break up current transformation
+			    basegfx::B2DTuple aScale;
+			    basegfx::B2DTuple aTranslate;
+			    double fRotate, fShearX;
+			    getSdrObjectTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
+
+			    // to keep mirrorX, mirrorY, rotation and shear, create a transformation
+			    // containing those values
+			    if(basegfx::fTools::less(aScale.getX(), 0.0))
+			    {
+				    aHelpMatrix.scale(-1.0, 1.0);
+				    aScale.setX(-1.0);
+			    }
 
-				// extract scale and translate. Transform topLeft from it back 
-				// to transformed state to get original topLeft (rotation center).
-				// Be careful not to delete mirrorings
-				aTranslate = aHelpMatrix * aRange.getMinimum();
-				aScale *= aRange.getRange();
-			}
-			else
-			{
-				// extract translate and scale straightforward
-				aTranslate = aRange.getMinimum();
-				aScale = aRange.getRange();
-			}
+			    if(basegfx::fTools::less(aScale.getY(), 0.0))
+                {
+				    aHelpMatrix.scale(1.0, -1.0);
+				    aScale.setY(-1.0);
+                }
 
-			// create new transformation
-			aHelpMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
-				aScale,
-				fShearX,
-				fRotate, 
-				aTranslate);
-		}
+			    if(!basegfx::fTools::equalZero(fShearX))
+			    {
+				    aHelpMatrix.shearX(fShearX);
+			    }
+
+			    if(!basegfx::fTools::equalZero(fRotate))
+			    {
+				    aHelpMatrix.rotate(fRotate);
+			    }
+
+			    if(!aHelpMatrix.isIdentity())
+			    {
+				    // create inverse from it and back-transform polygon
+				    basegfx::B2DPolyPolygon aBackTransformed(maPathPolygon);
+				    basegfx::B2DHomMatrix aInverseHelpMatrix(aHelpMatrix);
+				    aInverseHelpMatrix.invert();
+				    aBackTransformed.transform(aInverseHelpMatrix);
+
+				    // update range
+				    aRange = aBackTransformed.getB2DRange();
+
+				    // extract scale and translate. Transform topLeft from it back 
+				    // to transformed state to get original topLeft (rotation center).
+				    // Be careful not to delete mirrorings
+				    aTranslate = aHelpMatrix * aRange.getMinimum();
+				    aScale *= aRange.getRange();
+			    }
+			    else
+			    {
+				    // extract translate and scale straightforward
+				    aTranslate = aRange.getMinimum();
+				    aScale = aRange.getRange();
+			    }
+
+			    // create new transformation
+			    aHelpMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+				    aScale,
+				    fShearX,
+				    fRotate, 
+				    aTranslate);
+		    }
+        }
 	}
 
 	// set adapted transformation, but do not change the
@@ -1717,14 +1727,11 @@ sdr::contact::ViewContact* SdrPathObj::C
 
 SdrPathObj::SdrPathObj(
 	SdrModel& rSdrModel, 
-	SdrObjKind eNewKind, 
 	const basegfx::B2DPolyPolygon& rPathPoly)
 :	SdrTextObj(rSdrModel),
 	maPathPolygon(rPathPoly),
-	meKind(eNewKind),
 	mpDAC(0)
 {
-	ImpForceKind();
 	impAdaptTransformation();
 }
 
@@ -1757,8 +1764,7 @@ void SdrPathObj::copyDataFromSdrObject(c
 SdrObject* SdrPathObj::CloneSdrObject(SdrModel* pTargetModel) const
 {
 	SdrPathObj* pClone = new SdrPathObj(
-		pTargetModel ? *pTargetModel : getSdrModelFromSdrObject(),
-		meKind);
+		pTargetModel ? *pTargetModel : getSdrModelFromSdrObject());
 	OSL_ENSURE(pClone, "CloneSdrObject error (!)");
 	pClone->copyDataFromSdrObject(*this);
 
@@ -1767,48 +1773,18 @@ SdrObject* SdrPathObj::CloneSdrObject(Sd
 
 bool SdrPathObj::IsClosedObj() const
 {
-	return IsClosed();
+	return isClosed();
 }
 
-void SdrPathObj::ImpForceKind()
+void SdrPathObj::ImpSetClosed(bool bClose)
 {
-	if (meKind==OBJ_PATHPLIN) meKind=OBJ_PLIN;
-	if (meKind==OBJ_PATHPOLY) meKind=OBJ_POLY;
-
-	if(getB2DPolyPolygonInObjectCoordinates().areControlPointsUsed()) 
-	{
-		switch (meKind) 
-		{
-			case OBJ_LINE: meKind=OBJ_PATHLINE; break;
-			case OBJ_PLIN: meKind=OBJ_PATHLINE; break;
-			case OBJ_POLY: meKind=OBJ_PATHFILL; break;
-			default: break;
-		}
-	} 
-	else 
-	{
-		switch (meKind) 
-		{
-			case OBJ_PATHLINE: meKind=OBJ_PLIN; break;
-			case OBJ_FREELINE: meKind=OBJ_PLIN; break;
-			case OBJ_PATHFILL: meKind=OBJ_POLY; break;
-			case OBJ_FREEFILL: meKind=OBJ_POLY; break;
-			default: break;
-		}
-	}
-
-	if (meKind==OBJ_LINE && !ImpIsLine(getB2DPolyPolygonInObjectCoordinates())) meKind=OBJ_PLIN;
-	if (meKind==OBJ_PLIN && ImpIsLine(getB2DPolyPolygonInObjectCoordinates())) meKind=OBJ_LINE;
-
-	// #i75974# adapt polygon state to object type. This may include a reinterpretation
-	// of a closed geometry as open one, but with identical first and last point
-	for(sal_uInt32 a(0); a < getB2DPolyPolygonInObjectCoordinates().count(); a++)
+	for(sal_uInt32 a(0); a < maPathPolygon.count(); a++)
 	{
-		basegfx::B2DPolygon aCandidate(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(a));
+		basegfx::B2DPolygon aCandidate(maPathPolygon.getB2DPolygon(a));
 
-		if((bool)IsClosed() != aCandidate.isClosed())
+		if(bClose != aCandidate.isClosed())
 		{
-            // #i80213# really change polygon geometry; else e.g. the last point which
+            // really change polygon geometry; else e.g. the last point which
             // needs to be identical with the first one will be missing when opening
             // due to OBJ_PATH type
             if(aCandidate.isClosed())
@@ -1827,39 +1803,12 @@ void SdrPathObj::ImpForceKind()
 	}
 }
 
-void SdrPathObj::ImpSetClosed(sal_Bool bClose)
-{
-	if(bClose) 
-	{
-		switch (meKind) 
-		{
-			case OBJ_LINE    : meKind=OBJ_POLY;     break;
-			case OBJ_PLIN    : meKind=OBJ_POLY;     break;
-			case OBJ_PATHLINE: meKind=OBJ_PATHFILL; break;
-			case OBJ_FREELINE: meKind=OBJ_FREEFILL; break;
-			default: break;
-		}
-	} 
-	else 
-	{
-		switch (meKind) 
-		{
-			case OBJ_POLY    : meKind=OBJ_PLIN;     break;
-			case OBJ_PATHFILL: meKind=OBJ_PATHLINE; break;
-			case OBJ_FREEFILL: meKind=OBJ_FREELINE; break;
-			default: break;
-		}
-	}
-
-	ImpForceKind();
-}
-
 void SdrPathObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
 {
 	rInfo.bNoContortion=false;
 
-	bool bCanConv = !HasText() || ImpCanConvTextToCurve();
-	bool bIsPath = IsBezier();
+	const bool bCanConv(!HasText() || ImpCanConvTextToCurve());
+	const bool bIsPath(isBezier());
 
 	rInfo.mbEdgeRadiusAllowed	= false;
 	rInfo.mbCanConvToPath = bCanConv && !bIsPath;
@@ -1869,16 +1818,18 @@ void SdrPathObj::TakeObjInfo(SdrObjTrans
 
 sal_uInt16 SdrPathObj::GetObjIdentifier() const
 {
-	return sal_uInt16(meKind);
+	return sal_uInt16(OBJ_POLY);
 }
 
 void SdrPathObj::TakeObjNameSingul(XubString& rName) const
 {
-	if(OBJ_LINE == meKind) 
+	const SdrPathObjType aSdrPathObjType(getSdrPathObjType());
+
+    if(PathType_Line == aSdrPathObjType) 
 	{
 		sal_uInt16 nId(STR_ObjNameSingulLINE);
 
-		if(ImpIsLine(getB2DPolyPolygonInObjectCoordinates()))
+		if(isLine())
 		{
 			const basegfx::B2DPolygon aPoly(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(0L));
 			const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0L));
@@ -1909,9 +1860,9 @@ void SdrPathObj::TakeObjNameSingul(XubSt
 
 		rName = ImpGetResStr(nId);
 	} 
-	else if(OBJ_PLIN == meKind || OBJ_POLY == meKind) 
+	else if(PathType_OpenPolygon == aSdrPathObjType || PathType_ClosedPolygon == aSdrPathObjType) 
 	{
-		const sal_Bool bClosed(OBJ_POLY == meKind);
+		const bool bClosed(PathType_ClosedPolygon == aSdrPathObjType);
 		sal_uInt16 nId(0);
 
 		if(mpDAC && mpDAC->IsCreating()) 
@@ -1959,12 +1910,19 @@ void SdrPathObj::TakeObjNameSingul(XubSt
 	} 
 	else 
 	{
-		switch (meKind) 
+		switch (aSdrPathObjType) 
 		{
-			case OBJ_PATHLINE: rName=ImpGetResStr(STR_ObjNameSingulPATHLINE); break;
-			case OBJ_FREELINE: rName=ImpGetResStr(STR_ObjNameSingulFREELINE); break;
-			case OBJ_PATHFILL: rName=ImpGetResStr(STR_ObjNameSingulPATHFILL); break;
-			case OBJ_FREEFILL: rName=ImpGetResStr(STR_ObjNameSingulFREEFILL); break;
+            case PathType_OpenBezier:
+            {
+                rName = ImpGetResStr(STR_ObjNameSingulPATHLINE);
+                break;
+            }
+            case PathType_ClosedBezier:
+            {
+                rName = ImpGetResStr(STR_ObjNameSingulPATHFILL);
+                break;
+            }
+
 			default: break;
 		}
 	}
@@ -1981,15 +1939,36 @@ void SdrPathObj::TakeObjNameSingul(XubSt
 
 void SdrPathObj::TakeObjNamePlural(XubString& rName) const
 {
-	switch(meKind) 
+	const SdrPathObjType aSdrPathObjType(getSdrPathObjType());
+
+    switch(aSdrPathObjType) 
 	{
-		case OBJ_LINE    : rName=ImpGetResStr(STR_ObjNamePluralLINE    ); break;
-		case OBJ_PLIN    : rName=ImpGetResStr(STR_ObjNamePluralPLIN    ); break;
-		case OBJ_POLY    : rName=ImpGetResStr(STR_ObjNamePluralPOLY    ); break;
-		case OBJ_PATHLINE: rName=ImpGetResStr(STR_ObjNamePluralPATHLINE); break;
-		case OBJ_FREELINE: rName=ImpGetResStr(STR_ObjNamePluralFREELINE); break;
-		case OBJ_PATHFILL: rName=ImpGetResStr(STR_ObjNamePluralPATHFILL); break;
-		case OBJ_FREEFILL: rName=ImpGetResStr(STR_ObjNamePluralFREEFILL); break;
+        case PathType_Line:              // old OBJ_LINE
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralLINE);
+            break;
+        }
+        case PathType_OpenPolygon:       // old OBJ_PLIN
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralPLIN);
+            break;
+        }
+        case PathType_ClosedPolygon:     // old OBJ_POLY
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralPOLY);
+            break;
+        }
+        case PathType_OpenBezier:        // old OBJ_PATHLINE
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralPATHLINE);
+            break;
+        }
+        case PathType_ClosedBezier:      // old OBJ_PATHFILL
+        {
+            rName = ImpGetResStr(STR_ObjNamePluralPATHFILL);
+            break;
+        }
+
 		default: break;
 	}
 }
@@ -2004,7 +1983,7 @@ void SdrPathObj::AddToHdlList(SdrHdlList
 	// keep old stuff to be able to keep old SdrHdl stuff, too
 	const XPolyPolygon aOldPathPolygon(getB2DPolyPolygonInObjectCoordinates());
 	sal_uInt16 nPolyCnt=aOldPathPolygon.Count();
-	bool bClosed=IsClosed();
+	bool bClosed(isClosed());
 	sal_uInt16 nIdx=0;
 
 	for (sal_uInt16 i=0; i<nPolyCnt; i++) 
@@ -2051,13 +2030,13 @@ sal_uInt32 SdrPathObj::GetPlusHdlCount(c
 			{
 				if (rXPoly.GetFlags(nPnt)!=XPOLY_CONTROL) 
 				{
-					if (nPnt==0 && IsClosed()) 
+					if (nPnt==0 && isClosed()) 
                         nPnt=nPntMax;
 
 					if (nPnt>0 && rXPoly.GetFlags(nPnt-1)==XPOLY_CONTROL) 
                         nCnt++;
 
-					if (nPnt==nPntMax && IsClosed()) 
+					if (nPnt==nPntMax && isClosed()) 
                         nPnt=0;
 
 					if (nPnt<nPntMax && rXPoly.GetFlags(nPnt+1)==XPOLY_CONTROL) 
@@ -2091,7 +2070,7 @@ void SdrPathObj::GetPlusHdl(SdrHdlList& 
 				pHdl = new SdrHdlBezWgt(rHdlList, rSdrObject, rHdl);
 				pHdl->SetPolyNum(rHdl.GetPolyNum());
 
-				if (nPnt==0 && IsClosed()) 
+				if (nPnt==0 && isClosed()) 
 				{
 					nPnt=nPntMax;
 				}
@@ -2103,7 +2082,7 @@ void SdrPathObj::GetPlusHdl(SdrHdlList& 
 				} 
 				else 
 				{
-					if (nPnt==nPntMax && IsClosed()) 
+					if (nPnt==nPntMax && isClosed()) 
 					{
 						nPnt=0;
 					}
@@ -2125,7 +2104,7 @@ void SdrPathObj::GetPlusHdl(SdrHdlList& 
 
 SdrPathObjType SdrPathObj::getSdrPathObjType() const
 {
-	if(ImpIsLine(maPathPolygon))
+	if(isLine())
 	{
 		return PathType_Line;
 	}
@@ -2445,7 +2424,6 @@ sal_uInt32 SdrPathObj::InsPointOld(const
 		nNewHdl = InsPoint(rPos, sal_False);
 	}
 	
-	ImpForceKind();
 	return nNewHdl;
 }
 
@@ -2458,7 +2436,7 @@ sal_uInt32 SdrPathObj::InsPoint(const Po
 		basegfx::B2DPolygon aNewPoly;
 		const basegfx::B2DPoint aPoint(rPos.X(), rPos.Y());
 		aNewPoly.append(aPoint);
-		aNewPoly.setClosed(IsClosed());
+		aNewPoly.setClosed(isClosed());
 		maPathPolygon.append(aNewPoly);
 		impAdaptTransformation();
 		nNewHdl = getB2DPolyPolygonInObjectCoordinates().allPointCount();
@@ -2568,7 +2546,6 @@ sal_uInt32 SdrPathObj::InsPoint(const Po
 		}
 	}
 
-	ImpForceKind();
 	return nNewHdl;
 }
 
@@ -2587,7 +2564,7 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt
 
 			if(nPointCount)
 			{
-				if(IsClosed())
+				if(isClosed())
 				{
 					// when closed, RipPoint means to open the polygon at the selected point. To
 					// be able to do that, it is necessary to make the selected point the first one
@@ -2628,7 +2605,7 @@ SdrObject* SdrPathObj::DoConvertToPolygo
 
     SdrObject* pRet = bHideContour ? 
         0 : 
-        ImpConvertMakeObj(getB2DPolyPolygonInObjectCoordinates(), IsClosed(), bBezier);
+        ImpConvertMakeObj(getB2DPolyPolygonInObjectCoordinates(), isClosed(), bBezier);
 
     SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pRet);
 
@@ -2670,7 +2647,6 @@ void SdrPathObj::SaveGeoData(SdrObjGeoDa
 	SdrTextObj::SaveGeoData(rGeo);
 	SdrPathObjGeoData& rPGeo = (SdrPathObjGeoData&) rGeo;
 	rPGeo.maPathPolygon = getB2DPolyPolygonInObjectCoordinates();
-	rPGeo.meKind=meKind;
 }
 
 void SdrPathObj::RestGeoData(const SdrObjGeoData& rGeo)
@@ -2678,8 +2654,6 @@ void SdrPathObj::RestGeoData(const SdrOb
 	SdrTextObj::RestGeoData(rGeo);
 	SdrPathObjGeoData& rPGeo=(SdrPathObjGeoData&)rGeo;
 	maPathPolygon=rPGeo.maPathPolygon;
-	meKind=rPGeo.meKind;
-	ImpForceKind(); // damit u.a. bClosed gesetzt wird
 }
 
 basegfx::B2DPolyPolygon SdrPathObj::getB2DPolyPolygonInObjectCoordinates() const 
@@ -2693,7 +2667,6 @@ void SdrPathObj::setB2DPolyPolygonInObje
 	{
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
 		maPathPolygon=rPathPoly;
-		ImpForceKind();
 		impAdaptTransformation(); 
 		SetChanged();
 	}
@@ -2721,8 +2694,7 @@ void SdrPathObj::setB2DPolyPolygonInNorm
 void SdrPathObj::ToggleClosed()
 {
     const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-	ImpSetClosed(!IsClosed()); // neuen ObjKind setzen
-	ImpForceKind(); // wg. Line->Poly->PolyLine statt Line->Poly->Line
+	ImpSetClosed(!isClosed()); // neuen ObjKind setzen
 	SetChanged();
 }
 
@@ -2732,8 +2704,8 @@ ImpPathForDragAndCreate& SdrPathObj::imp
 	{
 		const_cast< SdrPathObj* >(this)->mpDAC = new ImpPathForDragAndCreate(
 			*this, 
-			rView.getTargetSdrPathObjType(),
-			rView.getCreateFreehandMode());
+			rView.getSdrObjectCreationInfo().getSdrPathObjType(),
+			rView.getSdrObjectCreationInfo().getFreehandMode());
 	}
 
 	return *mpDAC;
@@ -2750,21 +2722,51 @@ void SdrPathObj::impDeleteDAC() const
 
 void SdrPathObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation)
 {
-	// remember current ObjectTransformation
-	basegfx::B2DHomMatrix aOldObjectTransformation(getSdrObjectTransformation());
+    if(isLine())
+    {
+	    // call parent
+	    SdrTextObj::setSdrObjectTransformation(rTransformation);
 
-	// call parent
-	SdrTextObj::setSdrObjectTransformation(rTransformation);
+        // apply new transformation to (0,0) and (1,0) to create the polygon data
+        basegfx::B2DPolygon aLine;
+        
+        aLine.append(rTransformation * basegfx::B2DPoint(0.0, 0.0));
+        aLine.append(rTransformation * basegfx::B2DPoint(1.0, 0.0));
+        maPathPolygon = basegfx::B2DPolyPolygon(aLine);
+    }
+    else
+    {
+	    // remember current ObjectTransformation
+	    basegfx::B2DHomMatrix aOldObjectTransformation(getSdrObjectTransformation());
 
-	// need to adapt the object-coordinate representation of maPathPolygon
-	const basegfx::B2DHomMatrix aNewObjectTransformation(getSdrObjectTransformation());
+	    // call parent
+	    SdrTextObj::setSdrObjectTransformation(rTransformation);
 
-	if(aOldObjectTransformation != aNewObjectTransformation)
-    {
-		aOldObjectTransformation.invert();
-		aOldObjectTransformation = aNewObjectTransformation * aOldObjectTransformation;
-		maPathPolygon.transform(aOldObjectTransformation);
-	}
+	    // need to adapt the object-coordinate representation of maPathPolygon
+	    const basegfx::B2DHomMatrix aNewObjectTransformation(getSdrObjectTransformation());
+
+	    if(aOldObjectTransformation != aNewObjectTransformation)
+        {
+		    aOldObjectTransformation.invert();
+		    aOldObjectTransformation = aNewObjectTransformation * aOldObjectTransformation;
+		    maPathPolygon.transform(aOldObjectTransformation);
+	    }
+    }
+}
+
+bool SdrPathObj::isClosed() const
+{
+    return maPathPolygon.isClosed();
+}
+
+bool SdrPathObj::isLine() const
+{
+	return (1 == maPathPolygon.count() && 2 == maPathPolygon.getB2DPolygon(0).count());
+}
+
+bool SdrPathObj::isBezier() const
+{
+    return maPathPolygon.areControlPointsUsed();
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxtr.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxtr.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxtr.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxtr.cxx Thu Jun  7 17:08:07 2012
@@ -184,7 +184,7 @@ SdrObject* SdrTextObj::ImpConvertContain
 						aAttributeSet.Put(XFillStyleItem(XFILL_SOLID));
 
 						// create filled SdrPathObj
-						pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHFILL, aPolyPolygon);
+						pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPolygon);
 					}
 					else
 					{
@@ -195,7 +195,7 @@ SdrObject* SdrTextObj::ImpConvertContain
 						aAttributeSet.Put(XFillStyleItem(XFILL_NONE));
 
 						// create line SdrPathObj
-						pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), OBJ_PATHLINE, aPolyPolygon);
+						pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), aPolyPolygon);
 					}
 
 					// copy basic information from original
@@ -249,17 +249,15 @@ bool SdrTextObj::ImpCanConvTextToCurve()
 
 SdrObject* SdrTextObj::ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier, bool bNoSetAttr) const
 {
-	SdrObjKind ePathKind = bClosed ? OBJ_PATHFILL : OBJ_PATHLINE;
 	basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPolygon);
 
 	// #i37011#
 	if(!bBezier) 
 	{
 		aB2DPolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aB2DPolyPolygon);
-		ePathKind = bClosed ? OBJ_POLY : OBJ_PLIN;
 	}
 
-	SdrPathObj* pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), ePathKind, aB2DPolyPolygon);
+	SdrPathObj* pPathObj = new SdrPathObj(getSdrModelFromSdrObject(), aB2DPolyPolygon);
 
 	if(bBezier) 
 	{

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpntv.cxx Thu Jun  7 17:08:07 2012
@@ -319,9 +319,6 @@ SdrPaintView::SdrPaintView(SdrModel& rMo
     mbHideChart(false),
     mbHideDraw(false),
     mbHideFormControl(false),
-	mbCreateFreehandMode(false),
-	maSdrPathObjType(PathType_Line),
-	maSdrCircleObjType(CircleType_Circle),
 	maColorConfig(),
 	maGridColor(COL_BLACK)
 {

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpoev.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpoev.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpoev.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpoev.cxx Thu Jun  7 17:08:07 2012
@@ -102,7 +102,7 @@ void SdrPolyEditView::CheckPolyPossibili
 		
 	if(nMarkedPntAnz) 
 	{
-		const bool bClosed(rMarkedSdrPathObj.IsClosed());
+		const bool bClosed(rMarkedSdrPathObj.isClosed());
 		mbSetMarkedPointsSmoothPossible = true;
 			
 		if(bClosed) 

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdstr.src
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdstr.src?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdstr.src (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdstr.src Thu Jun  7 17:08:07 2012
@@ -245,18 +245,6 @@ String STR_ObjNameSingulFREELINE
 {
 	Text [ en-US ] = "Freeform Line" ;
 };
-String STR_ObjNamePluralFREELINE
-{
-	Text [ en-US ] = "Freeform Lines" ;
-};
-String STR_ObjNameSingulFREEFILL
-{
-	Text [ en-US ] = "Freeform Line" ;
-};
-String STR_ObjNamePluralFREEFILL
-{
-	Text [ en-US ] = "Freeform Lines" ;
-};
 String STR_ObjNameSingulCOMBLINE
 {
 	Text [ en-US ] = "Curve" ;

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdview.cxx Thu Jun  7 17:08:07 2012
@@ -1207,7 +1207,7 @@ bool SdrView::DoMouseEvent(const SdrView
 
 		case SDREVENT_BEGCREATEOBJ: 
 		{
-			if(SdrInventor == GetCurrentObjInventor() && OBJ_CAPTION == GetCurrentObjIdentifier()) 
+			if(SdrInventor == getSdrObjectCreationInfo().getInvent() && OBJ_CAPTION == getSdrObjectCreationInfo().getIdent()) 
 			{
 				const sal_Int32 nHgt(SdrEngineDefaults::GetFontHeight());
 				
@@ -1367,7 +1367,7 @@ Pointer SdrView::GetPreferedPointer(cons
 	switch (eEvent)
 	{
 		case SDREVENT_BEGCREATEOBJ:
-			return maCreatePointer;
+			return getCreatePointer();
 		case SDREVENT_MARKOBJ: 
 		case SDREVENT_BEGMARK:
 			return Pointer(POINTER_ARROW);
@@ -1642,7 +1642,7 @@ Pointer SdrView::GetPreferedPointer(cons
 
 	if(SDREDITMODE_CREATE == GetViewEditMode()) 
 	{
-		return maCreatePointer;
+		return getCreatePointer();
 	}
 
 	return Pointer(POINTER_ARROW);

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/table/tablecontroller.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/table/tablecontroller.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/table/tablecontroller.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/table/tablecontroller.cxx Thu Jun  7 17:08:07 2012
@@ -1758,7 +1758,7 @@ bool SvxTableController::StopTextEdit()
 	if(mpView->IsTextEdit())
 	{
 		mpView->SdrEndTextEdit();
-		mpView->SetCurrentObj(OBJ_TABLE);
+		mpView->setSdrObjectCreationInfo(SdrObjectCreationInfo(static_cast< sal_uInt16 >(OBJ_TABLE)));
 		mpView->SetViewEditMode(SDREDITMODE_EDIT);
 		return true;
 	}

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unomod.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unomod.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unomod.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unomod.cxx Thu Jun  7 17:08:07 2012
@@ -58,8 +58,6 @@
 #include <svx/svdpage.hxx>
 #include <svx/unoshape.hxx>
 
-extern UHashMapEntry pSdrShapeIdentifierMap[];
-
 //-////////////////////////////////////////////////////////////////////
 
 using namespace ::rtl;
@@ -191,18 +189,17 @@ uno::Reference< uno::XInterface > SAL_CA
 
 	if( ServiceSpecifier.compareTo( aDrawingPrefix, aDrawingPrefix.getLength() ) == 0 )
 	{
-		sal_uInt32 nType = aSdrShapeIdentifierMap.getId( ServiceSpecifier );
-		if( nType != UHASHMAP_NOTFOUND )
-		{
-			sal_uInt16 nT = (sal_uInt16)(nType & ~E3D_INVENTOR_FLAG);
-			sal_uInt32 nI = (nType & E3D_INVENTOR_FLAG)?E3dInventor:SdrInventor;
+        SvxShapeKind aSvxShapeKind(getSvxShapeKindFromTypeName(ServiceSpecifier));
 
-			return uno::Reference< uno::XInterface >( (drawing::XShape*) SvxDrawPage::CreateShapeByTypeAndInventor( nT, nI ) );
+        if(SvxShapeKind_None != aSvxShapeKind)
+		{
+			return uno::Reference< uno::XInterface >(static_cast< drawing::XShape* >(SvxDrawPage::CreateShapeBySvxShapeKind(aSvxShapeKind)));
 		}
 	}
 
 	uno::Reference< uno::XInterface > xRet( createTextField( ServiceSpecifier ) );
-	if( !xRet.is() )
+
+    if( !xRet.is() )
 		throw lang::ServiceNotRegisteredException();
 
 	return xRet;
@@ -222,28 +219,21 @@ uno::Reference< uno::XInterface > SAL_CA
 uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames()
 	throw( uno::RuntimeException )
 {
-	UHashMapEntry* pMap = pSdrShapeIdentifierMap;
-
-	sal_uInt32 nCount = 0;
-	while (pMap->aIdentifier.getLength())
-	{
-		pMap++;
-		nCount++;
-	}
-
-	uno::Sequence< OUString > aSeq( nCount );
-	OUString* pStrings = aSeq.getArray();
+    const std::vector< rtl::OUString > aAllNames(getAllSvxShapeTypeNames());
+    const sal_uInt32 nCount(aAllNames.size());
+   	uno::Sequence< OUString > aSeq(nCount);
+
+    if(nCount)
+    {
+    	OUString* pStrings = aSeq.getArray();
+
+        for(sal_uInt32 a(0); a < nCount; a++)
+        {
+            pStrings[a] = aAllNames[a];
+        }
+    }
 
-	pMap = pSdrShapeIdentifierMap;
-	sal_uInt32 nIdx = 0;
-	while(pMap->aIdentifier.getLength())
-	{
-		pStrings[nIdx] = pMap->aIdentifier;
-		pMap++;
-		nIdx++;
-	}
-
-	return aSeq;
+    return aSeq;
 }
 
 uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw()
@@ -457,72 +447,72 @@ uno::Reference< uno::XInterface > SAL_CA
 	if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
 	{
 		SvxShape* pShape = NULL;
+        SvxShapeKind aSvxShapeKind(SvxShapeKind_Text);
 
-		sal_uInt16 nType = OBJ_TEXT;
 		// create a shape wrapper
 		if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
 		{
-			nType = OBJ_GRAF;
+			aSvxShapeKind = SvxShapeKind_Graphic;
 		}
 		else if( aType.EqualsAscii( "PageShape", 26, 9 ) )
 		{
-			nType = OBJ_PAGE;
+			aSvxShapeKind = SvxShapeKind_Page;
 		}
 		else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) )
 		{
-			nType = OBJ_OLE2;
+			aSvxShapeKind = SvxShapeKind_OLE2;
 		}
 		else if( aType.EqualsAscii( "ChartShape", 26, 10 ) )
 		{
-			nType = OBJ_OLE2;
+			aSvxShapeKind = SvxShapeKind_OLE2;
 		}
 		else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
 		{
-			nType = OBJ_OLE2;
+			aSvxShapeKind = SvxShapeKind_OLE2;
 		}
 		else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) )
 		{
-			nType = OBJ_OLE2;
+			aSvxShapeKind = SvxShapeKind_OLE2;
 		}
 		else if( aType.EqualsAscii( "NotesShape", 26, 10 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "HandoutShape", 26, 12 ) )
 		{
-			nType = OBJ_PAGE;
+			aSvxShapeKind = SvxShapeKind_Page;
 		}
 		else if( aType.EqualsAscii( "FooterShape", 26, 12 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) )
 		{
-			nType = OBJ_TEXT;
+			aSvxShapeKind = SvxShapeKind_Text;
 		}
 		else if( aType.EqualsAscii( "TableShape", 26, 10 ) )
 		{
-			nType = OBJ_TABLE;
+			aSvxShapeKind = SvxShapeKind_Table;
 		}
 		else
 		{
@@ -530,7 +520,7 @@ uno::Reference< uno::XInterface > SAL_CA
 		}
 
 		// create the API wrapper
-		pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor );
+		pShape = SvxDrawPage::CreateShapeBySvxShapeKind(aSvxShapeKind);
 
 		// set shape type
 		if( pShape )

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unopage.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unopage.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unopage.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unopage.cxx Thu Jun  7 17:08:07 2012
@@ -538,342 +538,338 @@ void SAL_CALL SvxDrawPage::ungroup( cons
 //----------------------------------------------------------------------
 SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
 {
-	sal_uInt16 nType;
-	sal_uInt32 nInventor;
-
-	GetTypeAndInventor( nType, nInventor, xShape->getShapeType() );
 	SdrObject* pNewObj = 0;
 
-	if( nType != 0 && mpModel )
-	{
-		awt::Size aSize = xShape->getSize();
-		aSize.Width += 1;
-		aSize.Height += 1;
-		awt::Point aPos = xShape->getPosition();
-		Rectangle aRect( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) );
-
-		// special cases
-		if( nInventor == SdrInventor )
-		{
-			switch( nType )
-			{
-			case OBJ_MEASURE:
-				{
-					pNewObj = new SdrMeasureObj( *mpModel, aRect.TopLeft(), aRect.BottomRight() );
-					break;
-				}
-			case OBJ_LINE:
-				{
-					basegfx::B2DPolygon aPoly;
-					aPoly.append(basegfx::B2DPoint(aRect.Left(), aRect.Top()));
-					aPoly.append(basegfx::B2DPoint(aRect.Right(), aRect.Bottom()));
-					pNewObj = new SdrPathObj(*mpModel, OBJ_LINE, basegfx::B2DPolyPolygon(aPoly));
-					break;
-				}
-			}
-		}
-
-		if( pNewObj == NULL )
-			pNewObj = SdrObjFactory::MakeNewObject( *mpModel, nInventor, nType);
-
-		if(pNewObj)
-		{
-			sdr::legacy::SetSnapRect(*pNewObj, aRect);
-			E3dScene* pE3dScene = dynamic_cast< E3dScene* >(pNewObj);
-			E3dExtrudeObj* pE3dExtrudeObj = dynamic_cast< E3dExtrudeObj* >(pNewObj);
-			E3dLatheObj* pE3dLatheObj = dynamic_cast< E3dLatheObj* >(pNewObj);
-
-			if( pE3dScene )
-			{
-				// Szene initialisieren
-				double fW = (double)aSize.Width;
-				double fH = (double)aSize.Height;
-
-				Camera3D aCam(pE3dScene->GetCamera());
-				aCam.SetAutoAdjustProjection(sal_False);
-				aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
-				basegfx::B3DPoint aLookAt;
-				basegfx::B3DPoint aCamPos(0.0, 0.0, 10000.0);
-				aCam.SetPosAndLookAt(aCamPos, aLookAt);
-				aCam.SetFocalLength(100.0);
-				aCam.SetDefaults(aCamPos, aLookAt, 10000.0);
-				pE3dScene->SetCamera(aCam);
-
-				pE3dScene->ActionChanged();
-			}
-			else if(pE3dExtrudeObj)
-			{
-				basegfx::B2DPolygon aNewPolygon;
-				aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
-				aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
-				aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
-				aNewPolygon.setClosed(true);
-				pE3dExtrudeObj->SetExtrudePolygon(basegfx::B2DPolyPolygon(aNewPolygon));
-
-				// #107245# pE3dExtrudeObj->SetExtrudeCharacterMode(TRUE);
-				pE3dExtrudeObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
-			}
-			else if(pE3dLatheObj)
-			{
-				basegfx::B2DPolygon aNewPolygon;
-				aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
-				aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
-				aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
-				aNewPolygon.setClosed(true);
-				pE3dLatheObj->SetPolyPoly2D(basegfx::B2DPolyPolygon(aNewPolygon));
-
-				// #107245# pE3dLatheObj->SetLatheCharacterMode(TRUE);
-				pE3dLatheObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
-			}
-		}
-	}
+    if(mpModel)
+    {
+        const SvxShapeKind aSvxShapeKind(getSvxShapeKind(xShape->getShapeType()));
+
+	    if(SvxShapeKind_None != aSvxShapeKind)
+	    {
+		    const awt::Size aSize(xShape->getSize());
+		    const awt::Point aPos(xShape->getPosition());
+            bool bSetTransform(true);
+
+		    // special cases
+    	    if(SvxShapeKind_Measure == aSvxShapeKind)
+            {
+                // create measure direct point-based
+                pNewObj = new SdrMeasureObj(
+                    *mpModel, 
+                    Point(aPos.X, aPos.Y),
+                    Point(aPos.X + aSize.Width, aPos.Y + aSize.Height));
+                bSetTransform = false;
+            }
+            else if(SvxShapeKind_Path == aSvxShapeKind)
+            {
+                // create polygon object with some initial data to have a size
+				basegfx::B2DPolygon aPoly;
+					
+                aPoly.append(basegfx::B2DPoint(aPos.X, aPos.Y));
+				aPoly.append(basegfx::B2DPoint(aPos.X + aSize.Width, aPos.Y + aSize.Height));
+				pNewObj = new SdrPathObj(*mpModel, basegfx::B2DPolyPolygon(aPoly));
+                bSetTransform = false;
+            }
+
+		    if(!pNewObj)
+            {
+                sal_uInt16 nIdent(OBJ_NONE);
+                sal_uInt32 nInvent(SdrInventor);
+                    
+                SvxShapeKindToSdrObjectCreatorInventor(aSvxShapeKind, nIdent, nInvent);
+			    pNewObj = SdrObjFactory::MakeNewObject(*mpModel, SdrObjectCreationInfo(nIdent, nInvent));
+            }
+
+		    if(pNewObj)
+		    {
+                E3dScene* pE3dScene = dynamic_cast< E3dScene* >(pNewObj);
+			    E3dExtrudeObj* pE3dExtrudeObj = dynamic_cast< E3dExtrudeObj* >(pNewObj);
+			    E3dLatheObj* pE3dLatheObj = dynamic_cast< E3dLatheObj* >(pNewObj);
+
+			    if( pE3dScene )
+			    {
+				    // init scene
+				    const double fW(aSize.Width);
+				    const double fH(aSize.Height);
+				    Camera3D aCam(pE3dScene->GetCamera());
+				    
+                    aCam.SetAutoAdjustProjection(sal_False);
+				    aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+				    
+                    basegfx::B3DPoint aLookAt;
+				    basegfx::B3DPoint aCamPos(0.0, 0.0, 10000.0);
+				    
+                    aCam.SetPosAndLookAt(aCamPos, aLookAt);
+				    aCam.SetFocalLength(100.0);
+				    aCam.SetDefaults(aCamPos, aLookAt, 10000.0);
+				    pE3dScene->SetCamera(aCam);
+				    pE3dScene->ActionChanged();
+			    }
+			    else if(pE3dExtrudeObj)
+			    {
+                    // init extrude to some defaults
+				    basegfx::B2DPolygon aNewPolygon;
+				    
+                    aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+				    aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
+				    aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+				    aNewPolygon.setClosed(true);
+				    pE3dExtrudeObj->SetExtrudePolygon(basegfx::B2DPolyPolygon(aNewPolygon));
+
+				    pE3dExtrudeObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
+			    }
+			    else if(pE3dLatheObj)
+			    {
+                    // init lathe to some defaults
+				    basegfx::B2DPolygon aNewPolygon;
+				    
+                    aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+				    aNewPolygon.append(basegfx::B2DPoint(0.0, 1.0));
+				    aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+				    aNewPolygon.setClosed(true);
+				    pE3dLatheObj->SetPolyPoly2D(basegfx::B2DPolyPolygon(aNewPolygon));
+
+				    pE3dLatheObj->SetMergedItem(Svx3DCharacterModeItem(sal_True));
+			    }
+                
+                if(bSetTransform)
+                {
+                    pNewObj->setSdrObjectTransformation(
+                        basegfx::tools::createScaleTranslateB2DHomMatrix(
+                            aSize.Width, aSize.Height,
+                            aPos.X, aPos.Y));
+                }
+		    }
+	    }
+    }
 
 	return pNewObj;
 }
 
 //----------------------------------------------------------------------
-void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw()
+SvxShapeKind SvxDrawPage::getSvxShapeKind( const ::rtl::OUString& aName ) const throw()
 {
-	sal_uInt32 nTempType = aSdrShapeIdentifierMap.getId( aName );
+    SvxShapeKind aSvxShapeKind(getSvxShapeKindFromTypeName(aName));
 
-	if( nTempType == UHASHMAP_NOTFOUND )
-	{
-		if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) ||
-			aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TableShape")) )
+    if(SvxShapeKind_None != aSvxShapeKind)
+    {
+        switch(aSvxShapeKind)
+        {
+            case SvxShapeKind_Frame:
+            case SvxShapeKind_Plugin:
+            case SvxShapeKind_Applet:
+            {
+                aSvxShapeKind = SvxShapeKind_OLE2;
+                break;
+            }
+        }
+    }
+    else
+    {
+		if(aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape")) || aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TableShape")))
 		{
-			rInventor = SdrInventor;
-			rType = OBJ_TABLE;
+            aSvxShapeKind = SvxShapeKind_Table;
 		}
-		else if( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.MediaShape" )) )
+		else if(aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.MediaShape")))
 		{
-			rInventor = SdrInventor;
-			rType = OBJ_MEDIA;
+            aSvxShapeKind = SvxShapeKind_Media;
 		}
-	}
-	else if(nTempType & E3D_INVENTOR_FLAG)
-	{
-		rInventor = E3dInventor;
-		rType = (sal_uInt16)(nTempType & ~E3D_INVENTOR_FLAG);
-	}
-	else
-	{
-		rInventor = SdrInventor;
-		rType = (sal_uInt16)nTempType;
+    }
 
-		switch( rType )
-		{
-			case OBJ_FRAME:
-			case OBJ_OLE2_PLUGIN:
-			case OBJ_OLE2_APPLET:
-				rType = OBJ_OLE2;
-				break;
-		}
-	}
+    return aSvxShapeKind;
 }
 
 //----------------------------------------------------------------------
-SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj, SvxDrawPage *mpPage ) throw()
-{
-	SvxShape* pRet = NULL;
-	switch( nInventor )
-	{
-		case E3dInventor:
-		{
-			switch( nType )
-			{
-				case E3D_SCENE_ID :
-					pRet = new Svx3DSceneObject( pObj, mpPage );
-					break;
-				case E3D_CUBEOBJ_ID :
-					pRet = new Svx3DCubeObject( pObj );
-					break;
-				case E3D_SPHEREOBJ_ID :
-					pRet = new Svx3DSphereObject( pObj );
-					break;
-				case E3D_LATHEOBJ_ID :
-					pRet = new Svx3DLatheObject( pObj );
-					break;
-				case E3D_EXTRUDEOBJ_ID :
-					pRet = new Svx3DExtrudeObject( pObj );
-					break;
-				case E3D_POLYGONOBJ_ID :
-					pRet = new Svx3DPolygonObject( pObj );
-					break;
-				default: // unbekanntes 3D-Objekt auf der Page
-					pRet = new SvxShape( pObj );
-					break;
-			}
+SvxShape* SvxDrawPage::CreateShapeBySvxShapeKind(
+    SvxShapeKind aSvxShapeKind, 
+    SdrObject *pObj, 
+    SvxDrawPage *mpPage ) throw()
+{
+	SvxShape* pRet = 0;
+
+    switch(aSvxShapeKind)
+    {
+        // 3D shapes
+		case SvxShapeKind_3DScene:
+        {
+			pRet = new Svx3DSceneObject( pObj, mpPage );
 			break;
-		}
-		case SdrInventor:
-		{
-			switch( nType )
+        }
+		case SvxShapeKind_3DCube:
+        {
+			pRet = new Svx3DCubeObject( pObj );
+			break;
+        }
+		case SvxShapeKind_3DSphere:
+        {
+			pRet = new Svx3DSphereObject( pObj );
+			break;
+        }
+		case SvxShapeKind_3DExtrude:
+        {
+			pRet = new Svx3DExtrudeObject( pObj );
+			break;
+        }
+		case SvxShapeKind_3DLathe:
+        {
+			pRet = new Svx3DLatheObject( pObj );
+			break;
+        }
+		case SvxShapeKind_3DPolygon:
+        {
+			pRet = new Svx3DPolygonObject( pObj );
+			break;
+        }
+
+        // Svx shapes
+        case SvxShapeKind_Group:
+        {
+			pRet = new SvxShapeGroup( pObj, mpPage );
+			break;
+        }
+		case SvxShapeKind_Rectangle:
+        {
+			pRet = new SvxShapeRect( pObj );
+			break;
+        }
+		case SvxShapeKind_Circle:
+        {
+			pRet = new SvxShapeCircle( pObj );
+			break;
+        }
+		case SvxShapeKind_Path:
+        {
+			pRet = new SvxShapePolyPolygon( pObj );
+			break;
+        }
+		case SvxShapeKind_Text:
+        {
+			pRet = new SvxShapeText( pObj );
+			break;
+        }
+		case SvxShapeKind_Graphic:
+        {
+			pRet = new SvxGraphicObject( pObj );
+			break;
+        }
+		case SvxShapeKind_OLE2:
+        {
+			if( pObj && !pObj->IsEmptyPresObj() && mpPage )
 			{
-//				case OBJ_NONE:
-//					break;
-				case OBJ_GRUP:
-					pRet = new SvxShapeGroup( pObj, mpPage );
-					break;
-				case OBJ_LINE:
-					pRet = new SvxShapePolyPolygon( pObj , PolygonKind_LINE );
-					break;
-				case OBJ_RECT:
-					pRet = new SvxShapeRect( pObj );
-					break;
-				case OBJ_CIRC:
-				case OBJ_SECT:
-				case OBJ_CARC:
-				case OBJ_CCUT:
-					pRet = new SvxShapeCircle( pObj );
-					break;
-				case OBJ_POLY:
-					pRet = new SvxShapePolyPolygon( pObj , PolygonKind_POLY );
-					break;
-				case OBJ_PLIN:
-					pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PLIN );
-					break;
-				case OBJ_PATHLINE:
-					pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHLINE );
-					break;
-				case OBJ_PATHFILL:
-					pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHFILL );
-					break;
-				case OBJ_FREELINE:
-					pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREELINE );
-					break;
-				case OBJ_FREEFILL:
-					pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREEFILL );
-					break;
-				case OBJ_CAPTION:
-					pRet = new SvxShapeCaption( pObj );
-					break;
-				case OBJ_TITLETEXT:
-				case OBJ_OUTLINETEXT:
-				case OBJ_TEXT:
-					pRet = new SvxShapeText( pObj );
-					break;
-				case OBJ_GRAF:
-					pRet = new SvxGraphicObject( pObj );
-					break;
-				case OBJ_FRAME:
-					pRet = new SvxFrameShape( pObj );
-					break;
-				case OBJ_OLE2_APPLET:
-					pRet = new SvxAppletShape( pObj );
-					break;
-				case OBJ_OLE2_PLUGIN:
-					pRet = new SvxPluginShape( pObj );
-					break;
-				 case OBJ_OLE2:
-					 {
-						if( pObj && !pObj->IsEmptyPresObj() && mpPage )
+				SdrPage* pSdrPage = mpPage->GetSdrPage();
+						
+                if( pSdrPage )
+				{
+					::comphelper::IEmbeddedHelper *pPersist = pSdrPage->getSdrModelFromSdrPage().GetPersist();
+					if( pPersist )
+					{
+						uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
+								GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
+
+						// TODO CL->KA: Why is this not working anymore?
+						if( xObject.is() )
 						{
-							SdrPage* pSdrPage = mpPage->GetSdrPage();
-							if( pSdrPage )
+							SvGlobalName aClassId( xObject->getClassID() );
+
+							const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
+							const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
+							const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
+
+							if( aPluginClassId == aClassId )
 							{
-								::comphelper::IEmbeddedHelper *pPersist = pSdrPage->getSdrModelFromSdrPage().GetPersist();
-									if( pPersist )
-									{
-										uno::Reference < embed::XEmbeddedObject > xObject = pPersist->getEmbeddedObjectContainer().
-												GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
-
-										// TODO CL->KA: Why is this not working anymore?
-										if( xObject.is() )
-										{
-											SvGlobalName aClassId( xObject->getClassID() );
-
-											const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
-											const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
-											const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
-
-											if( aPluginClassId == aClassId )
-											{
-												pRet = new SvxPluginShape( pObj );
-												nType = OBJ_OLE2_PLUGIN;
-											}
-											else if( aAppletClassId == aClassId )
-											{
-												pRet = new SvxAppletShape( pObj );
-												nType = OBJ_OLE2_APPLET;
-											}
-											else if( aIFrameClassId == aClassId )
-											{
-												pRet = new SvxFrameShape( pObj );
-												nType = OBJ_FRAME;
-											}
-										}
-									}
-								}
+								pRet = new SvxPluginShape( pObj );
+								aSvxShapeKind = SvxShapeKind_Plugin;
+							}
+							else if( aAppletClassId == aClassId )
+							{
+								pRet = new SvxAppletShape( pObj );
+								aSvxShapeKind = SvxShapeKind_Applet;
+							}
+							else if( aIFrameClassId == aClassId )
+							{
+								pRet = new SvxFrameShape( pObj );
+								aSvxShapeKind = SvxShapeKind_Frame;
 							}
-						if( pRet == NULL )
-						{
-							pRet = new SvxOle2Shape( pObj, aSvxMapProvider.GetMap(SVXMAP_OLE2),  aSvxMapProvider.GetPropertySet(SVXMAP_OLE2, GetGlobalDrawObjectItemPool()) );
 						}
-					 }
-					break;
-				case OBJ_EDGE:
-					pRet = new SvxShapeConnector( pObj );
-					break;
-				case OBJ_PATHPOLY:
-					pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPOLY );
-					break;
-				case OBJ_PATHPLIN:
-					pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPLIN );
-					break;
-				case OBJ_PAGE:
-					pRet = new SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_PAGE),  aSvxMapProvider.GetPropertySet(SVXMAP_PAGE, GetGlobalDrawObjectItemPool()) );
-					break;
-				case OBJ_MEASURE:
-					pRet = new SvxShapeDimensioning( pObj );
-					break;
-				case OBJ_UNO:
-					pRet = new SvxShapeControl( pObj );
-					break;
-				case OBJ_CUSTOMSHAPE:
-					pRet = new SvxCustomShape( pObj );
-					break;
-				case OBJ_MEDIA:
-					pRet = new SvxMediaShape( pObj );
-					break;
-				case OBJ_TABLE:
-					pRet = new SvxTableShape( pObj );
-					break;
-				default: // unbekanntes 2D-Objekt auf der Page
-					DBG_ERROR("Nicht implementierter Starone-Shape erzeugt! [CL]");
-					pRet = new SvxShapeText( pObj );
-					break;
+					}
+				}
 			}
-			break;
+					
+            if( !pRet )
+			{
+				pRet = new SvxOle2Shape( pObj, aSvxMapProvider.GetMap(SVXMAP_OLE2),  aSvxMapProvider.GetPropertySet(SVXMAP_OLE2, GetGlobalDrawObjectItemPool()) );
+			}
+
+            break;
 		}
-		default: // Unbekannter Inventor
-		{
-			DBG_ERROR("AW: Unknown Inventor in SvxDrawPage::_CreateShape()");
+		case SvxShapeKind_Connector:
+        {
+			pRet = new SvxShapeConnector( pObj );
 			break;
-		}
-	}
-
-	if(pRet)
-	{
-		sal_uInt32 nObjId = nType;
-
-		if( nInventor == E3dInventor )
-			nObjId |= E3D_INVENTOR_FLAG;
-
-		switch(nObjId)
-		{
-		case OBJ_CCUT:			// Kreisabschnitt
-		case OBJ_CARC:			// Kreisbogen
-		case OBJ_SECT:			// Kreissektor
-			nObjId = OBJ_CIRC;
+        }
+        case SvxShapeKind_Caption:
+        {
+			pRet = new SvxShapeCaption( pObj );
+			break;
+        }
+		case SvxShapeKind_Page:
+        {
+			pRet = new SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_PAGE),  aSvxMapProvider.GetPropertySet(SVXMAP_PAGE, GetGlobalDrawObjectItemPool()) );
+			break;
+        }
+		case SvxShapeKind_Measure:
+        {
+			pRet = new SvxShapeDimensioning( pObj );
+			break;
+        }
+        case SvxShapeKind_Frame:
+        {
+			pRet = new SvxFrameShape( pObj );
+			break;
+        }
+		case SvxShapeKind_Control:
+        {
+			pRet = new SvxShapeControl( pObj );
+			break;
+        }
+		case SvxShapeKind_Customshape:
+        {
+			pRet = new SvxCustomShape( pObj );
 			break;
+        }
+		case SvxShapeKind_Media:
+        {
+			pRet = new SvxMediaShape( pObj );
+			break;
+        }
+		case SvxShapeKind_Table:
+        {
+			pRet = new SvxTableShape( pObj );
+			break;
+        }
 
-		case OBJ_TITLETEXT:
-		case OBJ_OUTLINETEXT:
-			nObjId = OBJ_TEXT;
+        // objects not directly associated with SdrObjKind
+        case SvxShapeKind_Applet:
+        {
+			pRet = new SvxAppletShape( pObj );
 			break;
-		}
+        }
+		case SvxShapeKind_Plugin:
+        {
+			pRet = new SvxPluginShape( pObj );
+			break;
+        }
+        default: // unknown Object on Page
+        {
+			DBG_ERROR("Not implemented Shape created (!)");
+			pRet = new SvxShapeText( pObj );
+			break;
+        }
+	}
 
-		pRet->setShapeKind(nObjId);
+	if(pRet)
+	{
+		pRet->setSvxShapeKind(aSvxShapeKind);
 	}
 
 	return pRet;
@@ -882,10 +878,11 @@ SvxShape* SvxDrawPage::CreateShapeByType
 //----------------------------------------------------------------------
 Reference< drawing::XShape >  SvxDrawPage::_CreateShape( SdrObject *pObj ) const throw()
 {
-	Reference< drawing::XShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(),
-											  pObj->GetObjInventor(),
-											  pObj,
-											  (SvxDrawPage*)this));
+	Reference< drawing::XShape > xShape( 
+        CreateShapeBySvxShapeKind(
+            SdrObjectCreatorInventorToSvxShapeKind(pObj->GetObjIdentifier(), pObj->GetObjInventor()),
+			pObj,
+			const_cast< SvxDrawPage* >(static_cast< const SvxDrawPage* >(this))));
 	return xShape;
 }
 
@@ -920,11 +917,6 @@ uno::Sequence< OUString > SAL_CALL SvxDr
 	return aSeq;
 }
 
-SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw()
-{
-	return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor );
-}
-
 /** returns a StarOffice API wrapper for the given SdrPage */
 uno::Reference< drawing::XDrawPage > GetXDrawPageForSdrPage( SdrPage* pPage ) throw ()
 {

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoprov.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoprov.cxx?rev=1347716&r1=1347715&r2=1347716&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoprov.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoprov.cxx Thu Jun  7 17:08:07 2012
@@ -49,6 +49,8 @@
 #include <svx/dialogs.hrc>
 #include <svx/svdpool.hxx>
 #include <svx/svdobj.hxx>
+#include <hash_map>
+#include <svx/unoshape.hxx>
 
 using namespace ::rtl;
 using namespace ::com::sun::star;
@@ -829,85 +831,125 @@ comphelper::PropertyMapEntry* ImplGetAdd
 }
 
 // ---------------------------------------------------------------------
-
 SvxUnoPropertyMapProvider aSvxMapProvider;
 
-UHashMapEntry pSdrShapeIdentifierMap[] =
+// ---------------------------------------------------------------------
+static rtl::OUString aComSunStarDrawing(rtl::OUString::createFromAscii("com.sun.star.drawing.")); 
+typedef std::hash_map< rtl::OUString, SvxShapeKind, rtl::OUStringHash > TypeNameToSvxShapeKindMapper;
+typedef std::pair< rtl::OUString, SvxShapeKind > TypeNameToSvxShapeKindType;
+static TypeNameToSvxShapeKindMapper aTypeNameToSvxShapeKindMapper;
+
+void initTokenMapper()
 {
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.RectangleShape"),		OBJ_RECT ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.EllipseShape"),			OBJ_CIRC ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ControlShape"),			OBJ_UNO  ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ConnectorShape"),		OBJ_EDGE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MeasureShape"),			OBJ_MEASURE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.LineShape"),			OBJ_LINE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonShape"),		OBJ_POLY ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLineShape"),		OBJ_PLIN ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenBezierShape"),		OBJ_PATHLINE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedBezierShape"),	OBJ_PATHFILL ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenFreeHandShape"),	OBJ_FREELINE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.ClosedFreeHandShape"),	OBJ_FREEFILL ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyPolygonPathShape"),	OBJ_PATHPOLY ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PolyLinePathShape"),	OBJ_PATHPLIN ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GraphicObjectShape"),	OBJ_GRAF ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape"),			OBJ_GRUP ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TextShape"),			OBJ_TEXT ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OLE2Shape"),			OBJ_OLE2 ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PageShape"),			OBJ_PAGE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CaptionShape"),			OBJ_CAPTION ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.FrameShape"),			OBJ_FRAME ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.PluginShape"),			OBJ_OLE2_PLUGIN ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.AppletShape"),			OBJ_OLE2_APPLET ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.CustomShape"),			OBJ_CUSTOMSHAPE ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MediaShape"),			OBJ_MEDIA ),
-
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"),	E3D_SCENE_ID      | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DCubeObject"),	E3D_CUBEOBJ_ID    | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DSphereObject"),	E3D_SPHEREOBJ_ID  | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DLatheObject"),	E3D_LATHEOBJ_ID   | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"),	E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"),	E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG ),
-	UHashMapEntry (RTL_CONSTASCII_STRINGPARAM(""),	0 )
-};
+    if(aTypeNameToSvxShapeKindMapper.empty())
+    {
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("RectangleShape"), SvxShapeKind_Rectangle));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("EllipseShape"), SvxShapeKind_Circle));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("ControlShape"), SvxShapeKind_Control));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("ConnectorShape"), SvxShapeKind_Connector));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("MeasureShape"), SvxShapeKind_Measure));
+
+        // all polygon shapes are handled as single path object
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("LineShape"), SvxShapeKind_Path));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PolyPolygonShape"), SvxShapeKind_Path));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PolyLineShape"), SvxShapeKind_Path));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("OpenBezierShape"), SvxShapeKind_Path));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("ClosedBezierShape"), SvxShapeKind_Path));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("OpenFreeHandShape"), SvxShapeKind_Path)); // freehands are only created interactively, should not happen
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("ClosedFreeHandShape"), SvxShapeKind_Path)); // freehands are only created interactively, should not happen
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PolyPolygonPathShape"), SvxShapeKind_Path)); // closed filled PolyPolygon, no difference to ClosedBezierShape
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PolyLinePathShape"), SvxShapeKind_Path)); // open PolyPolygon, no difference to OpenBezierShape
+
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("GraphicObjectShape"), SvxShapeKind_Graphic));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("GroupShape"), SvxShapeKind_Group));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("TextShape"), SvxShapeKind_Text));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("OLE2Shape"), SvxShapeKind_OLE2));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PageShape"), SvxShapeKind_Page));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("CaptionShape"), SvxShapeKind_Caption));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("FrameShape"), SvxShapeKind_Frame));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("PluginShape"), SvxShapeKind_Plugin));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("AppletShape"), SvxShapeKind_Applet));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("CustomShape"), SvxShapeKind_Customshape));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("MediaShape"), SvxShapeKind_Media));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DSceneObject"), SvxShapeKind_3DScene));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DCubeObject"), SvxShapeKind_3DCube));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DSphereObject"), SvxShapeKind_3DSphere));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DLatheObject"), SvxShapeKind_3DLathe));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DExtrudeObject"), SvxShapeKind_3DExtrude));
+        aTypeNameToSvxShapeKindMapper.insert(TypeNameToSvxShapeKindType(rtl::OUString::createFromAscii("Shape3DPolygonObject"), SvxShapeKind_3DPolygon));
+    }
+}
 
-// ---------------------------------------------------------------------
+std::vector< OUString > getAllSvxShapeTypeNames()
+{
+    static std::vector< OUString > aRetval;
 
-UHashMap aSdrShapeIdentifierMap( pSdrShapeIdentifierMap );
+    initTokenMapper();
 
-/***********************************************************************
-* class UHashMap                                                       *
-***********************************************************************/
+    if(!aTypeNameToSvxShapeKindMapper.empty() && !aRetval.size())
+    {
+        for(TypeNameToSvxShapeKindMapper::iterator a(aTypeNameToSvxShapeKindMapper.begin()); a != aTypeNameToSvxShapeKindMapper.end(); a++)
+        {
+            OUString aNew(a->first);
+
+            if(aNew.getLength())
+            {
+                const OUString aNewName(aComSunStarDrawing + aNew);
+                
+                aRetval.push_back(aNewName);
+            }
+        }
+    }
+
+    return aRetval;
+}
 
-UHashMap::UHashMap( UHashMapEntry* pMap )
+bool getNameForSvxShapeType(rtl::OUString& rName, SvxShapeKind eSvxShapeKind)
 {
-	while( pMap->aIdentifier.getLength() )
-	{
-		OUString aStr( pMap->aIdentifier );
-		size_t nHash = aStr.hashCode() & (HASHARRAYSIZE-1);
+    initTokenMapper();
 
-		m_aHashList[nHash].Insert(pMap);
-		pMap++;
-	}
-}
+    if(!aTypeNameToSvxShapeKindMapper.empty())
+    {
+        for(TypeNameToSvxShapeKindMapper::iterator a(aTypeNameToSvxShapeKindMapper.begin()); a != aTypeNameToSvxShapeKindMapper.end(); a++)
+        {
+            if(a->second == eSvxShapeKind)
+            {
+                rName = aComSunStarDrawing + a->first;
+                return true;
+            }
+        }
+    }
 
-// ---------------------------------------------------------------------
+    return false;
+}
 
-sal_uInt32 UHashMap::getId( const OUString& rCompareString )
+SvxShapeKind getSvxShapeKindFromTypeName(const OUString& rTypeName)
 {
-	size_t nHash = rCompareString.hashCode() & (HASHARRAYSIZE-1);
+    if(rTypeName.getLength() <= aComSunStarDrawing.getLength())
+    {
+        return SvxShapeKind_None;
+    }
 
-	UHashMapEntryList& rList = m_aHashList[nHash];
+    const OUString aCompare(rTypeName.copy(aComSunStarDrawing.getLength()));
 
-	UHashMapEntry * pMap = rList.First();
+    if(!aCompare.getLength())
+    {
+        return SvxShapeKind_None;
+    }
 
-	while(pMap)
-	{
-		if( rCompareString == pMap->aIdentifier )
-			return pMap->nId;
+    initTokenMapper();
 
-		pMap = rList.Next();
-	}
+    if(!aTypeNameToSvxShapeKindMapper.empty())
+    {
+        const TypeNameToSvxShapeKindMapper::iterator aResult(aTypeNameToSvxShapeKindMapper.find(aCompare));
+
+        if(aResult != aTypeNameToSvxShapeKindMapper.end())
+        {
+            return aResult->second;
+        }
+    }
 
-	return UHASHMAP_NOTFOUND;
+    return SvxShapeKind_None;
 }
 
 /***********************************************************************



Mime
View raw message