From 83535a28c57ffb59f795dd35332d6b3426071e32 Mon Sep 17 00:00:00 2001 From: Armin Le Grand <Armin.Le.Grand@cib.de> Date: Fri, 9 Jun 2017 19:55:17 +0200 Subject: emfplus: create a wmf/emf/emf+ primitive based importer First steps to organize an importer that can read/interpret wmf/emf/emf+ and deliver a primitive representation for the content by parsing it. Use the same mechanisms as already applied for Svg, so to reuse abilities to keep original binary data to allow save again and embedding in files and have an implemented replacement bitmap based representation. For this, unify the used helper classes to handle more than just Svg. For 1st try, add test code and static bool switches Change-Id: I6e0a82943541d811a8f8d65a84115569fcd8cee7 --- drawinglayer/source/primitive2d/graphicprimitive2d.cxx | 2 +- .../source/primitive2d/graphicprimitivehelper2d.cxx | 18 +++++++++--------- drawinglayer/source/processor2d/vclprocessor2d.cxx | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drawinglayer/source') diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index d0935fcc676e..fc4629b4ee21 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -78,7 +78,7 @@ namespace drawinglayer const GraphicObject& rGraphicObject = getGraphicObject(); Graphic aTransformedGraphic(rGraphicObject.GetGraphic()); - const bool isBitmap(GraphicType::Bitmap == aTransformedGraphic.GetType() && !aTransformedGraphic.getSvgData().get()); + const bool isBitmap(GraphicType::Bitmap == aTransformedGraphic.GetType() && !aTransformedGraphic.getVectorGraphicData().get()); const bool isAdjusted(getGraphicAttr().IsAdjusted()); const bool isDrawMode(GraphicDrawMode::Standard != getGraphicAttr().GetDrawMode()); diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 98192700264d..f78b53b101be 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -473,31 +473,31 @@ namespace drawinglayer rGraphic, rTransform); } - else if(rGraphic.getSvgData().get()) + else if(rGraphic.getVectorGraphicData().get()) { - // embedded Svg fill, create embed transform - const basegfx::B2DRange& rSvgRange(rGraphic.getSvgData()->getRange()); + // embedded Vector Graphic Data fill, create embed transform + const basegfx::B2DRange& rSvgRange(rGraphic.getVectorGraphicData()->getRange()); if(basegfx::fTools::more(rSvgRange.getWidth(), 0.0) && basegfx::fTools::more(rSvgRange.getHeight(), 0.0)) { // translate back to origin, scale to unit coordinates - basegfx::B2DHomMatrix aEmbedSvg( + basegfx::B2DHomMatrix aEmbedVectorGraphic( basegfx::tools::createTranslateB2DHomMatrix( -rSvgRange.getMinX(), -rSvgRange.getMinY())); - aEmbedSvg.scale( + aEmbedVectorGraphic.scale( 1.0 / rSvgRange.getWidth(), 1.0 / rSvgRange.getHeight()); // apply created object transformation - aEmbedSvg = rTransform * aEmbedSvg; + aEmbedVectorGraphic = rTransform * aEmbedVectorGraphic; - // add Svg primitives embedded + // add Vector Graphic Data primitives embedded aRetval.resize(1); aRetval[0] = new TransformPrimitive2D( - aEmbedSvg, - rGraphic.getSvgData()->getPrimitive2DSequence()); + aEmbedVectorGraphic, + rGraphic.getVectorGraphicData()->getPrimitive2DSequence()); } } else diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index f5a8745c4c13..5af036d3cced 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -397,13 +397,13 @@ namespace drawinglayer { // content is bitmap(ex) // - // for SVG support, force decomposition when SVG is present. This will lead to use - // the primitive representation of the svg directly. + // for Vector Graphic Data (SVG, EMF+) support, force decomposition when present. This will lead to use + // the primitive representation of the vector data directly. // // when graphic is animated, force decomposition to use the correct graphic, else // fill style will not be animated if(GraphicType::Bitmap == rFillGraphicAttribute.getGraphic().GetType() - && !rFillGraphicAttribute.getGraphic().getSvgData().get() + && !rFillGraphicAttribute.getGraphic().getVectorGraphicData().get() && !rFillGraphicAttribute.getGraphic().IsAnimated()) { // decompose matrix to check for shear, rotate and mirroring -- cgit