filter/source/msfilter/msdffimp.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 1cbec9cd986100de185f6dc10301a54f6604e6af
Author: Andre Fischer <a...@apache.org>
Date:   Mon Jul 9 11:10:26 2012 +0000

    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

diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 679388c..f759592 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
                             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to