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/08/01 19:14:32 UTC

svn commit: r1509334 [2/4] - in /openoffice/branches/alg/aw080/main: basegfx/inc/basegfx/matrix/ basegfx/inc/basegfx/polygon/ basegfx/source/inc/ basegfx/source/matrix/ basegfx/source/polygon/ basegfx/source/tools/ sd/source/ui/animations/ svx/inc/svx/...

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx Thu Aug  1 17:14:31 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 
@@ -39,12 +37,6 @@
 #include <svx/svdview.hxx>  // fuer MovCreate bei Freihandlinien
 #include <svx/svdglob.hxx>  // Stringcache
 #include <svx/svdstr.hrc>   // Objektname
-
-#ifdef _MSC_VER
-#pragma optimize ("",off)
-#pragma warning(disable: 4748) // "... because optimizations are disabled ..."
-#endif
-
 #include <svx/xlnwtit.hxx>
 #include <svx/xlnclit.hxx>
 #include <svx/xflclit.hxx>
@@ -90,6 +82,8 @@ inline sal_uInt16 GetNextPnt(sal_uInt16 
 	return nPnt;
 }
 
+//////////////////////////////////////////////////////////////////////////////
+
 struct ImpSdrPathDragData  : public SdrDragStatUserData
 {
 	XPolygon					aXP;            // Ausschnitt aud dem Originalpolygon
@@ -221,7 +215,7 @@ void ImpSdrPathDragData::ResetPoly(const
 	aXP[4]=aTmpXP[nNextNextPnt0];  aXP.SetFlags(4,aTmpXP.GetFlags(nNextNextPnt0));
 }
 
-/*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
 
 struct ImpPathCreateUser  : public SdrDragStatUserData
 {
@@ -369,7 +363,7 @@ XPolygon ImpPathCreateUser::GetLinePoly(
 	return aXP;
 }
 
-/*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
 
 class ImpPathForDragAndCreate
 {
@@ -1613,7 +1607,7 @@ Pointer ImpPathForDragAndCreate::GetCrea
 	return Pointer(POINTER_CROSS);
 }
 
-/*************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
 
 SdrPathObjGeoData::SdrPathObjGeoData()
 {
@@ -1624,100 +1618,143 @@ SdrPathObjGeoData::~SdrPathObjGeoData()
 }
 
 //////////////////////////////////////////////////////////////////////////////
-// DrawContact section
 
-void SdrPathObj::impAdaptTransformation()
+void SdrPathObj::impSetPathPolyPolygonWithTransformationAdaption(const basegfx::B2DPolyPolygon& rNew)
 {
-	basegfx::B2DHomMatrix aHelpMatrix;
+    // nothing to adapt when geometry does not change
+    if(getB2DPolyPolygonInObjectCoordinates() == rNew)
+    {
+        return;
+    }
 
-	if(maPathPolygon.count())
-	{
-        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);
+    static bool bRsetCoordinateSystemAfterWasLine(true);
+
+    if(bRsetCoordinateSystemAfterWasLine && isLine())
+    {
+        // the SdrPathObj has two basic states, line and other. Line is for two points
+        // and no bezier, it uses a specialized geometry (unified line from 0.0, to 1.0)
+        // and a specialized transformation which shows the rotation of the line what is 
+        // wanted.
+        // When a third point is added that mode is left and the regular one entered, in
+        // this conversion when using the code below keeping the rotation of the former
+        // line object. This is not wrong and works as intended, but is irritating for the
+        // user, e.g:
+        // - when drawing a freehand or multi-line (non-bezier) polygon, it will be rotated
+        //   after construction due to keeping the rotation of the first added line
+        // - this is also used e.g. in contour editors where it is not wanted
+        // - it is different from the behaviour of AOO before
+        // For this reason this is disabled and the old behaviour activated by adding this 
+        // case to esp. change back to the most trivial transformation in the transition
+        // between line status and other. To try out the also possible new alternative,
+        // change the value of bRsetCoordinateSystemAfterWasLine to false.
+        const basegfx::B2DRange aRangeNewGeometry(rNew.getB2DRange());
+
+        maPathPolyPolygon = rNew;
+        maSdrObjectTransformation.setB2DHomMatrix(
+            basegfx::tools::createScaleTranslateB2DHomMatrix(
+                aRangeNewGeometry.getRange(),
+                aRangeNewGeometry.getMinimum()));
+        return;
+    }
+
+    // set new geometry
+    maPathPolyPolygon = rNew;
 
-            aHelpMatrix = basegfx::tools::createScaleRotateTranslateB2DHomMatrix(
-                basegfx::B2DTuple(aDelta.getLength(), 0.0),
+    if(!rNew.areControlPointsUsed()
+        && 1 == rNew.count() 
+        && 2 == rNew.getB2DPolygon(0).count())
+    {
+        // new geometry is a non-curved line, create unit transformation so that (0,0) is 
+        // 1st point and (1,0) is 2nd point
+        const basegfx::B2DPoint aPointA(rNew.getB2DPolygon(0).getB2DPoint(0));
+        const basegfx::B2DPoint aPointB(rNew.getB2DPolygon(0).getB2DPoint(1));
+        const basegfx::B2DVector aDelta(aPointB - aPointA);
+
+        maSdrObjectTransformation.setB2DHomMatrix(
+            basegfx::tools::createScaleRotateTranslateB2DHomMatrix(
+                basegfx::B2DTuple(aDelta.getLength(), 1.0),
                 atan2(aDelta.getY(), aDelta.getX()),
-                aPointA);
-        }
-        else
-        {
-		    // get range
-		    basegfx::B2DRange aRange(maPathPolygon.getB2DRange());
+                aPointA));
+        return;
+    }
 
-		    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);
-			    }
+    // get range of the target geometry
+    const basegfx::B2DRange aRangeNewGeometry(rNew.getB2DRange());
 
-			    if(basegfx::fTools::less(aScale.getY(), 0.0))
-                {
-				    aHelpMatrix.scale(1.0, -1.0);
-				    aScale.setY(-1.0);
-                }
+    if(aRangeNewGeometry.isEmpty())
+    {
+        // no geometry, set default
+        maSdrObjectTransformation.setB2DHomMatrix(basegfx::B2DHomMatrix());
+        return;
+    }
 
-			    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);
-		    }
-        }
-	}
+    if(basegfx::fTools::equalZero(aRangeNewGeometry.getWidth()) && basegfx::fTools::equalZero(aRangeNewGeometry.getHeight()))
+    {
+        // single point geometry, use translation
+        maSdrObjectTransformation.setB2DHomMatrix(
+            basegfx::tools::createTranslateB2DHomMatrix(
+                aRangeNewGeometry.getMinimum()));
+        return;
+    }
+
+    // break up current transformation
+    basegfx::B2DTuple aScale;
+    basegfx::B2DTuple aTranslate;
+    double fRotate, fShearX;
+
+    maSdrObjectTransformation.getB2DHomMatrix().decompose(aScale, aTranslate, fRotate, fShearX);
+
+    // to preserve mirrorX, mirrorY, rotation and shear, create a transformation
+    // containing those values in aHelpMatrix
+    basegfx::B2DHomMatrix aHelpMatrix;
 
-	// set adapted transformation, but do not change the
-	// polygon data; that IS the defining part in this case
-	maSdrObjectTransformation = aHelpMatrix; 
+    if(basegfx::fTools::less(aScale.getX(), 0.0))
+    {
+        aHelpMatrix.scale(-1.0, 1.0);
+    }
+
+    if(basegfx::fTools::less(aScale.getY(), 0.0))
+    {
+        aHelpMatrix.scale(1.0, -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(rNew);
+        basegfx::B2DHomMatrix aInverseHelpMatrix(aHelpMatrix);
+
+        aInverseHelpMatrix.invert();
+        aBackTransformed.transform(aInverseHelpMatrix);
+
+        // get range of new geometry in unit coordinates
+        const basegfx::B2DRange aUnitRange(aBackTransformed.getB2DRange());
+        const basegfx::B2DHomMatrix aNewTransform(
+            basegfx::tools::createScaleTranslateB2DHomMatrix(
+                aUnitRange.getRange(),
+                aUnitRange.getMinimum()));
+
+        maSdrObjectTransformation.setB2DHomMatrix(
+            aHelpMatrix * aNewTransform);
+    }
+    else
+    {
+        // use translate and scale straightforward from new geometry
+        maSdrObjectTransformation.setB2DHomMatrix(
+            basegfx::tools::createScaleTranslateB2DHomMatrix(
+                aRangeNewGeometry.getRange(),
+                aRangeNewGeometry.getMinimum()));
+    }
 }
 
 sdr::contact::ViewContact* SdrPathObj::CreateObjectSpecificViewContact()
@@ -1729,10 +1766,10 @@ SdrPathObj::SdrPathObj(
 	SdrModel& rSdrModel, 
 	const basegfx::B2DPolyPolygon& rPathPoly)
 :	SdrTextObj(rSdrModel),
-	maPathPolygon(rPathPoly),
+	maPathPolyPolygon(),
 	mpDAC(0)
 {
-	impAdaptTransformation();
+    impSetPathPolyPolygonWithTransformationAdaption(rPathPoly);
 }
 
 SdrPathObj::~SdrPathObj()
@@ -1752,7 +1789,7 @@ void SdrPathObj::copyDataFromSdrObject(c
 			SdrTextObj::copyDataFromSdrObject(rSource);
 
 			// copy local data
-		    maPathPolygon = pSource->getB2DPolyPolygonInObjectCoordinates();
+		    maPathPolyPolygon = pSource->getB2DPolyPolygonInObjectCoordinates();
         }
 		else
         {
@@ -1778,9 +1815,9 @@ bool SdrPathObj::IsClosedObj() const
 
 void SdrPathObj::ImpSetClosed(bool bClose)
 {
-	for(sal_uInt32 a(0); a < maPathPolygon.count(); a++)
+	for(sal_uInt32 a(0); a < getB2DPolyPolygonInObjectCoordinates().count(); a++)
 	{
-		basegfx::B2DPolygon aCandidate(maPathPolygon.getB2DPolygon(a));
+		basegfx::B2DPolygon aCandidate(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(a));
 
 		if(bClose != aCandidate.isClosed())
 		{
@@ -1796,9 +1833,9 @@ void SdrPathObj::ImpSetClosed(bool bClos
                 basegfx::tools::closeWithGeometryChange(aCandidate);
             }
 
-			// no need to use impAdaptTransformation here,
-			// the geometry gets not changed in it's dimensions
-            maPathPolygon.setB2DPolygon(a, aCandidate);
+            // no need to adapt transformation here, the geometry gets not changed 
+            // in it's dimensions by triggering open/closed state
+            maPathPolyPolygon.setB2DPolygon(a, aCandidate);
 		}
 	}
 }
@@ -2100,8 +2137,6 @@ void SdrPathObj::GetPlusHdl(SdrHdlList& 
 	}
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 SdrPathObjType SdrPathObj::getSdrPathObjType() const
 {
 	if(isLine())
@@ -2109,9 +2144,9 @@ SdrPathObjType SdrPathObj::getSdrPathObj
 		return PathType_Line;
 	}
 
-	if(maPathPolygon.isClosed())
+	if(getB2DPolyPolygonInObjectCoordinates().isClosed())
 	{
-		if(maPathPolygon.areControlPointsUsed())
+		if(getB2DPolyPolygonInObjectCoordinates().areControlPointsUsed())
 		{
 			return PathType_ClosedBezier;
 		}
@@ -2122,7 +2157,7 @@ SdrPathObjType SdrPathObj::getSdrPathObj
 	}
 	else
 	{
-		if(maPathPolygon.areControlPointsUsed())
+		if(getB2DPolyPolygonInObjectCoordinates().areControlPointsUsed())
 		{
 			return PathType_OpenBezier;
 		}
@@ -2213,8 +2248,6 @@ basegfx::B2DPolyPolygon SdrPathObj::getS
     return aRetval;
 }
 
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
 bool SdrPathObj::BegCreate(SdrDragStat& rDrag)
 {
 	impDeleteDAC();
@@ -2382,36 +2415,35 @@ void SdrPathObj::SetObjectPoint(const ba
 
 	if(PolyPolygonEditor::GetRelativePolyPoint(getB2DPolyPolygonInObjectCoordinates(), nHdlNum, nPoly, nPnt)) 
 	{
-		basegfx::B2DPolygon aNewPolygon(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(nPoly));
-		const basegfx::B2DRange aRangeBefore(aNewPolygon.getB2DRange());
-		aNewPolygon.setB2DPoint(nPnt, rPnt);
-		const basegfx::B2DRange aRangeAfter(aNewPolygon.getB2DRange());
-		maPathPolygon.setB2DPolygon(nPoly, aNewPolygon);
+        basegfx::B2DPolygon aNewPolygon(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(nPoly));
 
-		if(aRangeBefore != aRangeAfter)
-		{
-			// need to adapt when geometric size has changed
-			impAdaptTransformation();
-		}
+        if(rPnt != aNewPolygon.getB2DPoint(nPnt))
+        {
+            basegfx::B2DPolyPolygon aNewPathPolyPolygon(getB2DPolyPolygonInObjectCoordinates());
+            aNewPolygon.setB2DPoint(nPnt, rPnt);
+            aNewPathPolyPolygon.setB2DPolygon(nPoly, aNewPolygon);
+
+            // set geometry and adapt transformation
+            impSetPathPolyPolygonWithTransformationAdaption(aNewPathPolyPolygon);
+        }
 	}
 }
 
-sal_uInt32 SdrPathObj::InsPointOld(const Point& rPos, sal_Bool bNewObj)
+sal_uInt32 SdrPathObj::InsPointOld(const basegfx::B2DPoint& rPos, bool bNewObj)
 {
 	sal_uInt32 nNewHdl;
 
 	if(bNewObj) 
 	{
-		nNewHdl = InsPoint(rPos, sal_True);
+		nNewHdl = InsPoint(rPos, true);
 	} 
 	else 
 	{
 		// look for smallest distance data
-		const basegfx::B2DPoint aTestPoint(rPos.X(), rPos.Y());
 		sal_uInt32 nSmallestPolyIndex(0L);
 		sal_uInt32 nSmallestEdgeIndex(0L);
 		double fSmallestCut;
-		basegfx::tools::getSmallestDistancePointToPolyPolygon(getB2DPolyPolygonInObjectCoordinates(), aTestPoint, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
+		basegfx::tools::getSmallestDistancePointToPolyPolygon(getB2DPolyPolygonInObjectCoordinates(), rPos, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
 
 		// create old polygon index from it
 		sal_uInt32 nPolyIndex(nSmallestEdgeIndex);
@@ -2421,50 +2453,48 @@ sal_uInt32 SdrPathObj::InsPointOld(const
 			nPolyIndex += getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(a).count();
 		}
 
-		nNewHdl = InsPoint(rPos, sal_False);
+		nNewHdl = InsPoint(rPos, false);
 	}
 	
 	return nNewHdl;
 }
 
-sal_uInt32 SdrPathObj::InsPoint(const Point& rPos, sal_Bool bNewObj)
+sal_uInt32 SdrPathObj::InsPoint(const basegfx::B2DPoint& rPos, bool bNewObj)
 {
 	sal_uInt32 nNewHdl;
+    basegfx::B2DPolyPolygon aNewPathPolyPolygon(getB2DPolyPolygonInObjectCoordinates());
 
 	if(bNewObj) 
 	{
 		basegfx::B2DPolygon aNewPoly;
-		const basegfx::B2DPoint aPoint(rPos.X(), rPos.Y());
-		aNewPoly.append(aPoint);
+		aNewPoly.append(rPos);
 		aNewPoly.setClosed(isClosed());
-		maPathPolygon.append(aNewPoly);
-		impAdaptTransformation();
+		aNewPathPolyPolygon.append(aNewPoly);
+        impSetPathPolyPolygonWithTransformationAdaption(aNewPathPolyPolygon);
 		nNewHdl = getB2DPolyPolygonInObjectCoordinates().allPointCount();
 	} 
 	else 
 	{
 		// look for smallest distance data
-		const basegfx::B2DPoint aTestPoint(rPos.X(), rPos.Y());
 		sal_uInt32 nSmallestPolyIndex(0L);
 		sal_uInt32 nSmallestEdgeIndex(0L);
-		double fSmallestCut;
-		basegfx::tools::getSmallestDistancePointToPolyPolygon(getB2DPolyPolygonInObjectCoordinates(), aTestPoint, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
+		double fSmallestCut(0.0);
+		basegfx::tools::getSmallestDistancePointToPolyPolygon(getB2DPolyPolygonInObjectCoordinates(), rPos, nSmallestPolyIndex, nSmallestEdgeIndex, fSmallestCut);
 		basegfx::B2DPolygon aCandidate(getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(nSmallestPolyIndex));
-		const basegfx::B2DRange aRangeBefore(aCandidate.getB2DRange());
 		const bool bBefore(!aCandidate.isClosed() && 0L == nSmallestEdgeIndex && 0.0 == fSmallestCut);
 		const bool bAfter(!aCandidate.isClosed() && aCandidate.count() == nSmallestEdgeIndex + 2L && 1.0 == fSmallestCut);
 
 		if(bBefore)
 		{
 			// before first point
-			aCandidate.insert(0L, aTestPoint);
+			aCandidate.insert(0L, rPos);
 			
 			if(aCandidate.areControlPointsUsed())
 			{
 				if(aCandidate.isNextControlPointUsed(1))
 				{
-					aCandidate.setNextControlPoint(0, interpolate(aTestPoint, aCandidate.getB2DPoint(1), (1.0 / 3.0)));
-					aCandidate.setPrevControlPoint(1, interpolate(aTestPoint, aCandidate.getB2DPoint(1), (2.0 / 3.0)));
+					aCandidate.setNextControlPoint(0, interpolate(rPos, aCandidate.getB2DPoint(1), (1.0 / 3.0)));
+					aCandidate.setPrevControlPoint(1, interpolate(rPos, aCandidate.getB2DPoint(1), (2.0 / 3.0)));
 				}
 			}
 			
@@ -2473,14 +2503,14 @@ sal_uInt32 SdrPathObj::InsPoint(const Po
 		else if(bAfter)
 		{
 			// after last point
-			aCandidate.append(aTestPoint);
+			aCandidate.append(rPos);
 
 			if(aCandidate.areControlPointsUsed())
 			{
 				if(aCandidate.isPrevControlPointUsed(aCandidate.count() - 2))
 				{
-					aCandidate.setNextControlPoint(aCandidate.count() - 2, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), aTestPoint, (1.0 / 3.0)));
-					aCandidate.setPrevControlPoint(aCandidate.count() - 1, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), aTestPoint, (2.0 / 3.0)));
+					aCandidate.setNextControlPoint(aCandidate.count() - 2, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), rPos, (1.0 / 3.0)));
+					aCandidate.setPrevControlPoint(aCandidate.count() - 1, interpolate(aCandidate.getB2DPoint(aCandidate.count() - 2), rPos, (2.0 / 3.0)));
 				}
 			}
 
@@ -2512,11 +2542,11 @@ sal_uInt32 SdrPathObj::InsPoint(const Po
 
 				// split and insert hit point
 				aBezier.split(fSmallestCut, &aBezierA, &aBezierB);
-				aCandidate.insert(nSmallestEdgeIndex + 1, aTestPoint);
+				aCandidate.insert(nSmallestEdgeIndex + 1, rPos);
 
 				// since we inserted hit point and not split point, we need to add an offset
 				// to the control points to get the C1 continuity we want to achieve
-				const basegfx::B2DVector aOffset(aTestPoint - aBezierA.getEndPoint());
+				const basegfx::B2DVector aOffset(rPos - aBezierA.getEndPoint());
 				aCandidate.setNextControlPoint(nSmallestEdgeIndex, aBezierA.getControlPointA() + aOffset);
 				aCandidate.setPrevControlPoint(nSmallestEdgeIndex + 1, aBezierA.getControlPointB() + aOffset);
 				aCandidate.setNextControlPoint(nSmallestEdgeIndex + 1, aBezierB.getControlPointA() + aOffset);
@@ -2524,29 +2554,23 @@ sal_uInt32 SdrPathObj::InsPoint(const Po
 			}
 			else
 			{
-				aCandidate.insert(nSmallestEdgeIndex + 1L, aTestPoint);
+				aCandidate.insert(nSmallestEdgeIndex + 1L, rPos);
 			}
 
 			nNewHdl = nSmallestEdgeIndex + 1L;
 		}
 
-		const basegfx::B2DRange aRangeAfter(aCandidate.getB2DRange());
-		maPathPolygon.setB2DPolygon(nSmallestPolyIndex, aCandidate);
+        aNewPathPolyPolygon.setB2DPolygon(nSmallestPolyIndex, aCandidate);
+        impSetPathPolyPolygonWithTransformationAdaption(aNewPathPolyPolygon);
 
 		// create old polygon index from it
 		for(sal_uInt32 a(0L); a < nSmallestPolyIndex; a++)
 		{
 			nNewHdl += getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(a).count();
 		}
-
-		if(aRangeBefore != aRangeAfter)
-		{
-			// need to adapt when geometric size has changed
-			impAdaptTransformation();
-		}
 	}
 
-	return nNewHdl;
+    return nNewHdl;
 }
 
 SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index)
@@ -2646,19 +2670,19 @@ void SdrPathObj::SaveGeoData(SdrObjGeoDa
 {
 	SdrTextObj::SaveGeoData(rGeo);
 	SdrPathObjGeoData& rPGeo = (SdrPathObjGeoData&) rGeo;
-	rPGeo.maPathPolygon = getB2DPolyPolygonInObjectCoordinates();
+	rPGeo.maPathPolyPolygon = getB2DPolyPolygonInObjectCoordinates();
 }
 
 void SdrPathObj::RestGeoData(const SdrObjGeoData& rGeo)
 {
 	SdrTextObj::RestGeoData(rGeo);
-	SdrPathObjGeoData& rPGeo=(SdrPathObjGeoData&)rGeo;
-	maPathPolygon=rPGeo.maPathPolygon;
+	SdrPathObjGeoData& rPGeo = (SdrPathObjGeoData&)rGeo;
+	maPathPolyPolygon = rPGeo.maPathPolyPolygon;
 }
 
-basegfx::B2DPolyPolygon SdrPathObj::getB2DPolyPolygonInObjectCoordinates() const 
+const basegfx::B2DPolyPolygon& SdrPathObj::getB2DPolyPolygonInObjectCoordinates() const 
 {
-	return maPathPolygon; 
+	return maPathPolyPolygon; 
 }
 
 void SdrPathObj::setB2DPolyPolygonInObjectCoordinates(const basegfx::B2DPolyPolygon& rPathPoly)
@@ -2666,31 +2690,11 @@ void SdrPathObj::setB2DPolyPolygonInObje
 	if(getB2DPolyPolygonInObjectCoordinates() != rPathPoly)
 	{
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-		maPathPolygon=rPathPoly;
-		impAdaptTransformation(); 
-		SetChanged();
+        impSetPathPolyPolygonWithTransformationAdaption(rPathPoly);
+        SetChanged();
 	}
 }
 
-basegfx::B2DPolyPolygon SdrPathObj::getB2DPolyPolygonInNormalizedCoordinates() const
-{
-	basegfx::B2DHomMatrix aInverse(getSdrObjectTransformation());
-	basegfx::B2DPolyPolygon aRetval(getB2DPolyPolygonInObjectCoordinates());
-
-	aInverse.invert();
-	aRetval.transform(aInverse);
-
-	return aRetval;
-}
-
-void SdrPathObj::setB2DPolyPolygonInNormalizedCoordinates(const basegfx::B2DPolyPolygon& rPathPoly)
-{
-	basegfx::B2DPolyPolygon aNew(rPathPoly);
-
-	aNew.transform(getSdrObjectTransformation());
-	setB2DPolyPolygonInObjectCoordinates(aNew);
-}
-
 void SdrPathObj::ToggleClosed()
 {
     const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
@@ -2722,51 +2726,51 @@ void SdrPathObj::impDeleteDAC() const
 
 void SdrPathObj::setSdrObjectTransformation(const basegfx::B2DHomMatrix& rTransformation)
 {
-    if(isLine())
-    {
-	    // 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
+    if(rTransformation != maSdrObjectTransformation.getB2DHomMatrix())
     {
-	    // remember current ObjectTransformation
-	    basegfx::B2DHomMatrix aOldObjectTransformation(getSdrObjectTransformation());
-
-	    // call parent
-	    SdrTextObj::setSdrObjectTransformation(rTransformation);
-
-	    // need to adapt the object-coordinate representation of maPathPolygon
-	    const basegfx::B2DHomMatrix aNewObjectTransformation(getSdrObjectTransformation());
+        if(isLine())
+        {
+            // apply new transformation to (0,0) and (1,0) to create the polygon data
+            basegfx::B2DPolygon aLine;
 
-	    if(aOldObjectTransformation != aNewObjectTransformation)
+            aLine.append(rTransformation * basegfx::B2DPoint(0.0, 0.0));
+            aLine.append(rTransformation * basegfx::B2DPoint(1.0, 0.0));
+            maPathPolyPolygon = basegfx::B2DPolyPolygon(aLine);
+        }
+        else
         {
-		    aOldObjectTransformation.invert();
-		    aOldObjectTransformation = aNewObjectTransformation * aOldObjectTransformation;
-		    maPathPolygon.transform(aOldObjectTransformation);
-	    }
+            if(getB2DPolyPolygonInObjectCoordinates().count())
+            {
+                // need to adapt the object-coordinate representation of maPathPolyPolygon.
+                // take out old and apply new transformation
+                basegfx::B2DHomMatrix aCombined(maSdrObjectTransformation.getB2DHomMatrix());
+
+                aCombined.invert();
+                aCombined = rTransformation * aCombined;
+                maPathPolyPolygon.transform(aCombined);
+            }
+        }
     }
+
+    // call parent
+    SdrTextObj::setSdrObjectTransformation(rTransformation);
 }
 
 bool SdrPathObj::isClosed() const
 {
-    return maPathPolygon.isClosed();
+    return getB2DPolyPolygonInObjectCoordinates().isClosed();
 }
 
 bool SdrPathObj::isLine() const
 {
-	return (1 == maPathPolygon.count() && 2 == maPathPolygon.getB2DPolygon(0).count());
+	return !getB2DPolyPolygonInObjectCoordinates().areControlPointsUsed()
+        && 1 == getB2DPolyPolygonInObjectCoordinates().count() 
+        && 2 == getB2DPolyPolygonInObjectCoordinates().getB2DPolygon(0).count();
 }
 
 bool SdrPathObj::isBezier() const
 {
-    return maPathPolygon.areControlPointsUsed();
+    return getB2DPolyPolygonInObjectCoordinates().areControlPointsUsed();
 }
 
 //////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx Thu Aug  1 17:14:31 2013
@@ -223,8 +223,8 @@ SvxShapeKind SdrObjectCreatorInventorToS
                 // SdrObject, map
                 case OBJ_GRUP: return SvxShapeKind_Group;
                 case OBJ_RECT: return SvxShapeKind_Rectangle;
-                case OBJ_CIRC: return SvxShapeKind_Circle;  
-                case OBJ_POLY: return SvxShapeKind_Path;
+                case OBJ_CIRC: return SvxShapeKind_Circle;  // and removed old ones (OBJ_SECT, OBJ_CARC, OBJ_CCUT)
+                case OBJ_POLY: return SvxShapeKind_Path;    // and removed old ones (OBJ_LINE, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL, OBJ_FREELINE, OBJ_FREEFILL, OBJ_PATHPOLY, OBJ_PATHPLIN)
                 case OBJ_TEXT: 
                 case OBJ_TITLETEXT: 
                 case OBJ_OUTLINETEXT: 
@@ -254,7 +254,7 @@ void SvxShapeKindToSdrObjectCreatorInven
         case SvxShapeKind_None: nIdent = OBJ_NONE; nInvent = SdrInventor; break;              // OBJ_NONE
         case SvxShapeKind_Group: nIdent = OBJ_GRUP; nInvent = SdrInventor; break;             // OBJ_GRUP
         case SvxShapeKind_Rectangle: nIdent = OBJ_RECT; nInvent = SdrInventor; break;         // OBJ_RECT
-        case SvxShapeKind_Circle: nIdent = OBJ_CIRC; nInvent = SdrInventor; break;            // OBJ_CIRC
+        case SvxShapeKind_Circle: nIdent = OBJ_CIRC; nInvent = SdrInventor; break;            // OBJ_CIRC and removed old ones (OBJ_SECT, OBJ_CARC, OBJ_CCUT)
         case SvxShapeKind_Path: nIdent = OBJ_POLY; nInvent = SdrInventor; break;              // OBJ_POLY and removed old ones (OBJ_LINE, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL, OBJ_FREELINE, OBJ_FREEFILL, OBJ_PATHPOLY, OBJ_PATHPLIN)
         case SvxShapeKind_Text: nIdent = OBJ_TEXT; nInvent = SdrInventor; break;              // OBJ_TEXT, OBJ_TITLETEXT, OBJ_OUTLINETEXT
         case SvxShapeKind_Graphic: nIdent = OBJ_GRAF; nInvent = SdrInventor; break;           // OBJ_GRAF
@@ -1486,6 +1486,63 @@ OUString SAL_CALL SvxShape::getShapeType
 	{
         OUString aName;
 
+        if(SvxShapeKind_Path == mpImpl->meSvxShapeKind && mpObj.is())
+        {
+            const SdrPathObj* pSdrPathObj = dynamic_cast< const SdrPathObj* >(mpObj.get());
+
+            if(pSdrPathObj)
+            {
+                // SvxShapeKinds are reduced, there is only one remaining type for
+                // path data, the SvxShapeKind_Path. Thus, the old types are all mapped 
+                // to that SvxShapeKind (see also aTypeNameToSvxShapeKindMapper). 
+                //
+                // "LineShape"
+                // "PolyPolygonShape"
+                // "PolyLineShape"
+                // "OpenBezierShape"
+                // "ClosedBezierShape"
+                // 
+                // Some are not used in export resp. mapped to existing ones, see also: 
+                // XMLShapeExport::ImpCalcShapeType in xmloff:
+                //
+                // OpenFreeHandShape -> OpenBezierShape
+                // ClosedFreeHandShape -> ClosedBezierShape
+                // PolyPolygonPathShape -> same as PolyPolygonShape
+                // PolyLinePathShape -> same as PolyLineShape
+
+                const SdrPathObjType aSdrPathObjType(pSdrPathObj->getSdrPathObjType());
+
+                switch(aSdrPathObjType)
+                {
+                    case PathType_Line:
+                    {
+                        return ::rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape");
+                    }
+                    case PathType_OpenPolygon:
+                    {
+                        return ::rtl::OUString::createFromAscii("com.sun.star.drawing.PolyLineShape");
+                    }
+                    case PathType_ClosedPolygon:
+                    {
+                        return ::rtl::OUString::createFromAscii("com.sun.star.drawing.PolyPolygonShape");
+                        break;
+                    }
+                    case PathType_OpenBezier:
+                    {
+                        return ::rtl::OUString::createFromAscii("com.sun.star.drawing.OpenBezierShape");
+                        break;
+                    }
+                    case PathType_ClosedBezier:
+                    {
+                        return ::rtl::OUString::createFromAscii("com.sun.star.drawing.ClosedBezierShape");
+                        break;
+                    }
+                }
+
+                OSL_ENSURE(false, "SvxShapeKind_Path could not be mapped to uno class type (!)");
+            }
+        }
+
         if(getNameForSvxShapeType(aName, mpImpl->meSvxShapeKind))
         {
             return aName;

Modified: openoffice/branches/alg/aw080/main/sw/source/ui/ribbar/conpoly.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/ui/ribbar/conpoly.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/ui/ribbar/conpoly.cxx (original)
+++ openoffice/branches/alg/aw080/main/sw/source/ui/ribbar/conpoly.cxx Thu Aug  1 17:14:31 2013
@@ -130,7 +130,7 @@ sal_Bool ConstPolygon::MouseButtonUp(con
 void ConstPolygon::Activate(const sal_uInt16 nSlotId)
 {
     SdrObjectCreationInfo aSdrObjectCreationInfo;
-    bool bSet(false);
+    bool bSet(true);
 
 	switch (nSlotId)
 	{
@@ -151,6 +151,7 @@ void ConstPolygon::Activate(const sal_uI
 			break;
 
 		default:
+            bSet = false;
 			break;
 	}
 
@@ -162,5 +163,4 @@ void ConstPolygon::Activate(const sal_uI
 	SwDrawBase::Activate(nSlotId);
 }
 
-
-
+// eof

Modified: openoffice/branches/alg/aw080/main/xmloff/inc/xexptran.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/inc/xexptran.hxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/inc/xexptran.hxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/inc/xexptran.hxx Thu Aug  1 17:14:31 2013
@@ -116,82 +116,83 @@ public:
 class SdXMLImExViewBox
 {
 	rtl::OUString				msString;
-	sal_Int32					mnX;
-	sal_Int32					mnY;
-	sal_Int32					mnW;
-	sal_Int32					mnH;
+	double                      mfX;
+	double                      mfY;
+	double                      mfW;
+	double                      mfH;
 
 public:
-	SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
+	SdXMLImExViewBox(double fX = 0.0, double fY = 0.0, double fW = 1000.0, double fH = 1000.0);
 	SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
 
-	sal_Int32 GetX() const { return mnX; }
-	sal_Int32 GetY() const { return mnY; }
-	sal_Int32 GetWidth() const { return mnW; }
-	sal_Int32 GetHeight() const { return mnH; }
+	double GetX() const { return mfX; }
+	double GetY() const { return mfY; }
+	double GetWidth() const { return mfW; }
+	double GetHeight() const { return mfH; }
 	const rtl::OUString& GetExportString();
 };
 
 //////////////////////////////////////////////////////////////////////////////
-
-class SdXMLImExPointsElement
-{
-	rtl::OUString				msString;
-	com::sun::star::drawing::PointSequenceSequence	maPoly;
-
-public:
-	SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints, 
-		const SdXMLImExViewBox& rViewBox,
-		const com::sun::star::awt::Point& rObjectPos,
-		const com::sun::star::awt::Size& rObjectSize,
-		const bool bClosed);
-	SdXMLImExPointsElement(const rtl::OUString& rNew, 
-		const SdXMLImExViewBox& rViewBox,
-		const com::sun::star::awt::Point& rObjectPos,
-		const com::sun::star::awt::Size& rObjectSize,
-		const SvXMLUnitConverter& rConv,
-        const bool bClosed);
-
-	const rtl::OUString& GetExportString() const { return msString; }
-	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
-};
-
+//
+//class SdXMLImExPointsElement
+//{
+//	rtl::OUString				msString;
+//	com::sun::star::drawing::PointSequenceSequence	maPoly;
+//
+//public:
+//	SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints, 
+//		const SdXMLImExViewBox& rViewBox,
+//		const com::sun::star::awt::Point& rObjectPos,
+//		const com::sun::star::awt::Size& rObjectSize,
+//		const bool bClosed);
+//	SdXMLImExPointsElement(const rtl::OUString& rNew, 
+//		const SdXMLImExViewBox& rViewBox,
+//		const com::sun::star::awt::Point& rObjectPos,
+//		const com::sun::star::awt::Size& rObjectSize,
+//		const SvXMLUnitConverter& rConv,
+//        const bool bClosed);
+//
+//	const rtl::OUString& GetExportString() const { return msString; }
+//	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
+//};
+//
 //////////////////////////////////////////////////////////////////////////////
-
-class SdXMLImExSvgDElement
-{
-	rtl::OUString					msString;
-	const SdXMLImExViewBox&			mrViewBox;
-	bool							mbIsClosed;
-	bool							mbIsCurve;
-
-	sal_Int32						mnLastX;
-	sal_Int32						mnLastY;
-
-	com::sun::star::drawing::PointSequenceSequence		maPoly;
-	com::sun::star::drawing::FlagSequenceSequence		maFlag;
-
-public:
-	SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
-	SdXMLImExSvgDElement(const rtl::OUString& rNew, 
-		const SdXMLImExViewBox& rViewBox,
-		const com::sun::star::awt::Point& rObjectPos,
-		const com::sun::star::awt::Size& rObjectSize,
-		const SvXMLUnitConverter& rConv);
-
-	void AddPolygon(
-		com::sun::star::drawing::PointSequence* pPoints, 
-		com::sun::star::drawing::FlagSequence* pFlags,
-		const com::sun::star::awt::Point& rObjectPos,
-		const com::sun::star::awt::Size& rObjectSize,
-		bool bClosed = false, bool bRelative = true);
-
-	const rtl::OUString& GetExportString() const { return msString; }
-	bool IsClosed() const { return mbIsClosed; }
-	bool IsCurve() const { return mbIsCurve; }
-	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
-	const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
-};
-
+//
+//class SdXMLImExSvgDElement
+//{
+//	rtl::OUString					msString;
+//	const SdXMLImExViewBox&			mrViewBox;
+//	bool							mbIsClosed;
+//	bool							mbIsCurve;
+//
+//	sal_Int32						mnLastX;
+//	sal_Int32						mnLastY;
+//
+//	com::sun::star::drawing::PointSequenceSequence		maPoly;
+//	com::sun::star::drawing::FlagSequenceSequence		maFlag;
+//
+//public:
+//	SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
+//	SdXMLImExSvgDElement(const rtl::OUString& rNew, 
+//		const SdXMLImExViewBox& rViewBox,
+//		const com::sun::star::awt::Point& rObjectPos,
+//		const com::sun::star::awt::Size& rObjectSize,
+//		const SvXMLUnitConverter& rConv);
+//
+//	void AddPolygon(
+//		com::sun::star::drawing::PointSequence* pPoints, 
+//		com::sun::star::drawing::FlagSequence* pFlags,
+//		const com::sun::star::awt::Point& rObjectPos,
+//		const com::sun::star::awt::Size& rObjectSize,
+//		bool bClosed = false, bool bRelative = true);
+//
+//	const rtl::OUString& GetExportString() const { return msString; }
+//	bool IsClosed() const { return mbIsClosed; }
+//	bool IsCurve() const { return mbIsCurve; }
+//	const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
+//	const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
+//};
+//
 
 #endif	//  _XEXPTRANSFORM_HXX
+// eof

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapContext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapContext.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapContext.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapContext.cxx Thu Aug  1 17:14:31 2013
@@ -19,25 +19,18 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_xmloff.hxx"
 #include "XMLImageMapContext.hxx"
 #include <rtl/ustrbuf.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/beans/XPropertySet.hpp>
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
-#endif
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
-
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
 #include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlimp.hxx>
@@ -50,7 +43,8 @@
 #include <xmloff/XMLEventsImportContext.hxx>
 #include "XMLStringBufferImportContext.hxx"
 #include <tools/debug.hxx>
-
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
@@ -494,32 +488,42 @@ void XMLImageMapPolygonContext::ProcessA
 	bValid = bViewBoxOK && bPointsOK;
 }
 
-void XMLImageMapPolygonContext::Prepare(
-	Reference<XPropertySet> & rPropertySet)
+void XMLImageMapPolygonContext::Prepare(Reference<XPropertySet> & rPropertySet)
 {
-	// process view box
-	SdXMLImExViewBox aViewBox(sViewBoxString, 
-							  GetImport().GetMM100UnitConverter());
-
-	// get polygon sequence
-	awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
-	awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
-	SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize, GetImport().GetMM100UnitConverter(), true );
-	PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
+    // process view box
+    SdXMLImExViewBox aViewBox(sViewBoxString, GetImport().GetMM100UnitConverter());
 
-	// only use first element of sequence-sequence
-	if (aPointSeqSeq.getLength() > 0)
-	{
-		Any aAny;
-		aAny <<= aPointSeqSeq[0];
-		rPropertySet->setPropertyValue(sPolygon, aAny);
-	}
-
-	// parent properties
-	XMLImageMapObjectContext::Prepare(rPropertySet);
-}
+    // get polygon sequence
+    basegfx::B2DPolygon aPolygon;
 
+    if(basegfx::tools::importFromSvgPoints(aPolygon, sPointsString))
+    {
+        if(aPolygon.count())
+        {
+            com::sun::star::drawing::PointSequence aPointSequence;
+            uno::Any aAny;
+
+            basegfx::tools::B2DPolygonToUnoPointSequence(aPolygon, aPointSequence);
+            aAny <<= aPointSequence;
+            rPropertySet->setPropertyValue(sPolygon, aAny);
+        }
+    }
+	//awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
+	//awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
+	//SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize, GetImport().GetMM100UnitConverter(), true );
+	//PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
+    //
+	//// only use first element of sequence-sequence
+	//if (aPointSeqSeq.getLength() > 0)
+	//{
+	//	Any aAny;
+	//	aAny <<= aPointSeqSeq[0];
+	//	rPropertySet->setPropertyValue(sPolygon, aAny);
+	//}
 
+    // parent properties
+    XMLImageMapObjectContext::Prepare(rPropertySet);
+}
 
 class XMLImageMapCircleContext : public XMLImageMapObjectContext
 {
@@ -621,15 +625,6 @@ void XMLImageMapCircleContext::Prepare(
 	XMLImageMapObjectContext::Prepare(rPropertySet);
 }
 
-
-
-
-
-
-
-
-
-
 XMLImageMapContext::XMLImageMapContext(
 	SvXMLImport& rImport,
 	sal_uInt16 nPrefix,
@@ -698,3 +693,4 @@ void XMLImageMapContext::EndElement()
 		xPropertySet->setPropertyValue(sImageMap, uno::makeAny( xImageMap ) );
 }
 
+// eof

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapExport.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapExport.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapExport.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapExport.cxx Thu Aug  1 17:14:31 2013
@@ -19,10 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_xmloff.hxx"
+
 #include "XMLImageMapExport.hxx"
 #include <rtl/ustring.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -32,10 +31,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
-
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
 #include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/awt/Size.hpp>
@@ -46,8 +42,8 @@
 #include <xmloff/XMLEventExport.hxx>
 #include <xmloff/xmluconv.hxx>
 #include "xexptran.hxx"
-
-
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
@@ -325,58 +321,68 @@ void XMLImageMapExport::ExportCircle(
 void XMLImageMapExport::ExportPolygon(
 	const Reference<XPropertySet> & rPropertySet)
 {
-	// polygons get exported as bounding box, viewbox, and coordinate
-	// pair sequence. The bounding box is always the entire image.
-
-	// get polygon point sequence
-	Any aAny = rPropertySet->getPropertyValue(msPolygon);
-	PointSequence aPoly;
-	aAny >>= aPoly;
-
-	// get bounding box (assume top-left to be 0,0)
-	sal_Int32 nWidth = 0;
-	sal_Int32 nHeight = 0;
-	sal_Int32 nLength = aPoly.getLength();
-	const struct awt::Point* pPointPtr = aPoly.getConstArray();
-	for	( sal_Int32 i = 0; i < nLength; i++ )
-	{
-		sal_Int32 nPolyX = pPointPtr->X;
-		sal_Int32 nPolyY = pPointPtr->Y;
-
-		if ( nPolyX > nWidth )
-			nWidth = nPolyX;
-		if ( nPolyY > nHeight )
-			nHeight = nPolyY;
-
-		pPointPtr++;
-	}
-	DBG_ASSERT(nWidth > 0, "impossible Polygon found");
-	DBG_ASSERT(nHeight > 0, "impossible Polygon found");
+    // polygons get exported as bounding box, viewbox, and coordinate
+    // pair sequence. The bounding box is always the entire image.
 
-	// parameters svg:x, svg:y, svg:width, svg:height
-	OUStringBuffer aBuffer;
-	mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
-	mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
-						  aBuffer.makeStringAndClear() );
-	mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
-	mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
-						  aBuffer.makeStringAndClear() );
-	mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth);
-	mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, 
-						  aBuffer.makeStringAndClear() );
-	mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight);
-	mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, 
-						  aBuffer.makeStringAndClear() );
-
-	// svg:viewbox
-	SdXMLImExViewBox aViewBox(0, 0, nWidth, nHeight);
-	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
-				aViewBox.GetExportString());
-
-	// export point sequence
-	awt::Point aPoint(0, 0);
-	awt::Size aSize(nWidth, nHeight);
-	SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize, true);
-	mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
-						  aPoints.GetExportString());
+    // get polygon point sequence
+    Any aAny = rPropertySet->getPropertyValue(msPolygon);
+    PointSequence aPoly;
+    aAny >>= aPoly;
+
+    const basegfx::B2DPolygon aPolygon(
+        basegfx::tools::UnoPointSequenceToB2DPolygon(
+            aPoly));
+    const basegfx::B2DRange aPolygonRange(aPolygon.getB2DRange());
+
+// TTTT:
+//	// get bounding box (assume top-left to be 0,0)
+//	sal_Int32 nWidth = 0;
+//	sal_Int32 nHeight = 0;
+//	sal_Int32 nLength = aPoly.getLength();
+//	const struct awt::Point* pPointPtr = aPoly.getConstArray();
+//	for	( sal_Int32 i = 0; i < nLength; i++ )
+//	{
+//		sal_Int32 nPolyX = pPointPtr->X;
+//		sal_Int32 nPolyY = pPointPtr->Y;
+//
+//		if ( nPolyX > nWidth )
+//			nWidth = nPolyX;
+//		if ( nPolyY > nHeight )
+//			nHeight = nPolyY;
+//
+//		pPointPtr++;
+//	}
+//	DBG_ASSERT(nWidth > 0, "impossible Polygon found");
+//	DBG_ASSERT(nHeight > 0, "impossible Polygon found");
+
+    // parameters svg:x, svg:y, svg:width, svg:height
+    OUStringBuffer aBuffer;
+
+    mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+    mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() );
+    mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+    mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() );
+    mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aPolygonRange.getWidth());
+    mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() );
+    mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, aPolygonRange.getHeight());
+    mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() );
+
+    // svg:viewbox
+    SdXMLImExViewBox aViewBox(0.0, 0.0, aPolygonRange.getWidth(), aPolygonRange.getHeight());
+    mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+    // export point sequence
+    const ::rtl::OUString aPointString(
+        basegfx::tools::exportToSvgPoints(
+            aPolygon));
+
+    mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
+
+    // TTTT:
+    //awt::Point aPoint(0, 0);
+    //awt::Size aSize(nWidth, nHeight);
+    //SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize, true);
+    //mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
 }
+
+// eof

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport2.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport2.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport2.cxx Thu Aug  1 17:14:31 2013
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_xmloff.hxx"
 #include "unointerfacetouniqueidentifiermapper.hxx"
@@ -52,6 +50,9 @@
 #include <basegfx/tuple/b2dtuple.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -138,30 +139,57 @@ void XMLShapeExport::ImpExportNewTrans_F
 		aTRScale.setX(1.0);
 	}
 
-	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX()));
-	aStr = sStringBuffer.makeStringAndClear();
-	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
-
 	// svg: height
 	if(!(nFeatures & SEF_EXPORT_HEIGHT))
 	{
 		aTRScale.setY(1.0);
 	}
 
+    // svg:width and svg:height are not allowed negative, extract that and
+    // set back to absolute values
+    bool bMirrorX(basegfx::fTools::less(aTRScale.getX(), 0.0));
+    bool bMirrorY(basegfx::fTools::less(aTRScale.getY(), 0.0));
+
+    if(bMirrorX)
+    {
+        aTRScale.setX(-aTRScale.getX());
+    }
+
+    if(bMirrorY)
+    {
+        aTRScale.setY(-aTRScale.getY());
+    }
+
+    // write positive svg:width
+    mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX()));
+	aStr = sStringBuffer.makeStringAndClear();
+	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
+
+    // write positive svg:height
 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY()));
 	aStr = sStringBuffer.makeStringAndClear();
 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
 
-	// decide if transformation is neccessary
-	sal_Bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0);
+	// decide if transformation is neccessary, new is that mirrorings are now
+    // part of this to not write negative svg:width or svg:height entries
+	const bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0 || bMirrorX || bMirrorY);
 
 	if(bTransformationIsNeccessary)
 	{
-		// write transformation, but WITHOUT scale which is exported as size above
-		SdXMLImExTransform2D aTransform;
+        // write transformation, but WITHOUT scale which is exported as size above
+        SdXMLImExTransform2D aTransform;
 
-		// Export Shear mirrored to stay compatible to ODF1.3
-		aTransform.AddSkewX(atan(-fTRShear));
+        if(bMirrorX || bMirrorY)
+        {
+            // add mirrorings if used
+            aTransform.AddScale(basegfx::B2DTuple(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0));
+        }
+
+        // Export Shear mirrored to stay compatible to ODF1.3
+        if(!basegfx::fTools::equalZero(fTRShear))
+        {
+            aTransform.AddSkewX(atan(-fTRShear));
+        }
 
         // #i78696# 
         // fTRRotate is mathematically correct, but due to the error
@@ -169,17 +197,38 @@ void XMLShapeExport::ImpExportNewTrans_F
         // uses the correctly oriented angle, it is necessary for compatibility to
         // mirror the angle here to stay at the old behaviour. There is a follow-up
         // task (#i78698#) to fix this in the next ODF FileFormat version
-		aTransform.AddRotate(-fTRRotate);
+        if(!basegfx::fTools::equalZero(fTRRotate))
+        {
+            aTransform.AddRotate(-fTRRotate);
+        }
+
+        // process translation; copy and evtl. detect non-writes
+        ::basegfx::B2DTuple aTRTranslate(rTRTranslate);
 
-        aTransform.AddTranslate(rTRTranslate);
+        if(!(nFeatures & SEF_EXPORT_X))
+        {
+            aTRTranslate.setX(0.0);
+        }
+
+        if(!(nFeatures & SEF_EXPORT_Y))
+        {
+            aTRTranslate.setY(0.0);
+        }
+
+        if(!basegfx::fTools::equalZero(aTRTranslate.getX()) || !basegfx::fTools::equalZero(aTRTranslate.getY()))
+        {
+            aTransform.AddTranslate(aTRTranslate);
+        }
 
 		// does transformation need to be exported?
 		if(aTransform.NeedsAction())
+        {
 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
+        }
 	}
 	else
 	{
-		// no shear, no rotate; just add object position to export and we are done
+		// no shear, no rotate, no mirror; just add object position to export and we are done
 		if(nFeatures & SEF_EXPORT_X)
 		{
 			// svg: x
@@ -922,147 +971,212 @@ void XMLShapeExport::ImpExportEllipseSha
 //////////////////////////////////////////////////////////////////////////////
 
 void XMLShapeExport::ImpExportPolygonShape(
-	const uno::Reference< drawing::XShape >& xShape,
-	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
+    const uno::Reference< drawing::XShape >& xShape,
+    XmlShapeType /*eShapeType*/, sal_Int32 nFeatures, awt::Point* pRefPoint) // TTTT: eShapeType
 {
-	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
-	if(xPropSet.is())
-	{
-		sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
-			|| eShapeType == XmlShapeTypeDrawClosedBezierShape);
-		sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
-			|| eShapeType == XmlShapeTypeDrawOpenBezierShape);
-
-		// get matrix
-		::basegfx::B2DHomMatrix aMatrix;
-		ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
-
-		// decompose and correct abour pRefPoint
-		::basegfx::B2DTuple aTRScale;
-		double fTRShear(0.0);
-		double fTRRotate(0.0);
-		::basegfx::B2DTuple aTRTranslate;
-		ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
-
-		// use features and write
-		ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
-
-		// create and export ViewBox
-		awt::Point aPoint(0, 0);
-		awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
-		SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
-		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
-
-		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
-
-		if(bBezier)
-		{
-			// get PolygonBezier
-			uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
-            drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
-				(drawing::PolyPolygonBezierCoords*)aAny.getValue();
-
-			if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
-			{
-				sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
-				drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
-				drawing::FlagSequence*  pOuterFlags = pSourcePolyPolygon->Flags.getArray();
-
-				if(pOuterSequence && pOuterFlags)
-				{
-					// prepare svx:d element export
-					SdXMLImExSvgDElement aSvgDElement(aViewBox);
-
-					for(sal_Int32 a(0L); a < nOuterCnt; a++)
-					{
-						drawing::PointSequence* pSequence = pOuterSequence++;
-						drawing::FlagSequence* pFlags = pOuterFlags++;
-
-						if(pSequence && pFlags)
-						{
-							aSvgDElement.AddPolygon(pSequence, pFlags,
-								aPoint, aSize, bClosed);
-						}
-					}
-
-					// write point array
-					mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
-				}
-
-				// write object now
-				SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
-
-				ImpExportDescription( xShape ); // #i68101#
-				ImpExportEvents( xShape );
-				ImpExportGluePoints( xShape );
-				ImpExportText( xShape );
-			}
-		}
-		else
-		{
-			// get non-bezier polygon
-			uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
-			drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
-
-			if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
-			{
-				sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
-
-				if(1L == nOuterCnt && !bBezier)
-				{
-					// simple polygon shape, can be written as svg:points sequence
-					drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
-					if(pSequence)
-					{
-						SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize, bClosed);
-
-						// write point array
-						mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
-					}
+    const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
 
-					// write object now
-					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
-						bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
-
-					ImpExportDescription( xShape ); // #i68101#
-					ImpExportEvents( xShape );
-					ImpExportGluePoints( xShape );
-					ImpExportText( xShape );
-				}
-				else
-				{
-					// polypolygon or bezier, needs to be written as a svg:path sequence
-					drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
-					if(pOuterSequence)
-					{
-						// prepare svx:d element export
-						SdXMLImExSvgDElement aSvgDElement(aViewBox);
+    if(xPropSet.is())
+    {
+//		sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
+//			|| eShapeType == XmlShapeTypeDrawClosedBezierShape);
+//		sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
+//			|| eShapeType == XmlShapeTypeDrawOpenBezierShape);
+
+        // get matrix
+        ::basegfx::B2DHomMatrix aMatrix;
+        ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
+
+        // decompose and correct about pRefPoint
+        ::basegfx::B2DTuple aTRScale;
+        double fTRShear(0.0);
+        double fTRRotate(0.0);
+        ::basegfx::B2DTuple aTRTranslate;
+        ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
+
+        // use features and write
+        ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
+
+        //awt::Point aPoint(0, 0);
+        //awt::Size aSize(FRound(fabs(aTRScale.getX())), FRound(fabs(aTRScale.getY())));
+
+        // create and export ViewBox. caution! for svg:ViewBox, use the absolute values (!)
+        SdXMLImExViewBox aViewBox(0.0, 0.0, fabs(aTRScale.getX()), fabs(aTRScale.getY()));
+
+        mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+        // get polygon data
+        const uno::Any aAny(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))));
+        basegfx::B2DPolyPolygon aPolyPolygon;
+        const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
 
-						for(sal_Int32 a(0L); a < nOuterCnt; a++)
-						{
-							drawing::PointSequence* pSequence = pOuterSequence++;
-							if(pSequence)
-							{
-								aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
-									aSize, bClosed);
-							}
-						}
+        if(aAny.getValueType().equals(getCppuType((drawing::PolyPolygonBezierCoords*)0)))
+        {
+            aPolyPolygon = basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue());
+        }
+        else if(aAny.getValueType().equals(getCppuType((drawing::PointSequenceSequence*)0)))
+        {
+            aPolyPolygon = basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue());
+        }
 
-						// write point array
-						mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
-					}
+        if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
+        {
+            // simple polygon shape, can be written as svg:points sequence
+            const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+            const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon));
+
+            // write point array
+            mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
+
+            // write object now
+            SvXMLElementExport aOBJ(
+                mrExport, 
+                XML_NAMESPACE_DRAW, 
+                aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE, 
+                bCreateNewline, 
+                sal_True);
+        }
+        else
+        {
+            // complex polygon shape, write as svg:d
+            const ::rtl::OUString aPolygonString(
+                basegfx::tools::exportToSvgD(
+                    aPolyPolygon,
+                    true,       // bUseRelativeCoordinates
+                    false));     // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
+
+            // write point array
+            mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+
+            // write object now
+            SvXMLElementExport aOBJ(
+                mrExport, 
+                XML_NAMESPACE_DRAW, 
+                XML_PATH, 
+                bCreateNewline, 
+                sal_True);
+        }
 
-					// write object now
-					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+        ImpExportDescription( xShape ); // #i68101#
+        ImpExportEvents( xShape );
+        ImpExportGluePoints( xShape );
+        ImpExportText( xShape );
 
-					ImpExportDescription( xShape ); // #i68101#
-					ImpExportEvents( xShape );
-					ImpExportGluePoints( xShape );
-					ImpExportText( xShape );
-				}
-			}
-		}
-	}
+// TTTT
+//		if(bBezier)
+//		{
+//			// get PolygonBezier
+//			uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+//            drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
+//				(drawing::PolyPolygonBezierCoords*)aAny.getValue();
+//
+//			if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+//			{
+//				sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+//				drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+//				drawing::FlagSequence*  pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+//
+//				if(pOuterSequence && pOuterFlags)
+//				{
+//					// prepare svx:d element export
+//					SdXMLImExSvgDElement aSvgDElement(aViewBox);
+//
+//					for(sal_Int32 a(0L); a < nOuterCnt; a++)
+//					{
+//						drawing::PointSequence* pSequence = pOuterSequence++;
+//						drawing::FlagSequence* pFlags = pOuterFlags++;
+//
+//						if(pSequence && pFlags)
+//						{
+//							aSvgDElement.AddPolygon(pSequence, pFlags,
+//								aPoint, aSize, bClosed);
+//						}
+//					}
+//
+//					// write point array
+//					mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+//				}
+//
+//				// write object now
+//				SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+//
+//				ImpExportDescription( xShape ); // #i68101#
+//				ImpExportEvents( xShape );
+//				ImpExportGluePoints( xShape );
+//				ImpExportText( xShape );
+//			}
+//		}
+//		else
+//		{
+//			// get non-bezier polygon
+//			uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+//			drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+//
+//			if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
+//			{
+//				sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
+//
+//				if(1L == nOuterCnt && !bBezier)
+//				{
+//                    // simple polygon shape, can be written as svg:points sequence
+//                    drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
+//                    if(pSequence)
+//                    {
+//                        const basegfx::B2DPolygon aPolygon(
+//                            basegfx::tools::UnoPointSequenceToB2DPolygon(
+//                                *pSequence));
+//                        const ::rtl::OUString aPointString(
+//                            basegfx::tools::exportToSvgPoints(
+//                                aPolygon));
+//                        // SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize, bClosed);
+//
+//                        // write point array
+//                        mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
+//                    }
+//
+//					// write object now
+//					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
+//						bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
+//
+//					ImpExportDescription( xShape ); // #i68101#
+//					ImpExportEvents( xShape );
+//					ImpExportGluePoints( xShape );
+//					ImpExportText( xShape );
+//				}
+//				else
+//				{
+//					// polypolygon or bezier, needs to be written as a svg:path sequence
+//					drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
+//					if(pOuterSequence)
+//					{
+//						// prepare svx:d element export
+//						SdXMLImExSvgDElement aSvgDElement(aViewBox);
+//
+//						for(sal_Int32 a(0L); a < nOuterCnt; a++)
+//						{
+//							drawing::PointSequence* pSequence = pOuterSequence++;
+//							if(pSequence)
+//							{
+//								aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
+//									aSize, bClosed);
+//							}
+//						}
+//
+//						// write point array
+//						mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+//					}
+//
+//					// write object now
+//					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+//
+//					ImpExportDescription( xShape ); // #i68101#
+//					ImpExportEvents( xShape );
+//					ImpExportGluePoints( xShape );
+//					ImpExportText( xShape );
+//				}
+//			}
+//		}
+    }
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -1402,43 +1516,54 @@ void XMLShapeExport::ImpExportConnectorS
 		}
 	}
 
-	if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
-	{
-		// get PolygonBezier
-		drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
-			(drawing::PolyPolygonBezierCoords*)aAny.getValue();
-
-		if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
-		{
-			sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
-			drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
-			drawing::FlagSequence*  pOuterFlags = pSourcePolyPolygon->Flags.getArray();
-
-			if(pOuterSequence && pOuterFlags)
-			{
-				// prepare svx:d element export
-				awt::Point aPoint( 0, 0 );
-				awt::Size aSize( 1, 1 );
-				SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
-				SdXMLImExSvgDElement aSvgDElement(aViewBox);
-
-				for(sal_Int32 a(0L); a < nOuterCnt; a++)
-				{
-					drawing::PointSequence* pSequence = pOuterSequence++;
-					drawing::FlagSequence* pFlags = pOuterFlags++;
-
-					if(pSequence && pFlags)
-					{
-						aSvgDElement.AddPolygon(pSequence, pFlags,
-							aPoint, aSize, sal_False );
-					}
-				}
+    if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
+    {
+        // get PolygonBezier
+        drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = (drawing::PolyPolygonBezierCoords*)aAny.getValue();
 
-				// write point array
-				mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
-			}
-		}
-	}
+        if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+        {
+            const basegfx::B2DPolyPolygon aPolyPolygon(
+                basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+                    *pSourcePolyPolygon));
+            const ::rtl::OUString aPolygonString(
+                basegfx::tools::exportToSvgD(
+                    aPolyPolygon,
+                    true,           // bUseRelativeCoordinates
+                    false));        // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
+
+            // write svg:d
+            mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+// TTTT
+//			sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
+//			drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
+//			drawing::FlagSequence*  pOuterFlags = pSourcePolyPolygon->Flags.getArray();
+//
+//			if(pOuterSequence && pOuterFlags)
+//			{
+//				// prepare svx:d element export
+//				awt::Point aPoint( 0, 0 );
+//				awt::Size aSize( 1, 1 );
+//				SdXMLImExViewBox aViewBox( 0.0, 0.0, 1.0, 1.0 );
+//				SdXMLImExSvgDElement aSvgDElement(aViewBox);
+//
+//				for(sal_Int32 a(0L); a < nOuterCnt; a++)
+//				{
+//					drawing::PointSequence* pSequence = pOuterSequence++;
+//					drawing::FlagSequence* pFlags = pOuterFlags++;
+//
+//					if(pSequence && pFlags)
+//					{
+//						aSvgDElement.AddPolygon(pSequence, pFlags,
+//							aPoint, aSize, sal_False );
+//					}
+//				}
+//
+//				// write point array
+//				mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+//			}
+        }
+    }
 
 	// write connector shape. Add Export later.
 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport3.cxx?rev=1509334&r1=1509333&r2=1509334&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport3.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/shapeexport3.cxx Thu Aug  1 17:14:31 2013
@@ -19,10 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_xmloff.hxx"
+
 #include <com/sun/star/drawing/HomogenMatrix.hpp>
 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
 #include <com/sun/star/drawing/ProjectionMode.hpp>
@@ -32,10 +31,7 @@
 #include <com/sun/star/drawing/CameraGeometry.hpp>
 #include <com/sun/star/drawing/DoubleSequence.hpp>
 #include <tools/gen.hxx>
-
-#ifndef _XMLOFF_SHAPEEXPORT_HXX
 #include <xmloff/shapeexport.hxx>
-#endif
 #include "sdpropls.hxx"
 #include <tools/debug.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -44,8 +40,12 @@
 #include "xexptran.hxx"
 #include <xmloff/xmltoken.hxx>
 #include <basegfx/vector/b3dvector.hxx>
-
-#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnmspe.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -198,117 +198,150 @@ void XMLShapeExport::ImpExport3DShape(
 			case XmlShapeTypeDraw3DLatheObject:
 			case XmlShapeTypeDraw3DExtrudeObject:
 			{
-				// write special 3DLathe/3DExtrude attributes
-				aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
-				drawing::PolyPolygonShape3D xPolyPolygon3D;
-				aAny >>= xPolyPolygon3D;
-
-				// look for maximal values
-				double fXMin = 0;
-				double fXMax = 0;
-				double fYMin = 0;
-				double fYMax = 0;
-				sal_Bool bInit(sal_False);
-				sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
-				drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
-				drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
-
-				sal_Int32 a;
-                for (a = 0; a < nOuterSequenceCount; a++)
-				{
-					sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
-					double* pArrayX = pInnerSequenceX->getArray();
-					double* pArrayY = pInnerSequenceY->getArray();
-
-					for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
-					{
-						double fX = *pArrayX++;
-						double fY = *pArrayY++;
-
-						if(bInit)
-						{
-							if(fX > fXMax)
-								fXMax = fX;
-
-							if(fX < fXMin)
-								fXMin = fX;
-
-							if(fY > fYMax)
-								fYMax = fY;
-
-							if(fY < fYMin)
-								fYMin = fY;
-						}
-						else
-						{
-							fXMin = fXMax = fX;
-							fYMin = fYMax = fY;
-							bInit = sal_True;
-						}
-					}
-
-					pInnerSequenceX++;
-					pInnerSequenceY++;
-				}
-
-				// export ViewBox
-				awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
-				awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
-				SdXMLImExViewBox aViewBox(
-					aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
-				mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, 
-					aViewBox.GetExportString());
-
-				// prepare svx:d element export
-				SdXMLImExSvgDElement aSvgDElement(aViewBox);
-				pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
-				pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
-
-                for (a = 0; a < nOuterSequenceCount; a++)
-				{
-					sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
-					double* pArrayX = pInnerSequenceX->getArray();
-					double* pArrayY = pInnerSequenceY->getArray();
-					drawing::PointSequence aPoly(nInnerSequenceCount);
-					awt::Point* pInnerSequence = aPoly.getArray();
-
-					for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
-					{
-						double fX = *pArrayX++;
-						double fY = *pArrayY++;
-
-						*pInnerSequence = awt::Point(FRound(fX), FRound(fY));
-						pInnerSequence++;
-					}
-
-					// calculate closed flag
-					awt::Point* pFirst = aPoly.getArray();
-					awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
-					sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
-
-					aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint, 
-						aMaxSize, bClosed);
-
-					// #80594# corrected error in PolyPolygon3D export for 3D XML
-					pInnerSequenceX++;
-					pInnerSequenceY++;
-				}
-
-				// write point array
-				mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
-
-				if(eShapeType == XmlShapeTypeDraw3DLatheObject)
-				{
-					// write 3DLathe shape
-					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
-				}
-				else
-				{
-					// write 3DExtrude shape
-					SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
-				}
-				break;
-			}
+                // write special 3DLathe/3DExtrude attributes, get 3D PolyPolygon as drawing::PolyPolygonShape3D
+                aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
+                drawing::PolyPolygonShape3D xPolyPolygon3D;
+                aAny >>= xPolyPolygon3D;
+
+                // convert to 3D PolyPolygon
+                const basegfx::B3DPolyPolygon aPolyPolygon3D(
+                    basegfx::tools::UnoPolyPolygonShape3DToB3DPolyPolygon(
+                        xPolyPolygon3D));
+
+                // convert to 2D PolyPolygon using identity 3D transformation (just grep X and Y)
+                const basegfx::B3DHomMatrix aB3DHomMatrixFor2DConversion;
+                const basegfx::B2DPolyPolygon aPolyPolygon(
+                    basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(
+                        aPolyPolygon3D,
+                        aB3DHomMatrixFor2DConversion));
+
+                // get 2D range of it
+                const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
+
+                // export ViewBox
+                SdXMLImExViewBox aViewBox(
+                    aPolyPolygonRange.getMinX(), 
+                    aPolyPolygonRange.getMinY(), 
+                    aPolyPolygonRange.getWidth(), 
+                    aPolyPolygonRange.getHeight());
+
+                mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+                // prepare svg:d string
+                const ::rtl::OUString aPolygonString(
+                    basegfx::tools::exportToSvgD(
+                        aPolyPolygon,
+                        true,           // bUseRelativeCoordinates
+                        false));        // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
+
+                // write point array
+                mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+
+                // TTTT
+                //// look for maximal values
+                //double fXMin = 0;
+                //double fXMax = 0;
+                //double fYMin = 0;
+                //double fYMax = 0;
+                //sal_Bool bInit(sal_False);
+                //sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
+                //drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+                //drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+                //
+                //sal_Int32 a;
+                //for (a = 0; a < nOuterSequenceCount; a++)
+                //{
+                //    sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+                //    double* pArrayX = pInnerSequenceX->getArray();
+                //    double* pArrayY = pInnerSequenceY->getArray();
+                //
+                //    for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+                //    {
+                //        double fX = *pArrayX++;
+                //        double fY = *pArrayY++;
+                //
+                //        if(bInit)
+                //        {
+                //            if(fX > fXMax)
+                //                fXMax = fX;
+                //
+                //            if(fX < fXMin)
+                //                fXMin = fX;
+                //
+                //            if(fY > fYMax)
+                //                fYMax = fY;
+                //
+                //            if(fY < fYMin)
+                //                fYMin = fY;
+                //        }
+                //        else
+                //        {
+                //            fXMin = fXMax = fX;
+                //            fYMin = fYMax = fY;
+                //            bInit = sal_True;
+                //        }
+                //    }
+                //
+                //    pInnerSequenceX++;
+                //    pInnerSequenceY++;
+                //}
+                //
+                //// export ViewBox
+                //awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
+                //awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
+                //SdXMLImExViewBox aViewBox(fXMin, fYMin, fXMax - fXMin, fYMax - fYMin);
+                //mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+                //
+                //// prepare svx:d element export
+                //SdXMLImExSvgDElement aSvgDElement(aViewBox);
+                //pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
+                //pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
+                //
+                //for (a = 0; a < nOuterSequenceCount; a++)
+                //{
+                //    sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
+                //    double* pArrayX = pInnerSequenceX->getArray();
+                //    double* pArrayY = pInnerSequenceY->getArray();
+                //    drawing::PointSequence aPoly(nInnerSequenceCount);
+                //    awt::Point* pInnerSequence = aPoly.getArray();
+                //
+                //    for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
+                //    {
+                //        double fX = *pArrayX++;
+                //        double fY = *pArrayY++;
+                //
+                //        *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
+                //        pInnerSequence++;
+                //    }
+                //
+                //    // calculate closed flag
+                //    awt::Point* pFirst = aPoly.getArray();
+                //    awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
+                //    sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
+                //
+                //    aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint, 
+                //        aMaxSize, bClosed);
+                //
+                //    // #80594# corrected error in PolyPolygon3D export for 3D XML
+                //    pInnerSequenceX++;
+                //    pInnerSequenceY++;
+                //}
+                //
+                //// write point array
+                //mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+
+                if(eShapeType == XmlShapeTypeDraw3DLatheObject)
+                {
+                    // write 3DLathe shape
+                    SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
+                }
+                else
+                {
+                    // write 3DExtrude shape
+                    SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
+                }
+                break;
+            }
 			default:
 				break;
 		}