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 2014/04/10 17:08:58 UTC

svn commit: r1586329 - in /openoffice/branches/alg/aw080/main: drawinglayer/source/processor2d/ sd/source/ui/func/ sd/source/ui/view/ svx/inc/svx/ svx/source/svdraw/ xmloff/source/draw/

Author: alg
Date: Thu Apr 10 15:08:57 2014
New Revision: 1586329

URL: http://svn.apache.org/r1586329
Log:
in-between results/corrections/improvemnts

Removed:
    openoffice/branches/alg/aw080/main/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
Modified:
    openoffice/branches/alg/aw080/main/sd/source/ui/func/fudraw.cxx
    openoffice/branches/alg/aw080/main/sd/source/ui/view/drviews7.cxx
    openoffice/branches/alg/aw080/main/svx/inc/svx/svdlegacy.hxx
    openoffice/branches/alg/aw080/main/svx/source/svdraw/svdedtv1.cxx
    openoffice/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx
    openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx
    openoffice/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx
    openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx
    openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx

Modified: openoffice/branches/alg/aw080/main/sd/source/ui/func/fudraw.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sd/source/ui/func/fudraw.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sd/source/ui/func/fudraw.cxx (original)
+++ openoffice/branches/alg/aw080/main/sd/source/ui/func/fudraw.cxx Thu Apr 10 15:08:57 2014
@@ -457,7 +457,7 @@ bool FuDraw::KeyInput(const KeyEvent& rK
 				if(!mpView->MarkNextObj( !aCode.IsShift() ))
 				{
 					//If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). 
-					if ( mpView->getSelectedSdrObjectCount()  > 1 )
+					if ( mpView->areSdrObjectsSelected() && mpView->GetMarkableObjCount() > 1 )
 					{
 						// #97016# No next object: go over open end and
 						// get first from the other side

Modified: openoffice/branches/alg/aw080/main/sd/source/ui/view/drviews7.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sd/source/ui/view/drviews7.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sd/source/ui/view/drviews7.cxx (original)
+++ openoffice/branches/alg/aw080/main/sd/source/ui/view/drviews7.cxx Thu Apr 10 15:08:57 2014
@@ -19,10 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sd.hxx"
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/linguistic2/XThesaurus.hpp>
@@ -46,8 +45,6 @@
 #include <editeng/unolingu.hxx>
 #include <svx/extrusionbar.hxx>
 #include <svx/fontworkbar.hxx>
-
-// #UndoRedo#
 #include <svl/slstitm.hxx>
 #include <sfx2/app.hxx>
 #include <svtools/insdlg.hxx>
@@ -55,18 +52,17 @@
 #include <svl/languageoptions.hxx>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/request.hxx>
-
-
+#include <svx/svdoole2.hxx>
 #include <svx/pfiledlg.hxx>
 #include <svx/grafctrl.hxx>
 #include <svtools/cliplistener.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <svx/svdotable.hxx>
 
 #include "app.hrc"
 #include "glob.hrc"
 #include "res_bmp.hrc"
 #include "PresentationViewShell.hxx"
-
 #include "misc.hxx"
 #include "Outliner.hxx"
 #include "drawdoc.hxx"
@@ -1411,141 +1407,126 @@ void DrawViewShell::GetMenuState( SfxIte
 	}
 	else
 	{
-		// get selection
-		const SdrObjectVector aSelection(mpDrawView->getSelectedSdrObjectVectorFromSdrMarkView());
-		bool bFoundBitmap(false);
-		bool bFoundMetafile(false);
-		bool bFoundObjNoLine(false);
-		bool bFoundObjNoArea(false);
-		bool bFoundNoGraphicObj(false);
-		bool bFoundAny(false);
-		bool bFoundTable(false);
-		
-		for(sal_uInt32 i(0); i < aSelection.size() && !bFoundAny; i++)
-		{
-			SdrObject* pObj = aSelection[i];
-			const sal_uInt16 nId(pObj->GetObjIdentifier());
-			const sal_uInt32 nInv(pObj->GetObjInventor());
+        // get selection
+        const SdrObjectVector aSelection(mpDrawView->getSelectedSdrObjectVectorFromSdrMarkView());
+        bool bFoundBitmap(false);
+        bool bFoundMetafile(false);
+        bool bFoundObjNoLine(false);
+        bool bFoundObjNoArea(false);
+        bool bFoundNoGraphicObj(false);
+        bool bFoundAny(false);
+        bool bFoundTable(false);
 
-			if(nInv == SdrInventor)
-			{
-				// 2D objects
-				switch( nId )
-				{
-                    case OBJ_POLY:
-                    {
-                        SdrPathObj* pSdrPathObj = dynamic_cast< SdrPathObj* >(pObj);
+        for(sal_uInt32 i(0); i < aSelection.size() && !bFoundAny; i++)
+        {
+            SdrObject* pObj = aSelection[i];
 
-                        if(pSdrPathObj)
-                        {
-                            switch(pSdrPathObj->getSdrPathObjType())
-                            {
-                                case PathType_Line:
-                                case PathType_OpenPolygon:
-                                case PathType_OpenBezier:
-                                {
-						            bFoundObjNoArea = true;
-						            bFoundNoGraphicObj = true;
-                                    break;
-                                }
-                                default:
-                                    break;
-                            }
-                        }
-                        else
-                        {
-                            OSL_ENSURE(false, "OOps, SdrObjKind and dynamic_cast do not fit (!)");
-                        }
-                        break;
+            if(pObj)
+            {
+                if(dynamic_cast< SdrPathObj* >(pObj) || dynamic_cast< SdrCircObj* >(pObj) || dynamic_cast< SdrEdgeObj* >(pObj))
+                {
+                    // OBJ_POLY, OBJ_CIRC and OBJ_EDGE; decision depends on closed or not (fill possible)
+                    if(pObj->IsClosedObj())
+                    {
+                        bFoundObjNoArea = true;
+                        bFoundNoGraphicObj = true;
                     }
-                    case OBJ_CIRC:
+                    else
                     {
-                        SdrCircObj* pSdrCircObj = dynamic_cast< SdrCircObj* >(pObj);
+                        bFoundAny = true;
+                        break;
+                    }
+                }
+                else if(dynamic_cast< SdrOle2Obj* >(pObj))
+                {
+                    // OBJ_OLE2 #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
+                    bSingleGraphicSelected = (1 == aSelection.size());
+                    bFoundBitmap = true;
+                    bFoundMetafile = true;
+                }
+                else if(dynamic_cast< SdrGrafObj* >(pObj))
+                {
+                    // OBJ_GRAF
+                    bSingleGraphicSelected = (1 == aSelection.size());
 
-                        if(pSdrCircObj)
+                    switch(static_cast< const SdrGrafObj* >(pObj)->GetGraphicType())
+                    {
+                        case GRAPHIC_BITMAP:
                         {
-                            if(CircleType_Arc == pSdrCircObj->GetSdrCircleObjType())
+                            bFoundBitmap = true;
+
+                            if(static_cast< const SdrGrafObj* >(pObj)->isEmbeddedSvg())
                             {
-						        bFoundObjNoArea = true;
-						        bFoundNoGraphicObj = true;
+                                bFoundMetafile = true;
                             }
+                            break;
                         }
-                        else
+                        case GRAPHIC_GDIMETAFILE:
                         {
-                            OSL_ENSURE(false, "OOps, SdrObjKind and dynamic_cast do not fit (!)");
+                            bFoundMetafile = true;
+                            break;
+                        }
+                        default:
+                        {
+                            break;
                         }
-                        break;
                     }
-					case OBJ_EDGE:
-						bFoundObjNoArea      = true;
-						bFoundNoGraphicObj = true;
-						break;
-					case OBJ_OLE2 :
-						// #i118485# #i118525# Allow Line, Area and Graphic (Metafile, Bitmap)
-						bSingleGraphicSelected = (1 == aSelection.size());
-    					bFoundBitmap = true;
-    					bFoundMetafile = true;
-						break;
-					case OBJ_GRAF :
-                    {
-						bSingleGraphicSelected = (1 == aSelection.size());
-                        const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj);
-						switch(pSdrGrafObj->GetGraphicType())
-						{
-							case GRAPHIC_BITMAP :
-								bFoundBitmap = true;
-                                if(pSdrGrafObj->isEmbeddedSvg())
-                                {
-                                    bFoundMetafile = true;
-                                }
-								break;
-							case GRAPHIC_GDIMETAFILE :
-								bFoundMetafile = true;
-								break;
-							default:
-								break;
-						}
+                }
+                else if(dynamic_cast< sdr::table::SdrTableObj* >(pObj))
+                {
+                    // OBJ_TABLE
+                    bFoundTable = true;
+                }
+                else
+                {
+                    // everything else (including 3D objects)
+                    bFoundAny = true;
+                }
+            }
+            else
+            {
+                OSL_ENSURE(false, "SdrObject selection with empty SdrObjects is not allowed (!)");
+            }
+        }
 
-						break;
-                    }
-					case OBJ_TABLE:
-						bFoundTable = true;
-						break;
-					default :
-						bFoundAny = true;
-				}
-			}
-			else if(nInv == E3dInventor)
-			{
-				// 3D objects
-				bFoundAny = true;
-			}
-		}
+        if(bFoundTable)
+        {
+            rSet.DisableItem(SID_ATTRIBUTES_LINE);
+        }
 
-		if( bFoundTable )
-			rSet.DisableItem( SID_ATTRIBUTES_LINE );
+        if(!bFoundAny)
+        {
+            // Disable menuitem for area-dialog
+            if(bFoundObjNoArea) 
+            {
+                // #i25616#
+                rSet.DisableItem(SID_ATTRIBUTES_AREA);
+            }
 
-		if (!bFoundAny)
-		{
-			// Disable menuitem for area-dialog
-			if( bFoundObjNoArea ) // #i25616#
-				rSet.DisableItem( SID_ATTRIBUTES_AREA );
-
-			// Disable menuitem for line-dialog
-			if( bFoundObjNoLine )
-				rSet.DisableItem( SID_ATTRIBUTES_LINE );
-
-			if( bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj )	// only Bitmaps marked
-				rSet.DisableItem( SID_CONVERT_TO_BITMAP );
-			else if( !bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj )	// only Metafiles marked
-				rSet.DisableItem( SID_CONVERT_TO_METAFILE );
-			else if( !bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj )	// nothing to do
-			{
-				rSet.DisableItem( SID_CONVERT_TO_BITMAP );
-				rSet.DisableItem( SID_CONVERT_TO_METAFILE );
-			}
-		}
-	}
+            // Disable menuitem for line-dialog
+            if(bFoundObjNoLine)
+            {
+                rSet.DisableItem(SID_ATTRIBUTES_LINE);
+            }
+
+            if(bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj)
+            {
+                // only Bitmaps marked
+                rSet.DisableItem(SID_CONVERT_TO_BITMAP);
+            }
+            else if(!bFoundBitmap && bFoundMetafile && !bFoundNoGraphicObj)
+            {
+                // only Metafiles marked
+                rSet.DisableItem(SID_CONVERT_TO_METAFILE);
+            }
+            else if(!bFoundBitmap && !bFoundMetafile && !bFoundNoGraphicObj)
+            {
+                // nothing to do
+                rSet.DisableItem(SID_CONVERT_TO_BITMAP);
+                rSet.DisableItem(SID_CONVERT_TO_METAFILE);
+            }
+        }
+    }
 
 	if( !bSingleGraphicSelected )
 	{

Modified: openoffice/branches/alg/aw080/main/svx/inc/svx/svdlegacy.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/inc/svx/svdlegacy.hxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/inc/svx/svdlegacy.hxx (original)
+++ openoffice/branches/alg/aw080/main/svx/inc/svx/svdlegacy.hxx Thu Apr 10 15:08:57 2014
@@ -59,9 +59,22 @@ namespace sdr
 		// old access to anchor as point
 		SVX_DLLPUBLIC Point GetAnchorPos(const SdrObject& rObject);
 
+        // back and forth converters for Rotation new (angle in rad [0.0 .. F_2PI[) and 
+        // old (mirrored angle in deg * 100 [0 .. 36000[)
+        // These converters are used for places where the correct new values are used
+        // for the UI and similar
+        long convertRotateAngleNewToLegacy(double fNew);
+        double convertRotateAngleLegacyToNew(long nOld);
+
+        // back and forth converters for ShearX new (shear x in rad [-F_PI .. F_PI[) and 
+        // old (mirrored shear x in deg * 100 [-18000 .. 18000[)
+        // These converters are used for places where the correct new values are used
+        // for the UI and similar
+        long convertShearAngleXNewToLegacy(double fNew);
+        double convertShearAngleXLegacyToNew(long nOld);
+
 		// old access to rotate and shear (including wrong orientation and
-		// integer nature). bool bVertical removed and method renamed,
-		// was not supported anyways
+		// integer nature, see above converters)
 		SVX_DLLPUBLIC long GetRotateAngle(const SdrObject& rObject);
 		SVX_DLLPUBLIC long GetShearAngleX(const SdrObject& rObject);
 

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdedtv1.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdedtv1.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdedtv1.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdedtv1.cxx Thu Apr 10 15:08:57 2014
@@ -268,36 +268,22 @@ void SdrEditView::ResizeMarkedObj(const 
 
 double SdrEditView::GetMarkedObjRotate() const
 {
-    if(!areSdrObjectsSelected())
-    {
-        return 0.0;
-    }
-
-    SdrObject* pSingle = getSelectedIfSingle();
-
-    if(pSingle)
-    {
-        return pSingle->getSdrObjectRotate();
-    }
-
-    const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
+    SdrObject* pCandidate = getSelectedIfSingle();
 
-    if(aSelection.size())
+    if(!pCandidate)
     {
-        SdrObject* pObject = aSelection[0];
+        // for multiselection use the rotation angle of the 1st object
+        const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
 
-        if(pObject)
-        {
-            return pObject->getSdrObjectRotate();
-        }
-        else
+        if(aSelection.size())
         {
-            OSL_ENSURE(false, "OOps, areSdrObjectsSelected() == true, but no first object (!)");
+            pCandidate = aSelection[0];
         }
     }
-    else
+
+    if(pCandidate)
     {
-        OSL_ENSURE(false, "OOps, areSdrObjectsSelected() == true, but no objects (!)");
+        return pCandidate->getSdrObjectRotate();
     }
 
     return 0.0;
@@ -496,36 +482,30 @@ void SdrEditView::MirrorMarkedObjVertica
 
 double SdrEditView::GetMarkedObjShearX() const
 {
-	double fRetval(0.0);
-
-	if(areSdrObjectsSelected())
-	{
-		const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
+    SdrObject* pCandidate = getSelectedIfSingle();
 
-		for(sal_uInt32 a(0); a < aSelection.size(); a++)
-		{
-			SdrObject* pObject = aSelection[a];
+    if(!pCandidate)
+    {
+        // for multiselection use the shear value of the 1st object
+        const SdrObjectVector aSelection(getSelectedSdrObjectVectorFromSdrMarkView());
 
-			if(a)
-			{
-				const double fNew(pObject->getSdrObjectShearX());
+        if(aSelection.size())
+        {
+            pCandidate = aSelection[0];
+        }
+    }
 
-				if(!basegfx::fTools::equal(fNew, fRetval))
-				{
-					return 0.0;
-				}
-			}
-			else
-			{
-				fRetval = pObject->getSdrObjectShearX();
-			}
-		}
+    if(pCandidate)
+    {
+        OSL_ENSURE(
+            basegfx::fTools::less(atan(pCandidate->getSdrObjectShearX()), F_PI2 * (89.0/90.0)) &&
+            basegfx::fTools::more(atan(pCandidate->getSdrObjectShearX()), -F_PI2 * (89.0/90.0)),
+            "Shear angle is out of bounds (inside the one degree extrema corresponding to a +/- 90 degree range)");
 
-		const double fMaxShearRange(F_PI2 * (89.0/90.0));
-		fRetval = basegfx::clamp(fRetval, -fMaxShearRange, fMaxShearRange);
-	}
+        return pCandidate->getSdrObjectShearX();
+    }
 
-	return fRetval;
+    return 0.0;
 }
 
 void SdrEditView::ShearMarkedObj(const basegfx::B2DPoint& rRefPoint, double fAngle, bool bVShear, bool bCopy)
@@ -961,24 +941,24 @@ void SdrEditView::SetNotPersistAttrToMar
 	
 		if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SFX_ITEM_SET) 
 		{
-			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
-			const double fNewAngle((((36000 - nAngle) % 36000) * F_PI) / 18000.0);
+ 			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
+            const double fNewAngle(sdr::legacy::convertRotateAngleLegacyToNew(nAngle));
 
 			RotateMarkedObj(rAllSnapRange.getCenter(), fNewAngle);
 		}
 	
 		if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,true,&pPoolItem)==SFX_ITEM_SET) 
 		{
-			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
-			const double fAngle(tan(((36000 - nAngle) * F_PI) / 18000.0));
+ 			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
+            const double fAngle(sdr::legacy::convertShearAngleXLegacyToNew(nAngle));
 
 			ShearMarkedObj(rAllSnapRange.getCenter(), fAngle, false);
 		}
 	
 		if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,true,&pPoolItem)==SFX_ITEM_SET) 
 		{
-			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
-			const double fAngle(tan(((36000 - nAngle) * F_PI) / 18000.0));
+ 			const sal_Int32 nAngle(((const SdrAngleItem*)pPoolItem)->GetValue());
+            const double fAngle(sdr::legacy::convertShearAngleXLegacyToNew(nAngle));
 
 			ShearMarkedObj(rAllSnapRange.getCenter(), fAngle, true);
 		}
@@ -1705,9 +1685,13 @@ SfxItemSet SdrEditView::GetGeoAttrFromMa
 			fRotateRefX = aRotateAxe.getX();
 			fRotateRefY = aRotateAxe.getY();
 		}
-		
+
+        // get rotation of selection. fAllRotation is in radians [0.0 .. F_2PI[
 		const double fAllRotation(GetMarkedObjRotate());
-		const sal_Int32 nOldAllRot((basegfx::fround(((F_2PI - fAllRotation) * 18000.0) / F_PI)) % 36000);
+
+        // convert to old notation used in the UI; it's orientation is mirrored and its
+        // degrees * 100 in integer
+		const sal_Int32 nOldAllRot(sdr::legacy::convertRotateAngleNewToLegacy(fAllRotation));
 
 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ANGLE,nOldAllRot));
 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_ROT_X,basegfx::fround(fRotateRefX)));
@@ -1724,15 +1708,15 @@ SfxItemSet SdrEditView::GetGeoAttrFromMa
 			fShearRefY = aRotateAxe.getY();
 		}
 
-		double fAllShearX(GetMarkedObjShearX());
-		const double fMaxShearRange(F_PI2 * (89.0/90.0));
+        // get shear of selection. GetMarkedObjShearX is the tan of the shear angle in radians
+        // tan(]-F_PI2 .. F_PI2[), so apply atan to get the shear angle
+        const double fAllShearAngleX(atan(GetMarkedObjShearX()));
+
+        // convert to old notation used in the UI; it's orientation is mirrored and its
+        // degrees * 100 in integer
+        const sal_Int32 nOldAllShearAngleX(sdr::legacy::convertShearAngleXNewToLegacy(fAllShearAngleX));
 
-		fAllShearX = basegfx::snapToRange(fAllShearX, -F_PI, F_PI);
-		fAllShearX = basegfx::clamp(fAllShearX, -fMaxShearRange, fMaxShearRange);
-
-		const sal_Int32 nOldAllShearX(basegfx::fround(((-fAllShearX) * 18000.0) / F_PI));
-
-		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR,nOldAllShearX));
+		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR,nOldAllShearAngleX));
 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X,basegfx::fround(fShearRefX)));
 		aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y,basegfx::fround(fShearRefY)));
 
@@ -1936,13 +1920,16 @@ void SdrEditView::SetGeoAttrToMarked(con
 	}
 
 	// rotation change?
-	const double fOldRotateAngle(GetMarkedObjRotate());
+	const double fOldRotateAngle(GetMarkedObjRotate()); // radians [0.0 .. F_2PI[
 	double fNewRotateAngle(fOldRotateAngle);
 
 	if (SFX_ITEM_SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE,true,&pPoolItem)) 
 	{
-		const sal_Int32 nAllRot(((const SfxInt32Item*)pPoolItem)->GetValue());
-		fNewRotateAngle = (((36000 - nAllRot) % 36000) * F_PI) / 18000.0;
+        const sal_Int32 nAllRot(((const SfxInt32Item*)pPoolItem)->GetValue());
+
+        // convert from old UI units (angle in degree * 100, wrong oriented)
+        // to correctly orinented radians, same coordinate system as fOldRotateAngle
+        fNewRotateAngle = sdr::legacy::convertRotateAngleLegacyToNew(nAllRot);
 	}
 
 	const bool bRotate(!basegfx::fTools::equal(fOldRotateAngle, fNewRotateAngle));
@@ -1960,24 +1947,36 @@ void SdrEditView::SetGeoAttrToMarked(con
 	}
 
 	// shear change?
-	double fShearAngle(0.0);
+	double fShearChange(0.0);
 	basegfx::B2DPoint aShearOffset(0.0, 0.0);
-	bool bShearVert(false);
-	bool bShear(false);
+	bool bDoShearY(false);
+	bool bDoShearDelta(false);
 
 	if(SFX_ITEM_SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,true,&pPoolItem)) 
 	{
-		const sal_Int32 nAllShear(((const SfxInt32Item*)pPoolItem)->GetValue());
-		const double fMaxShearRange(F_PI2 * (89.0/90.0));
-		double fNewShearAngle(((-nAllShear) * F_PI) / 18000.0);
-
-		fNewShearAngle = basegfx::snapToRange(fNewShearAngle, -F_PI, F_PI);
-		fNewShearAngle = basegfx::clamp(fNewShearAngle, -fMaxShearRange, fMaxShearRange);
+        // get UI shear angle ]-9000 .. 9000[
+        const sal_Int32 nAllShear(((const SfxInt32Item*)pPoolItem)->GetValue());
 
-		bShearVert = ((const SfxBoolItem&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_VERTICAL)).GetValue();
-		double fOldShearAngle(GetMarkedObjShearX());
+        // convert to correctly oriented shear angle in radians ]-F_PI2 .. F_PI2[
+        // limit to partial values (corresponding to +-89 degree)
+        // convert from shear angle to shear value used in the transformation to
+        // get to the same coordinate system as fOldShearValue below will use
+        const double fMaxShearRange(F_PI2 * (89.0/90.0));
+        const double fNewShearValue(
+            tan(
+                basegfx::clamp(
+                    sdr::legacy::convertShearAngleXLegacyToNew(nAllShear),
+                    -fMaxShearRange, 
+                    fMaxShearRange)));
+
+        // check if we have a ShearY
+        bDoShearY = ((const SfxBoolItem&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_VERTICAL)).GetValue();
+
+        // get current shear value. It is the tan of the shear angle in radians
+        // tan(]-F_PI .. F_PI[)
+        double fOldShearValue(GetMarkedObjShearX());
 
-		if(bShearVert)
+		if(bDoShearY)
 		{
 			// Currently only ShearX is directly used at the SdrObject since the homogen
 			// matrix only has six degrees of freedom and it has to be decided which one
@@ -1985,16 +1984,18 @@ void SdrEditView::SetGeoAttrToMarked(con
 			// the same as a 90 degree rotation, a ShearY(-x) and a -90 degree back-rotation.
 			// Exactly this will be used below. It also shows that the ShearY is -ShearX, thus
 			// the compare value can be detected
-			fOldShearAngle = -fOldShearAngle;
+			fOldShearValue = -fOldShearValue;
 		}
 
-		if(!basegfx::fTools::equal(fNewShearAngle, fOldShearAngle))
+		if(!basegfx::fTools::equal(fNewShearValue, fOldShearValue))
 		{
-			fShearAngle = fNewShearAngle - fOldShearAngle;
-			bShear = true;
+            // create shear diff and convert to shear angle, this is what ShearMarkedObj
+            // expects
+			fShearChange = atan(fNewShearValue - fOldShearValue);
+			bDoShearDelta = true;
 		}
 
-		if(bShear) 
+		if(bDoShearDelta) 
 		{
 			aShearOffset.setX(((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_X)).GetValue());
 			aShearOffset.setY(((const SfxInt32Item&)rAttr.Get(SID_ATTR_TRANSFORM_SHEAR_Y)).GetValue());
@@ -2062,20 +2063,20 @@ void SdrEditView::SetGeoAttrToMarked(con
 	}
 
 	// change shear
-	if(bShear && mbShearAllowed) 
+	if(bDoShearDelta && mbShearAllowed) 
 	{
 		basegfx::B2DPoint aRef(aShearOffset + aPageOrigin);
 
-		if(bShearVert)
+		if(bDoShearY)
 		{
-			// see explanation at setting bShearVert
+			// see explanation at setting bDoShearY above
 			RotateMarkedObj(aRef, F_PI2);
-			ShearMarkedObj(aRef, -fShearAngle, true);
+			ShearMarkedObj(aRef, -fShearChange, true);
 			RotateMarkedObj(aRef, -F_PI2);
 		}
 		else
 		{
-			ShearMarkedObj(aRef, fShearAngle, false);
+			ShearMarkedObj(aRef, fShearChange, false);
 		}
 	}
 

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx Thu Apr 10 15:08:57 2014
@@ -285,14 +285,21 @@ namespace sdr
 			return Point(basegfx::fround(rAnchor.getX()), basegfx::fround(rAnchor.getY()));
 		}
 
+        long convertRotateAngleNewToLegacy(double fNew)
+        {
+            return basegfx::fround(basegfx::snapToZeroRange(-fNew / F_PI18000, 36000.0));
+        }
+
+        double convertRotateAngleLegacyToNew(long nOld)
+        {
+            return basegfx::snapToZeroRange(static_cast< double >(nOld) * -F_PI18000, F_2PI);
+        }
+
 		long GetRotateAngle(const SdrObject& rObject)
 		{
 			if(rObject.isRotated())
 			{
-				const double fRotate(rObject.getSdrObjectRotate());
-                const double fSnapped(basegfx::snapToZeroRange(-fRotate / F_PI18000, 36000.0));
-
-                return basegfx::fround(fSnapped);
+                return convertRotateAngleNewToLegacy(rObject.getSdrObjectRotate());
 			}
 			else
 			{
@@ -300,24 +307,21 @@ namespace sdr
 			}
 		}
 
+        long convertShearAngleXNewToLegacy(double fNew)
+        {
+            return basegfx::fround(basegfx::snapToRange(-fNew / F_PI18000, -18000.0, 18000.0));
+        }
+
+        double convertShearAngleXLegacyToNew(long nOld)
+        {
+            return basegfx::snapToRange(static_cast< double >(nOld) * -F_PI18000, -F_PI, F_PI);
+        }
+
 		long GetShearAngleX(const SdrObject& rObject)
 		{
 			if(rObject.isSheared())
 			{
-				const double fShearX(rObject.getSdrObjectShearX());
-				long nRetval(basegfx::fround(-atan(fShearX) / F_PI18000));
-				
-				while(nRetval < -18000)
-				{
-					nRetval += 36000;
-				}
-
-				while(nRetval >= 18000)
-				{
-					nRetval -= 36000;
-				}
-
-				return nRetval;
+                return convertShearAngleXNewToLegacy(rObject.getSdrObjectShearX());
 			}
 			else
 			{

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdmrkv.cxx Thu Apr 10 15:08:57 2014
@@ -530,33 +530,79 @@ void SdrMarkView::BrkMarkGluePoints()
 
 bool SdrMarkView::HasMarkableObj() const
 {
-	const sal_uInt32 nCount(GetMarkableObjCount());
+    SdrPageView* pPV = GetSdrPageView();
 
-	return (0 != nCount);
+    if(pPV)
+    {
+        SdrObjList* pOL = pPV->GetCurrentObjectList();
+
+        if(pOL)
+        {
+            SdrObjectVector aObjects(pOL->getSdrObjectVector());
+
+            for(sal_uInt32 a(0); a < aObjects.size(); a++)
+            {
+                SdrObject* pCandidate = aObjects[a];
+
+                if(pCandidate)
+                {
+                    if(IsObjMarkable(*pCandidate))
+                    {
+                        return true;
+                    }
+                }
+                else
+                {
+                    OSL_ENSURE(false, "SdrObjectVector with empty entries (!)");
+                }
+            }
+        }
+        else
+        {
+            OSL_ENSURE(false, "Unexpected missing SdrObjList (!)");
+        }
+    }
+
+    return false;
 }
 
 sal_uInt32 SdrMarkView::GetMarkableObjCount() const
 {
-	sal_uInt32 nCount(0);
-	SdrPageView* pPV = GetSdrPageView();
+    sal_uInt32 nCount(0);
+    SdrPageView* pPV = GetSdrPageView();
 
-	if(pPV)
-	{
-		SdrObjList* pOL = pPV->GetCurrentObjectList();
-		sal_uInt32 nObjAnz = pOL->GetObjCount();
+    if(pPV)
+    {
+        SdrObjList* pOL = pPV->GetCurrentObjectList();
 
-		for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz && !nCount; nObjNum++) 
-		{
-			SdrObject* pObj=pOL->GetObj(nObjNum);
+        if(pOL)
+        {
+            SdrObjectVector aObjects(pOL->getSdrObjectVector());
 
-			if(IsObjMarkable(*pObj)) 
-			{
-				nCount++;
-			}
-		}
-	}
+            for(sal_uInt32 a(0); a < aObjects.size(); a++)
+            {
+                SdrObject* pCandidate = aObjects[a];
+
+                if(pCandidate)
+                {
+                    if(IsObjMarkable(*pCandidate))
+                    {
+                        nCount++;
+                    }
+                }
+                else
+                {
+                    OSL_ENSURE(false, "SdrObjectVector with empty entries (!)");
+                }
+            }
+        }
+        else
+        {
+            OSL_ENSURE(false, "Unexpected missing SdrObjList (!)");
+        }
+    }
 
-	return nCount;
+    return nCount;
 }
 
 bool SdrMarkView::ImpIsFrameHandles() const

Modified: openoffice/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx Thu Apr 10 15:08:57 2014
@@ -792,7 +792,7 @@ void SdrGrafObj::TakeObjInfo(SdrObjTrans
 	rInfo.mbShearAllowed = true;
 
     rInfo.mbEdgeRadiusAllowed=false;
-	rInfo.mbCanConvToPath = false;
+	rInfo.mbCanConvToPath = !IsEPS();
 	rInfo.mbCanConvToPathLineToArea = false;
 	rInfo.mbCanConvToPolyLineToArea = false;
 	rInfo.mbCanConvToPoly = !IsEPS();

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=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx (original)
+++ openoffice/branches/alg/aw080/main/svx/source/svdraw/svdopath.cxx Thu Apr 10 15:08:57 2014
@@ -1637,7 +1637,7 @@ void SdrPathObj::impSetPathPolyPolygonWi
     // 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.
+    // wanted. Shear is not preserved due to lines having no shear.
     // 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
@@ -1750,6 +1750,9 @@ void SdrPathObj::impSetPathPolyPolygonWi
     else
     {
         // use translate and scale straightforward from new geometry
+        // when either no mirror, scale and shear or object was a line 
+        // before and reset is wanted (see explanation for 
+        // bResetCoordinateSystemAfterWasLine above)
         maSdrObjectTransformation.setB2DHomMatrix(
             basegfx::tools::createScaleTranslateB2DHomMatrix(
                 aRangeNewGeometry.getRange(),
@@ -2726,11 +2729,26 @@ void SdrPathObj::setSdrObjectTransformat
         if(isLine())
         {
             // apply new transformation to (0,0) and (1,0) to create the polygon data
+            // and set as new geometry
+            const basegfx::B2DPoint aPointA(rTransformation * basegfx::B2DPoint(0.0, 0.0));
+            const basegfx::B2DPoint aPointB(rTransformation * basegfx::B2DPoint(1.0, 0.0));
             basegfx::B2DPolygon aLine;
 
-            aLine.append(rTransformation * basegfx::B2DPoint(0.0, 0.0));
-            aLine.append(rTransformation * basegfx::B2DPoint(1.0, 0.0));
+            aLine.append(aPointA);
+            aLine.append(aPointB);
             maPathPolyPolygon = basegfx::B2DPolyPolygon(aLine);
+
+            // the geometry is a non-curved line, create unit transformation so that (0,0) is 
+            // 1st point and (1,0) is 2nd point and call the parent method with the new 
+            // transformation. This is needed to trigger all the refresh stuff
+            const basegfx::B2DVector aDelta(aPointB - aPointA);
+
+            // call parent with new, adapted transformation
+            SdrTextObj::setSdrObjectTransformation(
+                basegfx::tools::createScaleRotateTranslateB2DHomMatrix(
+                    basegfx::B2DTuple(aDelta.getLength(), 1.0),
+                    atan2(aDelta.getY(), aDelta.getX()),
+                    aPointA));
         }
         else
         {
@@ -2740,14 +2758,18 @@ void SdrPathObj::setSdrObjectTransformat
                 // take out old and apply new transformation
                 basegfx::B2DHomMatrix aCombined(maSdrObjectTransformation.getB2DHomMatrix());
 
+                // apply minimal scaling before inverting to secure inversion and
+                // to handle cases where polygons have no width and/or height, but are not a line
+                aCombined = basegfx::tools::guaranteeMinimalScaling(aCombined);
+
                 aCombined.invert();
                 aCombined = rTransformation * aCombined;
                 maPathPolyPolygon.transform(aCombined);
             }
-        }
 
-        // call parent
-        SdrTextObj::setSdrObjectTransformation(rTransformation);
+            // call parent
+            SdrTextObj::setSdrObjectTransformation(rTransformation);
+        }
     }
 }
 

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx?rev=1586329&r1=1586328&r2=1586329&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx (original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx Thu Apr 10 15:08:57 2014
@@ -1390,6 +1390,8 @@ SdXMLPolygonShapeContext::~SdXMLPolygonS
 void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList)
 {
     // Add, set Style and properties from base shape
+    // The type is no longer relevant for having a closed or open shape; instead use an opened or
+    // closed polygon (see below)
     if(mbClosed)
         AddShape("com.sun.star.drawing.PolyPolygonShape");
     else
@@ -1423,6 +1425,13 @@ void SdXMLPolygonShapeContext::StartElem
                 {
                     if(aPolygon.count())
                     {
+                        // dependent from the ObjectType in the ODF file set the closed state
+                        // of the Polygon. That state is not part of the draw:points definition
+                        // which was imported in importFromSvgPoints, but depends on the object type
+                        // imported (e.g. draw:polyline or draw:polygon) which is reflected in the
+                        // member variable mbClosed
+                        aPolygon.setClosed(mbClosed);
+
                         const basegfx::B2DRange aSourceRange(
                             aViewBox.GetX(), aViewBox.GetY(), 
                             aViewBox.GetX() + aViewBox.GetWidth(), aViewBox.GetY() + aViewBox.GetHeight());