Author: alg
Date: Mon Jan 16 14:30:11 2012
New Revision: 1232006

URL: http://svn.apache.org/viewvc?rev=1232006&view=rev
Log:
#118783# Corrected errors in ID strings, corrected Svg line/fill export, 
corrected polygon close state

Modified:
    incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx
    incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx

Modified: incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx?rev=1232006&r1=1232005&r2=1232006&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgexport.cxx Mon Jan 16 
14:30:11 2012
@@ -689,7 +689,7 @@ sal_Bool SVGFilter::implExportPages( con
                     aId = ( B2UCONST( "Slide_" ) ) += 
::rtl::OUString::valueOf( ++mnSlideId );
 
                 if( aSlideName.getLength() )
-                    ( ( aId += B2UCONST( "(" ) ) += aSlideName ) += B2UCONST( 
")" );
+                    ( aId += B2UCONST( "_" ) ) += aSlideName;
                 
                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
 
@@ -825,7 +825,7 @@ sal_Bool SVGFilter::implExportShape( con
                     aId += ::rtl::OUString::valueOf( ++mnDrawingGroupId );
 
                     if( aObjName.getLength() )
-                        ( ( aId += B2UCONST( "(" ) ) += aObjName ) += 
B2UCONST( ")" );
+                        ( aId += B2UCONST( "_" ) ) += aObjName;
                 
                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
                                
@@ -855,7 +855,7 @@ sal_Bool SVGFilter::implExportShape( con
                     aId += ::rtl::OUString::valueOf( ++mnDrawingId );
 
                     if( aObjName.getLength() )
-                        ( ( aId += B2UCONST( "(" ) ) += aObjName ) += 
B2UCONST( ")" );
+                        ( aId += B2UCONST( "_" ) ) += aObjName;
                 
                     {
                         if( ( aShapeType.lastIndexOf( B2UCONST( 
"drawing.OLE2Shape" ) ) != -1 ) ||

Modified: incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx?rev=1232006&r1=1232005&r2=1232006&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/svg/svgwriter.cxx Mon Jan 16 
14:30:11 2012
@@ -489,8 +489,8 @@ PolyPolygon& SVGActionWriter::ImplMap( c
                        aPathData += ::rtl::OUString::valueOf( ( aPolyPoint = 
rPoly[ 0 ] ).X() );
                        aPathData += aComma;
                        aPathData += ::rtl::OUString::valueOf( aPolyPoint.Y() );
-                       
             sal_Char nCurrentMode = 0;
+            const bool bClose(!bLine || rPoly[0] == rPoly[nSize - 1]);
 
                        while( n < nSize )
                        {
@@ -525,7 +525,7 @@ PolyPolygon& SVGActionWriter::ImplMap( c
                                }
                        }
 
-                       if( !bLine )
+                       if(bClose)
                                aPathData += B2UCONST( " Z" );
 
                        if( i < ( nCount - 1 ) )
@@ -1039,6 +1039,10 @@ void SVGActionWriter::ImplWriteActions( 
                                         sal_uInt32 nWriteFlags,
                                         const ::rtl::OUString* pElementId )
 {
+    // need a counter fo rthe actions written per shape to avoid double ID
+    // generation
+    sal_Int32 nEntryCount(0);
+
     if( mnInnerMtfCount )
         nWriteFlags |= SVGWRITER_NO_SHAPE_COMMENTS;
 
@@ -1381,8 +1385,10 @@ void SVGActionWriter::ImplWriteActions( 
                             mapCurShape.reset( new SVGShapeDescriptor );
                             
                             if( pElementId )
-                                mapCurShape->maId = *pElementId;
-                            
+                            {
+                                mapCurShape->maId = *pElementId + 
B2UCONST("_") + ::rtl::OUString::valueOf(nEntryCount++);
+                            }
+
                             mapCurShape->maShapePolyPoly = aShapePolyPoly;
                             mapCurShape->maShapeFillColor = 
aFill.getFillColor();
                             mapCurShape->maShapeFillColor.SetTransparency( 
(sal_uInt8) FRound( 255.0 * aFill.getTransparency() ) );
@@ -1447,16 +1453,32 @@ void SVGActionWriter::ImplWriteActions( 
                     
                     if( bSkip )
                     {
+                        Polygon aPoly;
+
+                        aStroke.getPath(aPoly);
+
+                        if(mapCurShape.get())
+                        {
+                            if(1 != mapCurShape->maShapePolyPoly.Count()
+                                || 
!mapCurShape->maShapePolyPoly[0].IsEqual(aPoly))
+                            {
+                                // this path action is not covering the same 
path than the already existing
+                                // fill polypolygon, so write out the fill 
polygon
+                                ImplWriteShape( *mapCurShape );
+                                mapCurShape.reset();
+                            }
+                        }
+
                         if( !mapCurShape.get() )
                         {
-                            Polygon aPoly;
                             
                             mapCurShape.reset( new SVGShapeDescriptor );
                             
                             if( pElementId )
-                                mapCurShape->maId = *pElementId;
+                            {
+                                mapCurShape->maId = *pElementId + 
B2UCONST("_") + ::rtl::OUString::valueOf(nEntryCount++);
+                            }
                             
-                            aStroke.getPath( aPoly );
                             mapCurShape->maShapePolyPoly = aPoly;
                         }
                             


Reply via email to