drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 29 +- filter/source/svg/svgwriter.cxx | 152 ++++++++----- include/vcl/graphictools.hxx | 28 ++ scripting/source/pyprov/mailmerge.py | 11 vcl/source/gdi/graphictools.cxx | 11 vcl/source/gdi/metaact.cxx | 14 + 6 files changed, 172 insertions(+), 73 deletions(-)
New commits: commit 06f22f5ae0eafe094b280f03c770eebdbb33d403 Author: Caolán McNamara <[email protected]> Date: Mon Jun 17 11:08:15 2013 +0100 Resolves: fdo#55411 python 2 vs 3 str/bytes encoding issues Change-Id: Ic1aac1609f3a1fcbd0af9a1c9ecc07a735c8785a diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 18b476c..f70f034 100755 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -239,11 +239,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): encode_base64(msgattachment) fname = attachment.ReadableName try: - fname.encode('ascii') + msgattachment.add_header('Content-Disposition', 'attachment', \ + filename=fname) except: - fname = ('utf-8','',fname.encode('utf-8')) - msgattachment.add_header('Content-Disposition', 'attachment', \ - filename=fname) + msgattachment.add_header('Content-Disposition', 'attachment', \ + filename=('utf-8','',fname)) + if dbg: + print(("PyMailSMTPService attachmentheader: ", str(msgattachment)), file=dbgout) + msg.attach(msgattachment) uniquer = {} commit 64aed8554510ec3c288ccc247701cf048df59860 Author: Armin Le Grand <[email protected]> Date: Wed Apr 24 16:26:20 2013 +0000 Resolves: #i122132# Some simple extensions to exporter (cherry picked from commit 3454d18694e0ddcf9bc71661bf48c37450fa1fab) Conflicts: filter/source/svg/svgwriter.cxx Change-Id: I2f9d96ffce0d51695a665b58a776807bab5d277e diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 59080d3..83238c0 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -402,6 +402,7 @@ namespace drawinglayer if(rB2DPolygon.count() && !mnSvtGraphicStrokeCount) { + basegfx::B2DPolygon aLocalPolygon(rB2DPolygon); basegfx::BColor aStrokeColor; basegfx::B2DPolyPolygon aStartArrow; basegfx::B2DPolyPolygon aEndArrow; @@ -419,29 +420,37 @@ namespace drawinglayer // SvtGraphicStroke has NO entry for stroke color(!) mpOutputDevice->SetLineColor(Color(aStrokeColor)); - if(!rB2DPolygon.isClosed()) + if(!aLocalPolygon.isClosed()) { double fPolyLength(0.0); + double fStart(0.0); + double fEnd(0.0); if(pStart && pStart->isActive()) { - fPolyLength = basegfx::tools::getLength(rB2DPolygon); + fPolyLength = basegfx::tools::getLength(aLocalPolygon); aStartArrow = basegfx::tools::createAreaGeometryForLineStartEnd( - rB2DPolygon, pStart->getB2DPolyPolygon(), true, pStart->getWidth(), - fPolyLength, pStart->isCentered() ? 0.5 : 0.0, 0); + aLocalPolygon, pStart->getB2DPolyPolygon(), true, pStart->getWidth(), + fPolyLength, pStart->isCentered() ? 0.5 : 0.0, &fStart); } if(pEnd && pEnd->isActive()) { if(basegfx::fTools::equalZero(fPolyLength)) { - fPolyLength = basegfx::tools::getLength(rB2DPolygon); + fPolyLength = basegfx::tools::getLength(aLocalPolygon); } aEndArrow = basegfx::tools::createAreaGeometryForLineStartEnd( - rB2DPolygon, pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(), - fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, 0); + aLocalPolygon, pEnd->getB2DPolyPolygon(), false, pEnd->getWidth(), + fPolyLength, pEnd->isCentered() ? 0.5 : 0.0, &fEnd); + } + + if(0.0 != fStart || 0.0 != fEnd) + { + // build new poly, consume something from old poly + aLocalPolygon = basegfx::tools::getSnippetAbsolute(aLocalPolygon, fStart, fPolyLength - fEnd, fPolyLength); } } @@ -517,14 +526,12 @@ namespace drawinglayer // concept of PDF export and SvtGraphicStroke usage does simply not // allow handling such definitions. The only clean way would be to // add the transformation to SvtGraphicStroke and to handle it there - basegfx::B2DPolygon aB2DPolygon(rB2DPolygon); - - aB2DPolygon.transform(maCurrentTransformation); + aLocalPolygon.transform(maCurrentTransformation); aStartArrow.transform(maCurrentTransformation); aEndArrow.transform(maCurrentTransformation); pRetval = new SvtGraphicStroke( - Polygon(aB2DPolygon), + Polygon(aLocalPolygon), PolyPolygon(aStartArrow), PolyPolygon(aEndArrow), mfCurrentUnifiedTransparence, diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index d1f3c4a..f48cdde 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 ); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index ed066a2..64664d5 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4040,20 +4040,34 @@ void MetaCommentAction::Move( long nXMove, long nYMove ) { SvtGraphicStroke aStroke; aMemStm >> aStroke; + Polygon aPath; aStroke.getPath( aPath ); aPath.Move( nXMove, nYMove ); aStroke.setPath( aPath ); + + PolyPolygon aStartArrow; + aStroke.getStartArrow(aStartArrow); + aStartArrow.Move(nXMove, nYMove); + aStroke.setStartArrow(aStartArrow); + + PolyPolygon aEndArrow; + aStroke.getEndArrow(aEndArrow); + aEndArrow.Move(nXMove, nYMove); + aStroke.setEndArrow(aEndArrow); + aDest << aStroke; } else { SvtGraphicFill aFill; aMemStm >> aFill; + PolyPolygon aPath; aFill.getPath( aPath ); aPath.Move( nXMove, nYMove ); aFill.setPath( aPath ); + aDest << aFill; } delete[] mpData; commit d7cebf0f211053960fba5c0bf1179df54fd35456 Author: Caolán McNamara <[email protected]> Date: Mon Jun 17 11:12:16 2013 +0100 restore SvtGraphicStroke::set[Start|End]Arrow partial revert of 743e627bcfc9c87d806109fe6f3f4e2817b73dda because we want to use that then unused code now Change-Id: I94fe173dda053ce1b72b3b776a9855ce9ecc249b diff --git a/include/vcl/graphictools.hxx b/include/vcl/graphictools.hxx index 3600f1a..70a17fd 100644 --- a/include/vcl/graphictools.hxx +++ b/include/vcl/graphictools.hxx @@ -142,6 +142,34 @@ public: // mutators /// Set path to stroke void setPath ( const Polygon& ); + /** Set the polygon that is put at the start of the line + + The polygon has to be in a special normalized position, and + already scaled to the desired size: the center of the stroked + path will meet the given polygon at (0,0) from negative y + values. Thus, an arrow would have its baseline on the x axis, + going upwards to positive y values. Furthermore, the polygon + also has to be scaled appropriately: the width of the joining + stroke is defined to be SvtGraphicStroke::normalizedArrowWidth + (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your + arrow does have this width, it will fit every stroke with + every stroke width exactly. + */ + void setStartArrow ( const PolyPolygon& ); + /** Set the polygon that is put at the end of the line + + The polygon has to be in a special normalized position, and + already scaled to the desired size: the center of the stroked + path will meet the given polygon at (0,0) from negative y + values. Thus, an arrow would have its baseline on the x axis, + going upwards to positive y values. Furthermore, the polygon + also has to be scaled appropriately: the width of the joining + stroke is defined to be SvtGraphicStroke::normalizedArrowWidth + (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your + arrow does have this width, it will fit every stroke with + every stroke width exactly. + */ + void setEndArrow ( const PolyPolygon& ); /// Affine scaling in both X and Y dimensions void scale ( double fScaleX, double fScaleY ); diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 26cb977..1a0190a 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -111,6 +111,17 @@ void SvtGraphicStroke::setPath( const Polygon& rPoly ) maPath = rPoly; } +void SvtGraphicStroke::setStartArrow( const PolyPolygon& rPoly ) +{ + maStartArrow = rPoly; +} + +void SvtGraphicStroke::setEndArrow( const PolyPolygon& rPoly ) +{ + maEndArrow = rPoly; +} + + void SvtGraphicStroke::scale( double fXScale, double fYScale ) { // Clearly scaling stroke-width for fat lines is rather a problem
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
