incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1345289 [2/3] - in /incubator/ooo/branches/alg/aw080/main: basegfx/source/numeric/ basegfx/source/polygon/ filter/inc/filter/msfilter/ filter/source/msfilter/ oox/inc/oox/export/ sc/source/filter/excel/ sc/source/filter/inc/ sc/source/filt...
Date Fri, 01 Jun 2012 17:57:51 GMT
Modified: incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/eppt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/eppt.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/eppt.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/eppt.hxx Fri Jun  1 17:57:48 2012
@@ -87,6 +87,8 @@
 #include <com/sun/star/awt/CharSet.hpp>
 #include <com/sun/star/text/WritingMode.hpp>
 #include <com/sun/star/lang/Locale.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
 
 enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
 
@@ -489,6 +491,7 @@ class PropValue
 		::com::sun::star::uno::Reference
 			< ::com::sun::star::beans::XPropertySet	>			mXPropSet;
 
+        basegfx::B2DHomMatrix ImplGetObjectTransformation();
 		sal_Bool	ImplGetPropertyValue( const String& rString );
 		sal_Bool	ImplGetPropertyValue( const ::com::sun::star::uno::Reference
 						< ::com::sun::star::beans::XPropertySet > &, const String& );
@@ -584,9 +587,6 @@ class ParagraphObj : public List, public
 	friend class TextObj;
 	friend struct PPTExParaSheet;
 
-		MapMode			maMapModeSrc;
-		MapMode			maMapModeDest;
-
 	protected :
 
 		void			ImplConstruct( const ParagraphObj& rParagraphObj );
@@ -685,11 +685,12 @@ class PPTWriter : public GroupTable, pub
 		std::vector< PPTExStyleSheet* >	maStyleSheetList;
 		PPTExStyleSheet*				mpStyleSheet;
 
-		Fraction						maFraction;
-		MapMode							maMapModeSrc;
-		MapMode							maMapModeDest;
-		::com::sun::star::awt::Size		maDestPageSize;
-		::com::sun::star::awt::Size		maNotesPageSize;
+        double                          mfMap100thMmToMs;
+        basegfx::B2DHomMatrix           maMap100thMmToMs;
+        basegfx::B2DHomMatrix           maInvMap100thMmToMs;
+
+		basegfx::B2DVector              maDestPageSize;
+		basegfx::B2DVector              maNotesPageSize;
 		PageType						meLatestPageType;
 		List							maSlideNameList;
 		rtl::OUString					maBaseURI;
@@ -709,14 +710,19 @@ class PPTWriter : public GroupTable, pub
 		::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >				mXCursorText;		// TextRef des Teilstuecks des Cursors
 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet	>			mXCursorPropSet;	// die Properties des Teilstueckes
 		::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >				mXTextField;
-		::com::sun::star::awt::Size			maSize;
-		::com::sun::star::awt::Point		maPosition;
-		basegfx::B2DRange	maRange;
-		ByteString			mType;
+		
+        // the object range, split in pos and scale to keep the evtl. negative size (mirroring)
+        basegfx::B2DPoint   maObjectPosition;
+        basegfx::B2DVector  maObjectScale;
+//        basegfx::B2DRange               maObjectRange;
+//        bool                            mbMirroredX;
+//        bool                            mbMirroredY;
+        double                          mfObjectRotation;
+		
+        ByteString			mType;
 		sal_Bool			mbPresObj;
 		sal_Bool			mbEmptyPresObj;
 		sal_Bool			mbStatusIndicator;
-		sal_Int32			mnAngle;
 		sal_uInt32			mnTextStyle;
 
 		sal_Bool			mbFontIndependentLineSpacing;
@@ -793,7 +799,7 @@ class PPTWriter : public GroupTable, pub
 		sal_Bool			ImplGetPageByIndex( sal_uInt32 nIndex, PageType );
 		sal_Bool			ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = sal_False );
 		sal_uInt32			ImplGetMasterIndex( PageType ePageType );
-		void				ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
+		void				ImplHandleRotation( EscherPropertyContainer& rPropOpt );
 		sal_Bool			ImplGetText();
 		sal_Bool			ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType,
 								const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
@@ -823,11 +829,8 @@ class PPTWriter : public GroupTable, pub
 		void				ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
 		void				ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
 								EscherPropertyContainer& aPropOpt );
-		::com::sun::star::awt::Point		ImplMapPoint( const ::com::sun::star::awt::Point& );
-		::com::sun::star::awt::Size			ImplMapSize( const ::com::sun::star::awt::Size& );
-		basegfx::B2DRange ImplMapRectangle( const ::com::sun::star::awt::Rectangle& );
 
-		sal_Bool							ImplCloseDocument();		// die font-, hyper-, Soundliste wird geschrieben ..
+        sal_Bool							ImplCloseDocument();		// die font-, hyper-, Soundliste wird geschrieben ..
 
 	public:
 								PPTWriter( const std::vector< com::sun::star::beans::PropertyValue >&, SvStorageRef& rSvStorage,

Modified: incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/epptso.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/epptso.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/epptso.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/epptso.cxx Fri Jun  1 17:57:48 2012
@@ -102,6 +102,9 @@
 #include "i18npool/mslangid.hxx"
 #include <vos/xception.hxx>
 #include <svx/svdlegacy.hxx>
+#include <svx/svdocirc.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
 using namespace vos;
 using namespace ::com::sun::star;
 
@@ -183,8 +186,9 @@ sal_uInt16 PPTExBulletProvider::GetId( c
 			}
 		}
 
-		const basegfx::B2DRange aRange;
-		nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRange, NULL, NULL );
+        const basegfx::B2DPoint aObjectPosition(0.0, 0.0);
+        const basegfx::B2DVector aObjectScale(1.0, 1.0);
+		nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aObjectPosition, aObjectScale, NULL, NULL );
 
         if ( nId && ( nId < 0x10000 ) )
             nRetValue = (sal_uInt16)nId - 1;
@@ -923,6 +927,22 @@ sal_Bool PropValue::ImplGetPropertyValue
 
 // ---------------------------------------------------------------------------------------------
 
+basegfx::B2DHomMatrix PropValue::ImplGetObjectTransformation()
+{
+    basegfx::B2DHomMatrix aRetval;
+
+    if(GetPropertyValue(mAny, mXPropSet, String(RTL_CONSTASCII_USTRINGPARAM("Transformation"))))
+    {
+		drawing::HomogenMatrix3 aMatrix;
+        mAny >>= aMatrix;
+    	aRetval = basegfx::tools::UnoHomogenMatrix3ToB2DHomMatrix(aMatrix);
+    }
+
+    return aRetval;
+}
+
+// ---------------------------------------------------------------------------------------------
+
 sal_Bool PropValue::ImplGetPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & aXPropSet, const String& rString )
 {
     return GetPropertyValue( mAny, aXPropSet, rString );
@@ -1118,9 +1138,53 @@ sal_Bool PPTWriter::ImplGetShapeByIndex(
 
         if ( !mXPropSet.is() )
             break;
-        maPosition = ImplMapPoint( mXShape->getPosition() );
-        maSize = ImplMapSize( mXShape->getSize() );
-        maRange = basegfx::B2DRange(maPosition.X, maPosition.Y, maPosition.X + maSize.Width, maPosition.Y + maSize.Height);
+        
+        // get object transformation
+        basegfx::tools::B2DHomMatrixBufferedDecompose aObjTrans(ImplGetObjectTransformation());
+
+        // map to PPt metrics
+        aObjTrans = basegfx::tools::B2DHomMatrixBufferedDecompose(
+            basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+                maMap100thMmToMs* aObjTrans.getScale(),
+                aObjTrans.getShearX(),
+                aObjTrans.getRotate(),
+                maMap100thMmToMs * aObjTrans.getTranslate()));
+
+//        // use translation and scale to create range
+//        maObjectRange = basegfx::B2DRange(aObjTrans.getTranslate(), aObjTrans.getTranslate() + aObjTrans.getScale());
+
+        // get object position and scale. cale can now be negative in X and/or Y representing mirroring
+        maObjectPosition = aObjTrans.getTranslate();
+        maObjectScale = aObjTrans.getScale();
+
+        // use scale to detect mirrorings
+//        mbMirroredX = aObjTrans.getScale().getX() < 0.0;
+//        mbMirroredY = aObjTrans.getScale().getY() < 0.0;
+
+        // get rotation
+        mfObjectRotation = aObjTrans.getRotate();
+
+        // mbMirroredX and mbMirroredY are new aspects to handle. The text
+        // in offices before transformation ignored mirrorX and used a 180
+        // deg rotation for mirrorY. To get close to the old behaviour, use
+        // mbMirroredY to apply a 180 deg rotation to mimic old behaviour. 
+        // Do not forget to adapt the object's range!
+//        if(mbMirroredY)
+//        {
+//            // adapt object range
+//            maObjectRange.transform(basegfx::tools::createRotateAroundPoint(maObjectRange.getMaximum(), -M_PI));
+//
+//            // add to rotation and clear mirror flag
+//            mfObjectRotation += M_PI;
+//            mbMirroredX = false;
+//        }
+
+        // assert shear (not supported yet)
+        if(!basegfx::fTools::equalZero(aObjTrans.getShearX()))
+        {
+            OSL_ENSURE(false, "PPt export: shear is not supported (!)");
+        }
+        
         mType = ByteString( String( mXShape->getShapeType() ), RTL_TEXTENCODING_UTF8 );
         mType.Erase( 0, 13 );                                   // "com.sun.star." entfernen
         sal_uInt16 nPos = mType.Search( (const char*)"Shape" );
@@ -1133,11 +1197,6 @@ sal_Bool PPTWriter::ImplGetShapeByIndex(
         if ( mbPresObj && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ) ) )
             mAny >>= mbEmptyPresObj;
 
-        mnAngle = ( PropValue::GetPropertyValue( aAny,
-            mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
-                ? *((sal_Int32*)aAny.getValue() )
-                : 0;
-
         return sal_True;
     }
     return sal_False;
@@ -1489,8 +1548,9 @@ void PPTWriter::ImplWritePortions( SvStr
 				{
 					case ::com::sun::star::drawing::FillStyle_GRADIENT :
 					{
-						basegfx::B2DRange aRange(0.0, 0.0, 28000.0, 21000.0);
-                        EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRange);
+                        basegfx::B2DPoint aObjectPosition(0.0, 0.0);
+                        basegfx::B2DVector aObjectScale(28000.0, 21000.0);
+                        EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aObjectPosition, aObjectScale);
 						aPropOpt.CreateGradientProperties( mXPropSet );
 						aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
 					}
@@ -1511,8 +1571,9 @@ void PPTWriter::ImplWritePortions( SvStr
 						{
 							case ::com::sun::star::drawing::FillStyle_GRADIENT :
 							{
-								basegfx::B2DRange aRange(0.0, 0.0, 28000.0, 21000.0);
-                                EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRange);
+                                basegfx::B2DPoint aObjectPosition(0.0, 0.0);
+                                basegfx::B2DVector aObjectScale(28000.0, 21000.0);
+                                EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aObjectPosition, aObjectScale);
 								aPropOpt.CreateGradientProperties( mXBackgroundPropSet );
 								aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
 							}
@@ -1650,38 +1711,39 @@ sal_Bool PPTWriter::ImplGetText()
 
 //  -----------------------------------------------------------------------
 
-void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
+void PPTWriter::ImplHandleRotation( EscherPropertyContainer& rPropOpt )
 {
-    if ( mnAngle < 0 )
-        mnAngle = ( 36000 + mnAngle ) % 36000;
-    else
-        mnAngle = ( 36000 - ( mnAngle % 36000 ) );
+    if(!basegfx::fTools::equalZero(mfObjectRotation))
+    {
+        sal_Int32 nAngle(basegfx::fround(basegfx::snapToZeroRange(-mfObjectRotation / F_PI18000, 36000.0)));
+        
+        nAngle = ( 36000 - ( nAngle % 36000 ) );
 
-    double  fCos = cos( (double)mnAngle * F_PI18000 );
-    double  fSin = sin( (double)mnAngle * F_PI18000 );
+        double  fCos = cos( (double)nAngle * F_PI18000 );
+        double  fSin = sin( (double)nAngle * F_PI18000 );
 
-    const double fWidthHalf(maRange.getWidth() * 0.5);
-    const double fHeightHalf(maRange.getHeight() * 0.5);
+        const double fWidthHalf(maObjectScale.getX() * 0.5);
+        const double fHeightHalf(maObjectScale.getY() * 0.5);
 
-    double  fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
-    double  fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
+        double  fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
+        double  fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
 
-    maRange.transform(basegfx::tools::createTranslateB2DHomMatrix(-(fWidthHalf - fXDiff), -(fHeightHalf + fYDiff)));
-    mnAngle *= 655;
-    mnAngle += 0x8000;
-    mnAngle &=~0xffff;                                  // nAngle auf volle Gradzahl runden
-    rPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
+        maObjectPosition -= basegfx::B2DPoint(fWidthHalf - fXDiff, fHeightHalf + fYDiff);
 
-    if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
-            ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
-    {
-        // In diesen beiden Bereichen steht in PPT gemeinerweise die
-        // BoundingBox bereits senkrecht. Daher muss diese VOR
-        // DER ROTATION flachgelegt werden.
-		const basegfx::B2DPoint aNewTopLeft(maRange.getMinX() + fWidthHalf - fHeightHalf, maRange.getMinY() + fHeightHalf - fWidthHalf);
-		const basegfx::B2DVector aNewScale(maRange.getHeight(), maRange.getWidth());
+        nAngle *= 655;
+        nAngle += 0x8000;
+        nAngle &=~0xffff;                                  // nAngle auf volle Gradzahl runden
+        rPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
 
-		maRange = basegfx::B2DRange(aNewTopLeft, aNewTopLeft + aNewScale);
+        if ( ( nAngle >= ( 45 << 16 ) && nAngle < ( 135 << 16 ) ) ||
+                ( nAngle >= ( 225 << 16 ) && nAngle < ( 315 << 16 ) ) )
+        {
+            // In diesen beiden Bereichen steht in PPT gemeinerweise die
+            // BoundingBox bereits senkrecht. Daher muss diese VOR
+            // DER ROTATION flachgelegt werden.
+            maObjectPosition = basegfx::B2DPoint(maObjectPosition.getX() + fWidthHalf - fHeightHalf, maObjectPosition.getY() + fHeightHalf - fWidthHalf);
+            maObjectScale = basegfx::B2DVector(maObjectScale.getY(), maObjectScale.getX());
+        }
     }
 }
 
@@ -2286,10 +2348,7 @@ PortionObj& PortionObj::operator=( const
 
 //  -----------------------------------------------------------------------
 
-ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
-                PPTExBulletProvider& rProv ) :
-    maMapModeSrc        ( MAP_100TH_MM ),
-    maMapModeDest       ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) )
+ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, PPTExBulletProvider& rProv )
 {
     mXPropSet = rXPropSet;
 
@@ -2302,11 +2361,8 @@ ParagraphObj::ParagraphObj( const ::com:
     ImplGetParagraphValues( rProv, false );
 }
 
-    ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
-                    ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) :
-    maMapModeSrc        ( MAP_100TH_MM ),
-    maMapModeDest       ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ),
-    mbFirstParagraph    ( aParaFlags.bFirstParagraph ),
+ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent, ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv )
+:   mbFirstParagraph    ( aParaFlags.bFirstParagraph ),
     mbLastParagraph     ( aParaFlags.bLastParagraph )
 {
     bExtendedParameters = false;
@@ -3269,8 +3325,8 @@ void PPTWriter::ImplWriteTextStyleAtom( 
             }
             nParaFlags >>= 16;
 
-            sal_uInt32  nDefaultTabSize = ImplMapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width;
-            sal_uInt32  nDefaultTabs = basegfx::fround(fabs(maRange.getWidth())) / nDefaultTabSize;
+            sal_uInt32  nDefaultTabSize = mfMap100thMmToMs * 2011.0;
+            sal_uInt32  nDefaultTabs = basegfx::fround(fabs(maObjectScale.getX())) / nDefaultTabSize;
             if ( nTabs )
                 nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize );
             if ( (sal_Int32)nDefaultTabs < 0 )
@@ -4132,10 +4188,10 @@ sal_Bool PPTWriter::ImplCreatePresentati
 		aPropOpt.CreateShapeProperties( mXShape );
 		aPropOpt.Commit( *mpStrm );
 		mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
-		*mpStrm << (sal_Int16)basegfx::fround(maRange.getMinY()) // CAUTION! Here, X,Y is exchanged
-			    << (sal_Int16)basegfx::fround(maRange.getMinX()) // by PURPOSE, it's not an error (!)
-				<< (sal_Int16)basegfx::fround(maRange.getMaxX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
-				<< (sal_Int16)basegfx::fround(maRange.getMaxY());
+		*mpStrm << (sal_Int16)basegfx::fround(maObjectPosition.getY()) // CAUTION! Here, X,Y is exchanged
+			    << (sal_Int16)basegfx::fround(maObjectPosition.getX()) // by PURPOSE, it's not an error (!)
+				<< (sal_Int16)basegfx::fround(maObjectPosition.getX() + maObjectScale.getX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
+				<< (sal_Int16)basegfx::fround(maObjectPosition.getY() + maObjectScale.getY());
 		mpPptEscherEx->OpenContainer( ESCHER_ClientData );
 		mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
 		*mpStrm << (sal_uInt32)0                // PlacementID
@@ -4201,7 +4257,8 @@ void PPTWriter::ImplWritePage( const PHL
 
     nOlePictureId = 0;
 
-    sal_Bool bAdditionalText = sal_False;
+    bool bAdditionalText = false;
+    double fTextRotation(0.0);
 	sal_Bool bSecOutl = sal_False;
 	sal_uInt32 nPObjects = 0;
     SvMemoryStream* pClientTextBox = NULL;
@@ -4251,10 +4308,9 @@ void PPTWriter::ImplWritePage( const PHL
 			List        aAdjustmentList;
             Rectangle   aPolyBoundRect;
 
-            const ::com::sun::star::awt::Size   aSize100thmm( mXShape->getSize() );
-            const ::com::sun::star::awt::Point  aPoint100thmm( mXShape->getPosition() );
-            basegfx::B2DRange aRange100thmm(aPoint100thmm.X, aPoint100thmm.Y, aPoint100thmm.X + aSize100thmm.Width, aPoint100thmm.Y + aSize100thmm.Height);
-            EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRange100thmm);
+            basegfx::B2DPoint maObjectPosition100thmm(maInvMap100thMmToMs * maObjectPosition);
+            basegfx::B2DVector maObjectScale100thmm(maInvMap100thMmToMs * maObjectScale);
+            EscherPropertyContainer aPropOpt(mpPptEscherEx->GetGraphicProvider(), mpPicStrm, maObjectPosition100thmm, maObjectScale100thmm);
 
             if ( bGroup )
             {
@@ -4274,7 +4330,7 @@ void PPTWriter::ImplWritePage( const PHL
 							pTmp = new SvMemoryStream( 0x200, 0x200 );
 						ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
 					}
-                    sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maRange, pTmp );
+                    sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maObjectPosition, &maObjectScale, pTmp );
 					aSolverContainer.AddShape( mXShape, nShapeId );
                     delete pTmp;
                 }
@@ -4297,9 +4353,9 @@ void PPTWriter::ImplWritePage( const PHL
                     if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "BoundRect" ) ) ) )
                     {
                         const ::com::sun::star::awt::Rectangle aAwtRect(*(::com::sun::star::awt::Rectangle*)mAny.getValue());
-                        maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aAwtRect.X, aAwtRect.Y ) );
-                        maSize = ImplMapSize( ::com::sun::star::awt::Size( aAwtRect.Width, aAwtRect.Height ) );
-                        maRange = basegfx::B2DRange(maPosition.X, maPosition.Y, maPosition.X + maSize.Width, maPosition.Y + maSize.Height);
+                        
+                        maObjectPosition = maMap100thMmToMs * basegfx::B2DPoint(aAwtRect.X, aAwtRect.Y);
+                        maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aAwtRect.Width, aAwtRect.Height);
                     }
 					mType = "drawing.dontknow";
                 }
@@ -4324,16 +4380,11 @@ void PPTWriter::ImplWritePage( const PHL
 						SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
 						if ( pObj )
 						{
-                            maRange = pObj->getObjectRange(0);
-                            maPosition = ImplMapPoint( 
-                                ::com::sun::star::awt::Point( 
-                                    basegfx::fround(maRange.getMinX()), 
-                                    basegfx::fround(maRange.getMinY())));
-					        maSize = ImplMapSize( 
-                                ::com::sun::star::awt::Size( 
-                                    basegfx::fround(maRange.getWidth()), 
-                                    basegfx::fround(maRange.getHeight())));
-							mnAngle = 0;
+                            const basegfx::B2DRange aObjRange(pObj->getObjectRange(0));
+
+                            maObjectPosition = maMap100thMmToMs * aObjRange.getMinimum();
+                            maObjectScale = maMap100thMmToMs * aObjRange.getRange();
+							mfObjectRotation = 0.0;
 						}
 					}
 				}
@@ -4356,12 +4407,12 @@ void PPTWriter::ImplWritePage( const PHL
                 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CornerRadius" ) ) ) )
                 {
                     mAny >>= nRadius;
-                    nRadius = ImplMapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width;
+                    nRadius = basegfx::fround(mfMap100thMmToMs * nRadius);
                 }
                 if ( nRadius )
                 {
                     ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
-                    double fLength(std::min(maRange.getWidth(), maRange.getHeight()) * 0.5);
+                    double fLength(fabs(std::min(maObjectScale.getX(), maObjectScale.getY()) * 0.5));
 
 					if ( nRadius >= fLength )
 					{
@@ -4384,35 +4435,15 @@ void PPTWriter::ImplWritePage( const PHL
             }
             else if ( mType == "drawing.Ellipse" )
             {
-                ::com::sun::star::drawing::CircleKind  eCircleKind( ::com::sun::star::drawing::CircleKind_FULL );
-                PolyStyle ePolyKind = POLY_CHORD;
-                if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleKind" ) ) ) )
-                {
-                    mAny >>= eCircleKind;
-                    switch ( eCircleKind )
-                    {
-                        case ::com::sun::star::drawing::CircleKind_SECTION :
-                        {
-                            ePolyKind = POLY_PIE;
-                        }
-                        break;
-                        case ::com::sun::star::drawing::CircleKind_ARC :
-                        {
-                            ePolyKind = POLY_ARC;
-                        }
-                        break;
-
-                        case ::com::sun::star::drawing::CircleKind_CUT :
-                        {
-                            ePolyKind = POLY_CHORD;
-                        }
-                        break;
+                // changed to directly use the SdrObject, using the handmade creatin of the polygon data
+                // seemed too dangerous for the moment. Can be changed back to own geometry creation, of 
+                // course (e.g. by getting primitives using UNO API and filtering for hairlines)
+                SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(GetSdrObjectFromXShape(mXShape));
+                    
+                if(!pCircObj)
+                    continue;
 
-                        default:
-                            eCircleKind = ::com::sun::star::drawing::CircleKind_FULL;
-                    }
-                }
-                if ( eCircleKind == ::com::sun::star::drawing::CircleKind_FULL )
+                if(OBJ_CIRC == pCircObj->GetCircleKind())
                 {
                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                     ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
@@ -4422,66 +4453,48 @@ void PPTWriter::ImplWritePage( const PHL
 				}
                 else
                 {
-                    sal_Int32 nStartAngle, nEndAngle;
-                    if ( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleStartAngle" ) ) ) )
-                        continue;
-                    nStartAngle = *( (sal_Int32*)mAny.getValue() );
-                    if( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleEndAngle" ) ) ) )
+                	const basegfx::B2DPolyPolygon aOutline(pCircObj->TakeXorPoly());
+
+                    if(!aOutline.count())
                         continue;
-                    nEndAngle = *( (sal_Int32*)mAny.getValue() );
-                    ::com::sun::star::awt::Point aPoint( mXShape->getPosition() );
-                    ::com::sun::star::awt::Size  aSize( mXShape->getSize() );
-                    ::com::sun::star::awt::Point aStart, aEnd, aCenter;
-                    Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
-                    aStart.X = (sal_Int32)( ( cos( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
-                    aStart.Y = - (sal_Int32)( ( sin( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
-                    aEnd.X = (sal_Int32)( ( cos( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
-                    aEnd.Y = - (sal_Int32)( ( sin( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
-                    aCenter.X = aPoint.X + ( aSize.Width / 2 );
-                    aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
-                    aStart.X += aCenter.X;
-                    aStart.Y += aCenter.Y;
-                    aEnd.X += aCenter.X;
-                    aEnd.Y += aCenter.Y;
-                    Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
+
+                    Polygon aPolygon(aOutline.getB2DPolygon(0));
 					sal_Bool bNeedText = sal_True;
-					if ( mnAngle )
+
+                    if ( mfObjectRotation )
 					{
-						aPolygon.Rotate( aRect.TopLeft(), (sal_uInt16)( mnAngle / 10 ) );
+                        // already applied to the polygon, nothing to do there
 						if ( ImplGetText() )
 						{
-							mpPptEscherEx->EnterGroup( 0,0 );
+							mpPptEscherEx->EnterGroup();
 							nGroupLevel = mpPptEscherEx->GetGroupLevel();
 							bNeedText = sal_False;
 							bAdditionalText = true;
+                            fTextRotation = mfObjectRotation;
 							mnTextSize = 0;
 						}
-						mnAngle = 0;
+						mfObjectRotation = 0.0;
 					}
+                    
                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                     ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );       // Flags: Connector | HasSpt
                     ::com::sun::star::awt::Rectangle aNewRect;
-                    switch ( ePolyKind )
-                    {
-                        case POLY_PIE :
-                        case POLY_CHORD :
-                        {
-                            if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
-                                aPropOpt.CreateFillProperties( mXPropSet, sal_True );
-                        }
-                        break;
 
-                        case POLY_ARC :
-                        {
-                            if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon ) )
-                                aPropOpt.CreateLineProperties( mXPropSet, sal_False );
-                        }
-                        break;
+                    if(aOutline.isClosed())
+                    {
+                        if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
+                            aPropOpt.CreateFillProperties( mXPropSet, sal_True );
                     }
-                    maRange = ImplMapRectangle( aNewRect );
-                    maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                    maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
-					if ( bNeedText && ImplGetText() )
+                    else
+                    {
+                        if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon ) )
+                            aPropOpt.CreateLineProperties( mXPropSet, sal_False );
+                    }
+
+                    maObjectPosition = maMap100thMmToMs * basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                    maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+
+                    if ( bNeedText && ImplGetText() )
 						aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
                 }
             }
@@ -4622,9 +4635,8 @@ void PPTWriter::ImplWritePage( const PHL
                 if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
                     continue;
 
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
 
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
@@ -4645,15 +4657,16 @@ void PPTWriter::ImplWritePage( const PHL
                 const bool bMirrorX(aNewRect.Width < 0);
                 const bool bMirrorY(aNewRect.Height < 0);
 
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+
                 if ( ImplGetText() )
                 {
-                    aTextRefPoint = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
+                    aTextRefPoint = ::com::sun::star::awt::Point(basegfx::fround(maObjectPosition.getX()), basegfx::fround(maObjectPosition.getY()));
                     mnTextSize = 0;
                     bAdditionalText = true;
-                    mpPptEscherEx->EnterGroup( &maRange,0 );
+                    fTextRotation = mfObjectRotation;
+                    mpPptEscherEx->EnterGroup( &maObjectPosition, &maObjectScale, 0 );
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 sal_uInt32 nFlags = 0xa00;                                  // Flags: Connector | HasSpt
@@ -4671,83 +4684,91 @@ void PPTWriter::ImplWritePage( const PHL
                 ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
                 aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
                 aPropOpt.CreateLineProperties( mXPropSet, sal_False );
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
             }
             else if ( bPolyPolygon )
             {
                 if ( ImplGetText() )
                 {
-                    mpPptEscherEx->EnterGroup( 0,0 );
+                    mpPptEscherEx->EnterGroup();
                     nGroupLevel = mpPptEscherEx->GetGroupLevel();
                     bAdditionalText = true;
+                    fTextRotation = mfObjectRotation;
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
                 ::com::sun::star::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+
                 aPropOpt.CreateFillProperties( mXPropSet, sal_True );
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
             }
             else if ( bPolyLine )
             {
                 if ( ImplGetText() )
                 {
-                    mpPptEscherEx->EnterGroup( 0,0 );
+                    mpPptEscherEx->EnterGroup();
                     nGroupLevel = mpPptEscherEx->GetGroupLevel();
                     bAdditionalText = true;
+                    fTextRotation = mfObjectRotation;
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
                 ::com::sun::star::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+                
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+                
                 aPropOpt.CreateLineProperties( mXPropSet, sal_False );
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
             }
             else if ( bOpenBezier )
             {
                 if ( ImplGetText() )
                 {
-                    mpPptEscherEx->EnterGroup( 0,0 );
+                    mpPptEscherEx->EnterGroup();
                     nGroupLevel = mpPptEscherEx->GetGroupLevel();
                     bAdditionalText = true;
+                    fTextRotation = mfObjectRotation;
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
                 ::com::sun::star::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+                
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+                
                 aPropOpt.CreateLineProperties( mXPropSet, sal_False );
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
             }
             else if ( bClosedBezier )
             {
                 if ( ImplGetText() )
                 {
-                    mpPptEscherEx->EnterGroup( 0,0 );
+                    mpPptEscherEx->EnterGroup();
                     nGroupLevel = mpPptEscherEx->GetGroupLevel();
                     bAdditionalText = true;
+                    fTextRotation = mfObjectRotation;
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
                 ::com::sun::star::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
-                maRange = ImplMapRectangle( aNewRect );
-                maPosition = ::com::sun::star::awt::Point(basegfx::fround(maRange.getMinX()), basegfx::fround(maRange.getMinY()));
-                maSize = ::com::sun::star::awt::Size(basegfx::fround(maRange.getWidth()), basegfx::fround(maRange.getHeight()));
+                
+                maObjectPosition = basegfx::B2DPoint(aNewRect.X, aNewRect.Y);
+                maObjectScale = maMap100thMmToMs * basegfx::B2DVector(aNewRect.Width, aNewRect.Height);
+
                 aPropOpt.CreateFillProperties( mXPropSet, sal_True );
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
             }
             else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
             {
@@ -4854,10 +4875,10 @@ void PPTWriter::ImplWritePage( const PHL
 								ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
 								aPropertyOptions.Commit( *mpStrm );
 								mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
-								*mpStrm << (sal_Int16)basegfx::fround(maRange.getMinY()) // CAUTION! Here, X,Y is exchanged
-									    << (sal_Int16)basegfx::fround(maRange.getMinX()) // by PURPOSE, it's not an error (!)
-										<< (sal_Int16)basegfx::fround(maRange.getMaxX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
-										<< (sal_Int16)basegfx::fround(maRange.getMaxY());      // oben, links, rechts, unten ????
+								*mpStrm << (sal_Int16)basegfx::fround(maObjectPosition.getY()) // CAUTION! Here, X,Y is exchanged
+									    << (sal_Int16)basegfx::fround(maObjectPosition.getX()) // by PURPOSE, it's not an error (!)
+										<< (sal_Int16)basegfx::fround(maObjectPosition.getX() + maObjectScale.getX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
+										<< (sal_Int16)basegfx::fround(maObjectPosition.getY() + maObjectScale.getY());      // oben, links, rechts, unten ????
 								mpPptEscherEx->OpenContainer( ESCHER_ClientData );
 								mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
 								*mpStrm << (sal_uInt32)0                                                        // PlacementID
@@ -4951,10 +4972,10 @@ void PPTWriter::ImplWritePage( const PHL
 								ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
 								aPropOpt2.Commit( *mpStrm );
 								mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
-								*mpStrm << (sal_Int16)basegfx::fround(maRange.getMinY()) // CAUTION! Here, X,Y is exchanged 
-									    << (sal_Int16)basegfx::fround(maRange.getMinX()) // by PURPOSE, it's not an error (!)
-										<< (sal_Int16)basegfx::fround(maRange.getMaxX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
-										<< (sal_Int16)basegfx::fround(maRange.getMaxY());  // oben, links, rechts, unten ????
+								*mpStrm << (sal_Int16)basegfx::fround(maObjectPosition.getY()) // CAUTION! Here, X,Y is exchanged 
+									    << (sal_Int16)basegfx::fround(maObjectPosition.getX()) // by PURPOSE, it's not an error (!)
+										<< (sal_Int16)basegfx::fround(maObjectPosition.getX() + maObjectScale.getX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
+										<< (sal_Int16)basegfx::fround(maObjectPosition.getY() + maObjectScale.getY());  // oben, links, rechts, unten ????
 								mpPptEscherEx->OpenContainer( ESCHER_ClientData );
 								mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
 								*mpStrm << (sal_uInt32)1                                                        // PlacementID
@@ -5165,7 +5186,7 @@ void PPTWriter::ImplWritePage( const PHL
             }
 			else if ( mType == "drawing.Media" )
 			{
-				mnAngle = 0;
+				mfObjectRotation = 0.0;
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
 
@@ -5241,7 +5262,7 @@ void PPTWriter::ImplWritePage( const PHL
 			}
             else if ( mType == "drawing.dontknow" )
             {
-                mnAngle = 0;
+                mfObjectRotation = 0.0;
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                 ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
@@ -5406,14 +5427,18 @@ void PPTWriter::ImplWritePage( const PHL
             }
 
 			aPropOpt.CreateShadowProperties( mXPropSet );
-            if ( mnAngle )
-                ImplFlipBoundingBox( aPropOpt );
+            
+            if(!basegfx::fTools::equalZero(mfObjectRotation))
+            {
+                ImplHandleRotation( aPropOpt );
+            }
+
             aPropOpt.CreateShapeProperties( mXShape );
 			aPropOpt.Commit( *mpStrm );
 			if ( GetCurrentGroupLevel() > 0 )		
-		        mpPptEscherEx->AddChildAnchor( maRange );
+		        mpPptEscherEx->AddChildAnchor( maObjectPosition, maObjectScale );
 			else
-				mpPptEscherEx->AddClientAnchor( maRange );
+				mpPptEscherEx->AddClientAnchor( maObjectPosition, maObjectScale );
 
 			if ( pClientData )
             {
@@ -5438,41 +5463,37 @@ void PPTWriter::ImplWritePage( const PHL
         if ( bAdditionalText )
         {
             bAdditionalText = false;
-
-            ::com::sun::star::uno::Any  aAny;
+            mfObjectRotation = fTextRotation;
             EscherPropertyContainer     aPropOpt;
-            mnAngle = ( PropValue::GetPropertyValue( aAny,
-                mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
-                    ? *((sal_Int32*)aAny.getValue() )
-                    : 0;
 
             aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
             if ( mType == "drawing.Line" )
             {
-                double fDist = hypot( maRange.getWidth(), maRange.getHeight() );
-                maRange = basegfx::B2DRange(aTextRefPoint.X, aTextRefPoint.Y, aTextRefPoint.X + fDist, aTextRefPoint.Y - 1.0);
+                const double fDist(hypot(maObjectScale.getX(), maObjectScale.getY()));
+
+                maObjectPosition = basegfx::B2DPoint(aTextRefPoint.X, aTextRefPoint.Y);
+                maObjectScale = basegfx::B2DVector(fDist, -1.0);
                 ImplCreateTextShape( aPropOpt, aSolverContainer, false );
                 aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 );        // Size Shape To Fit Text
-                if ( mnAngle < 0 )
-                    mnAngle = ( 36000 + mnAngle ) % 36000;
-                if ( mnAngle )
-                    ImplFlipBoundingBox( aPropOpt );
+
+                if(!basegfx::fTools::equalZero(mfObjectRotation))
+                {
+                    ImplHandleRotation( aPropOpt );
+                }
             }
             else
             {
                 ImplCreateTextShape( aPropOpt, aSolverContainer, false );
-                if ( mnAngle < 0 )
-                    mnAngle = ( 36000 + mnAngle ) % 36000;
-                else
-                    mnAngle = ( 36000 - ( mnAngle % 36000 ) );
-
-                mnAngle *= 655;
-                mnAngle += 0x8000;
-                mnAngle &=~0xffff;  // nAngle auf volle Gradzahl runden
-                aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
-                mpPptEscherEx->SetGroupSnapRange( nGroupLevel, maRange );
-                mpPptEscherEx->SetGroupLogicRange( nGroupLevel, maRange );
+                sal_Int32 nAngle(basegfx::fround(basegfx::snapToZeroRange(-mfObjectRotation / F_PI18000, 36000.0)));
+        
+                nAngle = ( 36000 - ( nAngle % 36000 ) );
+                nAngle *= 655;
+                nAngle += 0x8000;
+                nAngle &=~0xffff;  // nAngle auf volle Gradzahl runden
+                aPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
+                mpPptEscherEx->SetGroupSnapPositionAndScale( nGroupLevel, maObjectPosition, maObjectScale );
+                mpPptEscherEx->SetGroupLogicPositionAndScale( nGroupLevel, maObjectPosition, maObjectScale );
             }
             if ( !pClientTextBox )
                 pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
@@ -5483,9 +5504,9 @@ void PPTWriter::ImplWritePage( const PHL
             aPropOpt.CreateShapeProperties( mXShape );
             aPropOpt.Commit( *mpStrm );
 			if ( GetCurrentGroupLevel() > 0 )		
-		        mpPptEscherEx->AddChildAnchor( maRange );
+		        mpPptEscherEx->AddChildAnchor( maObjectPosition, maObjectScale );
 			else
-				mpPptEscherEx->AddClientAnchor( maRange );
+				mpPptEscherEx->AddClientAnchor( maObjectPosition, maObjectScale );
 
             *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
                     << (sal_uInt32)pClientTextBox->Tell();
@@ -5505,39 +5526,6 @@ void PPTWriter::ImplWritePage( const PHL
 
 //  -----------------------------------------------------------------------
 
-::com::sun::star::awt::Point PPTWriter::ImplMapPoint( const ::com::sun::star::awt::Point& rPoint )
-{
-    Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) );
-    return ::com::sun::star::awt::Point( aRet.X(), aRet.Y() );
-}
-
-//  -----------------------------------------------------------------------
-
-::com::sun::star::awt::Size PPTWriter::ImplMapSize( const ::com::sun::star::awt::Size& rSize )
-{
-    Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
-
-    if ( !aRetSize.Width() )
-        aRetSize.Width()++;
-    if ( !aRetSize.Height() )
-        aRetSize.Height()++;
-    return ::com::sun::star::awt::Size( aRetSize.Width(), aRetSize.Height() );
-}
-
-//  -----------------------------------------------------------------------
-
-basegfx::B2DRange PPTWriter::ImplMapRectangle( const ::com::sun::star::awt::Rectangle& rRect )
-{
-    ::com::sun::star::awt::Point    aPoint( rRect.X, rRect.Y );
-    ::com::sun::star::awt::Size     aSize( rRect.Width, rRect.Height );
-    ::com::sun::star::awt::Point    aP( ImplMapPoint( aPoint ) );
-    ::com::sun::star::awt::Size     aS( ImplMapSize( aSize ) );
-    
-	return basegfx::B2DRange(aP.X, aP.Y, aP.X + aS.Width, aP.Y + aS.Height);
-}
-
-//  -----------------------------------------------------------------------
-
 struct CellBorder
 {
 	sal_Int32						mnPos;		// specifies the distance to the top/left position of the table
@@ -5552,7 +5540,7 @@ void PPTWriter::ImplCreateCellBorder( co
 	sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
 	if ( nLineWidth )
 	{
-		mnAngle = 0;
+		mfObjectRotation = 0.0;
 		mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
 		EscherPropertyContainer aPropOptSp;
 
@@ -5597,10 +5585,10 @@ void PPTWriter::ImplCreateTable( uno::Re
 	mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer );
 	mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
 	mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
-	*mpStrm		<< (sal_Int32)basegfx::fround(maRange.getMinX())	// Bounding box fuer die Gruppierten shapes an die sie attached werden
-				<< (sal_Int32)basegfx::fround(maRange.getMinY())    // TTTT: Check for mirrored if Min/Max needs to be exchanged
-				<< (sal_Int32)basegfx::fround(maRange.getMaxX())
-				<< (sal_Int32)basegfx::fround(maRange.getMaxY());
+	*mpStrm		<< (sal_Int32)basegfx::fround(maObjectPosition.getX())	// Bounding box fuer die Gruppierten shapes an die sie attached werden
+				<< (sal_Int32)basegfx::fround(maObjectPosition.getY())    // TTTT: Check for mirrored if Min/Max needs to be exchanged
+				<< (sal_Int32)basegfx::fround(maObjectPosition.getX() + maObjectScale.getX())
+				<< (sal_Int32)basegfx::fround(maObjectPosition.getY() + maObjectScale.getX());
 
     sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
 	mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId );		// Flags: Group | Patriarch
@@ -5624,27 +5612,26 @@ void PPTWriter::ImplCreateTable( uno::Re
 			std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
 			std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
 
-			awt::Point aPosition( ImplMapPoint( rXShape->getPosition() ) );
-			sal_uInt32 nPosition = aPosition.X;
+			sal_uInt32 nPosition = basegfx::fround(maObjectPosition.getX());
 			for ( sal_Int32 x = 0; x < nColumnCount; x++ )
 			{
 				uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
-				awt::Size aS( 0, 0 );
-				xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
-				awt::Size aM( ImplMapSize( aS ) );
-				aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) );
-				nPosition += aM.Width;
+                long aWidth(0);
+				xPropSet->getPropertyValue( sWidth ) >>= aWidth;
+                aWidth = basegfx::fround(mfMap100thMmToMs * aWidth);
+				aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aWidth ) );
+				nPosition += aWidth;
 			}
 
-			nPosition = aPosition.Y;
+			nPosition = basegfx::fround(maObjectPosition.getY());
 			for ( sal_Int32 y = 0; y < nRowCount; y++ )
 			{
 				uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
-				awt::Size aS( 0, 0 );
-				xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
-				awt::Size aM( ImplMapSize( aS ) );
-				aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) );
-				nPosition += aM.Height;
+                long aHeight(0);
+				xPropSet->getPropertyValue( sHeight ) >>= aHeight;
+                aHeight = basegfx::fround(mfMap100thMmToMs * aHeight);
+				aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aHeight ) );
+				nPosition += aHeight;
 			}
 
 			if ( nRowCount )
@@ -5666,9 +5653,9 @@ void PPTWriter::ImplCreateTable( uno::Re
 				aPropOpt.Commit( *mpStrm );
 				aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
 				if ( GetCurrentGroupLevel() > 0 )		
-					mpPptEscherEx->AddChildAnchor( maRange );
+					mpPptEscherEx->AddChildAnchor( maObjectPosition, maObjectScale );
 				else
-					mpPptEscherEx->AddClientAnchor( maRange );
+					mpPptEscherEx->AddClientAnchor( maObjectPosition, maObjectScale );
 				mpPptEscherEx->CloseContainer();
 
 
@@ -5691,7 +5678,7 @@ void PPTWriter::ImplCreateTable( uno::Re
 								if ( nC < aColumns.size() )
 									nRight += aColumns[ nC ].second;
 								else
-									nRight = basegfx::fround(maRange.getMaxX());
+									nRight = basegfx::fround(maObjectPosition.getX() + maObjectScale.getX());
 							}
 							for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
 							{
@@ -5699,7 +5686,7 @@ void PPTWriter::ImplCreateTable( uno::Re
 								if ( nR < aColumns.size() )
 									nBottom += aRows[ nR ].second;
 								else
-									nBottom = basegfx::fround(maRange.getMaxY());
+									nBottom = basegfx::fround(maObjectPosition.getY() + maObjectScale.getY());
 							}
 
 							mbFontIndependentLineSpacing = sal_False;
@@ -5748,21 +5735,21 @@ void PPTWriter::ImplCreateTable( uno::Re
 				static const rtl::OUString	sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
 
 				// creating horz lines
-				sal_Int32 nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
+				sal_Int32 nYPos = basegfx::fround(maObjectPosition.getY());
 				for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
 				{
-					sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
+					sal_Int32 nXPos = basegfx::fround(maObjectPosition.getX());
 					std::vector< CellBorder > vCellBorders;
 					for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
 					{
 						uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW );
-						awt::Size aS( 0, 0 );
-						xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
-						awt::Size aM( ImplMapSize( aS ) );
+                        long aWidth(0);
+						xPropSet->getPropertyValue( sWidth ) >>= aWidth;
+                        aWidth = basegfx::fround(mfMap100thMmToMs * aWidth);
 
 						CellBorder aCellBorder;
 						aCellBorder.mnPos = nXPos;
-						aCellBorder.mnLength = aM.Width;
+						aCellBorder.mnLength = aWidth;
 						if ( nLine < xRows->getCount() )
 						{	// top border
 							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
@@ -5780,7 +5767,7 @@ void PPTWriter::ImplCreateTable( uno::Re
 								aCellBorder.maCellBorder = aBorderLine;
 						}
 						vCellBorders.push_back( aCellBorder );
-						nXPos += aM.Width;
+						nXPos += aWidth;
 					}
 					std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
 					while( aCellBorderIter != vCellBorders.end() )
@@ -5792,29 +5779,29 @@ void PPTWriter::ImplCreateTable( uno::Re
 					if ( nLine < xRows->getCount() )
 					{
 						uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW );
-						awt::Size aS( 0, 0 );
-						xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
-						awt::Size aM( ImplMapSize( aS ) );
-						nYPos += aM.Height;
+                        long aHeight(0);
+						xPropSet->getPropertyValue( sHeight ) >>= aHeight;
+                        aHeight = basegfx::fround(mfMap100thMmToMs * aHeight);
+						nYPos += aHeight;
 					}
 				}
 
 				// creating vertical lines
-				sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
+				sal_Int32 nXPos = basegfx::fround(maObjectPosition.getX());
 				for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
 				{
-					nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
+					nYPos = basegfx::fround(maObjectPosition.getY());
 					std::vector< CellBorder > vCellBorders;
 					for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
 					{
 						uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW );
-						awt::Size aS( 0, 0 );
-						xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
-						awt::Size aM( ImplMapSize( aS ) );
+                        long aHeight(0);
+						xPropSet->getPropertyValue( sHeight ) >>= aHeight;
+                        aHeight = basegfx::fround(mfMap100thMmToMs * aHeight);
 
 						CellBorder aCellBorder;
 						aCellBorder.mnPos = nYPos;
-						aCellBorder.mnLength = aM.Height;
+						aCellBorder.mnLength = aHeight;
 						if ( nLine < xColumns->getCount() )
 						{	// left border
 							uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
@@ -5832,7 +5819,7 @@ void PPTWriter::ImplCreateTable( uno::Re
 								aCellBorder.maCellBorder = aBorderLine;
 						}
 						vCellBorders.push_back( aCellBorder );
-						nYPos += aM.Height;
+						nYPos += aHeight;
 					}
 					std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
 					while( aCellBorderIter != vCellBorders.end() )
@@ -5844,10 +5831,10 @@ void PPTWriter::ImplCreateTable( uno::Re
 					if ( nLine < xColumns->getCount() )
 					{
 						uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW );
-						awt::Size aS( 0, 0 );
-						xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
-						awt::Size aM( ImplMapSize( aS ) );
-						nXPos += aM.Width;
+                        long aWidth(0);
+						xPropSet->getPropertyValue( sWidth ) >>= aWidth;
+                        aWidth = basegfx::fround(mfMap100thMmToMs * aWidth);
+						nXPos += aWidth;
 					}
 				}
 			}

Modified: incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.cxx Fri Jun  1 17:57:48 2012
@@ -239,7 +239,10 @@ void PptEscherEx::CloseContainer()
 
 // ---------------------------------------------------------------------------------------------
 
-sal_uInt32 PptEscherEx::EnterGroup( basegfx::B2DRange* pBoundRange, SvMemoryStream* pClientData )
+sal_uInt32 PptEscherEx::EnterGroup( 
+    const basegfx::B2DPoint* pObjectPosition,
+    const basegfx::B2DVector* pObjectScale,
+    SvMemoryStream* pClientData )
 {
 	sal_uInt32 nShapeId = 0;
 	/* SJ: #Issue 26747#
@@ -248,18 +251,27 @@ sal_uInt32 PptEscherEx::EnterGroup( base
 	*/
 	if ( mnGroupLevel < 12 )
 	{
-		basegfx::B2DRange aRange;
-		if ( pBoundRange )
-			aRange = *pBoundRange;
+        basegfx::B2DPoint aObjectPosition(0.0, 0.0);
+        basegfx::B2DVector aObjectScale(1.0, 1.0);
+
+        if(pObjectPosition)
+        {
+            aObjectPosition = *pObjectPosition;
+        }
+
+        if(pObjectScale)
+        {
+            aObjectScale = *pObjectScale;
+        }
 
 		OpenContainer( ESCHER_SpgrContainer );
 		OpenContainer( ESCHER_SpContainer );
 		AddAtom( 16, ESCHER_Spgr, 1 );
 		PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel, mpOutStrm->Tell() );
-		*mpOutStrm	<< (sal_Int32)basegfx::fround(aRange.getMinX())	// Bounding box fuer die Gruppierten shapes an die sie attached werden
-					<< (sal_Int32)basegfx::fround(aRange.getMinY())
-					<< (sal_Int32)basegfx::fround(aRange.getMaxX())
-					<< (sal_Int32)basegfx::fround(aRange.getMaxY());
+		*mpOutStrm	<< (sal_Int32)basegfx::fround(aObjectPosition.getX())	// Bounding box fuer die Gruppierten shapes an die sie attached werden
+					<< (sal_Int32)basegfx::fround(aObjectPosition.getY()) // here minx,y, maxx,y is correct
+					<< (sal_Int32)basegfx::fround(aObjectPosition.getX() + aObjectScale.getX())
+					<< (sal_Int32)basegfx::fround(aObjectPosition.getY() + aObjectScale.getY());
 
         nShapeId = GenerateShapeId();
 		if ( !mnGroupLevel )
@@ -271,19 +283,19 @@ sal_uInt32 PptEscherEx::EnterGroup( base
 			{
 				AddAtom( 8, ESCHER_ClientAnchor );
 				PtReplaceOrInsert( ESCHER_Persist_Grouping_Logic | mnGroupLevel, mpOutStrm->Tell() );
-				*mpOutStrm << (sal_Int16)basegfx::fround(aRange.getMinY()) // CAUTION! Here, X,Y is exchanged
-						   << (sal_Int16)basegfx::fround(aRange.getMinX()) // by PURPOSE, it's not an error (!)
-						   << (sal_Int16)basegfx::fround(aRange.getMaxX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
-						   << (sal_Int16)basegfx::fround(aRange.getMaxY());
+				*mpOutStrm << (sal_Int16)basegfx::fround(aObjectPosition.getY()) // CAUTION! Here, X,Y is exchanged
+						   << (sal_Int16)basegfx::fround(aObjectPosition.getX()) // by PURPOSE, it's not an error (!)
+						   << (sal_Int16)basegfx::fround(aObjectPosition.getX() + aObjectScale.getX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
+						   << (sal_Int16)basegfx::fround(aObjectPosition.getY() + aObjectScale.getY());
 			}
 			else
 			{
 				AddAtom( 16, ESCHER_ChildAnchor );
 				PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel, mpOutStrm->Tell() );
-				*mpOutStrm << (sal_Int32)basegfx::fround(aRange.getMinX())
-						   << (sal_Int32)basegfx::fround(aRange.getMinY())
-						   << (sal_Int32)basegfx::fround(aRange.getMaxX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
-						   << (sal_Int32)basegfx::fround(aRange.getMaxY());
+				*mpOutStrm << (sal_Int32)basegfx::fround(aObjectPosition.getX()) // here minx,y, maxx,y is correct
+						   << (sal_Int32)basegfx::fround(aObjectPosition.getY())
+						   << (sal_Int32)basegfx::fround(aObjectPosition.getX() + aObjectScale.getX()) // TTTT: Check for mirrored if Min/Max needs to be exchanged
+						   << (sal_Int32)basegfx::fround(aObjectPosition.getY() + aObjectScale.getY());
 			}
 		}
 		if ( pClientData )

Modified: incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/sd/source/filter/eppt/escherex.hxx Fri Jun  1 17:57:48 2012
@@ -61,7 +61,10 @@ class PptEscherEx : public EscherEx
 		void	OpenContainer( sal_uInt16 n_EscherContainer, int nRecInstance = 0 );
 		void	CloseContainer();
 
-		sal_uInt32 EnterGroup( basegfx::B2DRange* pBoundRect, SvMemoryStream* pClientData );
+		sal_uInt32 EnterGroup( 
+            const basegfx::B2DPoint* pObjectPosition,
+            const basegfx::B2DVector* pObjectScale, 
+            SvMemoryStream* pClientData );
 
 		sal_uInt32	DrawingGroupContainerSize();
 		void	WriteDrawingGroupContainer( SvStream& rSt );

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx Fri Jun  1 17:57:48 2012
@@ -182,8 +182,8 @@ public:
 	virtual bool MovCreate(SdrDragStat& rStat);	// #i37448#
 	virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
 
-	virtual bool AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt=true, bool bWdt=true) const;
-	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true);
+	virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const;
+	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
 	virtual bool IsAutoGrowHeight() const;
 	virtual bool IsAutoGrowWidth() const;
 	virtual void SetVerticalWriting( bool bVertical );

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx Fri Jun  1 17:57:48 2012
@@ -225,8 +225,8 @@ public:
 	virtual sal_uInt16 GetObjIdentifier() const;
 	virtual void SetChanged();
 
-	virtual bool AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt=true, bool bWdt=true) const;
-	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true);
+	virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const;
+	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
 	virtual void TakeObjNameSingul(String& rName) const;
 	virtual void TakeObjNamePlural(String& rName) const;
 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx Fri Jun  1 17:57:48 2012
@@ -293,6 +293,9 @@ protected:
 	/// method to copy all data from given source
 	virtual void copyDataFromSdrObject(const SdrObject& rSource);
 
+    // helper for AdjustTextFrameWidthAndHeight which contains the common parts to avoid useless code copying
+    bool ImpAdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt, bool bWdt, bool bCheckAnimation) const;
+
 public:
 	/// create a copy, evtl. with a different target model (if given)
 	virtual SdrObject* CloneSdrObject(SdrModel* pTargetModel = 0) const;
@@ -319,8 +322,8 @@ public:
     bool ReloadLinkedText(bool bForceLoad=false);
     bool LoadText(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet);
 
-	virtual bool AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt=true, bool bWdt=true) const;
-	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true);
+	virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const;
+	virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
 	void ResizeTextAttributes(const Fraction& xFact, const Fraction& yFact);
 	bool IsTextFrame() const { return bTextFrame; }
 	bool IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); }

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unopage.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unopage.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unopage.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unopage.hxx Fri Jun  1 17:57:48 2012
@@ -94,7 +94,6 @@ class SVX_DLLPUBLIC SvxDrawPage : public
 
 	// Internals
 	SdrPage* GetSdrPage() const { return mpPage; }
-//CMCX	void ChangeModel( SdrModel* pNewModel );
 
 	// Erzeugen eines SdrObjects und Einfugen in die SdrPage
 	SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshape.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshape.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshape.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshape.hxx Fri Jun  1 17:57:48 2012
@@ -183,8 +183,6 @@ public:
     void TakeSdrObjectOwnership();
     bool HasSdrObjectOwnership() const;
 
-//CMCX	void ChangeModel( SdrModel* pNewModel );
-
 	void InvalidateSdrObject() { mpObj.reset( NULL ); };
 	const SvxItemPropertySet& GetPropertySet() { return *mpPropSet; }
 	SdrObject* GetSdrObject() const {return mpObj.get();}

Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshtxt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshtxt.hxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshtxt.hxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/unoshtxt.hxx Fri Jun  1 17:57:48 2012
@@ -84,8 +84,6 @@ public:
     virtual Point		LogicToPixel( const Point&, const MapMode& ) const;
     virtual Point		PixelToLogic( const Point&, const MapMode& ) const;
 
-//CMCX	void ChangeModel( SdrModel* pNewModel );
-
     void UpdateOutliner();
 
 private:

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx Fri Jun  1 17:57:48 2012
@@ -1121,9 +1121,9 @@ basegfx::B2DRange EnhancedCustomShape2d:
 
 	if ( nSize )
 	{
-	nIndex = 0;
-	if ( bTextFlow && ( nSize > 1 ) )
-		nIndex++;
+	    nIndex = 0;
+	    if ( bTextFlow && ( nSize > 1 ) )
+		    nIndex++;
 		basegfx::B2DPoint aTopLeft( GetPoint( seqTextFrames[ nIndex ].TopLeft, sal_True, sal_True ) );
 		basegfx::B2DPoint aBottomRight( GetPoint( seqTextFrames[ nIndex ].BottomRight, sal_True, sal_True ) );
 //		if ( bFlipH )

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/sdrtexthelpers.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/sdrtexthelpers.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/sdrtexthelpers.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/sdrtexthelpers.cxx Fri Jun  1 17:57:48 2012
@@ -158,14 +158,18 @@ namespace drawinglayer
 
 basegfx::B2DRange getScaledCenteredTextRange(const SdrTextObj& rText)
 {
-	const basegfx::B2DRange aUnifiedTextRange(
-		rText.getUnifiedTextRange());
+    // get unified text range (no mirroring)
+	const basegfx::B2DRange aUnifiedTextRange(rText.getUnifiedTextRange());
+
+    // scale to object size
 	basegfx::B2DRange aRetval(
 		basegfx::tools::createScaleB2DHomMatrix(
-			basegfx::absolute(rText.getSdrObjectScale())) * 
+			rText.getSdrObjectScale()) * 
 		aUnifiedTextRange);
-	const basegfx::B2DPoint aCurrentCenter(
-		aRetval.getCenter());
+
+    // to align centered, just translate to the current object center. This
+    // will also correct evtl. mirrorings
+	const basegfx::B2DPoint aCurrentCenter(aRetval.getCenter());
 	const basegfx::B2DPoint aFullTransformedCenter(
 		rText.getSdrObjectTransformation() * aUnifiedTextRange.getCenter());
 

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx Fri Jun  1 17:57:48 2012
@@ -853,24 +853,6 @@ void SdrCreateView::ShowCreateObj()
 			if(bUseSolidDragging)
 			{
 				basegfx::B2DPolyPolygon aDragPolyPolygon;
-				SdrRectObj* pRectObj = dynamic_cast< SdrRectObj* >(GetCreateObj());
-
-				if(pRectObj)
-				{
-					// ensure object has some size, necessary for SdrTextObj because
-					// there are still untested divisions by that sizes
-					const basegfx::B2DRange aCurrentSnapRange(sdr::legacy::GetSnapRange(*pRectObj));
-
-					if(!(aCurrentSnapRange.getWidth() > 1.0 && aCurrentSnapRange.getHeight() > 1.0))
-					{
-						const basegfx::B2DRange aNewRange(
-							GetDragStat().GetStart(), 
-							GetDragStat().GetStart() + basegfx::B2DPoint(2.0, 2.0));
-						
-						sdr::legacy::SetSnapRange(*pRectObj, aNewRange);
-					}
-				}
-
 				SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >(GetCreateObj());
 
 				if(pPathObj)

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedtv2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedtv2.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedtv2.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedtv2.cxx Fri Jun  1 17:57:48 2012
@@ -1817,16 +1817,31 @@ void SdrEditView::ImpDismantleOneObject(
 					aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
 					aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
 
-					// get the text bounds and set at text object
-					sdr::legacy::SetSnapRange(*pTextObj, pCustomShape->getRawUnifiedTextRange());
+                    // create transformation for text object.
+                    // TTTT: Need to check text border distances handling
+                    const basegfx::B2DRange aRawUnitTextRange(pCustomShape->getRawUnifiedTextRange());
+
+                    // get TopLeft and BottomRight when applying current objects scale and translate,
+                    // but leave out rot and shear
+                    const basegfx::B2DHomMatrix aJustScaleTranslate(
+                        basegfx::tools::createScaleTranslateB2DHomMatrix(
+                            pCustomShape->getSdrObjectScale(),
+                            pCustomShape->getSdrObjectTranslate()));
+                    const basegfx::B2DPoint aTopLeft(aJustScaleTranslate * aRawUnitTextRange.getMinimum());
+                    const basegfx::B2DPoint aBottomRight(aJustScaleTranslate * aRawUnitTextRange.getMaximum());
+
+                    // aBottomRight may now be top/left of aTopLeft containing the evtl. applied
+                    // mirroring. Use it to create scale for the traget transformation. Also use
+                    // already created TopLeft as translation
+                    const basegfx::B2DHomMatrix aTextTransform(
+                        basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+                            aBottomRight - aTopLeft,
+                            pCustomShape->getSdrObjectShearX(),
+                            pCustomShape->getSdrObjectRotate(),
+                            aTopLeft));
 
-					// if rotated, copy rotation, too.
-					const sal_Int32 aOldRotation(sdr::legacy::GetRotateAngle(*pCustomShape));
-					
-					if(aOldRotation)
-					{
-						sdr::legacy::RotateSdrObject(*pTextObj, sdr::legacy::GetSnapRect(*pCustomShape).Center(), aOldRotation);
-					}
+                    // set new transformation to text object
+                    pTextObj->setSdrObjectTransformation(aTextTransform);
 
 					// set modified ItemSet at text object
 					pTextObj->SetMergedItemSet(aTargetItemSet);
@@ -2414,6 +2429,8 @@ void SdrEditView::DoImportMarkedMtf(SvdP
                 }
 		    }
 
+            // TTTT: ObjectTransform probably needs to be adapted, e.g. when metafile
+            // already contains rotations, it should be removed
 			if(aMetaFile.GetActionCount())
 			{
 				ImpSdrGDIMetaFileImport aFilter(getSdrModelFromSdrView(), pObj->GetLayer(), aObjectTransform);

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx Fri Jun  1 17:57:48 2012
@@ -290,19 +290,9 @@ namespace sdr
 			if(rObject.isRotated())
 			{
 				const double fRotate(rObject.getSdrObjectRotate());
-				long nRetval(basegfx::fround(-fRotate / F_PI18000));
+                const double fSnapped(basegfx::snapToNearestMultiple(-fRotate / F_PI18000, 360000.0));
 
-				while(nRetval < 0)
-				{
-					nRetval += 36000;
-				}
-
-				while(nRetval >= 36000)
-				{
-					nRetval -= 36000;
-				}
-
-				return nRetval;
+                return basegfx::fround(fSnapped);
 			}
 			else
 			{

Modified: incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx?rev=1345289&r1=1345288&r2=1345289&view=diff
==============================================================================
--- incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx (original)
+++ incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx Fri Jun  1 17:57:48 2012
@@ -2169,184 +2169,41 @@ void SdrObjCustomShape::SetVerticalWriti
 		}
 	}
 }
-bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bWdt) const
+bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt, bool bWdt) const
 {
- 	if ( HasText() && !rR.IsEmpty() )
+ 	if(HasText() && !o_rRange.isEmpty())
 	{
-		bool bWdtGrow=bWdt && IsAutoGrowWidth();
-		bool bHgtGrow=bHgt && IsAutoGrowHeight();
-		if ( bWdtGrow || bHgtGrow )
-		{
-			Rectangle aR0(rR);
-			long nHgt=0,nMinHgt=0,nMaxHgt=0;
-			long nWdt=0,nMinWdt=0,nMaxWdt=0;
-			Size aSiz(rR.GetSize()); aSiz.Width()--; aSiz.Height()--;
-			Size aMaxSiz(100000,100000);
-
-			if(!basegfx::fTools::equalZero(getSdrModelFromSdrObject().GetMaxObjectScale().getX())) 
-			{
-				aMaxSiz.Width() = basegfx::fround(getSdrModelFromSdrObject().GetMaxObjectScale().getX());
-			}
-
-			if(!basegfx::fTools::equalZero(getSdrModelFromSdrObject().GetMaxObjectScale().getY())) 
-			{
-				aMaxSiz.Height() = basegfx::fround(getSdrModelFromSdrObject().GetMaxObjectScale().getY());
-			}
-
-			if (bWdtGrow)
-			{
-				nMinWdt=GetMinTextFrameWidth();
-				nMaxWdt=GetMaxTextFrameWidth();
-				if (nMaxWdt==0 || nMaxWdt>aMaxSiz.Width()) nMaxWdt=aMaxSiz.Width();
-				if (nMinWdt<=0) nMinWdt=1;
-				aSiz.Width()=nMaxWdt;
-			}
-			if (bHgtGrow)
-			{
-				nMinHgt=GetMinTextFrameHeight();
-				nMaxHgt=GetMaxTextFrameHeight();
-				if (nMaxHgt==0 || nMaxHgt>aMaxSiz.Height()) nMaxHgt=aMaxSiz.Height();
-				if (nMinHgt<=0) nMinHgt=1;
-				aSiz.Height()=nMaxHgt;
-			}
-			long nHDist=GetTextLeftDistance()+GetTextRightDistance();
-			long nVDist=GetTextUpperDistance()+GetTextLowerDistance();
-			aSiz.Width()-=nHDist;
-			aSiz.Height()-=nVDist;
-			if ( aSiz.Width() < 2 )
-				aSiz.Width() = 2;   // Mindestgroesse 2
-			if ( aSiz.Height() < 2 )
-				aSiz.Height() = 2; // Mindestgroesse 2
+        return ImpAdjustTextFrameWidthAndHeight(o_rRange, bHgt, bWdt, false);
+    }
 
-			if(pEdtOutl)
-			{
-				pEdtOutl->SetMaxAutoPaperSize( aSiz );
-				if (bWdtGrow)
-				{
-					Size aSiz2(pEdtOutl->CalcTextSize());
-					nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
-					if (bHgtGrow) nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
-				} else
-				{
-					nHgt=pEdtOutl->GetTextHeight()+1; // lieber etwas Tolleranz
-				}
-			}
-			else
-			{
-				Outliner& rOutliner=ImpGetDrawOutliner();
-				rOutliner.SetPaperSize(aSiz);
-				rOutliner.SetUpdateMode(true);
-				// !!! hier sollte ich wohl auch noch mal die Optimierung mit
-				// bPortionInfoChecked usw einbauen
-				OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
-				if( pOutlinerParaObject != NULL )
-				{
-					rOutliner.SetText(*pOutlinerParaObject);
-					rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue());
-				}
-				if ( bWdtGrow )
-				{
-					Size aSiz2(rOutliner.CalcTextSize());
-					nWdt=aSiz2.Width()+1; // lieber etwas Tolleranz
-					if ( bHgtGrow )
-						nHgt=aSiz2.Height()+1; // lieber etwas Tolleranz
-				}
-				else
-					nHgt = rOutliner.GetTextHeight()+1; // lieber etwas Tolleranz
-				rOutliner.Clear();
-			}
-			if ( nWdt < nMinWdt )
-				nWdt = nMinWdt;
-			if ( nWdt > nMaxWdt )
-				nWdt = nMaxWdt;
-			nWdt += nHDist;
-			if ( nWdt < 1 )
-				nWdt = 1; // nHDist kann auch negativ sein
-			if ( nHgt < nMinHgt )
-				nHgt = nMinHgt;
-			if ( nHgt > nMaxHgt )
-				nHgt = nMaxHgt;
-			nHgt+=nVDist;
-			if ( nHgt < 1 )
-				nHgt = 1; // nVDist kann auch negativ sein
-			long nWdtGrow = nWdt-(rR.Right()-rR.Left());
-			long nHgtGrow = nHgt-(rR.Bottom()-rR.Top());
-			if ( nWdtGrow == 0 )
-				bWdtGrow = false;
-			if ( nHgtGrow == 0 )
-				bHgtGrow=false;
-			if ( bWdtGrow || bHgtGrow )
-			{
-				if ( bWdtGrow )
-				{
-					SdrTextHorzAdjust eHAdj=GetTextHorizontalAdjust();
-					if ( eHAdj == SDRTEXTHORZADJUST_LEFT )
-						rR.Right()+=nWdtGrow;
-					else if ( eHAdj == SDRTEXTHORZADJUST_RIGHT )
-						rR.Left()-=nWdtGrow;
-					else
-					{
-						long nWdtGrow2=nWdtGrow/2;
-						rR.Left()-=nWdtGrow2;
-						rR.Right()=rR.Left()+nWdt;
-					}
-				}
-				if ( bHgtGrow )
-				{
-					SdrTextVertAdjust eVAdj=GetTextVerticalAdjust();
-					if ( eVAdj == SDRTEXTVERTADJUST_TOP )
-						rR.Bottom()+=nHgtGrow;
-					else if ( eVAdj == SDRTEXTVERTADJUST_BOTTOM )
-						rR.Top()-=nHgtGrow;
-					else
-					{
-						long nHgtGrow2=nHgtGrow/2;
-						rR.Top()-=nHgtGrow2;
-						rR.Bottom()=rR.Top()+nHgt;
-					}
-				}
-				const long aOldRotation(sdr::legacy::GetRotateAngle(*this));
-				if ( aOldRotation )
-				{
-					Point aD1(rR.TopLeft());
-					aD1-=aR0.TopLeft();
-					Point aD2(aD1);
-					RotatePoint(aD2,Point(),sin(aOldRotation*nPi180), cos(aOldRotation*nPi180));
-					aD2-=aD1;
-					rR.Move(aD2.X(),aD2.Y());
-				}
-				return true;
-			}
-		}
-	}
-	return false;
+    return false;
 }
 
 basegfx::B2DRange SdrObjCustomShape::ImpCalculateTextFrame(const bool bHgt, const bool bWdt)
 {
 	basegfx::B2DRange aReturnValue;
-	const basegfx::B2DRange aOldObjRange(sdr::legacy::GetLogicRange(*this));
+	const basegfx::B2DRange aOldObjRange(
+        getSdrObjectTranslate(), 
+        getSdrObjectTranslate() + getSdrObjectScale());
 
 	// initial text rectangle
 	const basegfx::B2DRange aOldTextRange(aOldObjRange);
 
-	// new text rectangle returned from the custom shape renderer,
-	// it depends to the current logical shape size
-	const basegfx::B2DRange aNewTextRange(getRawUnifiedTextRange()); 
+	// new text range returned from the custom shape renderer. It is
+    // in unit coordinates initially, so needs to be transformed by
+    // object scale and position
+	basegfx::B2DRange aNewTextRange(getRawUnifiedTextRange()); 
+    aNewTextRange.transform(
+        basegfx::tools::createScaleTranslateB2DHomMatrix(
+            getSdrObjectScale(),
+            getSdrObjectTranslate()));
 
 	// new text rectangle is being tested by AdjustTextFrameWidthAndHeight to ensure
 	// that the new text rectangle is matching the current text size from the outliner
 	basegfx::B2DRange aAdjustedTextRange(aNewTextRange);
 	
-	Rectangle aTemp( // TTTT: adapt AdjustTextFrameWidthAndHeight, remove here
-		(sal_Int32)floor(aAdjustedTextRange.getMinX()), (sal_Int32)floor(aAdjustedTextRange.getMinY()),
-		(sal_Int32)ceil(aAdjustedTextRange.getMaxX()), (sal_Int32)ceil(aAdjustedTextRange.getMaxY()));
-
-	if(AdjustTextFrameWidthAndHeight(aTemp, bHgt, bWdt))	
+	if(AdjustTextFrameWidthAndHeight(aAdjustedTextRange, bHgt, bWdt))	
 	{
-		// TTTT: adapt AdjustTextFrameWidthAndHeight, remove here
-		aAdjustedTextRange = basegfx::B2DRange(aTemp.Left(), aTemp.Top(), aTemp.Right(), aTemp.Bottom());
-
 		if((aAdjustedTextRange != aNewTextRange) && (aOldTextRange != aAdjustedTextRange))
 		{
 			const basegfx::B2DVector aScale(aOldTextRange.getRange() / aNewTextRange.getRange());
@@ -2365,25 +2222,26 @@ basegfx::B2DRange SdrObjCustomShape::Imp
 bool SdrObjCustomShape::AdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt)
 {
 	const basegfx::B2DRange aNewTextRange(ImpCalculateTextFrame(bHgt, bWdt));
-	const basegfx::B2DRange aOldObjRange(sdr::legacy::GetLogicRange(*this));
-	bool bRet(!aNewTextRange.isEmpty() && (aNewTextRange != aOldObjRange));
+	const basegfx::B2DRange aOldObjRange(getSdrObjectTranslate(), getSdrObjectTranslate() + getSdrObjectScale());
 	
-	if(bRet)
+	if(!aNewTextRange.isEmpty() && !aNewTextRange.equal(aOldObjRange))
 	{
 		// taking care of handles that should not been changed
         const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(*this);
-		std::vector< SdrCustomShapeInteraction > aInteractionHandles( GetInteractionHandles( this ) );
+		std::vector< SdrCustomShapeInteraction > aInteractionHandles(GetInteractionHandles(this));
 		sdr::legacy::SetLogicRange(*this, aNewTextRange);
-		std::vector< SdrCustomShapeInteraction >::iterator aIter( aInteractionHandles.begin() );
+		std::vector< SdrCustomShapeInteraction >::iterator aIter(aInteractionHandles.begin());
 
-		while ( aIter != aInteractionHandles.end() )
+		while(aIter != aInteractionHandles.end())
 		{
 			try
 			{
-				if ( aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED )
-					aIter->xInteraction->setControllerPosition( aIter->aPosition );
+				if(aIter->nMode & CUSTOMSHAPE_HANDLE_RESIZE_FIXED)
+                {
+					aIter->xInteraction->setControllerPosition(aIter->aPosition);
+                }
 			}
-			catch ( const uno::RuntimeException& )
+			catch(const uno::RuntimeException&)
 			{
 			}
 
@@ -2392,9 +2250,11 @@ bool SdrObjCustomShape::AdjustTextFrameW
 
 		InvalidateRenderGeometry();
 		SetChanged();
+        
+        return true;
 	}
 
-	return bRet;
+	return false;
 }
 
 bool SdrObjCustomShape::BegTextEdit( SdrOutliner& rOutl )
@@ -2577,10 +2437,10 @@ basegfx::B2DRange SdrObjCustomShape::get
 			// whereby scale is absolute (without mirrorings AFAIK). To get the unified range,
 			// multiply with the inverse of M = T(obj) * S(obj). This can be done directly
 			// here
-			const double fX(aR.X - getSdrObjectTranslate().getX());
-			const double fY(aR.Y - getSdrObjectTranslate().getY());
 			const double fAbsInvScaleX(basegfx::fTools::equalZero(getSdrObjectScale().getX()) ? 1.0 : 1.0 / fabs(getSdrObjectScale().getX()));
 			const double fAbsInvScaleY(basegfx::fTools::equalZero(getSdrObjectScale().getY()) ? 1.0 : 1.0 / fabs(getSdrObjectScale().getY()));
+			const double fX((aR.X - getSdrObjectTranslate().getX()) * fAbsInvScaleX);
+			const double fY((aR.Y - getSdrObjectTranslate().getY()) * fAbsInvScaleY);
 			const double fW(aR.Width * fAbsInvScaleX);
 			const double fH(aR.Height * fAbsInvScaleY);
 
@@ -2593,11 +2453,12 @@ basegfx::B2DRange SdrObjCustomShape::get
 }
 basegfx::B2DRange SdrObjCustomShape::getUnifiedTextRange() const
 {
+    // get raw range (without text borders)
 	basegfx::B2DRange aRawRange(getRawUnifiedTextRange());
 	const double fAbsInvScaleX(basegfx::fTools::equalZero(getSdrObjectScale().getX()) ? 1.0 : 1.0 / fabs(getSdrObjectScale().getX()));
 	const double fAbsInvScaleY(basegfx::fTools::equalZero(getSdrObjectScale().getY()) ? 1.0 : 1.0 / fabs(getSdrObjectScale().getY()));
 
-	// add/remove the text distances
+	// add/remove the text borders
 	return basegfx::B2DRange(
 		aRawRange.getMinX() + (GetTextLeftDistance() * fAbsInvScaleX),
 		aRawRange.getMinY() + (GetTextUpperDistance() * fAbsInvScaleY),



Mime
View raw message