cppcanvas/source/inc/implrenderer.hxx | 9 cppcanvas/source/mtfrenderer/emfplus.cxx | 353 ++++++++++++++++++++++++++++--- vcl/source/filter/wmf/enhwmf.cxx | 102 ++++---- vcl/source/filter/wmf/winmtf.cxx | 34 -- vcl/source/filter/wmf/winmtf.hxx | 14 - 5 files changed, 378 insertions(+), 134 deletions(-)
New commits: commit aa58872593822206e2f0a2bc0322954d4bf7685b Author: Jan Holesovsky <[email protected]> Date: Mon Nov 25 22:09:48 2013 +0100 EMF+: Set the stroke attributes on the custom line caps. This finally makes the rendering of the custom line caps nice & complete. Change-Id: If35ef1c44f34f5d5e6c50789c907105d03e96fca diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 2fa121f0..4907b6f 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -37,8 +37,10 @@ #include <rtl/ustring.hxx> #include <sal/alloca.h> -#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/PathCapType.hpp> +#include <com/sun/star/rendering/PathJoinType.hpp> #include <com/sun/star/rendering/TexturingMode.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> #include <bitmapaction.hxx> #include <implrenderer.hxx> @@ -103,6 +105,16 @@ const sal_uInt32 EmfPlusCustomLineCapDataTypeAdjustableArrow = 0x00000001; const sal_uInt32 EmfPlusCustomLineCapDataFillPath = 0x00000001; const sal_uInt32 EmfPlusCustomLineCapDataLinePath = 0x00000002; +const sal_uInt32 EmfPlusLineCapTypeFlat = 0x00000000; +const sal_uInt32 EmfPlusLineCapTypeSquare = 0x00000001; +const sal_uInt32 EmfPlusLineCapTypeRound = 0x00000002; +const sal_uInt32 EmfPlusLineCapTypeTriangle = 0x00000003; + +const sal_uInt32 EmfPlusLineJoinTypeMiter = 0x00000000; +const sal_uInt32 EmfPlusLineJoinTypeBevel = 0x00000001; +const sal_uInt32 EmfPlusLineJoinTypeRound = 0x00000002; +const sal_uInt32 EmfPlusLineJoinTypeMiterClipped = 0x00000003; + using namespace ::com::sun::star; using namespace ::basegfx; @@ -594,9 +606,25 @@ namespace cppcanvas } }; + /// Convert stroke caps between EMF+ and rendering API + sal_Int8 lcl_convertStrokeCap(sal_uInt32 nEmfStroke) + { + switch (nEmfStroke) + { + case EmfPlusLineCapTypeSquare: return rendering::PathCapType::SQUARE; + case EmfPlusLineCapTypeRound: return rendering::PathCapType::ROUND; + } + + // we have no mapping for EmfPlusLineCapTypeTriangle, so return + // BUTT always + return rendering::PathCapType::BUTT; + } + struct EMFPCustomLineCap : public EMFPObject { sal_uInt32 type; + sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin; + float miterLimit; basegfx::B2DPolyPolygon polygon; public: @@ -608,6 +636,22 @@ namespace cppcanvas { } + void SetAttributes(rendering::StrokeAttributes& aAttributes) + { + aAttributes.StartCapType = lcl_convertStrokeCap(strokeStartCap); + aAttributes.EndCapType = lcl_convertStrokeCap(strokeEndCap); + + switch (strokeJoin) + { + case EmfPlusLineJoinTypeMiter: // fall-through + case EmfPlusLineJoinTypeMiterClipped: aAttributes.JoinType = rendering::PathJoinType::MITER; break; + case EmfPlusLineJoinTypeBevel: aAttributes.JoinType = rendering::PathJoinType::BEVEL; break; + case EmfPlusLineJoinTypeRound: aAttributes.JoinType = rendering::PathJoinType::ROUND; break; + } + + aAttributes.MiterLimit = miterLimit; + } + void ReadPath(SvStream& s, ImplRenderer& rR, bool bClosed) { sal_Int32 pathLength; @@ -648,13 +692,12 @@ namespace cppcanvas { sal_uInt32 customLineCapDataFlags, baseCap; float baseInset; - sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin; - float strokeMiterLimit, widthScale; + float widthScale; float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY; s >> customLineCapDataFlags >> baseCap >> baseInset >> strokeStartCap >> strokeEndCap >> strokeJoin - >> strokeMiterLimit >> widthScale + >> miterLimit >> widthScale >> fillHotSpotX >> fillHotSpotY >> strokeHotSpotX >> strokeHotSpotY; SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLineCapDataFlags: 0x" << std::hex << customLineCapDataFlags); @@ -663,7 +706,7 @@ namespace cppcanvas SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeStartCap: 0x" << std::hex << strokeStartCap); SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeEndCap: 0x" << std::hex << strokeEndCap); SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeJoin: 0x" << std::hex << strokeJoin); - SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeMiterLimit: " << strokeMiterLimit); + SAL_INFO("cppcanvas.emf", "EMF+\t\tmiterLimit: " << miterLimit); SAL_INFO("cppcanvas.emf", "EMF+\t\twidthScale: " << widthScale); if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath) @@ -682,11 +725,11 @@ namespace cppcanvas // no test document to be able to implement it] sal_Int32 width, height, middleInset, fillState, lineStartCap; - sal_Int32 lineEndCap, lineJoin, lineMiterLimit, widthScale; + sal_Int32 lineEndCap, lineJoin, widthScale; float fillHotSpotX, fillHotSpotY, lineHotSpotX, lineHotSpotY; s >> width >> height >> middleInset >> fillState >> lineStartCap - >> lineEndCap >> lineJoin >> lineMiterLimit >> widthScale + >> lineEndCap >> lineJoin >> miterLimit >> widthScale >> fillHotSpotX >> fillHotSpotY >> lineHotSpotX >> lineHotSpotY; SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - actually read EmfPlusCustomLineCapArrowData object (section 2.2.2.12)"); @@ -1358,13 +1401,23 @@ namespace cppcanvas // line start if (pen->customStartCap) + { + rendering::StrokeAttributes aAttributes(aCommonAttributes); + pen->customStartCap->SetAttributes(aAttributes); + EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customStartCap->polygon, - true, aCommonAttributes, rParms, rState); + true, aAttributes, rParms, rState); + } // line end if (pen->customEndCap) + { + rendering::StrokeAttributes aAttributes(aCommonAttributes); + pen->customEndCap->SetAttributes(aAttributes); + EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customEndCap->polygon, - false, aCommonAttributes, rParms, rState); + false, aAttributes, rParms, rState); + } } } commit c3052ac86115f9bb3319abc55ef7cc2a1607231e Author: Jan Holesovsky <[email protected]> Date: Mon Nov 25 21:35:26 2013 +0100 EMF+: Render custom line cap data. Change-Id: Ic5e2e2d105fb006503b63e4e162d4dc09dab9e68 diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index 02fc003..c649db3 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -280,6 +280,13 @@ static float GetSwapFloat( SvStream& rSt ) /* EMF+ */ void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas ); double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState ); + + /// Render LineCap, like the start or end arrow of a polygon. + void EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength, + const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart, + const com::sun::star::rendering::StrokeAttributes& rAttributes, + const ActionFactoryParameters& rParms, OutDevState& rState); + void EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex); void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor); diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 69568d3..2fa121f0 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -597,6 +597,7 @@ namespace cppcanvas struct EMFPCustomLineCap : public EMFPObject { sal_uInt32 type; + basegfx::B2DPolyPolygon polygon; public: EMFPCustomLineCap() : EMFPObject() @@ -607,6 +608,33 @@ namespace cppcanvas { } + void ReadPath(SvStream& s, ImplRenderer& rR, bool bClosed) + { + sal_Int32 pathLength; + s >> pathLength; + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength); + + sal_uInt32 pathHeader; + sal_Int32 pathPoints, pathFlags; + s >> pathHeader >> pathPoints >> pathFlags; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap line path)"); + SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec ); + + EMFPPath path(pathPoints); + path.Read(s, pathFlags, rR); + + polygon = path.GetPolygon(rR, false); + polygon.setClosed(bClosed); + + // transformation to convert the path to what LibreOffice + // expects + B2DHomMatrix aMatrix; + aMatrix.scale(1.0, -1.0); + + polygon.transform(aMatrix); + }; + void Read (SvStream& s, ImplRenderer& rR) { sal_uInt32 header; @@ -618,9 +646,10 @@ namespace cppcanvas if (type == EmfPlusCustomLineCapDataTypeDefault) { - sal_Int32 customLineCapDataFlags, baseCap, baseInset; - sal_Int32 strokeStartCap, strokeEndCap, strokeJoin; - sal_Int32 strokeMiterLimit, widthScale; + sal_uInt32 customLineCapDataFlags, baseCap; + float baseInset; + sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin; + float strokeMiterLimit, widthScale; float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY; s >> customLineCapDataFlags >> baseCap >> baseInset @@ -628,40 +657,23 @@ namespace cppcanvas >> strokeMiterLimit >> widthScale >> fillHotSpotX >> fillHotSpotY >> strokeHotSpotX >> strokeHotSpotY; - SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLinCapDataFlags: 0x" << std::hex << customLineCapDataFlags); + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLineCapDataFlags: 0x" << std::hex << customLineCapDataFlags); + SAL_INFO("cppcanvas.emf", "EMF+\t\tbaseCap: 0x" << std::hex << baseCap); + SAL_INFO("cppcanvas.emf", "EMF+\t\tbaseInset: " << baseInset); + SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeStartCap: 0x" << std::hex << strokeStartCap); + SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeEndCap: 0x" << std::hex << strokeEndCap); + SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeJoin: 0x" << std::hex << strokeJoin); + SAL_INFO("cppcanvas.emf", "EMF+\t\tstrokeMiterLimit: " << strokeMiterLimit); + SAL_INFO("cppcanvas.emf", "EMF+\t\twidthScale: " << widthScale); if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath) { - sal_Int32 pathLength; - s >> pathLength; - SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength); - - sal_uInt32 pathHeader; - sal_Int32 pathPoints, pathFlags; - s >> pathHeader >> pathPoints >> pathFlags; - - SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap fill path)"); - SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec ); - - EMFPPath path(pathPoints); - path.Read(s, pathFlags, rR); + ReadPath(s, rR, true); } if (customLineCapDataFlags & EmfPlusCustomLineCapDataLinePath) { - sal_Int32 pathLength; - s >> pathLength; - SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength); - - sal_uInt32 pathHeader; - sal_Int32 pathPoints, pathFlags; - s >> pathHeader >> pathPoints >> pathFlags; - - SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap line path)"); - SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec ); - - EMFPPath path(pathPoints); - path.Read(s, pathFlags, rR); + ReadPath(s, rR, false); } } else if (type == EmfPlusCustomLineCapDataTypeAdjustableArrow) @@ -1264,6 +1276,38 @@ namespace cppcanvas } } + + void ImplRenderer::EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength, + const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart, const rendering::StrokeAttributes& rAttributes, + const ActionFactoryParameters& rParms, OutDevState& rState) + { + if (!rLineCap.count()) + return; + + // it seems the line caps in EMF+ are 4*larger than what + // LibreOffice expects, and the mapping in + // createAreaGeometryForLineStartEnd scales that down, so + // correct it + // [unfortunately found no proof for this in the spec :-( - please + // feel free to correct this if it causes trouble] + double fWidth = rAttributes.StrokeWidth*4; + + basegfx::B2DPolyPolygon aArrow(basegfx::tools::createAreaGeometryForLineStartEnd( + rPolygon, rLineCap, bStart, + fWidth, fPolyLength, 0.0, NULL)); + + // createAreaGeometryForLineStartEnd from some reason always sets + // the path as closed, correct it + aArrow.setClosed(rLineCap.isClosed()); + + ActionSharedPtr pAction(internal::PolyPolyActionFactory::createPolyPolyAction(aArrow, rParms.mrCanvas, rState, rAttributes)); + if (pAction) + { + maActions.push_back(MtfAction(pAction, rParms.mrCurrActionIndex)); + rParms.mrCurrActionIndex += pAction->getActionCount()-1; + } + } + void ImplRenderer::EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex) { @@ -1298,6 +1342,32 @@ namespace cppcanvas maActions.push_back(MtfAction(pPolyAction, rParms.mrCurrActionIndex)); rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; } + + // render line starts & ends + if (pen->customStartCap || pen->customEndCap) + { + for (sal_uInt32 i = 0; i < aPolyPolygon.count(); ++i) + { + // break the polypolygon into polygons + basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(i)); + + if (aPolygon.isClosed()) + continue; + + double fPolyLength = basegfx::tools::getLength(aPolygon); + + // line start + if (pen->customStartCap) + EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customStartCap->polygon, + true, aCommonAttributes, rParms, rState); + + // line end + if (pen->customEndCap) + EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customEndCap->polygon, + false, aCommonAttributes, rParms, rState); + } + } + } } commit 7bf90cf4065b0e23223f26ca24acfadc89fa875b Author: Jan Holesovsky <[email protected]> Date: Mon Nov 25 11:45:05 2013 +0100 EMF+: Parse custom line cap data for start and end line caps. Change-Id: I3a5f79e22500f53c3c61c173e0827c250b2a8fd0 diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index ec5e739..69568d3 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -97,6 +97,12 @@ const sal_Int32 EmfPlusLineStyleDashDot = 0x00000003; const sal_Int32 EmfPlusLineStyleDashDotDot = 0x00000004; const sal_Int32 EmfPlusLineStyleCustom = 0x00000005; +const sal_uInt32 EmfPlusCustomLineCapDataTypeDefault = 0x00000000; +const sal_uInt32 EmfPlusCustomLineCapDataTypeAdjustableArrow = 0x00000001; + +const sal_uInt32 EmfPlusCustomLineCapDataFillPath = 0x00000001; +const sal_uInt32 EmfPlusCustomLineCapDataLinePath = 0x00000002; + using namespace ::com::sun::star; using namespace ::basegfx; @@ -588,6 +594,94 @@ namespace cppcanvas } }; + struct EMFPCustomLineCap : public EMFPObject + { + sal_uInt32 type; + + public: + EMFPCustomLineCap() : EMFPObject() + { + } + + ~EMFPCustomLineCap() + { + } + + void Read (SvStream& s, ImplRenderer& rR) + { + sal_uInt32 header; + + s >> header >> type; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustom cap"); + SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << header << " type: " << type << std::dec); + + if (type == EmfPlusCustomLineCapDataTypeDefault) + { + sal_Int32 customLineCapDataFlags, baseCap, baseInset; + sal_Int32 strokeStartCap, strokeEndCap, strokeJoin; + sal_Int32 strokeMiterLimit, widthScale; + float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY; + + s >> customLineCapDataFlags >> baseCap >> baseInset + >> strokeStartCap >> strokeEndCap >> strokeJoin + >> strokeMiterLimit >> widthScale + >> fillHotSpotX >> fillHotSpotY >> strokeHotSpotX >> strokeHotSpotY; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomLinCapDataFlags: 0x" << std::hex << customLineCapDataFlags); + + if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath) + { + sal_Int32 pathLength; + s >> pathLength; + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength); + + sal_uInt32 pathHeader; + sal_Int32 pathPoints, pathFlags; + s >> pathHeader >> pathPoints >> pathFlags; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap fill path)"); + SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec ); + + EMFPPath path(pathPoints); + path.Read(s, pathFlags, rR); + } + + if (customLineCapDataFlags & EmfPlusCustomLineCapDataLinePath) + { + sal_Int32 pathLength; + s >> pathLength; + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath length: " << pathLength); + + sal_uInt32 pathHeader; + sal_Int32 pathPoints, pathFlags; + s >> pathHeader >> pathPoints >> pathFlags; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tpath (custom cap line path)"); + SAL_INFO("cppcanvas.emf", "EMF+\t\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec ); + + EMFPPath path(pathPoints); + path.Read(s, pathFlags, rR); + } + } + else if (type == EmfPlusCustomLineCapDataTypeAdjustableArrow) + { + // TODO only reads the data, does not use them [I've had + // no test document to be able to implement it] + + sal_Int32 width, height, middleInset, fillState, lineStartCap; + sal_Int32 lineEndCap, lineJoin, lineMiterLimit, widthScale; + float fillHotSpotX, fillHotSpotY, lineHotSpotX, lineHotSpotY; + + s >> width >> height >> middleInset >> fillState >> lineStartCap + >> lineEndCap >> lineJoin >> lineMiterLimit >> widthScale + >> fillHotSpotX >> fillHotSpotY >> lineHotSpotX >> lineHotSpotY; + + SAL_INFO("cppcanvas.emf", "EMF+\t\tTODO - actually read EmfPlusCustomLineCapArrowData object (section 2.2.2.12)"); + } + } + }; + struct EMFPPen : public EMFPBrush { XForm transformation; @@ -605,9 +699,9 @@ namespace cppcanvas sal_Int32 compoundArrayLen; float *compoundArray; sal_Int32 customStartCapLen; - sal_uInt8 *customStartCap; + EMFPCustomLineCap *customStartCap; sal_Int32 customEndCapLen; - sal_uInt8 *customEndCap; + EMFPCustomLineCap *customEndCap; public: EMFPPen () : EMFPBrush () @@ -622,8 +716,8 @@ namespace cppcanvas { delete[] dashPattern; delete[] compoundArray; - delete[] customStartCap; - delete[] customEndCap; + delete customStartCap; + delete customEndCap; } void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) @@ -762,15 +856,13 @@ namespace cppcanvas { s >> customStartCapLen; SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen); + sal_uInt32 pos = s.Tell(); - if( customStartCapLen<0 ) - customStartCapLen=0; - customStartCap = new sal_uInt8 [customStartCapLen]; - for (i = 0; i < customStartCapLen; i++) - { - s >> customStartCap [i]; - SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomStartCap[" << i << "]: 0x" << std::hex << int(customStartCap[i])); - } + customStartCap = new EMFPCustomLineCap(); + customStartCap->Read(s, rR); + + // maybe we don't read everything yet, play it safe ;-) + s.Seek(pos + customStartCapLen); } else customStartCapLen = 0; @@ -779,15 +871,13 @@ namespace cppcanvas { s >> customEndCapLen; SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen); + sal_uInt32 pos = s.Tell(); - if( customEndCapLen<0 ) - customEndCapLen=0; - customEndCap = new sal_uInt8 [customEndCapLen]; - for (i = 0; i < customEndCapLen; i++) - { - s >> customEndCap [i]; - SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomEndCap[" << i << "]: 0x" << std::hex << int(customEndCap[i])); - } + customEndCap = new EMFPCustomLineCap(); + customEndCap->Read(s, rR); + + // maybe we don't read everything yet, play it safe ;-) + s.Seek(pos + customEndCapLen); } else customEndCapLen = 0; commit 1ff6cb553ba67ba5167506a2498d20525b58a087 Author: Jan Holesovsky <[email protected]> Date: Fri Nov 22 17:06:10 2013 +0100 EMF+: Small cleanup & more logging in preparation for line starts & ends. Change-Id: I584f8a1680c6aa7b51b948a00213c285387b77c3 diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index c70bf54..02fc003 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -280,7 +280,7 @@ static float GetSwapFloat( SvStream& rSt ) /* EMF+ */ void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas ); double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState ); - void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex); + void EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex); void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor); ActionVector maActions; diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 9dc50d7..ec5e739 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -28,6 +28,7 @@ #include <basegfx/vector/b2dsize.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drectangle.hxx> +#include <basegfx/polygon/b2dlinegeometry.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -625,7 +626,7 @@ namespace cppcanvas delete[] customEndCap; } - void SetStrokeAttributes (rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) + void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) { #if OSL_DEBUG_LEVEL > 1 if (width == 0.0) { @@ -633,8 +634,10 @@ namespace cppcanvas } #endif rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX()); + } - // set dashing + void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes) + { if (dashStyle != EmfPlusLineStyleSolid) { const float dash[] = {3, 3}; @@ -678,12 +681,18 @@ namespace cppcanvas s >> transformation; if (penFlags & 2) + { s >> startCap; + SAL_INFO("cppcanvas.emf", "EMF+\t\tstartCap: 0x" << std::hex << startCap); + } else startCap = 0; if (penFlags & 4) + { s >> endCap; + SAL_INFO("cppcanvas.emf", "EMF+\t\tendCap: 0x" << std::hex << endCap); + } else endCap = 0; @@ -749,24 +758,38 @@ namespace cppcanvas } else compoundArrayLen = 0; - if (penFlags & 2048) { + if (penFlags & 2048) + { s >> customStartCapLen; + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen); + if( customStartCapLen<0 ) customStartCapLen=0; customStartCap = new sal_uInt8 [customStartCapLen]; for (i = 0; i < customStartCapLen; i++) + { s >> customStartCap [i]; - } else + SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomStartCap[" << i << "]: 0x" << std::hex << int(customStartCap[i])); + } + } + else customStartCapLen = 0; - if (penFlags & 4096) { + if (penFlags & 4096) + { s >> customEndCapLen; + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen); + if( customEndCapLen<0 ) customEndCapLen=0; customEndCap = new sal_uInt8 [customEndCapLen]; for (i = 0; i < customEndCapLen; i++) + { s >> customEndCap [i]; - } else + SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomEndCap[" << i << "]: 0x" << std::hex << int(customEndCap[i])); + } + } + else customEndCapLen = 0; EMFPBrush::Read (s, rR); @@ -1151,7 +1174,7 @@ namespace cppcanvas } } - void ImplRenderer::EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, + void ImplRenderer::EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex) { EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff]; @@ -1165,22 +1188,24 @@ namespace cppcanvas rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (), rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace()); - polygon.transform( rState.mapModeTransform ); - rendering::StrokeAttributes aStrokeAttributes; + basegfx::B2DPolyPolygon aPolyPolygon(polygon); + aPolyPolygon.transform(rState.mapModeTransform); + rendering::StrokeAttributes aCommonAttributes; - pen->SetStrokeAttributes (aStrokeAttributes, *this, rState); + // some attributes are common for the polygon, and the line + // starts & ends - like the stroke width + pen->SetStrokeWidth(aCommonAttributes, *this, rState); - ActionSharedPtr pPolyAction( - internal::PolyPolyActionFactory::createPolyPolyAction( - polygon, rParms.mrCanvas, rState, aStrokeAttributes ) ); + // but eg. dashing has to be additionally set only on the + // polygon + rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes); + pen->SetStrokeDashing(aPolygonAttributes); + // render the polygon + ActionSharedPtr pPolyAction(internal::PolyPolyActionFactory::createPolyPolyAction(aPolyPolygon, rParms.mrCanvas, rState, aPolygonAttributes)); if( pPolyAction ) { - maActions.push_back( - MtfAction( - pPolyAction, - rParms.mrCurrActionIndex ) ); - + maActions.push_back(MtfAction(pPolyAction, rParms.mrCurrActionIndex)); rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; } } commit 007f427dd2565eb108ed2292c1fe1af8051f2abb Author: Jan Holesovsky <[email protected]> Date: Fri Nov 22 12:01:15 2013 +0100 EMF+: Implement line dashing. Change-Id: I9eb21c0a8b5baa5b0080845f61b12fc65034d959 diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index be2bfbd..9dc50d7 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -89,6 +89,13 @@ #define EmfPlusRegionInitialStateInfinite 0x10000003 +const sal_Int32 EmfPlusLineStyleSolid = 0x00000000; +const sal_Int32 EmfPlusLineStyleDash = 0x00000001; +const sal_Int32 EmfPlusLineStyleDot = 0x00000002; +const sal_Int32 EmfPlusLineStyleDashDot = 0x00000003; +const sal_Int32 EmfPlusLineStyleDashDotDot = 0x00000004; +const sal_Int32 EmfPlusLineStyleCustom = 0x00000005; + using namespace ::com::sun::star; using namespace ::basegfx; @@ -626,6 +633,34 @@ namespace cppcanvas } #endif rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX()); + + // set dashing + if (dashStyle != EmfPlusLineStyleSolid) + { + const float dash[] = {3, 3}; + const float dot[] = {1, 3}; + const float dashdot[] = {3, 3, 1, 3}; + const float dashdotdot[] = {3, 3, 1, 3, 1, 3}; + + sal_Int32 nLen = 0; + const float *pPattern; + switch (dashStyle) + { + case EmfPlusLineStyleDash: nLen = SAL_N_ELEMENTS(dash); pPattern = dash; break; + case EmfPlusLineStyleDot: nLen = SAL_N_ELEMENTS(dot); pPattern = dot; break; + case EmfPlusLineStyleDashDot: nLen = SAL_N_ELEMENTS(dashdot); pPattern = dashdot; break; + case EmfPlusLineStyleDashDotDot: nLen = SAL_N_ELEMENTS(dashdotdot); pPattern = dashdotdot; break; + case EmfPlusLineStyleCustom: nLen = dashPatternLen; pPattern = dashPattern; break; + } + if (nLen > 0) + { + uno::Sequence<double> aDashArray(nLen); + for (int i = 0; i < nLen; ++i) + aDashArray[i] = pPattern[i]; + + rStrokeAttributes.DashArray = aDashArray; + } + } } void Read (SvStream& s, ImplRenderer& rR, sal_Int32, sal_Int32 ) @@ -663,7 +698,10 @@ namespace cppcanvas mitterLimit = 0; if (penFlags & 32) + { s >> dashStyle; + SAL_INFO("cppcanvas.emf", "EMF+\t\tdashStyle: 0x" << std::hex << dashStyle); + } else dashStyle = 0; @@ -677,14 +715,23 @@ namespace cppcanvas else dashOffset = 0; - if (penFlags & 256) { + if (penFlags & 256) + { + dashStyle = EmfPlusLineStyleCustom; + s >> dashPatternLen; + SAL_INFO("cppcanvas.emf", "EMF+\t\tdashPatternLen: " << dashPatternLen); + if( dashPatternLen<0 || sal_uInt32(dashPatternLen)>SAL_MAX_INT32/sizeof(float) ) dashPatternLen = SAL_MAX_INT32/sizeof(float); dashPattern = new float [dashPatternLen]; for (i = 0; i < dashPatternLen; i++) + { s >> dashPattern [i]; - } else + SAL_INFO("cppcanvas.emf", "EMF+\t\t\tdashPattern[" << i << "]: " << dashPattern[i]); + } + } + else dashPatternLen = 0; if (penFlags & 512) commit fc1041634d3ed32593d78d1c7a96df734f2f5cdc Author: Jan Holesovsky <[email protected]> Date: Tue Nov 19 11:36:23 2013 +0100 EMF: More useful debugging output. Change-Id: I2aa0e97878db62275d794be43a7d351e5ae25f1c diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx index 2e79081..3ad4481 100644 --- a/vcl/source/filter/wmf/enhwmf.cxx +++ b/vcl/source/filter/wmf/enhwmf.cxx @@ -1378,57 +1378,57 @@ sal_Bool EnhWMFReader::ReadEnhWMF() } break; - default : WinMtfAssertHandler( "Unknown Meta Action" ); break; - case EMR_MASKBLT : WinMtfAssertHandler( "MaskBlt" ); break; - case EMR_PLGBLT : WinMtfAssertHandler( "PlgBlt" ); break; - case EMR_SETDIBITSTODEVICE : WinMtfAssertHandler( "SetDIBitsToDevice" ); break; - case EMR_FRAMERGN : WinMtfAssertHandler( "FrameRgn" ); break; - case EMR_INVERTRGN : WinMtfAssertHandler( "InvertRgn" ); break; - case EMR_PAINTRGN : WinMtfAssertHandler( "PaintRgn" ); break; - case EMR_FLATTENPATH : WinMtfAssertHandler( "FlattenPath" ); break; - case EMR_WIDENPATH : WinMtfAssertHandler( "WidenPath" ); break; - case EMR_POLYDRAW : WinMtfAssertHandler( "Polydraw" ); break; - case EMR_SETARCDIRECTION : WinMtfAssertHandler( "SetArcDirection" ); break; - case EMR_SETPALETTEENTRIES : WinMtfAssertHandler( "SetPaletteEntries" ); break; - case EMR_RESIZEPALETTE : WinMtfAssertHandler( "ResizePalette" ); break; - case EMR_EXTFLOODFILL : WinMtfAssertHandler( "ExtFloodFill" ); break; - case EMR_ANGLEARC : WinMtfAssertHandler( "AngleArc" ); break; - case EMR_SETCOLORADJUSTMENT : WinMtfAssertHandler( "SetColorAdjustment" ); break; - case EMR_POLYDRAW16 : WinMtfAssertHandler( "PolyDraw16" ); break; - case EMR_POLYTEXTOUTA : WinMtfAssertHandler( "PolyTextOutA" ); break; - case EMR_POLYTEXTOUTW : WinMtfAssertHandler( "PolyTextOutW" ); break; - case EMR_CREATECOLORSPACE : WinMtfAssertHandler( "CreateColorSpace" ); break; - case EMR_SETCOLORSPACE : WinMtfAssertHandler( "SetColorSpace" ); break; - case EMR_DELETECOLORSPACE : WinMtfAssertHandler( "DeleteColorSpace" ); break; - case EMR_GLSRECORD : WinMtfAssertHandler( "GlsRecord" ); break; - case EMR_GLSBOUNDEDRECORD : WinMtfAssertHandler( "GlsBoundRecord" ); break; - case EMR_PIXELFORMAT : WinMtfAssertHandler( "PixelFormat" ); break; - case EMR_DRAWESCAPE : WinMtfAssertHandler( "DrawEscape" ); break; - case EMR_EXTESCAPE : WinMtfAssertHandler( "ExtEscape" ); break; - case EMR_STARTDOC : WinMtfAssertHandler( "StartDoc" ); break; - case EMR_SMALLTEXTOUT : WinMtfAssertHandler( "SmallTextOut" ); break; - case EMR_FORCEUFIMAPPING : WinMtfAssertHandler( "ForceUFIMapping" ); break; - case EMR_NAMEDESCAPE : WinMtfAssertHandler( "NamedEscape" ); break; - case EMR_COLORCORRECTPALETTE : WinMtfAssertHandler( "ColorCorrectPalette" ); break; - case EMR_SETICMPROFILEA : WinMtfAssertHandler( "SetICMProfileA" ); break; - case EMR_SETICMPROFILEW : WinMtfAssertHandler( "SetICMProfileW" ); break; - case EMR_TRANSPARENTBLT : WinMtfAssertHandler( "TransparenBlt" ); break; - case EMR_TRANSPARENTDIB : WinMtfAssertHandler( "TransparenDib" ); break; - case EMR_GRADIENTFILL : WinMtfAssertHandler( "GradientFill" ); break; - case EMR_SETLINKEDUFIS : WinMtfAssertHandler( "SetLinkedUFIS" ); break; - - case EMR_SETMAPPERFLAGS : WinMtfAssertHandler( "SetMapperFlags", 0 ); break; - case EMR_SETICMMODE : WinMtfAssertHandler( "SetICMMode", 0 ); break; - case EMR_CREATEMONOBRUSH : WinMtfAssertHandler( "CreateMonoBrush", 0 ); break; - case EMR_SETBRUSHORGEX : WinMtfAssertHandler( "SetBrushOrgEx", 0 ); break; - case EMR_SETMETARGN : WinMtfAssertHandler( "SetMetArgn", 0 ); break; - case EMR_SETMITERLIMIT : WinMtfAssertHandler( "SetMiterLimit", 0 ); break; - case EMR_EXCLUDECLIPRECT : WinMtfAssertHandler( "ExcludeClipRect", 0 ); break; - case EMR_REALIZEPALETTE : WinMtfAssertHandler( "RealizePalette", 0 ); break; - case EMR_SELECTPALETTE : WinMtfAssertHandler( "SelectPalette", 0 ); break; - case EMR_CREATEPALETTE : WinMtfAssertHandler( "CreatePalette", 0 ); break; - case EMR_ALPHADIBBLEND : WinMtfAssertHandler( "AlphaDibBlend", 0 ); break; - case EMR_SETTEXTJUSTIFICATION : WinMtfAssertHandler( "SetTextJustification", 0 ); break; + default : SAL_INFO("vcl.emf", "Unknown Meta Action"); break; + case EMR_MASKBLT : SAL_INFO("vcl.emf", "not implemented '" << "MaskBlt" << "'"); break; + case EMR_PLGBLT : SAL_INFO("vcl.emf", "not implemented '" << "PlgBlt" << "'"); break; + case EMR_SETDIBITSTODEVICE : SAL_INFO("vcl.emf", "not implemented '" << "SetDIBitsToDevice" << "'"); break; + case EMR_FRAMERGN : SAL_INFO("vcl.emf", "not implemented '" << "FrameRgn" << "'"); break; + case EMR_INVERTRGN : SAL_INFO("vcl.emf", "not implemented '" << "InvertRgn" << "'"); break; + case EMR_PAINTRGN : SAL_INFO("vcl.emf", "not implemented '" << "PaintRgn" << "'"); break; + case EMR_FLATTENPATH : SAL_INFO("vcl.emf", "not implemented '" << "FlattenPath" << "'"); break; + case EMR_WIDENPATH : SAL_INFO("vcl.emf", "not implemented '" << "WidenPath" << "'"); break; + case EMR_POLYDRAW : SAL_INFO("vcl.emf", "not implemented '" << "Polydraw" << "'"); break; + case EMR_SETARCDIRECTION : SAL_INFO("vcl.emf", "not implemented '" << "SetArcDirection" << "'"); break; + case EMR_SETPALETTEENTRIES : SAL_INFO("vcl.emf", "not implemented '" << "SetPaletteEntries" << "'"); break; + case EMR_RESIZEPALETTE : SAL_INFO("vcl.emf", "not implemented '" << "ResizePalette" << "'"); break; + case EMR_EXTFLOODFILL : SAL_INFO("vcl.emf", "not implemented '" << "ExtFloodFill" << "'"); break; + case EMR_ANGLEARC : SAL_INFO("vcl.emf", "not implemented '" << "AngleArc" << "'"); break; + case EMR_SETCOLORADJUSTMENT : SAL_INFO("vcl.emf", "not implemented '" << "SetColorAdjustment" << "'"); break; + case EMR_POLYDRAW16 : SAL_INFO("vcl.emf", "not implemented '" << "PolyDraw16" << "'"); break; + case EMR_POLYTEXTOUTA : SAL_INFO("vcl.emf", "not implemented '" << "PolyTextOutA" << "'"); break; + case EMR_POLYTEXTOUTW : SAL_INFO("vcl.emf", "not implemented '" << "PolyTextOutW" << "'"); break; + case EMR_CREATECOLORSPACE : SAL_INFO("vcl.emf", "not implemented '" << "CreateColorSpace" << "'"); break; + case EMR_SETCOLORSPACE : SAL_INFO("vcl.emf", "not implemented '" << "SetColorSpace" << "'"); break; + case EMR_DELETECOLORSPACE : SAL_INFO("vcl.emf", "not implemented '" << "DeleteColorSpace" << "'"); break; + case EMR_GLSRECORD : SAL_INFO("vcl.emf", "not implemented '" << "GlsRecord" << "'"); break; + case EMR_GLSBOUNDEDRECORD : SAL_INFO("vcl.emf", "not implemented '" << "GlsBoundRecord" << "'"); break; + case EMR_PIXELFORMAT : SAL_INFO("vcl.emf", "not implemented '" << "PixelFormat" << "'"); break; + case EMR_DRAWESCAPE : SAL_INFO("vcl.emf", "not implemented '" << "DrawEscape" << "'"); break; + case EMR_EXTESCAPE : SAL_INFO("vcl.emf", "not implemented '" << "ExtEscape" << "'"); break; + case EMR_STARTDOC : SAL_INFO("vcl.emf", "not implemented '" << "StartDoc" << "'"); break; + case EMR_SMALLTEXTOUT : SAL_INFO("vcl.emf", "not implemented '" << "SmallTextOut" << "'"); break; + case EMR_FORCEUFIMAPPING : SAL_INFO("vcl.emf", "not implemented '" << "ForceUFIMapping" << "'"); break; + case EMR_NAMEDESCAPE : SAL_INFO("vcl.emf", "not implemented '" << "NamedEscape" << "'"); break; + case EMR_COLORCORRECTPALETTE : SAL_INFO("vcl.emf", "not implemented '" << "ColorCorrectPalette" << "'"); break; + case EMR_SETICMPROFILEA : SAL_INFO("vcl.emf", "not implemented '" << "SetICMProfileA" << "'"); break; + case EMR_SETICMPROFILEW : SAL_INFO("vcl.emf", "not implemented '" << "SetICMProfileW" << "'"); break; + case EMR_TRANSPARENTBLT : SAL_INFO("vcl.emf", "not implemented '" << "TransparenBlt" << "'"); break; + case EMR_TRANSPARENTDIB : SAL_INFO("vcl.emf", "not implemented '" << "TransparenDib" << "'"); break; + case EMR_GRADIENTFILL : SAL_INFO("vcl.emf", "not implemented '" << "GradientFill" << "'"); break; + case EMR_SETLINKEDUFIS : SAL_INFO("vcl.emf", "not implemented '" << "SetLinkedUFIS" << "'"); break; + + case EMR_SETMAPPERFLAGS : SAL_INFO("vcl.emf", "not implemented '" << "SetMapperFlags" << "'"); break; + case EMR_SETICMMODE : SAL_INFO("vcl.emf", "not implemented '" << "SetICMMode" << "'"); break; + case EMR_CREATEMONOBRUSH : SAL_INFO("vcl.emf", "not implemented '" << "CreateMonoBrush" << "'"); break; + case EMR_SETBRUSHORGEX : SAL_INFO("vcl.emf", "not implemented '" << "SetBrushOrgEx" << "'"); break; + case EMR_SETMETARGN : SAL_INFO("vcl.emf", "not implemented '" << "SetMetArgn" << "'"); break; + case EMR_SETMITERLIMIT : SAL_INFO("vcl.emf", "not implemented '" << "SetMiterLimit" << "'"); break; + case EMR_EXCLUDECLIPRECT : SAL_INFO("vcl.emf", "not implemented '" << "ExcludeClipRect" << "'"); break; + case EMR_REALIZEPALETTE : SAL_INFO("vcl.emf", "not implemented '" << "RealizePalette" << "'"); break; + case EMR_SELECTPALETTE : SAL_INFO("vcl.emf", "not implemented '" << "SelectPalette" << "'"); break; + case EMR_CREATEPALETTE : SAL_INFO("vcl.emf", "not implemented '" << "CreatePalette" << "'"); break; + case EMR_ALPHADIBBLEND : SAL_INFO("vcl.emf", "not implemented '" << "AlphaDibBlend" << "'"); break; + case EMR_SETTEXTJUSTIFICATION : SAL_INFO("vcl.emf", "not implemented '" << "SetTextJustification" << "'"); break; case EMR_GDICOMMENT : case EMR_HEADER : // has already been read at ReadHeader() diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index 9120b26..160416b 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -265,45 +265,11 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) }; -#ifdef WIN_MTF_ASSERT -void WinMtfAssertHandler( const sal_Char* pAction, sal_uInt32 nFlags ) -{ - static bool bOnlyOnce; - static sal_Int32 nAssertCount; - - if ( nFlags & WIN_MTF_ASSERT_INIT ) - nAssertCount = 0; - if ( nFlags & WIN_MTF_ASSERT_ONCE ) - bOnlyOnce = true; - if ( nFlags & WIN_MTF_ASSERT_MIFE ) - { - if ( ( nAssertCount == 0 ) || !bOnlyOnce ) - { - OStringBuffer aText("WMF/EMF Import: "); - if (pAction) - aText.append(pAction); - aText.append(" needs to be implemented"); - DBG_ASSERT( 0, aText.getStr() ); - } - nAssertCount++; - } -} -#endif - - WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, FilterConfigItem* pConfigItem ) : pOut ( pWinMtfOutput ), pWMF ( &rStreamWMF ), pFilterConfigItem ( pConfigItem ) { -#ifdef WIN_MTF_ASSERT - // we want to assert not implemented features, but we do this - // only once, so that nobody is handicapped by getting too many assertions - // I hope this will bring more testdocuments, without support of these - // testdocuments the implementation of missing features won't be possible. (SJ) - WinMtfAssertHandler( NULL, WIN_MTF_ASSERT_INIT | WIN_MTF_ASSERT_ONCE ); -#endif - SvLockBytes *pLB = pWMF->GetLockBytes(); if ( pLB ) pLB->SetSynchronMode( sal_True ); diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx index 46cc80a..9db9245 100644 --- a/vcl/source/filter/wmf/winmtf.hxx +++ b/vcl/source/filter/wmf/winmtf.hxx @@ -20,10 +20,6 @@ #ifndef INCLUDED_VCL_SOURCE_FILTER_WMF_WINMTF_HXX #define INCLUDED_VCL_SOURCE_FILTER_WMF_WINMTF_HXX -#ifdef DBG_UTIL -#define WIN_MTF_ASSERT -#endif - #include <sot/object.hxx> #include <boost/shared_ptr.hpp> #include <vcl/graph.hxx> @@ -287,16 +283,6 @@ struct WMF_EXTERNALHEADER; //============================ WMFReader ================================== -#ifdef WIN_MTF_ASSERT -#define WIN_MTF_ASSERT_INIT 0x80000000 -#define WIN_MTF_ASSERT_ONCE 0x40000000 -#define WIN_MTF_ASSERT_MIFE 0x20000000 - -void WinMtfAssertHandler( const sal_Char*, sal_uInt32 nFlags = WIN_MTF_ASSERT_MIFE ); -#else -inline void WinMtfAssertHandler( const sal_Char*, sal_uInt32 = 0 ) {} -#endif - class WinMtfClipPath { basegfx::tools::B2DClipState maClip; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
