Author: alg
Date: Fri Jan  6 09:54:02 2012
New Revision: 1228047

URL: http://svn.apache.org/viewvc?rev=1228047&view=rev
Log:
linecap: Adapted svgio (Svg import) to use linecap attribute

Modified:
    
incubator/ooo/branches/alg/linecap/main/svgio/source/svgreader/svgstyleattributes.cxx

Modified: 
incubator/ooo/branches/alg/linecap/main/svgio/source/svgreader/svgstyleattributes.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/branches/alg/linecap/main/svgio/source/svgreader/svgstyleattributes.cxx?rev=1228047&r1=1228046&r2=1228047&view=diff
==============================================================================
--- 
incubator/ooo/branches/alg/linecap/main/svgio/source/svgreader/svgstyleattributes.cxx
 (original)
+++ 
incubator/ooo/branches/alg/linecap/main/svgio/source/svgreader/svgstyleattributes.cxx
 Fri Jan  6 09:54:02 2012
@@ -63,6 +63,28 @@ namespace svgio
             return basegfx::B2DLINEJOIN_MITER;
         }
 
+        com::sun::star::drawing::LineCap 
StrokeLinecapToDrawingLineCap(StrokeLinecap aStrokeLinecap)
+        {
+            switch(aStrokeLinecap)
+            {
+                default: /* StrokeLinecap_notset, StrokeLinecap_butt */
+                {
+                    return com::sun::star::drawing::LineCap_BUTT;
+                    break;
+                }
+                case StrokeLinecap_round:
+                {
+                    return com::sun::star::drawing::LineCap_ROUND;
+                    break;
+                }
+                case StrokeLinecap_square:
+                {
+                    return com::sun::star::drawing::LineCap_SQUARE;
+                    break;
+                }
+            }
+        }
+
         FontStretch getWider(FontStretch aSource)
         {
             switch(aSource)
@@ -656,8 +678,9 @@ namespace svgio
 
                     if(basegfx::fTools::more(fStrokeWidth, 0.0))
                     {
-                        // get LineJoin and stroke array
+                        // get LineJoin, LineCap and stroke array
                         const basegfx::B2DLineJoin 
aB2DLineJoin(StrokeLinejoinToB2DLineJoin(getStrokeLinejoin()));
+                        const com::sun::star::drawing::LineCap 
aLineCap(StrokeLinecapToDrawingLineCap(getStrokeLinecap()));
                         ::std::vector< double > aDashArray;
                     
                         if(!getStrokeDasharray().empty())
@@ -666,14 +689,14 @@ namespace svgio
                         }
 
                         // todo: Handle getStrokeDashOffset()
-                        // todo: Handle getStrokeLinecap()
                         
                         // prepare line attribute
                         drawinglayer::primitive2d::Primitive2DReference 
aNewLinePrimitive;
                         const drawinglayer::attribute::LineAttribute 
aLineAttribute(
                             pStroke ? *pStroke : basegfx::BColor(0.0, 0.0, 
0.0),
                             fStrokeWidth,
-                            aB2DLineJoin);
+                            aB2DLineJoin,
+                            aLineCap);
 
                         if(aDashArray.empty())
                         {


Reply via email to