summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2012-07-09 11:10:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-05 09:23:40 +0000
commit1cbec9cd986100de185f6dc10301a54f6604e6af (patch)
treeb057df936591641fdd29065fab44e0484061b641 /filter
parent6536826f2f4c747582d60ed40b0418c6a67a9829 (diff)
Resolves: #i119480# Fixed import of curves from PPT
Reported by: Du Jing Patch by: SunYing Review by: Andre Fischer (cherry picked from commit 7d4fbffcf83ae6cbd01485320c2f21155c3dd4de) Change-Id: I1ca3caf3aaec255ab204a4a687ed8434fbdb234a
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/msdffimp.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 679388c8c452..f7595920c86b 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4393,6 +4393,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
// 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();
@@ -4408,6 +4409,11 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
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
@@ -4432,6 +4438,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
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
}