summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-07-11 18:26:48 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-07-11 19:41:35 +0200
commit0613ce41da0b94bc481b94b8141afcf15df8abe7 (patch)
treebd47ff760a53dbf7a4d6f84fa52b328bb0036a80 /svgio
parente6b18c1d0f377e1295970b94bdf6b90739e13d4d (diff)
tdf#118232 Allow load and insert of SVGs with no Geometry
Change-Id: Iaf3d6a0423c5f11dda1e623dd730af01dbd6551c Reviewed-on: https://gerrit.libreoffice.org/57284 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index be2bc31ced09..ee8e81ee7dab 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -713,6 +713,23 @@ namespace svgio
}
}
}
+
+ if(aSequence.empty() && !getParent() && getViewBox())
+ {
+ // tdf#118232 No geometry, Outermost SVG element and we have a ViewBox.
+ // Create a HiddenGeometry Primitive containing an expanded
+ // hairline geometry to have the size contained
+ const drawinglayer::primitive2d::Primitive2DReference xLine(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ basegfx::utils::createPolygonFromRect(
+ *getViewBox()),
+ basegfx::BColor(0.0, 0.0, 0.0)));
+ const drawinglayer::primitive2d::Primitive2DReference xHidden(
+ new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(
+ drawinglayer::primitive2d::Primitive2DContainer { xLine }));
+
+ rTarget.push_back(xHidden);
+ }
}
const basegfx::B2DRange SvgSvgNode::getCurrentViewPort() const