diff options
Diffstat (limited to 'filter/source/flash')
-rw-r--r-- | filter/source/flash/swfwriter.cxx | 13 | ||||
-rw-r--r-- | filter/source/flash/swfwriter.hxx | 3 | ||||
-rw-r--r-- | filter/source/flash/swfwriter1.cxx | 83 | ||||
-rw-r--r-- | filter/source/flash/swfwriter2.cxx | 6 |
4 files changed, 88 insertions, 17 deletions
diff --git a/filter/source/flash/swfwriter.cxx b/filter/source/flash/swfwriter.cxx index 0ec6e6d3cb4a..968c7b513ea5 100644 --- a/filter/source/flash/swfwriter.cxx +++ b/filter/source/flash/swfwriter.cxx @@ -33,6 +33,7 @@ #include "swfwriter.hxx" #include <vcl/virdev.hxx> #include <vcl/gdimtf.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace ::swf; using namespace ::std; @@ -248,8 +249,10 @@ void Writer::placeShape( sal_uInt16 nID, sal_uInt16 nDepth, sal_Int32 x, sal_Int mpTag->addUI16( nDepth ); // depth mpTag->addUI16( nID ); // character Id - ::basegfx::B2DHomMatrix aMatrix; // #i73264# - aMatrix.translate( _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)), _Int16(static_cast<long>(map100thmm(y)*mnDocYScale))); + // #i73264# + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)), + _Int16(static_cast<long>(map100thmm(y)*mnDocYScale)))); mpTag->addMatrix( aMatrix ); // transformation matrix if( pName ) @@ -280,8 +283,10 @@ void Writer::moveShape( sal_uInt16 nDepth, sal_Int32 x, sal_Int32 y ) mpTag->addBits( aBits ); mpTag->addUI16( nDepth ); // depth - ::basegfx::B2DHomMatrix aMatrix; // #i73264# - aMatrix.translate( _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)), _Int16(static_cast<long>(map100thmm(y)*mnDocYScale))); + // #i73264# + const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix( + _Int16(static_cast<long>(map100thmm(x)*mnDocXScale)), + _Int16(static_cast<long>(map100thmm(y)*mnDocYScale)))); mpTag->addMatrix( aMatrix ); // transformation matrix endTag(); diff --git a/filter/source/flash/swfwriter.hxx b/filter/source/flash/swfwriter.hxx index d91410c36b98..e8c75b8095b6 100644 --- a/filter/source/flash/swfwriter.hxx +++ b/filter/source/flash/swfwriter.hxx @@ -63,6 +63,8 @@ class PolyPolygon; class Gradient; class SvtGraphicFill; class SvtGraphicStroke; +class LineInfo; +namespace basegfx { class B2DPolygon; } inline sal_uInt16 _uInt16( sal_Int32 nValue ) { @@ -363,6 +365,7 @@ private: void Impl_writeBmp( sal_uInt16 nBitmapId, sal_uInt32 width, sal_uInt32 height, sal_uInt8 *pCompressed, sal_uInt32 compressed_size ); void Impl_writeImage( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const Rectangle& rClipRect, bool bMap ); void Impl_writeJPEG(sal_uInt16 nBitmapId, const sal_uInt8* pJpgData, sal_uInt32 nJpgDataLength, sal_uInt8 *pCompressed, sal_uInt32 compressed_size ); + void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void Impl_writeActions( const GDIMetaFile& rMtf ); void Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled ); void Impl_writePolygon( const Polygon& rPoly, sal_Bool bFilled, const Color& rFillColor, const Color& rLineColor ); diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 6718cc4be8be..ffe26c35699b 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -33,7 +33,6 @@ #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> - #include <comphelper/processfactory.hxx> #include "swfwriter.hxx" #include <vcl/metaact.hxx> @@ -41,8 +40,7 @@ #include <vcl/bmpacc.hxx> #include <vcl/virdev.hxx> #include <vcl/metric.hxx> - - +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <svtools/filter.hxx> #include <vcl/graphictools.hxx> @@ -53,7 +51,10 @@ #include <external/zlib/zlib.h> #endif #endif + #include <vcl/salbtype.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> using namespace ::swf; using namespace ::std; @@ -640,9 +641,6 @@ void Writer::Impl_writeText( const Point& rPos, const String& rText, const sal_I // CL: This is still a hack until we figure out how to calculate a correct bound rect // for rotatet text Rectangle textBounds( 0, 0, static_cast<long>(mnDocWidth*mnDocXScale), static_cast<long>(mnDocHeight*mnDocYScale) ); - - ::basegfx::B2DHomMatrix m; // #i73264# - double scale = 1.0; // scale width if we have a stretched text @@ -660,7 +658,7 @@ void Writer::Impl_writeText( const Point& rPos, const String& rText, const sal_I scale = (double)n1 / (double)n2; } - m.rotate( static_cast<double>(nOrientation) * F_PI1800 ); + basegfx::B2DHomMatrix m(basegfx::tools::createRotateB2DHomMatrix(static_cast<double>(nOrientation) * F_PI1800)); m.translate( double(aPt.X() / scale), double(aPt.Y()) ); m.scale( scale, scale ); @@ -1240,6 +1238,12 @@ bool Writer::Impl_writeStroke( SvtGraphicStroke& rStroke ) Rectangle aNewRect( aPolyPolygon.GetBoundRect() ); + // as log as not LINESTYLE2 and DefineShape4 is used (which + // added support for LineJoin), only round LineJoins are + // supported. Fallback to META_POLYLINE_ACTION and META_LINE_ACTION + if(SvtGraphicStroke::joinRound != rStroke.getJoinType()) + return false; + PolyPolygon aStartArrow; rStroke.getStartArrow( aStartArrow ); if( 0 != aStartArrow.Count() ) @@ -1395,6 +1399,46 @@ bool Writer::Impl_writePageField( Rectangle& rTextBounds ) // ----------------------------------------------------------------------------- +void Writer::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + Impl_writePolygon(Polygon(aCandidate), sal_False ); + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(mpVDev->GetLineColor()); + const Color aOldFillColor(mpVDev->GetFillColor()); + + mpVDev->SetLineColor(); + mpVDev->SetFillColor(aOldLineColor); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + Impl_writePolyPolygon(PolyPolygon(Polygon(aPolygon)), sal_True ); + } + + mpVDev->SetLineColor(aOldLineColor); + mpVDev->SetFillColor(aOldFillColor); + } + } +} + +// ----------------------------------------------------------------------------- + void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) { Rectangle clipRect; @@ -1426,7 +1470,18 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) { const MetaLineAction* pA = (const MetaLineAction*) pAction; - Impl_writeLine( pA->GetStartPoint(), pA->GetEndPoint() ); + if(pA->GetLineInfo().IsDefault()) + { + Impl_writeLine( pA->GetStartPoint(), pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } break; @@ -1501,7 +1556,17 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf ) const Polygon& rPoly = pA->GetPolygon(); if( rPoly.GetSize() ) - Impl_writePolygon( rPoly, sal_False ); + { + if(pA->GetLineInfo().IsDefault()) + { + Impl_writePolygon( rPoly, sal_False ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } } break; diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index bbc5746cf2cd..891439668c91 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -32,6 +32,7 @@ #include "precompiled_filter.hxx" #include "swfwriter.hxx" #include <vcl/virdev.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <math.h> @@ -608,10 +609,7 @@ struct GradRecord void FillStyle::Impl_addGradient( Tag* pTag ) const { vector< struct GradRecord > aGradientRecords; - - ::basegfx::B2DHomMatrix m; // #i73264# - - m.rotate( (maGradient.GetAngle() - 900) * F_PI1800 ); + basegfx::B2DHomMatrix m(basegfx::tools::createRotateB2DHomMatrix((maGradient.GetAngle() - 900) * F_PI1800)); switch( maGradient.GetStyle() ) { |