diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-24 16:26:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-17 13:50:32 +0100 |
commit | 64aed8554510ec3c288ccc247701cf048df59860 (patch) | |
tree | 105ad52d0ed0253562afeba3a0355dfbe1e31df2 /filter/source | |
parent | d7cebf0f211053960fba5c0bf1179df54fd35456 (diff) |
Resolves: #i122132# Some simple extensions to exporter
(cherry picked from commit 3454d18694e0ddcf9bc71661bf48c37450fa1fab)
Conflicts:
filter/source/svg/svgwriter.cxx
Change-Id: I2f9d96ffce0d51695a665b58a776807bab5d277e
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 152 |
1 files changed, 94 insertions, 58 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index d1f3c4a6e39a..f48cdde36ae9 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -2805,6 +2805,14 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, if( rPoly.GetSize() ) { + const LineInfo& rLineInfo = pA->GetLineInfo(); + + if(rLineInfo.GetWidth()) + { + sal_Int32 nStrokeWidth = ImplMap(rLineInfo.GetWidth()); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStrokeWidth, OUString::valueOf( nStrokeWidth ) ); + } + mpContext->AddPaintAttr( mpVDev->GetLineColor(), Color( COL_TRANSPARENT ) ); ImplAddLineAttr( pA->GetLineInfo() ); ImplWritePolyPolygon( rPoly, sal_True ); @@ -3043,83 +3051,109 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, aStroke.getEndArrow( aEndArrow ); // Currently no support for strokes with start/end arrow(s) - sal_Bool bSkip = ( !aStartArrow.Count() && !aEndArrow.Count() ); - - if( bSkip ) - { - Polygon aPoly; + // added that support + Polygon aPoly; - aStroke.getPath(aPoly); + aStroke.getPath(aPoly); - if(mapCurShape.get()) + if(mapCurShape.get()) + { + if(1 != mapCurShape->maShapePolyPoly.Count() + || !mapCurShape->maShapePolyPoly[0].IsEqual(aPoly)) { - 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(); - } + // 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() ) - { - mapCurShape.reset( new SVGShapeDescriptor ); + if( !mapCurShape.get() ) + { - if( pElementId ) - { - mapCurShape->maId = *pElementId + "_" + OUString::valueOf(nEntryCount++); - } + mapCurShape.reset( new SVGShapeDescriptor ); - aStroke.getPath( aPoly ); - mapCurShape->maShapePolyPoly = aPoly; + if( pElementId ) + { + mapCurShape->maId = *pElementId + "_" + OUString::valueOf(nEntryCount++); } - mapCurShape->maShapeLineColor = mpVDev->GetLineColor(); - mapCurShape->maShapeLineColor.SetTransparency( (sal_uInt8) FRound( aStroke.getTransparency() * 255.0 ) ); - mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() ); - aStroke.getDashArray( mapCurShape->maDashArray ); + mapCurShape->maShapePolyPoly = aPoly; } - // support for LineJoin + mapCurShape->maShapeLineColor = mpVDev->GetLineColor(); + mapCurShape->maShapeLineColor.SetTransparency( (sal_uInt8) FRound( aStroke.getTransparency() * 255.0 ) ); + mapCurShape->mnStrokeWidth = FRound( aStroke.getStrokeWidth() ); + aStroke.getDashArray( mapCurShape->maDashArray ); + + // added support for LineJoin switch(aStroke.getJoinType()) { - default: /* SvtGraphicStroke::joinMiter, SvtGraphicStroke::joinNone */ - { - mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_MITER; - break; - } - case SvtGraphicStroke::joinRound: - { - mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_ROUND; - break; - } - case SvtGraphicStroke::joinBevel: - { - mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_BEVEL; - break; - } + default: /* SvtGraphicStroke::joinMiter, SvtGraphicStroke::joinNone */ + { + mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_MITER; + break; + } + case SvtGraphicStroke::joinRound: + { + mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_ROUND; + break; + } + case SvtGraphicStroke::joinBevel: + { + mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_BEVEL; + break; + } } - // support for LineCap + // added support for LineCap switch(aStroke.getCapType()) { - default: /* SvtGraphicStroke::capButt */ - { - mapCurShape->maLineCap = com::sun::star::drawing::LineCap_BUTT; - break; - } - case SvtGraphicStroke::capRound: - { - mapCurShape->maLineCap = com::sun::star::drawing::LineCap_ROUND; - break; + default: /* SvtGraphicStroke::capButt */ + { + mapCurShape->maLineCap = com::sun::star::drawing::LineCap_BUTT; + break; + } + case SvtGraphicStroke::capRound: + { + mapCurShape->maLineCap = com::sun::star::drawing::LineCap_ROUND; + break; + } + case SvtGraphicStroke::capSquare: + { + mapCurShape->maLineCap = com::sun::star::drawing::LineCap_SQUARE; + break; + } } - case SvtGraphicStroke::capSquare: + + if(mapCurShape.get() &&(aStartArrow.Count() || aEndArrow.Count())) { - mapCurShape->maLineCap = com::sun::star::drawing::LineCap_SQUARE; - break; - } + ImplWriteShape( *mapCurShape ); + + mapCurShape->maShapeFillColor = mapCurShape->maShapeLineColor; + mapCurShape->maShapeLineColor = Color(COL_TRANSPARENT); + mapCurShape->mnStrokeWidth = 0; + mapCurShape->maDashArray.clear(); + mapCurShape->maLineJoin = basegfx::B2DLINEJOIN_MITER; + mapCurShape->maLineCap = com::sun::star::drawing::LineCap_BUTT; + + if(aStartArrow.Count()) + { + mapCurShape->maShapePolyPoly = aStartArrow; + mapCurShape->maId = *pElementId + "_" + OUString::valueOf(nEntryCount++); + + ImplWriteShape( *mapCurShape ); + } + + if(aEndArrow.Count()) + { + mapCurShape->maShapePolyPoly = aEndArrow; + mapCurShape->maId = *pElementId + "_" + OUString::valueOf(nEntryCount++); + + ImplWriteShape( *mapCurShape ); + } + + mapCurShape.reset(); } // write open shape in every case @@ -3130,6 +3164,8 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, } // skip rest of comment + sal_Bool bSkip = true; + while( bSkip && ( ++nCurAction < nCount ) ) { pAction = rMtf.GetAction( nCurAction ); |