[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - svx/source tools/inc tools/source

Radek Doulík rodo at kemper.freedesktop.org
Thu Jan 12 02:17:40 PST 2012


 svx/source/customshapes/EnhancedCustomShape2d.cxx |    6 +++---
 tools/inc/tools/poly.hxx                          |    3 ++-
 tools/source/generic/poly.cxx                     |    5 ++++-
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 1ceb8e1878be513f260c6d7fbe7066627fca0693
Author: Radek Doulik <rodo at novell.com>
Date:   Thu Jan 12 11:07:51 2012 +0100

    fix ooxml custom shapes with 360 degree arcs

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 948fff5..ee8a365 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1407,7 +1407,7 @@ void EnhancedCustomShape2d::SwapStartAndEndArrow( SdrObject* pObj ) //#108274
     pObj->SetMergedItem( aLineEndCenter );
 }
 
-basegfx::B2DPolygon CreateArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, const sal_Bool bClockwise )
+basegfx::B2DPolygon CreateArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, const sal_Bool bClockwise, sal_Bool bFullCircle = sal_False )
 {
     Rectangle aRect( rRect );
     Point aStart( rStart );
@@ -1430,7 +1430,7 @@ basegfx::B2DPolygon CreateArc( const Rectangle& rRect, const Point& rStart, cons
         }
     }
 
-    Polygon aTempPoly( aRect, aStart, aEnd, POLY_ARC );
+    Polygon aTempPoly( aRect, aStart, aEnd, POLY_ARC, bFullCircle );
     basegfx::B2DPolygon aRetval;
 
     if ( bClockwise )
@@ -1757,7 +1757,7 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
                             OSL_TRACE("ARCANGLETO rect: %d, %d   x   %d, %d   start: %d, %d end: %d, %d clockwise: %d",
                                       aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom(),
                                       aStartPoint.X(), aStartPoint.Y(), aEndPoint.X(), aEndPoint.Y(), bClockwise);
-                            aNewB2DPolygon.append(CreateArc( aRect, bClockwise ? aEndPoint : aStartPoint, bClockwise ? aStartPoint : aEndPoint, bClockwise));
+                            aNewB2DPolygon.append(CreateArc( aRect, bClockwise ? aEndPoint : aStartPoint, bClockwise ? aStartPoint : aEndPoint, bClockwise, aStartPoint == aEndPoint && fSwingAngle > F_PI));
                         }
 
                         rSrcPt += 2;
commit e4cd111fae5f9b781471d4150915bb189eff90ef
Author: Radek Doulik <rodo at novell.com>
Date:   Thu Jan 12 11:06:11 2012 +0100

    make it possible to create 360 degrees arc (circle)

diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx
index 5923266..480b357 100644
--- a/tools/inc/tools/poly.hxx
+++ b/tools/inc/tools/poly.hxx
@@ -140,7 +140,8 @@ public:
                                  sal_uInt16 nPoints = 0 );
                         Polygon( const Rectangle& rBound,
                                  const Point& rStart, const Point& rEnd,
-                                 PolyStyle ePolyStyle = POLY_ARC );
+                                 PolyStyle ePolyStyle = POLY_ARC,
+                                 sal_Bool bWholeCircle = sal_False );
                         Polygon( const Point& rBezPt1, const Point& rCtrlPt1,
                                  const Point& rBezPt2, const Point& rCtrlPt2,
                                  sal_uInt16 nPoints = 0 );
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index f062b9e..14b34d3 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -510,7 +510,7 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin
 // -----------------------------------------------------------------------
 
 Polygon::Polygon( const Rectangle& rBound,
-                  const Point& rStart, const Point& rEnd, PolyStyle eStyle )
+                  const Point& rStart, const Point& rEnd, PolyStyle eStyle, sal_Bool bFullCircle )
 {
     DBG_CTOR( Polygon, NULL );
 
@@ -547,6 +547,9 @@ Polygon::Polygon( const Rectangle& rBound,
         if( fDiff < 0. )
             fDiff += F_2PI;
 
+        if ( bFullCircle )
+            fDiff = F_2PI;
+
         // Punktanzahl proportional verkleinern ( fDiff / (2PI) );
         // ist eingentlich nur fuer einen Kreis richtig; wir
         // machen es hier aber trotzdem


More information about the Libreoffice-commits mailing list