diff options
-rw-r--r-- | vcl/qa/cppunit/wmf/wmfimporttest.cxx | 24 | ||||
-rw-r--r-- | vcl/source/filter/wmf/enhwmf.cxx | 26 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.cxx | 15 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winmtf.hxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/wmf/winwmf.cxx | 11 |
5 files changed, 29 insertions, 49 deletions
diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/vcl/qa/cppunit/wmf/wmfimporttest.cxx index 2c6a6e30e9bd..855c42739f56 100644 --- a/vcl/qa/cppunit/wmf/wmfimporttest.cxx +++ b/vcl/qa/cppunit/wmf/wmfimporttest.cxx @@ -146,36 +146,36 @@ void WmfTest::testEmfLineStyles() assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#0000ff"); assertXPath(pDoc, "/metafile/line[1]", "style", "dash"); - assertXPath(pDoc, "/metafile/line[1]", "dashlen", "225"); + assertXPath(pDoc, "/metafile/line[1]", "dashlen", "528"); assertXPath(pDoc, "/metafile/line[1]", "dashcount", "1"); - assertXPath(pDoc, "/metafile/line[1]", "dotlen", "0"); + assertXPath(pDoc, "/metafile/line[1]", "dotlen", "176"); assertXPath(pDoc, "/metafile/line[1]", "dotcount", "0"); - assertXPath(pDoc, "/metafile/line[1]", "distance", "100"); + assertXPath(pDoc, "/metafile/line[1]", "distance", "176"); assertXPath(pDoc, "/metafile/line[1]", "join", "miter"); assertXPath(pDoc, "/metafile/line[1]", "cap", "butt"); assertXPath(pDoc, "/metafile/line[2]", "style", "dash"); - assertXPath(pDoc, "/metafile/line[2]", "dashlen", "0"); + assertXPath(pDoc, "/metafile/line[2]", "dashlen", "528"); assertXPath(pDoc, "/metafile/line[2]", "dashcount", "0"); - assertXPath(pDoc, "/metafile/line[2]", "dotlen", "30"); + assertXPath(pDoc, "/metafile/line[2]", "dotlen", "176"); assertXPath(pDoc, "/metafile/line[2]", "dotcount", "1"); - assertXPath(pDoc, "/metafile/line[2]", "distance", "50"); + assertXPath(pDoc, "/metafile/line[2]", "distance", "176"); assertXPath(pDoc, "/metafile/line[2]", "join", "miter"); assertXPath(pDoc, "/metafile/line[2]", "cap", "butt"); assertXPath(pDoc, "/metafile/line[3]", "style", "dash"); - assertXPath(pDoc, "/metafile/line[3]", "dashlen", "150"); + assertXPath(pDoc, "/metafile/line[3]", "dashlen", "528"); assertXPath(pDoc, "/metafile/line[3]", "dashcount", "1"); - assertXPath(pDoc, "/metafile/line[3]", "dotlen", "30"); + assertXPath(pDoc, "/metafile/line[3]", "dotlen", "176"); assertXPath(pDoc, "/metafile/line[3]", "dotcount", "1"); - assertXPath(pDoc, "/metafile/line[3]", "distance", "90"); + assertXPath(pDoc, "/metafile/line[3]", "distance", "176"); assertXPath(pDoc, "/metafile/line[4]", "style", "dash"); - assertXPath(pDoc, "/metafile/line[4]", "dashlen", "150"); + assertXPath(pDoc, "/metafile/line[4]", "dashlen", "528"); assertXPath(pDoc, "/metafile/line[4]", "dashcount", "1"); - assertXPath(pDoc, "/metafile/line[4]", "dotlen", "30"); + assertXPath(pDoc, "/metafile/line[4]", "dotlen", "176"); assertXPath(pDoc, "/metafile/line[4]", "dotcount", "2"); - assertXPath(pDoc, "/metafile/line[4]", "distance", "50"); + assertXPath(pDoc, "/metafile/line[4]", "distance", "176"); assertXPath(pDoc, "/metafile/line[4]", "join", "miter"); assertXPath(pDoc, "/metafile/line[4]", "cap", "butt"); }; diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index c1c8160286b3..185e2fab9086 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -17,10 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "winmtf.hxx" #include <osl/endian.h> #include <basegfx/matrix/b2dhommatrix.hxx> #include <vcl/dibtools.hxx> + +#include "winmtf.hxx" + #include <memory> #ifdef DBG_UTIL @@ -912,37 +914,27 @@ bool EnhWMFReader::ReadEnhWMF() aLineInfo.SetWidth( aSize.Width() ); bool bTransparent = false; - switch( nStyle & 0xFF ) + switch( nStyle & PS_STYLE_MASK ) { case PS_DASHDOTDOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 2 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASHDOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 90 ); break; case PS_DOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 0 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASH : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 0 ); - aLineInfo.SetDashLen( 225 ); - aLineInfo.SetDistance( 100 ); break; case PS_NULL : bTransparent = true; @@ -1015,31 +1007,21 @@ bool EnhWMFReader::ReadEnhWMF() aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 2 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASHDOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 90 ); break; case PS_DOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 0 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASH : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 0 ); - aLineInfo.SetDashLen( 225 ); - aLineInfo.SetDistance( 100 ); break; case PS_NULL : bTransparent = true; diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index e87234b614de..711b6fa8d0dc 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -503,14 +503,13 @@ tools::Polygon& WinMtfOutput::ImplMap( tools::Polygon& rPolygon ) return rPolygon; } -tools::Polygon& WinMtfOutput::ImplScale( tools::Polygon& rPolygon ) +void WinMtfOutput::ImplScale( tools::Polygon& rPolygon ) { sal_uInt16 nPoints = rPolygon.GetSize(); for ( sal_uInt16 i = 0; i < nPoints; i++ ) { rPolygon[ i ] = ImplScale( rPolygon[ i ] ); } - return rPolygon; } tools::PolyPolygon& WinMtfOutput::ImplScale( tools::PolyPolygon& rPolyPolygon ) @@ -730,8 +729,16 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS { WinMtfLineStyle* pLineStyle = static_cast<WinMtfLineStyle*>(pStyle); Size aSize(pLineStyle->aLineInfo.GetWidth(), 0); - aSize = ImplMap(aSize); - pLineStyle->aLineInfo.SetWidth(aSize.Width()); + pLineStyle->aLineInfo.SetWidth( ImplMap(aSize).Width() ); + + if ( pLineStyle->aLineInfo.GetStyle() == LINE_DASH ) + { + aSize.Width() += 1; + long nDotLen = ImplMap( aSize ).Width(); + pLineStyle->aLineInfo.SetDistance( nDotLen ); + pLineStyle->aLineInfo.SetDotLen( nDotLen ); + pLineStyle->aLineInfo.SetDashLen( nDotLen * 3 ); + } } } if ( (sal_uInt32)nIndex >= vGDIObj.size() ) diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index 7bd5f7db6329..79b375709945 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -610,7 +610,7 @@ class WinMtfOutput void ImplMap( vcl::Font& rFont ); tools::Polygon& ImplMap( tools::Polygon& rPolygon ); tools::PolyPolygon& ImplMap( tools::PolyPolygon& rPolyPolygon ); - tools::Polygon& ImplScale( tools::Polygon& rPolygon ); + void ImplScale( tools::Polygon& rPolygon ); tools::PolyPolygon& ImplScale( tools::PolyPolygon& rPolyPolygon ); void ImplResizeObjectArry( sal_uInt32 nNewEntry ); void ImplSetNonPersistentLineColorTransparenz(); diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index 1b590e4cca15..86c21124e284 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -811,37 +811,28 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) aLineInfo.SetWidth(nWidth); bool bTransparent = false; + switch( nStyle & 0xFF ) { case PS_DASHDOTDOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 2 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASHDOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDashLen( 150 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 90 ); break; case PS_DOT : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 0 ); aLineInfo.SetDotCount( 1 ); - aLineInfo.SetDotLen( 30 ); - aLineInfo.SetDistance( 50 ); break; case PS_DASH : aLineInfo.SetStyle( LINE_DASH ); aLineInfo.SetDashCount( 1 ); aLineInfo.SetDotCount( 0 ); - aLineInfo.SetDashLen( 225 ); - aLineInfo.SetDistance( 100 ); break; case PS_NULL : bTransparent = true; |