Kaydet (Commit) 1cbec9cd authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Caolán McNamara

Resolves: #i119480# Fixed import of curves from PPT

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

(cherry picked from commit 7d4fbffc)

Change-Id: I1ca3caf3aaec255ab204a4a687ed8434fbdb234a
üst 6536826f
...@@ -4393,6 +4393,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ...@@ -4393,6 +4393,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// before clearing the GeometryItem we have to store the current Coordinates // before clearing the GeometryItem we have to store the current Coordinates
const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates ); const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
Rectangle aPolyBoundRect; Rectangle aPolyBoundRect;
Point aStartPt( 0,0 );
if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength() >= 4 ) ) if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength() >= 4 ) )
{ {
sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength(); sal_Int32 nPtNum, nNumElemVert = seqCoordinates.getLength();
...@@ -4408,6 +4409,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ...@@ -4408,6 +4409,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aXP[ (sal_uInt16)nPtNum ] = aP; aXP[ (sal_uInt16)nPtNum ] = aP;
} }
aPolyBoundRect = Rectangle( aXP.GetBoundRect() ); 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 else
aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 ); // defaulting aPolyBoundRect = Rectangle( -21600, 0, 21600, 43200 ); // defaulting
...@@ -4432,6 +4438,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ...@@ -4432,6 +4438,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
else else
{ {
fNumber = 270.0; 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 ].Value <<= fNumber;
seqAdjustmentValues[ 0 ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; // so this value will properly be stored seqAdjustmentValues[ 0 ].State = com::sun::star::beans::PropertyState_DIRECT_VALUE; // so this value will properly be stored
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment