incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1359096 - /incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
Date Mon, 09 Jul 2012 12:10:26 GMT
Author: af
Date: Mon Jul  9 12:10:26 2012
New Revision: 1359096

URL: http://svn.apache.org/viewvc?rev=1359096&view=rev
Log:
#i119480# Fixed import of curves from PPT.

          Reported by: Du Jing
          Patch by: SunYing
          Review by: Andre Fischer

Modified:
    incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx

Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1359096&r1=1359095&r2=1359096&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Mon Jul  9 12:10:26 2012
@@ -4500,6 +4500,7 @@ SdrObject* SvxMSDffManager::ImportShape(
 						// before clearing the GeometryItem we have to store the current Coordinates
 						const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName(
sPath, sCoordinates );
 						Rectangle aPolyBoundRect;
+						Point aStartPt( 0,0 );
 						if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength()
>= 4 ) )
 						{
 							sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength();
@@ -4516,6 +4517,11 @@ SdrObject* SvxMSDffManager::ImportShape(
 								aXP[ (sal_uInt16)nPtNum ] = aP;
 							}
 							aPolyBoundRect = Rectangle( aXP.GetBoundRect() );
+							if ( nNumElemVert >= 3 )
+							{ // arc first command is always wr -- clockwise arc
+								// the parameters are : (left,top),(right,bottom),start(x,y),end(x,y) 
+								aStartPt = aXP[2];
+							}
 						}
 						else
 							aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 );	// defaulting
@@ -4540,6 +4546,18 @@ SdrObject* SvxMSDffManager::ImportShape(
 							else
 							{
 								fNumber = 270.0;
+								//normal situation:if endAngle != 90,there will be a direct_value,but for damaged
curve,the endAngle need to recalculate.
+								Point cent = aPolyBoundRect.Center();
+								if ( aStartPt.Y() == cent.Y() )
+									fNumber = ( aStartPt.X() >= cent.X() ) ? 0:180.0;
+								else if ( aStartPt.X() == cent.X() )
+									fNumber = ( aStartPt.Y() >= cent.Y() ) ? 90.0: 270.0;
+								else
+								{
+									fNumber = atan2( double( aStartPt.X() - cent.X() ),double( aStartPt.Y() - cent.Y()
) )+ F_PI; // 0..2PI
+									fNumber /= F_PI180; // 0..360.0
+								}
+								nEndAngle = NormAngle360( - (sal_Int32)fNumber * 100 );
 								seqAdjustmentValues[ 0 ].Value <<= fNumber;
 								seqAdjustmentValues[ 0 ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE;
	// so this value will properly be stored
 							}



Mime
View raw message