diff options
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgstyleattributes.hxx | 12 | ||||
-rw-r--r-- | svgio/inc/svgtoken.hxx | 1 | ||||
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 17 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf159968.svg | 37 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 38 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtoken.cxx | 1 |
6 files changed, 105 insertions, 1 deletions
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 4516773e83..bf921f8b1b 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -170,6 +170,13 @@ namespace svgio::svgreader Central }; + enum class Overflow + { + notset, + hidden, + visible + }; + enum class Visibility { notset, @@ -207,6 +214,7 @@ namespace svgio::svgreader TextAnchor maTextAnchor; SvgPaint maColor; SvgNumber maOpacity; + Overflow maOverflow; Visibility maVisibility; OUString maTitle; OUString maDesc; @@ -410,6 +418,10 @@ namespace svgio::svgreader SvgNumber getOpacity() const; void setOpacity(const SvgNumber& rOpacity) { maOpacity = rOpacity; } + /// Overflow + Overflow getOverflow() const; + void setOverflow(const Overflow aOverflow) { maOverflow = aOverflow; } + /// Visibility Visibility getVisibility() const; void setVisibility(const Visibility aVisibility) { maVisibility = aVisibility; } diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx index 3927a27d1d..26a5d8f5f4 100644 --- a/svgio/inc/svgtoken.hxx +++ b/svgio/inc/svgtoken.hxx @@ -112,6 +112,7 @@ namespace svgio::svgreader Visibility, Title, Desc, + Overflow, // AspectRatio and params PreserveAspectRatio, diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 0ba32d8cb9..326e8f38ff 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -1950,6 +1950,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156271) assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "dx1"_ostr, "23"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159968) +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf159968.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence)); + + CPPUNIT_ASSERT (pDocument); + + // Check no mask is applied to the marker + assertXPath(pDocument, + "/primitive2D/transform/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000"); + assertXPath(pDocument, + "/primitive2D/transform/transform/transform/transform/polypolygoncolor/polypolygon/polygon/point"_ostr, 5); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149880) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg"); diff --git a/svgio/qa/cppunit/data/tdf159968.svg b/svgio/qa/cppunit/data/tdf159968.svg new file mode 100644 index 0000000000..8c13f08649 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf159968.svg @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> + +<svg + width="100mm" + height="100mm" + viewBox="0 0 100 100" + version="1.1" + id="svg1" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs + id="defs1"> + <marker + style="overflow:visible" + id="ArrowTriangleStylized" + refX="0" + refY="0" + orient="auto-start-reverse" + markerWidth="1" + markerHeight="1" + viewBox="0 0 1 1" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="m 6,0 c -3,1 -7,3 -9,5 0,0 0,-4 2,-5 -2,-1 -2,-5 -2,-5 2,2 6,4 9,5 z" + id="path4" /> + </marker> + </defs> + <g + id="layer1"> + <path + style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowTriangleStylized)" + d="M 9.7161802,91.253315 84.819628,15.230769" + id="path1"/> + </g> +</svg> diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 731df59aee..19070989bb 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -850,7 +850,8 @@ namespace svgio::svgreader const basegfx::B2DRange aTargetRange(0.0, 0.0, fTargetWidth, fTargetHeight); const SvgAspectRatio& rRatio = rMarker.getSvgAspectRatio(); - if(rRatio.isSet()) + + if(rRatio.isSet() && Overflow::visible != rMarker.getSvgStyleAttributes()->getOverflow()) { // let mapping be created from SvgAspectRatio rMarkerTransform = rRatio.createMapping(aTargetRange, aPrimitiveRange); @@ -1279,6 +1280,7 @@ namespace svgio::svgreader maTextAlign(TextAlign::notset), maTextDecoration(TextDecoration::notset), maTextAnchor(TextAnchor::notset), + maOverflow(Overflow::notset), maVisibility(Visibility::notset), maFillRule(FillRule::notset), maClipRule(FillRule::notset), @@ -1822,6 +1824,21 @@ namespace svgio::svgreader } break; } + case SVGToken::Overflow: + { + if(!aContent.isEmpty()) + { + if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"visible")) + { + setOverflow(Overflow::visible); + } + else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"hidden")) + { + setOverflow(Overflow::hidden); + } + } + break; + } case SVGToken::Visibility: { if(!aContent.isEmpty()) @@ -2316,6 +2333,25 @@ namespace svgio::svgreader return SvgNumber(1.0); } + Overflow SvgStyleAttributes::getOverflow() const + { + if(Overflow::notset != maOverflow) + { + return maOverflow; + } + + if(mrOwner.hasLocalCssStyle()) + { + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + if (pSvgStyleAttributes) + { + return pSvgStyleAttributes->getOverflow(); + } + } + + return Overflow::hidden; + } + Visibility SvgStyleAttributes::getVisibility() const { if(Visibility::notset == maVisibility || Visibility::inherit == maVisibility) diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index fa28c8647c..968ead0483 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -110,6 +110,7 @@ constexpr auto aSVGTokenMap = frozen::make_unordered_map<std::u16string_view, SV { u"visibility", SVGToken::Visibility }, { u"title", SVGToken::Title }, { u"desc", SVGToken::Desc }, + { u"overflow", SVGToken::Overflow }, { u"preserveAspectRatio", SVGToken::PreserveAspectRatio }, { u"defer", SVGToken::Defer }, { u"none", SVGToken::None }, |