[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-10-26 Thread Mike Kaganski (via logerrit)
 svgio/inc/svganode.hxx   |2 +-
 svgio/inc/svgcirclenode.hxx  |2 +-
 svgio/inc/svgclippathnode.hxx|2 +-
 svgio/inc/svgellipsenode.hxx |2 +-
 svgio/inc/svgfecolormatrixnode.hxx   |3 +--
 svgio/inc/svgfedropshadownode.hxx|3 +--
 svgio/inc/svgfefloodnode.hxx |3 +--
 svgio/inc/svgfegaussianblurnode.hxx  |3 +--
 svgio/inc/svgfeimagenode.hxx |3 +--
 svgio/inc/svgfeoffsetnode.hxx|3 +--
 svgio/inc/svggnode.hxx   |2 +-
 svgio/inc/svggradientnode.hxx|2 +-
 svgio/inc/svggradientstopnode.hxx|2 +-
 svgio/inc/svgimagenode.hxx   |2 +-
 svgio/inc/svglinenode.hxx|2 +-
 svgio/inc/svgmarkernode.hxx  |2 +-
 svgio/inc/svgmasknode.hxx|2 +-
 svgio/inc/svgnode.hxx|2 +-
 svgio/inc/svgpathnode.hxx|2 +-
 svgio/inc/svgpatternnode.hxx |2 +-
 svgio/inc/svgpolynode.hxx|2 +-
 svgio/inc/svgrectnode.hxx|2 +-
 svgio/inc/svgstylenode.hxx   |2 +-
 svgio/inc/svgsvgnode.hxx |2 +-
 svgio/inc/svgsymbolnode.hxx  |2 +-
 svgio/inc/svgtextnode.hxx|2 +-
 svgio/inc/svgtextpathnode.hxx|2 +-
 svgio/inc/svgtrefnode.hxx|2 +-
 svgio/inc/svgtspannode.hxx   |2 +-
 svgio/inc/svgusenode.hxx |2 +-
 svgio/source/svgreader/svganode.cxx  |4 ++--
 svgio/source/svgreader/svgcirclenode.cxx |4 ++--
 svgio/source/svgreader/svgclippathnode.cxx   |4 ++--
 svgio/source/svgreader/svgdocumenthandler.cxx|2 +-
 svgio/source/svgreader/svgellipsenode.cxx|4 ++--
 svgio/source/svgreader/svgfecolormatrixnode.cxx  |3 +--
 svgio/source/svgreader/svgfedropshadownode.cxx   |3 +--
 svgio/source/svgreader/svgfefloodnode.cxx|3 +--
 svgio/source/svgreader/svgfegaussianblurnode.cxx |3 +--
 svgio/source/svgreader/svgfeimagenode.cxx|3 +--
 svgio/source/svgreader/svgfeoffsetnode.cxx   |3 +--
 svgio/source/svgreader/svggnode.cxx  |4 ++--
 svgio/source/svgreader/svggradientnode.cxx   |4 ++--
 svgio/source/svgreader/svggradientstopnode.cxx   |4 ++--
 svgio/source/svgreader/svgimagenode.cxx  |4 ++--
 svgio/source/svgreader/svglinenode.cxx   |4 ++--
 svgio/source/svgreader/svgmarkernode.cxx |4 ++--
 svgio/source/svgreader/svgmasknode.cxx   |4 ++--
 svgio/source/svgreader/svgnode.cxx   |4 ++--
 svgio/source/svgreader/svgpathnode.cxx   |4 ++--
 svgio/source/svgreader/svgpatternnode.cxx|4 ++--
 svgio/source/svgreader/svgpolynode.cxx   |4 ++--
 svgio/source/svgreader/svgrectnode.cxx   |4 ++--
 svgio/source/svgreader/svgstylenode.cxx  |4 ++--
 svgio/source/svgreader/svgsvgnode.cxx|4 ++--
 svgio/source/svgreader/svgsymbolnode.cxx |4 ++--
 svgio/source/svgreader/svgtextnode.cxx   |4 ++--
 svgio/source/svgreader/svgtextpathnode.cxx   |4 ++--
 svgio/source/svgreader/svgtrefnode.cxx   |4 ++--
 svgio/source/svgreader/svgtspannode.cxx  |4 ++--
 svgio/source/svgreader/svgusenode.cxx|4 ++--
 61 files changed, 85 insertions(+), 97 deletions(-)

New commits:
commit 48ff87e100b7aa3a519937a73076f5c38cb919da
Author: Mike Kaganski 
AuthorDate: Thu Oct 26 12:10:14 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Oct 27 06:35:41 2023 +0200

Drop rTokenName argument from SvgNode::parseAttribute

It was never used.

Change-Id: I8bc7d625977a6cdc8fe6863037e72577dbfc46c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158493
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 1590421c5a11..34bc551a54dd 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -41,7 +41,7 @@ namespace svgio::svgreader
 virtual ~SvgANode() override;
 
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
-virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
+virtual void parseAttribute(SVGToken aSVGToken, const OUString& 
aContent) override;
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
 
 /// transform content
diff --git 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-10-26 Thread Mike Kaganski (via logerrit)
 svgio/inc/svgtoken.hxx  |2 
 svgio/source/svgreader/svgtoken.cxx |  206 ++--
 2 files changed, 18 insertions(+), 190 deletions(-)

New commits:
commit 009ea6f786e5a7fd1e08d768e33b5b7af30e5765
Author: Mike Kaganski 
AuthorDate: Fri Jul 7 12:46:24 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Oct 27 06:35:26 2023 +0200

Commit 04c78e1a46a423071d7ea68724525ec7ef92e0e8 follow-up

Drops duplicating map, and uses std::find_if with case-insensitive
comparison. Likely to have some performance impact, but avoids the
maintenance penalty of two maps.

Change-Id: I7144556488aa134d9b9214b00ba9d7c4e0fb68a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154159
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 3a4a89f285e2..3927a27d1db5 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -192,7 +192,7 @@ namespace svgio::svgreader
 DominantBaseline
 };
 
-SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent);
+SVGToken StrToSVGToken(std::u16string_view rStr, bool bIgnoreCase);
 OUString SVGTokenToStr(const SVGToken& rToken);
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index 492c78623f14..fa28c8647cea 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -21,11 +21,12 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace svgio::svgreader
 {
 
-constexpr auto aSVGTokenMapperList = 
frozen::make_unordered_map(
+constexpr auto aSVGTokenMap = frozen::make_unordered_map(
 {
 { u"width", SVGToken::Width },
 { u"height", SVGToken::Height },
@@ -181,203 +182,30 @@ constexpr auto aSVGTokenMapperList = 
frozen::make_unordered_map(
+SVGToken StrToSVGToken(std::u16string_view rStr, bool bIgnoreCase)
 {
-{ u"width", SVGToken::Width },
-{ u"height", SVGToken::Height },
-{ u"viewbox", SVGToken::ViewBox },
-{ u"transform", SVGToken::Transform },
-{ u"style", SVGToken::Style },
-{ u"display", SVGToken::Display }, // #i121656#
-{ u"d", SVGToken::D },
-{ u"x", SVGToken::X },
-{ u"y", SVGToken::Y },
-{ u"xmlns", SVGToken::Xmlns },
-{ u"version", SVGToken::Version },
-{ u"id", SVGToken::Id },
-{ u"in", SVGToken::In },
-{ u"rx", SVGToken::Rx },
-{ u"ry", SVGToken::Ry },
-{ u"points", SVGToken::Points },
-{ u"dx", SVGToken::Dx },
-{ u"dy", SVGToken::Dy },
-{ u"rotate", SVGToken::Rotate },
-{ u"textlength", SVGToken::TextLength },
-{ u"lengthadjust", SVGToken::LengthAdjust },
-{ u"font", SVGToken::Font },
-{ u"font-family", SVGToken::FontFamily },
-{ u"font-size", SVGToken::FontSize },
-{ u"font-size-adjust", SVGToken::FontSizeAdjust },
-{ u"font-stretch", SVGToken::FontStretch },
-{ u"font-style", SVGToken::FontStyle },
-{ u"font-variant", SVGToken::FontVariant },
-{ u"font-weight", SVGToken::FontWeight },
-{ u"direction", SVGToken::Direction },
-{ u"letter-spacing", SVGToken::LetterSpacing },
-{ u"text-decoration", SVGToken::TextDecoration },
-{ u"unicode-bidi", SVGToken::UnicodeBidi },
-{ u"word-spacing", SVGToken::WordSpacing },
-{ u"tspan", SVGToken::Tspan },
-{ u"tref", SVGToken::Tref },
-{ u"textpath", SVGToken::TextPath },
-{ u"startoffset", SVGToken::StartOffset },
-{ u"method", SVGToken::Method },
-{ u"spacing", SVGToken::Spacing },
-{ u"stddeviation", SVGToken::StdDeviation },
-{ u"text-align", SVGToken::TextAlign },
-{ u"pathlength", SVGToken::PathLength },
-{ u"type", SVGToken::Type },
-{ u"class", SVGToken::Class },
-{ u"text-anchor", SVGToken::TextAnchor },
-{ u"xml:space", SVGToken::XmlSpace },
-{ u"color", SVGToken::Color },
-{ u"clippath", SVGToken::ClipPathNode },
-{ u"clip-path", SVGToken::ClipPathProperty },
-{ u"fecolormatrix", SVGToken::FeColorMatrix },
-{ u"fedropshadow", SVGToken::FeDropShadow },
-{ u"feflood", SVGToken::FeFlood },
-{ u"feimage", SVGToken::FeImage },
-{ u"fegaussianblur", SVGToken::FeGaussianBlur },
-{ u"feoffset", SVGToken::FeOffset },
-{ u"filter", SVGToken::Filter },
-{ u"flood-color", SVGToken::FloodColor },
-{ u"flood-opacity", SVGToken::FloodOpacity },
-{ u"mask", SVGToken::Mask },
-{ u"clippathunits", SVGToken::ClipPathUnits },
-{ u"maskunits", SVGToken::MaskUnits },
-{ u"maskcontentunits", SVGToken::MaskContentUnits },
-{ u"clip-rule", SVGToken::ClipRule },
-{ u"marker", SVGToken::Marker },
-{ u"marker-start", SVGToken::MarkerStart },
-{ u"marker-mid", SVGToken::MarkerMid },
-{ u"marker-end", SVGToken::MarkerEnd },
-{ u"refx", SVGToken::RefX },
-{ u"refy", SVGToken::RefY },
-{ u"markerunits", SVGToken::MarkerUnits },
-{ u"markerwidth", 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-22 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx   |2 -
 svgio/qa/cppunit/SvgImportTest.cxx  |   23 
 svgio/qa/cppunit/data/tdf129356.svg |   34 ++
 svgio/source/svgreader/svgnode.cxx  |   68 +++-
 4 files changed, 80 insertions(+), 47 deletions(-)

New commits:
commit b2247336409b7b3b0ae04356a167dcd204badb04
Author: Xisco Fauli 
AuthorDate: Tue Aug 22 12:46:02 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 22 20:06:24 2023 +0200

tdf#129356: handle css combinator when the element name is combined...

... with the ID or the class

While at it, simplify the code a bit

Change-Id: I9e36f334b884d31229568835a346d4427a47c760
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155945
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 0d8008d41c90..96c6ade01efa 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -125,7 +125,7 @@ namespace svgio::svgreader
 const OUString& aConcatenated);
 void fillCssStyleVectorUsingHierarchyAndSelectors(
 const SvgNode& rCurrent,
-const OUString& aConcatenated);
+std::u16string_view aConcatenated);
 void fillCssStyleVectorUsingParent(
 const SvgNode& rCurrent);
 
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 4d7cd9772d51..0450d3617e11 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -441,6 +441,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156168)
 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line", 
"color", "#00ff00");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf129356)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf129356.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed with
+// - Expected: #008000
+// - Actual  : #ff
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", 
"color", "#008000");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf156034)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156034.svg");
diff --git a/svgio/qa/cppunit/data/tdf129356.svg 
b/svgio/qa/cppunit/data/tdf129356.svg
new file mode 100644
index ..46bd6935daa4
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf129356.svg
@@ -0,0 +1,34 @@
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 800 800">
+
+
+g.g1 rect {fill:green;}
+g#g3 rect {fill:green;}
+g.g4 #r1 {fill:green;}
+g#g3 .r5 {fill:green;}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 4f82a16ebf1e..fd80337eb5b6 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -94,7 +94,7 @@ namespace {
 
 void SvgNode::fillCssStyleVectorUsingHierarchyAndSelectors(
 const SvgNode& rCurrent,
-const OUString& aConcatenated)
+std::u16string_view aConcatenated)
 {
 const SvgDocument& rDocument = getDocument();
 
@@ -102,6 +102,7 @@ namespace {
 return;
 
 const SvgNode* pParent = rCurrent.getParent();
+OUString sCurrentType(SVGTokenToStr(rCurrent.getType()));
 
 // check for ID (highest priority)
 if(rCurrent.getId())
@@ -110,21 +111,17 @@ namespace {
 
 if(rId.getLength())
 {
-const OUString aNewConcatenated(
-"#" + rId + aConcatenated);
+const OUString aNewConcatenated("#" + rId + aConcatenated);
+addCssStyle(rDocument, aNewConcatenated);
+
+

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-21 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx  |   13 +++
 svgio/inc/svgtoken.hxx|3 +
 svgio/qa/cppunit/SvgImportTest.cxx|   24 ++
 svgio/qa/cppunit/data/tdf156834.svg   |7 
 svgio/source/svgreader/svgcharacternode.cxx   |   24 ++
 svgio/source/svgreader/svgstyleattributes.cxx |   43 +-
 svgio/source/svgreader/svgtoken.cxx   |6 ++-
 7 files changed, 116 insertions(+), 4 deletions(-)

New commits:
commit 8fa209ce2e800dc8a51e941cd42a65fa8b2eb14b
Author: Xisco Fauli 
AuthorDate: Mon Aug 21 12:35:49 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 21 19:59:27 2023 +0200

tdf#156834: Add basic support for dominant-baseline attribute

Change-Id: I005d6ca6bc340d73cae639ccd09321a0a00bc4b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155892
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 751ee6014e41..60781942667b 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -162,6 +162,13 @@ namespace svgio::svgreader
 Length
 };
 
+enum class DominantBaseline
+{
+Auto,
+Middle,
+Hanging
+};
+
 enum class Visibility
 {
 notset,
@@ -223,6 +230,8 @@ namespace svgio::svgreader
 BaselineShift   maBaselineShift;
 SvgNumber   maBaselineShiftNumber;
 
+DominantBaselinemaDominantBaseline;
+
 mutable std::vector maResolvingParent;
 
 // defines if this attributes are part of a ClipPath. If yes,
@@ -438,6 +447,10 @@ namespace svgio::svgreader
 void setBaselineShift(const BaselineShift aBaselineShift) { 
maBaselineShift = aBaselineShift; }
 BaselineShift getBaselineShift() const;
 SvgNumber getBaselineShiftNumber() const;
+
+// DominantBaseline
+void setDominantBaseline(const DominantBaseline aDominantBaseline) 
{ maDominantBaseline = aDominantBaseline; }
+DominantBaseline getDominantBaseline() const;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 6c1a17692f22..3a4a89f285e2 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -188,7 +188,8 @@ namespace svgio::svgreader
 
 // text tokens
 Text,
-BaselineShift
+BaselineShift,
+DominantBaseline
 };
 
 SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent);
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 95cbc0bcda6a..4d7cd9772d51 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -731,6 +731,30 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156777)
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 
"23");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156834)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156834.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 3);
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"text", "Auto");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 
"20");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "Middle");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 
"56");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"text", "Hanging");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", 
"94");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf104339)
 {
 Primitive2DSequence aSequenceTdf104339 = 
parseSvg(u"/svgio/qa/cppunit/data/tdf104339.svg");
diff --git a/svgio/qa/cppunit/data/tdf156834.svg 
b/svgio/qa/cppunit/data/tdf156834.svg
new file mode 100644
index ..74dc1548186e
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156834.svg
@@ -0,0 +1,7 @@
+http://www.w3.org/2000/svg;>
+  
+
+  Auto
+  Middle
+  Hanging
+
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 9b9e87d23dca..0199a1ff9105 100644
--- 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-21 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx  |2 +-
 svgio/qa/cppunit/SvgImportTest.cxx|   25 +
 svgio/qa/cppunit/data/tdf156837.svg   |   13 +
 svgio/source/svgreader/svgstyleattributes.cxx |   22 +-
 4 files changed, 60 insertions(+), 2 deletions(-)

New commits:
commit 56a360328790eb009efed6fce94a795f6fe0a7d2
Author: Xisco Fauli 
AuthorDate: Mon Aug 21 14:15:56 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 21 15:49:15 2023 +0200

tdf#156837: check baseline-shift from parent too

Change-Id: I6e62d794dd4410447db3bee26c1e18fe9dad6a9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155895
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 4ada2e687ee9..751ee6014e41 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -436,7 +436,7 @@ namespace svgio::svgreader
 
 // BaselineShift
 void setBaselineShift(const BaselineShift aBaselineShift) { 
maBaselineShift = aBaselineShift; }
-BaselineShift getBaselineShift() const { return maBaselineShift; }
+BaselineShift getBaselineShift() const;
 SvgNumber getBaselineShiftNumber() const;
 };
 
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 2297367ee778..95cbc0bcda6a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1740,6 +1740,31 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156283)
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"dx2", "63");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156837)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156837.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 2);
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 
"114");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 
"103");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"text", "x");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 
"122");
+
+// Without the fix in place, this test would have failed with
+// - Expected: 94
+// - Actual  : 103
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 
"94");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"height", "10");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "3");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156271.svg");
diff --git a/svgio/qa/cppunit/data/tdf156837.svg 
b/svgio/qa/cppunit/data/tdf156837.svg
new file mode 100644
index ..f04cb015d313
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156837.svg
@@ -0,0 +1,13 @@
+http://www.w3.org/2000/svg;>
+
+
+.super{
+   font-size: 65%;
+}
+
+
+  
+  x 
+  3
+  
+
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index fd4482057f17..68e8b59d76c2 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1285,7 +1285,7 @@ namespace svgio::svgreader
 maClipRule(FillRule::notset),
 maBaselineShift(BaselineShift::Baseline),
 maBaselineShiftNumber(0),
-maResolvingParent(29, 0),
+maResolvingParent(30, 0),
 mbIsClipPathContent(SVGToken::ClipPathNode == mrOwner.getType()),
 mbStrokeDasharraySet(false)
 {
@@ -3062,6 +3062,26 @@ namespace svgio::svgreader
 
 return maBaselineShiftNumber;
 }
+
+BaselineShift SvgStyleAttributes::getBaselineShift() const
+{
+if(maBaselineShift != BaselineShift::Baseline)
+{
+return maBaselineShift;
+}
+
+const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+if (pSvgStyleAttributes && maResolvingParent[29] < 
nStyleDepthLimit)
+{
+++maResolvingParent[29];
+auto ret = pSvgStyleAttributes->getBaselineShift();
+--maResolvingParent[29];
+return ret;
+}
+
+return BaselineShift::Baseline;
+}
 } // end of namespace svgio
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-08-16 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtspannode.hxx  |2 +-
 svgio/source/svgreader/svgcharacternode.cxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 8da4e517266e74d8b0e2cda02416263d8dd6f6bd
Author: Xisco Fauli 
AuthorDate: Wed Aug 16 11:16:21 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Aug 16 12:22:13 2023 +0200

svgio: fix typo in code

Change-Id: Ice8e830cebf307b6a4deb9dbbd26e65b34420a31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155734
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx
index 991b0ac451f6..d5aa40471d28 100644
--- a/svgio/inc/svgtspannode.hxx
+++ b/svgio/inc/svgtspannode.hxx
@@ -84,7 +84,7 @@ namespace svgio::svgreader
 void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
 
 void concatenateTextLineWidth(double nWidth) {mnTextLineWidth += 
nWidth;}
-double getTextLineWith() const { return mnTextLineWidth; }
+double getTextLineWidth() const { return mnTextLineWidth; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 91ec98ae9b68..9b9e87d23dca 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -261,12 +261,12 @@ namespace svgio::svgreader
 {
 case TextAlign::right:
 {
-aPosition.setX(aPosition.getX() - 
mpParentLine->getTextLineWith());
+aPosition.setX(aPosition.getX() - 
mpParentLine->getTextLineWidth());
 break;
 }
 case TextAlign::center:
 {
-aPosition.setX(aPosition.getX() - 
(mpParentLine->getTextLineWith() * 0.5));
+aPosition.setX(aPosition.getX() - 
(mpParentLine->getTextLineWidth() * 0.5));
 break;
 }
 case TextAlign::notset:


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-12 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|4 +-
 svgio/inc/svgtextnode.hxx |7 
 svgio/inc/svgtspannode.hxx|7 
 svgio/qa/cppunit/SvgImportTest.cxx|   38 ++
 svgio/qa/cppunit/data/tdf156616.svg   |   29 +++
 svgio/source/svgreader/svgcharacternode.cxx   |8 -
 svgio/source/svgreader/svgdocumenthandler.cxx |   22 +++
 7 files changed, 99 insertions(+), 16 deletions(-)

New commits:
commit dcb3cb0bd4e4bf2bed05ae3b9d370e17a331a9b1
Author: Xisco Fauli 
AuthorDate: Sat Aug 12 02:28:02 2023 +0200
Commit: Xisco Fauli 
CommitDate: Sat Aug 12 10:00:29 2023 +0200

tdf#156616: check if character's parent has x or y

if so, only concatenate the characters that are in the same line
so the alignment will be calculated based on the
line's width

Change-Id: I704370c0a470f8b4cff97c51ad9863158118ee8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155636
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 391c4029e46c..059aa9ece1fd 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -40,7 +40,7 @@ namespace svgio::svgreader
 // keep a copy of string data before space handling
 OUString   maTextBeforeSpaceHandling;
 
-SvgTextNode*mpTextParent;
+SvgTspanNode*mpParentLine;
 
 /// local helpers
 rtl::Reference 
createSimpleTextPrimitive(
@@ -68,7 +68,7 @@ namespace svgio::svgreader
 /// Text content
 const OUString& getText() const { return maText; }
 
-void setTextParent(SvgTextNode* pTextParent) { mpTextParent = 
pTextParent; }
+void setParentLine(SvgTspanNode* pParentLine) { mpParentLine = 
pParentLine; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index 2d5f98ec18fc..787687977e11 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -33,10 +33,6 @@ namespace svgio::svgreader
 std::optional
 mpaTransform;
 
-// The text line composed by the different SvgCharacterNode 
children
-// it will be used to calculate their alignment
-OUString maTextLine;
-
 /// local helpers
 void DecomposeChild(
 const SvgNode& rCandidate,
@@ -59,9 +55,6 @@ namespace svgio::svgreader
 /// transform content, set if found in current context
 const std::optional& getTransform() const { 
return mpaTransform; }
 void setTransform(const std::optional& 
pMatrix) { mpaTransform = pMatrix; }
-
-void concatenateTextLine(std::u16string_view rText) {maTextLine += 
rText;}
-const OUString& getTextLine() const { return maTextLine; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx
index d5d86c5a7c1a..92ed8319c628 100644
--- a/svgio/inc/svgtspannode.hxx
+++ b/svgio/inc/svgtspannode.hxx
@@ -39,6 +39,10 @@ namespace svgio::svgreader
 
 boolmbLengthAdjust : 1; // true = spacing, 
false = spacingAndGlyphs
 
+// The text line composed by the different SvgCharacterNode 
children
+// it will be used to calculate their alignment
+OUString maTextLine;
+
 public:
 SvgTspanNode(
 SVGToken aType,
@@ -78,6 +82,9 @@ namespace svgio::svgreader
 /// LengthAdjust content
 bool getLengthAdjust() const { return mbLengthAdjust; }
 void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
+
+void concatenateTextLine(std::u16string_view rText) {maTextLine += 
rText;}
+const OUString& getTextLine() const { return maTextLine; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index cf66e5bb623f..d97892f8d98f 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -744,7 +744,45 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770)
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"text", " End");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"height", "11");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"familyname", "Times New Roman");
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf156616)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156616.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-08-10 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|9 --
 svgio/inc/svgtextnode.hxx |7 +
 svgio/source/svgreader/svgcharacternode.cxx   |2 
 svgio/source/svgreader/svgdocumenthandler.cxx |   93 +-
 4 files changed, 17 insertions(+), 94 deletions(-)

New commits:
commit ad3d6732dc8905b1660fa25147a00024b0ac0cd0
Author: Xisco Fauli 
AuthorDate: Thu Aug 10 14:54:15 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 10 16:52:32 2023 +0200

related: tdf#151103: simplify code

Keep the text line in the SvgTextNode and not in each
SvgCharacterNode

Change-Id: Ia33e46cc974a39a915e7b97b4c529e6eeca5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/18
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 007f9028e80b..391c4029e46c 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -24,7 +24,7 @@
 
 #include 
 
-#include "svgnode.hxx"
+#include "svgtextnode.hxx"
 #include "svgtextposition.hxx"
 
 namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
@@ -40,8 +40,7 @@ namespace svgio::svgreader
 // keep a copy of string data before space handling
 OUString   maTextBeforeSpaceHandling;
 
-// The whole text line of which this SvgCharacterNode is parted of
-OUString   maWholeTextLine;
+SvgTextNode*mpTextParent;
 
 /// local helpers
 rtl::Reference 
createSimpleTextPrimitive(
@@ -69,9 +68,7 @@ namespace svgio::svgreader
 /// Text content
 const OUString& getText() const { return maText; }
 
-void setWholeTextLine(const OUString& rWholeTextLine) { 
maWholeTextLine = rWholeTextLine; }
-
-const OUString& getWholeTextLine() const { return maWholeTextLine; 
}
+void setTextParent(SvgTextNode* pTextParent) { mpTextParent = 
pTextParent; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index 787687977e11..2d5f98ec18fc 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -33,6 +33,10 @@ namespace svgio::svgreader
 std::optional
 mpaTransform;
 
+// The text line composed by the different SvgCharacterNode 
children
+// it will be used to calculate their alignment
+OUString maTextLine;
+
 /// local helpers
 void DecomposeChild(
 const SvgNode& rCandidate,
@@ -55,6 +59,9 @@ namespace svgio::svgreader
 /// transform content, set if found in current context
 const std::optional& getTransform() const { 
return mpaTransform; }
 void setTransform(const std::optional& 
pMatrix) { mpaTransform = pMatrix; }
+
+void concatenateTextLine(std::u16string_view rText) {maTextLine += 
rText;}
+const OUString& getTextLine() const { return maTextLine; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 2c3fce247554..6150fbb62953 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -250,7 +250,7 @@ namespace svgio::svgreader
 }
 
 // Use the whole text line to calculate the align position
-double 
fWholeTextLineWidth(aTextLayouterDevice.getTextWidth(getWholeTextLine(), 0, 
getWholeTextLine().getLength()));
+double 
fWholeTextLineWidth(aTextLayouterDevice.getTextWidth(mpTextParent->getTextLine(),
 0, mpTextParent->getTextLine().getLength()));
 // apply TextAlign
 switch(aTextAlign)
 {
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 793539de0602..16f100e0b01e 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -62,7 +62,7 @@ namespace svgio::svgreader
 
 namespace
 {
-svgio::svgreader::SvgCharacterNode* 
whiteSpaceHandling(svgio::svgreader::SvgNode const * pNode, 
svgio::svgreader::SvgCharacterNode* pLast)
+svgio::svgreader::SvgCharacterNode* 
whiteSpaceHandling(svgio::svgreader::SvgNode const * pNode, 
svgio::svgreader::SvgTextNode* pText, svgio::svgreader::SvgCharacterNode* pLast)
 {
 if(pNode)
 {
@@ -84,6 +84,9 @@ namespace
 
 pCharNode->whiteSpaceHandling();
 pLast = pCharNode->addGap(pLast);
+
+pCharNode->setTextParent(pText);
+pText->concatenateTextLine(pCharNode->getText());
 break;
 

[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/source

2023-08-10 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk  |1 
 svgio/inc/svgcharacternode.hxx  |   43 --
 svgio/inc/svgtextnode.hxx   |2 
 svgio/inc/svgtextposition.hxx   |   72 ++
 svgio/source/svgreader/svgcharacternode.cxx |  171 ---
 svgio/source/svgreader/svgtextposition.cxx  |  200 
 6 files changed, 275 insertions(+), 214 deletions(-)

New commits:
commit fff601edf76b1783c5a47353452a83ac9c5ac07a
Author: Xisco Fauli 
AuthorDate: Thu Aug 10 14:39:27 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 10 16:34:54 2023 +0200

svgio: move SvgTextPosition to its own file

In order to avoid a circular dependency in a follow-up commit

Change-Id: Ib7b16e73282dfa6f3ca87aab1044cb92df72b6bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/15
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index c25077ed94d3..edd83ed57251 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgsvgnode \
 svgio/source/svgreader/svgsymbolnode \
 svgio/source/svgreader/svgtextnode \
+svgio/source/svgreader/svgtextposition \
 svgio/source/svgreader/svgtitledescnode \
 svgio/source/svgreader/svgtoken \
 svgio/source/svgreader/svgtrefnode \
diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index e0e353a429a7..007f9028e80b 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -25,53 +25,12 @@
 #include 
 
 #include "svgnode.hxx"
-#include "svgtspannode.hxx"
+#include "svgtextposition.hxx"
 
 namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
 
 namespace svgio::svgreader
 {
-class SvgTextPosition
-{
-private:
-SvgTextPosition*mpParent;
-::std::vector< double > maX;
-::std::vector< double > maY;
-::std::vector< double > maDx;
-::std::vector< double > maRotate;
-double  mfTextLength;
-
-// absolute, current, advancing position
-basegfx::B2DPoint   maPosition;
-
-// advancing rotation index
-sal_uInt32  mnRotationIndex;
-
-boolmbLengthAdjust : 1; // true = spacing, 
false = spacingAndGlyphs
-boolmbAbsoluteX : 1;
-
-public:
-SvgTextPosition(
-SvgTextPosition* pParent,
-const SvgTspanNode& rSvgCharacterNode);
-
-// data read access
-const SvgTextPosition* getParent() const { return mpParent; }
-const ::std::vector< double >& getX() const { return maX; }
-const ::std::vector< double >& getDx() const { return maDx; }
-double getTextLength() const { return mfTextLength; }
-bool getLengthAdjust() const { return mbLengthAdjust; }
-bool getAbsoluteX() const { return mbAbsoluteX; }
-
-// get/set absolute, current, advancing position
-const basegfx::B2DPoint& getPosition() const { return maPosition; }
-void setPosition(const basegfx::B2DPoint& rNew) { maPosition = 
rNew; }
-
-// rotation handling
-bool isRotated() const;
-double consumeRotation();
-};
-
 class SvgCharacterNode final : public SvgNode
 {
 private:
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index da6f0e5cbcb2..787687977e11 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -20,7 +20,7 @@
 #pragma once
 
 #include "svgstyleattributes.hxx"
-#include "svgcharacternode.hxx"
+#include "svgtextposition.hxx"
 #include "svgtspannode.hxx"
 #include 
 
diff --git a/svgio/inc/svgtextposition.hxx b/svgio/inc/svgtextposition.hxx
new file mode 100644
index ..df6adc16ab1e
--- /dev/null
+++ b/svgio/inc/svgtextposition.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-08-09 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|   51 --
 svgio/inc/svgtextnode.hxx |9 -
 svgio/inc/svgtspannode.hxx|   44 +++-
 svgio/source/svgreader/svgcharacternode.cxx   |  132 +++---
 svgio/source/svgreader/svgdocumenthandler.cxx |2 
 svgio/source/svgreader/svgtextnode.cxx|   25 
 svgio/source/svgreader/svgtspannode.cxx   |   85 +++-
 7 files changed, 148 insertions(+), 200 deletions(-)

New commits:
commit 1e4d10dcfbeeeb997bf93145da2326514ffcfad3
Author: Xisco Fauli 
AuthorDate: Wed Aug 9 11:47:37 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Aug 9 20:20:58 2023 +0200

svgio: get rid of SvgTextPositions

and make SvgText inherit from SvgTspan

Change-Id: Ief25e52ba2a493936f82f1674f73168ed5647278
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155521
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index c74f881df468..f44d7547b4ca 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -25,57 +25,12 @@
 #include 
 
 #include "svgnode.hxx"
+#include "svgtspannode.hxx"
 
 namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
 
 namespace svgio::svgreader
 {
-class SvgTextPositions
-{
-private:
-SvgNumberVector maX;
-SvgNumberVector maY;
-SvgNumberVector maDx;
-SvgNumberVector maDy;
-SvgNumberVector maRotate;
-SvgNumber   maTextLength;
-
-boolmbLengthAdjust : 1; // true = spacing, 
false = spacingAndGlyphs
-
-public:
-SvgTextPositions();
-
-void parseTextPositionAttributes(SVGToken aSVGToken, 
std::u16string_view aContent);
-
-/// X content
-const SvgNumberVector& getX() const { return maX; }
-void setX(SvgNumberVector&& aX) { maX = std::move(aX); }
-
-/// Y content
-const SvgNumberVector& getY() const { return maY; }
-void setY(SvgNumberVector&& aY) { maY = std::move(aY); }
-
-/// Dx content
-const SvgNumberVector& getDx() const { return maDx; }
-void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); }
-
-/// Dy content
-const SvgNumberVector& getDy() const { return maDy; }
-void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); }
-
-/// Rotate content
-const SvgNumberVector& getRotate() const { return maRotate; }
-void setRotate(SvgNumberVector&& aRotate) { maRotate = 
std::move(aRotate); }
-
-/// TextLength content
-const SvgNumber& getTextLength() const { return maTextLength; }
-void setTextLength(const SvgNumber& rTextLength) { maTextLength = 
rTextLength; }
-
-/// LengthAdjust content
-bool getLengthAdjust() const { return mbLengthAdjust; }
-void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
-};
-
 class SvgTextPosition
 {
 private:
@@ -98,8 +53,7 @@ namespace svgio::svgreader
 public:
 SvgTextPosition(
 SvgTextPosition* pParent,
-const InfoProvider& rInfoProvider,
-const SvgTextPositions& rSvgTextPositions);
+const SvgTspanNode& rSvgCharacterNode);
 
 // data read access
 const SvgTextPosition* getParent() const { return mpParent; }
@@ -147,6 +101,7 @@ namespace svgio::svgreader
 virtual ~SvgCharacterNode() override;
 
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
+
 void 
decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, 
SvgTextPosition& rSvgTextPosition) const;
 void whiteSpaceHandling();
 void addGap();
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index 0cc78f130aed..da6f0e5cbcb2 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -19,23 +19,19 @@
 
 #pragma once
 
-#include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
 #include "svgcharacternode.hxx"
+#include "svgtspannode.hxx"
 #include 
 
 namespace svgio::svgreader
 {
-class SvgTextNode final : public SvgNode
+class SvgTextNode final : public SvgTspanNode
 {
 private:
-/// use styles
-SvgStyleAttributes  maSvgStyleAttributes;
-
 /// variable scan values, dependent of given XAttributeList
 std::optional
 mpaTransform;
-SvgTextPositionsmaSvgTextPositions;
 
 /// local helpers
 void DecomposeChild(
@@ -53,7 +49,6 @@ namespace 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-08-03 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgdocumenthandler.hxx  |2 --
 svgio/inc/svgtoken.hxx|4 +---
 svgio/source/svgreader/svgdocumenthandler.cxx |   19 +--
 svgio/source/svgreader/svgtoken.cxx   |6 ++
 4 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 2f17ce9ac89c1ad380bde39036000a1979f567bb
Author: Xisco Fauli 
AuthorDate: Thu Aug 3 18:55:50 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 3 22:48:03 2023 +0200

Revert "fdo#50114 ingore flowRoot element during svg import"

This commit reverts 5bd241b99b76ae7f4b3c1d4f2bcbaf7c487bb339
which is no longer needed after
13a41e7a12598c7896d6dc8d34aba6af5b80b83c
"tdf#150124: do nothing when parent is of unkown type"

and might cause unexpected results as seen with
https://bugs.documentfoundation.org/attachment.cgi?id=124782
from https://bugs.documentfoundation.org/show_bug.cgi?id=99628

Change-Id: I8bb700f5c5553700f91b937330bc3730e8ea84c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155320
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgdocumenthandler.hxx b/svgio/inc/svgdocumenthandler.hxx
index a13284340a38..8511a0adfbcc 100644
--- a/svgio/inc/svgdocumenthandler.hxx
+++ b/svgio/inc/svgdocumenthandler.hxx
@@ -40,8 +40,6 @@ namespace svgio::svgreader
 // text collector string stack for css styles
 std::vector< OUString >maCssContents;
 
-boolbSkip;
-
 public:
 SvgDocHdl(const OUString& rAbsolutePath);
 virtual ~SvgDocHdl() override;
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 175297fa67e5..6c1a17692f22 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -188,9 +188,7 @@ namespace svgio::svgreader
 
 // text tokens
 Text,
-BaselineShift,
-
-FlowRoot
+BaselineShift
 };
 
 SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent);
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 4eafc9e9639a..6bb27cd2a52d 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -230,8 +230,7 @@ namespace
 
 SvgDocHdl::SvgDocHdl(const OUString& aAbsolutePath)
 :   maDocument(aAbsolutePath),
-mpTarget(nullptr),
-bSkip(false)
+mpTarget(nullptr)
 {
 }
 
@@ -266,8 +265,6 @@ namespace
 
 void SvgDocHdl::startElement( const OUString& aName, const 
uno::Reference< xml::sax::XAttributeList >& xAttribs )
 {
-if (bSkip)
-return;
 if(aName.isEmpty())
 return;
 
@@ -533,13 +530,6 @@ namespace
 break;
 }
 
-// ignore FlowRoot and child nodes
-case SVGToken::FlowRoot:
-{
-bSkip = true;
-break;
-}
-
 default:
 {
 mpTarget = new SvgNode(SVGToken::Unknown, maDocument, 
mpTarget);
@@ -558,13 +548,6 @@ namespace
 SvgStyleNode* pCssStyle(SVGToken::Style == aSVGToken ? 
static_cast< SvgStyleNode* >(mpTarget) : nullptr);
 SvgTitleDescNode* pSvgTitleDescNode(SVGToken::Title == aSVGToken 
|| SVGToken::Desc == aSVGToken ? static_cast< SvgTitleDescNode* >(mpTarget) : 
nullptr);
 
-// if we are in skipping mode and we reach the flowRoot end tag: 
stop skipping mode
-if(bSkip && aSVGToken == SVGToken::FlowRoot)
-bSkip = false;
-// we are in skipping mode: do nothing until we found the flowRoot 
end tag
-else if(bSkip)
-return;
-
 switch (aSVGToken)
 {
 /// valid tokens for which a new one was created
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index 24e24a5a31f7..961c4ec3b5a4 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -177,8 +177,7 @@ constexpr auto aSVGTokenMapperList = 
frozen::make_unordered_map

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-03 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|7 ++
 svgio/qa/cppunit/SvgImportTest.cxx|   86 
 svgio/qa/cppunit/data/tdf151103.svg   |   18 +
 svgio/source/svgreader/svgcharacternode.cxx   |6 +
 svgio/source/svgreader/svgdocumenthandler.cxx |   91 +-
 5 files changed, 203 insertions(+), 5 deletions(-)

New commits:
commit 2795a230464aea3a792e67b5625fce2a0c01d547
Author: Xisco Fauli 
AuthorDate: Thu Aug 3 17:47:36 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 3 18:36:56 2023 +0200

tdf#151103: Use the whole text line to calculate the align position

Change-Id: I7ecd41c422afbf028101924972c47a510834ba5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155314
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 8861055f8e65..c74f881df468 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -127,6 +127,9 @@ namespace svgio::svgreader
 // keep a copy of string data before space handling
 OUString   maTextBeforeSpaceHandling;
 
+// The whole text line of which this SvgCharacterNode is parted of
+OUString   maWholeTextLine;
+
 /// local helpers
 rtl::Reference 
createSimpleTextPrimitive(
 SvgTextPosition& rSvgTextPosition,
@@ -153,6 +156,10 @@ namespace svgio::svgreader
 const OUString& getText() const { return maText; }
 
 const OUString& getTextBeforeSpaceHandling() const { return 
maTextBeforeSpaceHandling; }
+
+void setWholeTextLine(const OUString& rWholeTextLine) { 
maWholeTextLine = rWholeTextLine; }
+
+const OUString& getWholeTextLine() const { return maWholeTextLine; 
}
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 24a05ea27075..80234e8b1f56 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1458,6 +1458,92 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf95400)
 assertXPathNoAttribute(pDocument, 
"/primitive2D/transform/textsimpleportion[2]", "dx0");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTextAnchor)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf151103.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 
"60");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 
"40");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 
"43");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 
"50");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", 
"26");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", 
"60");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", 
"60");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", 
"40");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", 
"43");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "y", 
"50");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", 
"26");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "y", 
"60");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "x", 
"60");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "y", 
"40");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", 
"43");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "y", 
"50");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", 
"text", "ABC");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", 
"26");
+assertXPath(pDocument, 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-08-02 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtoken.hxx|1 +
 svgio/source/svgreader/svgdocumenthandler.cxx |2 ++
 svgio/source/svgreader/svgtoken.cxx   |2 ++
 3 files changed, 5 insertions(+)

New commits:
commit 76f50549f4898313ef4a18ce32d1f0a625ce766d
Author: Xisco Fauli 
AuthorDate: Wed Aug 2 13:35:53 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Aug 2 18:04:49 2023 +0200

tdf#156579: treat switch element as a group

Regression from

commit 13a41e7a12598c7896d6dc8d34aba6af5b80b83c
Author: Xisco Fauli 
Date:   Mon Jul 3 14:11:43 2023 +0200

tdf#150124: do nothing when parent is of unkown type

because 'switch' is not a known token. For now it, treat
it as a group

No need to have a unittest for this

Change-Id: I4cae92a010e45cd729db475a7abccab19a5d5403
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155250
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index cec89241903a..175297fa67e5 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -135,6 +135,7 @@ namespace svgio::svgreader
 G,
 Svg,
 Symbol,
+Switch,
 Use,
 A,
 
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index be80d1b828df..5c600a86dce1 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -203,6 +203,7 @@ namespace
 mpTarget->parseAttributes(xAttribs);
 break;
 }
+case SVGToken::Switch: //TODO: Support switch element
 case SVGToken::Defs:
 case SVGToken::G:
 {
@@ -487,6 +488,7 @@ namespace
 case SVGToken::G:
 case SVGToken::Svg:
 case SVGToken::Symbol:
+case SVGToken::Switch:
 case SVGToken::Use:
 case SVGToken::A:
 
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index d5222a2df125..24e24a5a31f7 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -129,6 +129,7 @@ constexpr auto aSVGTokenMapperList = 
frozen::make_unordered_map

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-08-01 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx  |2 +
 svgio/qa/cppunit/SvgImportTest.cxx  |   36 ++-
 svgio/qa/cppunit/data/tdf156283.svg |4 +++
 svgio/source/svgreader/svgcharacternode.cxx |   37 +++-
 4 files changed, 67 insertions(+), 12 deletions(-)

New commits:
commit ac8fd70e4e23d12857f766a4918747bbc5a7cb9b
Author: Xisco Fauli 
AuthorDate: Tue Aug 1 18:19:20 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 1 23:27:51 2023 +0200

tdf#156283: take remaing dx value into consideration too

Change-Id: I27c6f12edacd68c7f956b67dcf9ef0cc5045e3d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155169
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 5fad2008ba1c..8861055f8e65 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -82,6 +82,7 @@ namespace svgio::svgreader
 SvgTextPosition*mpParent;
 ::std::vector< double > maX;
 ::std::vector< double > maY;
+::std::vector< double > maDx;
 ::std::vector< double > maRotate;
 double  mfTextLength;
 
@@ -103,6 +104,7 @@ namespace svgio::svgreader
 // data read access
 const SvgTextPosition* getParent() const { return mpParent; }
 const ::std::vector< double >& getX() const { return maX; }
+const ::std::vector< double >& getDx() const { return maDx; }
 double getTextLength() const { return mfTextLength; }
 bool getLengthAdjust() const { return mbLengthAdjust; }
 bool getAbsoluteX() const { return mbAbsoluteX; }
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 5845b7ea6f52..9bc0dfc24e19 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1431,6 +1431,39 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269)
 assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", 
"#00");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156283)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156283.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", 
"20");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"text", "ABC");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"dx0", "41");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"dx1", "52");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"dx2", "63");
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", 
"30");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "ABC");
+
+// Without the fix in place, this test would have failed with
+// - Expected: 41
+// - Actual  : 12
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"dx0", "41");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"dx1", "52");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"dx2", "63");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156271.svg");
@@ -1474,7 +1507,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"x", "40");
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"y", "40");
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"text", "AB");
-assertXPathNoAttribute(pDocument, 
"/primitive2D/transform/mask/textsimpleportion[4]", "dx0");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"dx0", "12");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"dx1", "23");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf149880)
diff --git a/svgio/qa/cppunit/data/tdf156283.svg 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-07-12 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|6 +++
 svgio/inc/svgtools.hxx|1 
 svgio/qa/cppunit/SvgImportTest.cxx|   23 +++
 svgio/qa/cppunit/data/tdf156251.svg   |   17 
 svgio/source/svgreader/svgcharacternode.cxx   |   17 
 svgio/source/svgreader/svgdocumenthandler.cxx |   50 +++---
 svgio/source/svgreader/svgtools.cxx   |   16 
 7 files changed, 107 insertions(+), 23 deletions(-)

New commits:
commit 5079e7937ef471a44dcf119dc6ae0a334d9c6adc
Author: Xisco Fauli 
AuthorDate: Wed Jul 12 17:46:01 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 12 22:11:01 2023 +0200

tdf#156251: Add gap between text elements when needed

Partially revert a42f5faac7c6d4590e632cf40e3ba9eb618e6f56
"tdf#103888: Do not add a gap at the end of each text portion"
and adapt code to keep tdf#103888 fixed

Change-Id: I4b3f1ff7d87b1945233d9b05824d58af1e001d65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154364
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 738ddf4d9e73..5fad2008ba1c 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -122,6 +122,9 @@ namespace svgio::svgreader
 /// the string data
 OUString   maText;
 
+// keep a copy of string data before space handling
+OUString   maTextBeforeSpaceHandling;
+
 /// local helpers
 rtl::Reference 
createSimpleTextPrimitive(
 SvgTextPosition& rSvgTextPosition,
@@ -141,10 +144,13 @@ namespace svgio::svgreader
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
 void 
decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, 
SvgTextPosition& rSvgTextPosition) const;
 void whiteSpaceHandling();
+void addGap();
 void concatenate(std::u16string_view rText);
 
 /// Text content
 const OUString& getText() const { return maText; }
+
+const OUString& getTextBeforeSpaceHandling() const { return 
maTextBeforeSpaceHandling; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index c395702e5998..91ea53ce5e28 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -127,7 +127,6 @@ namespace svgio::svgreader
 void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rData);
 
 OUString consolidateContiguousSpace(const OUString& rCandidate);
-OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault);
 
 // #125325# removes block comment of the general form '/* ... */', 
returns
 // an adapted string or the original if no comments included
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 9f0b8ff7b9d7..b3d20603cfa7 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -737,7 +737,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770)
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "11");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"familyname", "Times New Roman");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"fontcolor", "#00");
-assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "Start");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "Start ");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"height", "11");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"familyname", "Times New Roman");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"fontcolor", "#00");
@@ -1150,6 +1150,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf103888)
 assertXPath(pDocument, 
"/primitive2D/transform/transform/textsimpleportion[3]", "text", "hebung");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156251)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156251.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed with
+// - Expected: 'You are '
+// - Actual  : 'You are'
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"text", "You are ");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "not ");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"text", "a 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-07-12 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgfecolormatrixnode.hxx   |6 +--
 svgio/inc/svgfedropshadownode.hxx|6 +--
 svgio/inc/svgfefloodnode.hxx |6 +--
 svgio/inc/svgfegaussianblurnode.hxx  |6 +--
 svgio/inc/svgfeimagenode.hxx |6 +--
 svgio/inc/svgfeoffsetnode.hxx|6 +--
 svgio/inc/svgfilternode.hxx  |6 +--
 svgio/source/svgreader/svgdocumenthandler.cxx|2 -
 svgio/source/svgreader/svgfecolormatrixnode.cxx  |2 -
 svgio/source/svgreader/svgfedropshadownode.cxx   |2 -
 svgio/source/svgreader/svgfefloodnode.cxx|2 -
 svgio/source/svgreader/svgfegaussianblurnode.cxx |2 -
 svgio/source/svgreader/svgfeimagenode.cxx|2 -
 svgio/source/svgreader/svgfeoffsetnode.cxx   |2 -
 svgio/source/svgreader/svgfilternode.cxx |   42 ++-
 15 files changed, 33 insertions(+), 65 deletions(-)

New commits:
commit 8d03f1d83d4ca561c11463325f16d7520a36df32
Author: Xisco Fauli 
AuthorDate: Wed Jul 12 08:12:30 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 12 13:23:44 2023 +0200

svgio: re-implement to use virtual function

kudos to Mike Kaganski for the hint

Change-Id: Iea58a31ffa481c4d9579a31f045f2a73d30ad883
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154344
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgfecolormatrixnode.hxx 
b/svgio/inc/svgfecolormatrixnode.hxx
index 975d9d082972..b8c3944435b4 100644
--- a/svgio/inc/svgfecolormatrixnode.hxx
+++ b/svgio/inc/svgfecolormatrixnode.hxx
@@ -19,7 +19,7 @@
 
 #pragma once
 
-#include "svgnode.hxx"
+#include "svgfilternode.hxx"
 #include "svgstyleattributes.hxx"
 #include 
 
@@ -33,7 +33,7 @@ enum class ColorType
 LuminanceToAlpha
 };
 
-class SvgFeColorMatrixNode final : public SvgNode
+class SvgFeColorMatrixNode final : public SvgFilterNode
 {
 private:
 ColorType maType;
@@ -46,7 +46,7 @@ public:
 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
 const OUString& aContent) override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfedropshadownode.hxx 
b/svgio/inc/svgfedropshadownode.hxx
index 5cc4b51ed797..1f3b62576411 100644
--- a/svgio/inc/svgfedropshadownode.hxx
+++ b/svgio/inc/svgfedropshadownode.hxx
@@ -19,12 +19,12 @@
 
 #pragma once
 
-#include "svgnode.hxx"
+#include "svgfilternode.hxx"
 #include "svgstyleattributes.hxx"
 
 namespace svgio::svgreader
 {
-class SvgFeDropShadowNode final : public SvgNode
+class SvgFeDropShadowNode final : public SvgFilterNode
 {
 private:
 SvgNumber maDx;
@@ -40,7 +40,7 @@ public:
 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
 const OUString& aContent) override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfefloodnode.hxx b/svgio/inc/svgfefloodnode.hxx
index a8cb2da47e51..cc7a985e4416 100644
--- a/svgio/inc/svgfefloodnode.hxx
+++ b/svgio/inc/svgfefloodnode.hxx
@@ -19,12 +19,12 @@
 
 #pragma once
 
-#include "svgnode.hxx"
+#include "svgfilternode.hxx"
 #include "svgstyleattributes.hxx"
 
 namespace svgio::svgreader
 {
-class SvgFeFloodNode final : public SvgNode
+class SvgFeFloodNode final : public SvgFilterNode
 {
 private:
 SvgNumber maX;
@@ -41,7 +41,7 @@ public:
 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
 const OUString& aContent) override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfegaussianblurnode.hxx 
b/svgio/inc/svgfegaussianblurnode.hxx
index 0bef266f9368..7ef7acdc419c 100644
--- a/svgio/inc/svgfegaussianblurnode.hxx
+++ b/svgio/inc/svgfegaussianblurnode.hxx
@@ -19,13 +19,13 @@
 
 #pragma once
 
-#include "svgnode.hxx"
+#include "svgfilternode.hxx"
 #include "svgstyleattributes.hxx"
 #include 
 
 namespace svgio::svgreader
 {
-class SvgFeGaussianBlurNode final : public SvgNode
+class SvgFeGaussianBlurNode final : public SvgFilterNode
 {
 private:
 SvgNumber maStdDeviation;
@@ -37,7 +37,7 @@ public:
 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
 const OUString& aContent) override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+void 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-07-05 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtoken.hxx|3 ---
 svgio/source/svgreader/svgdocumenthandler.cxx |9 +
 svgio/source/svgreader/svgtoken.cxx   |   17 ++---
 3 files changed, 3 insertions(+), 26 deletions(-)

New commits:
commit d378a44b4aa917d1f000f6ed2aa682009c544b6f
Author: Xisco Fauli 
AuthorDate: Wed Jul 5 16:37:58 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 5 22:46:42 2023 +0200

svgio: simplify code

Change-Id: Ieaf0430cd0e84d861f108ec33bf98ff2870ba2df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154067
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 61abd28f11e8..cec89241903a 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -195,9 +195,6 @@ namespace svgio::svgreader
 SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent);
 OUString SVGTokenToStr(const SVGToken& rToken);
 
-OUString getStrTitle();
-OUString getStrDesc();
-
 } // end of namespace svgio::svgreader
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 46d938a7c31e..99ca832a34f5 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -525,14 +525,7 @@ namespace
 
 if(!aText.isEmpty())
 {
-if(SVGToken::Title == aSVGToken)
-{
-mpTarget->parseAttribute(getStrTitle(), aSVGToken, 
aText);
-}
-else // if(SVGTokenDesc == aSVGToken)
-{
-mpTarget->parseAttribute(getStrDesc(), aSVGToken, 
aText);
-}
+mpTarget->parseAttribute(SVGTokenToStr(aSVGToken), 
aSVGToken, aText);
 }
 }
 
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index 6af6a1f5856e..1e2d3d7486da 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -25,9 +25,6 @@
 namespace svgio::svgreader
 {
 
-constexpr const std::u16string_view constToken_Title = u"title";
-constexpr const std::u16string_view constToken_Desc = u"desc";
-
 constexpr frozen::unordered_map 
aSVGTokenMapperList
 {
 { u"width", SVGToken::Width },
@@ -110,8 +107,8 @@ constexpr frozen::unordered_map aSVGTokenMap
 { u"patternTransform", SVGToken::PatternTransform },
 { u"opacity", SVGToken::Opacity },
 { u"visibility", SVGToken::Visibility },
-{ constToken_Title, SVGToken::Title },
-{ constToken_Desc, SVGToken::Desc },
+{ u"title", SVGToken::Title },
+{ u"desc", SVGToken::Desc },
 { u"preserveAspectRatio", SVGToken::PreserveAspectRatio },
 { u"defer", SVGToken::Defer },
 { u"none", SVGToken::None },
@@ -262,16 +259,6 @@ OUString SVGTokenToStr(const SVGToken& rToken)
 return OUString();
 }
 
-OUString getStrTitle()
-{
-return OUString(constToken_Title);
-}
-
-OUString getStrDesc()
-{
-return OUString(constToken_Desc);
-}
-
 } // end of namespace svgio
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-07-05 Thread Caolán McNamara (via logerrit)
 svgio/inc/svgdocument.hxx  |6 ++
 svgio/source/svgreader/svgnode.cxx |9 ++---
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 0dfd8288a87b58e503bb3a41be6137485fbf3f68
Author: Caolán McNamara 
AuthorDate: Wed Jul 5 09:31:58 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 5 15:08:05 2023 +0200

ofz#60384 Direct-leak

since:

commit 13a41e7a12598c7896d6dc8d34aba6af5b80b83c
Date:   Mon Jul 3 14:11:43 2023 +0200

tdf#150124: do nothing when parent is of unkown type

Change-Id: I58edf5f63d97e8afb1cd58c7e23452a9ea6a87eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154023
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/svgio/inc/svgdocument.hxx b/svgio/inc/svgdocument.hxx
index 9f79342c0c55..77b4d3891179 100644
--- a/svgio/inc/svgdocument.hxx
+++ b/svgio/inc/svgdocument.hxx
@@ -34,6 +34,9 @@ namespace svgio::svgreader
 /// the document hierarchy with all root nodes
 SvgNodeVector   maNodes;
 
+/// invalid nodes that have no parent
+SvgNodeVector   maOrphanNodes;
+
 /// the absolute path of the Svg file in progress (if available)
 const OUString maAbsolutePath;
 
@@ -72,6 +75,9 @@ namespace svgio::svgreader
 /// data read access
 const SvgNodeVector& getSvgNodeVector() const { return maNodes; }
 const OUString& getAbsolutePath() const { return maAbsolutePath; }
+
+/// invalid nodes that have no parent
+void addOrphanNode(SvgNode* pOrphan) { 
maOrphanNodes.emplace_back(pOrphan); }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index d87c76d81e20..992aaf72bce0 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -395,10 +395,13 @@ namespace {
 mbDecomposing(false),
 mbCssStyleVectorBuilt(false)
 {
-// tdf#150124 ignore when parent is unknown
-if(pParent && pParent->getType() != SVGToken::Unknown)
+if (pParent)
 {
-pParent->maChildren.emplace_back(this);
+// tdf#150124 ignore when parent is unknown
+if (pParent->getType() != SVGToken::Unknown)
+pParent->maChildren.emplace_back(this);
+else
+mrDocument.addOrphanNode(this);
 }
 }
 


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-30 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgfecolormatrixnode.hxx  |1 -
 svgio/qa/cppunit/data/filterFeColorMatrix.svg   |1 -
 svgio/source/svgreader/svgfecolormatrixnode.cxx |2 +-
 3 files changed, 1 insertion(+), 3 deletions(-)

New commits:
commit b391d6e2934fb5f6417a4ac37d510816e0773942
Author: Xisco Fauli 
AuthorDate: Fri Jun 30 12:49:10 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 30 14:11:21 2023 +0200

tdf#118087: set matrix as default value for type

From https://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement
"If attribute ‘type’ is not specified, then the effect is as if a value
of matrix were specified."

Change-Id: I8ddaa9129661d9a9f51c474461cf788d8d524a1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153804
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgfecolormatrixnode.hxx 
b/svgio/inc/svgfecolormatrixnode.hxx
index 78d8b027f653..975d9d082972 100644
--- a/svgio/inc/svgfecolormatrixnode.hxx
+++ b/svgio/inc/svgfecolormatrixnode.hxx
@@ -27,7 +27,6 @@ namespace svgio::svgreader
 {
 enum class ColorType
 {
-None,
 HueRotate,
 Matrix,
 Saturate,
diff --git a/svgio/qa/cppunit/data/filterFeColorMatrix.svg 
b/svgio/qa/cppunit/data/filterFeColorMatrix.svg
index 07d5559ed1b6..a86c2debc2b0 100644
--- a/svgio/qa/cppunit/data/filterFeColorMatrix.svg
+++ b/svgio/qa/cppunit/data/filterFeColorMatrix.svg
@@ -18,7 +18,6 @@
   
 

[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-29 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk|1 
 svgio/inc/svgfeimagenode.hxx  |   45 
 svgio/inc/svgtoken.hxx|1 
 svgio/qa/cppunit/SvgImportTest.cxx|   13 ++
 svgio/qa/cppunit/data/filterFeImage.svg   |   16 +++
 svgio/source/svgreader/svgdocumenthandler.cxx |9 +
 svgio/source/svgreader/svgfeimagenode.cxx |  134 ++
 svgio/source/svgreader/svgfilternode.cxx  |6 +
 svgio/source/svgreader/svgtoken.cxx   |3 
 9 files changed, 227 insertions(+), 1 deletion(-)

New commits:
commit 74c9fd3ae5b63981fb256e019f0cf974329157f0
Author: Xisco Fauli 
AuthorDate: Thu Jun 29 15:46:42 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 29 21:35:17 2023 +0200

tdf#156066: Add support for feImage filter

Change-Id: I76cf8932ae352c271283483c9c734408a35b6074
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153770
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 56d1f8dc1ae3..c25077ed94d3 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -63,6 +63,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgfecolormatrixnode \
 svgio/source/svgreader/svgfedropshadownode \
 svgio/source/svgreader/svgfefloodnode \
+svgio/source/svgreader/svgfeimagenode \
 svgio/source/svgreader/svgfegaussianblurnode \
 svgio/source/svgreader/svgfeoffsetnode \
 svgio/source/svgreader/svgfilternode \
diff --git a/svgio/inc/svgfeimagenode.hxx b/svgio/inc/svgfeimagenode.hxx
new file mode 100644
index ..ff3c87930a6c
--- /dev/null
+++ b/svgio/inc/svgfeimagenode.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+
+namespace svgio::svgreader
+{
+class SvgFeImageNode final : public SvgNode
+{
+private:
+OUString maUrl; // external link
+OUString maData; // base64 data
+
+public:
+SvgFeImageNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeImageNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 7d75a0e097a5..61abd28f11e8 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -83,6 +83,7 @@ namespace svgio::svgreader
 FeColorMatrix,
 FeDropShadow,
 FeFlood,
+FeImage,
 FeGaussianBlur,
 FeOffset,
 Filter,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 5aa25aed5b1e..6827d4f81d39 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -238,6 +238,19 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterFeDropShadow)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#ffc0cb");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testFilterFeImage)
+{
+Primitive2DSequence aSequenceTdf132246 = 
parseSvg(u"/svgio/qa/cppunit/data/filterFeImage.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf132246.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/transform/bitmap");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf87309)
 {
 Primitive2DSequence aSequenceTdf87309 = 
parseSvg(u"/svgio/qa/cppunit/data/tdf87309.svg");
diff --git a/svgio/qa/cppunit/data/filterFeImage.svg 
b/svgio/qa/cppunit/data/filterFeImage.svg
new file mode 100644
index ..5682dbf4692c
--- /dev/null
+++ b/svgio/qa/cppunit/data/filterFeImage.svg
@@ -0,0 +1,16 @@
+http://www.w3.org/2000/svg;
+  

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-06-29 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgimagenode.hxx  |1 -
 svgio/inc/svgtools.hxx  |2 +-
 svgio/source/svgreader/svgimagenode.cxx |4 ++--
 svgio/source/svgreader/svgtools.cxx |9 -
 4 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 210f2345c2eea2c52b673e2327a2ed096d9a888a
Author: Xisco Fauli 
AuthorDate: Thu Jun 29 17:42:19 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 29 21:13:13 2023 +0200

svgio: simplify code

Change-Id: I18c4179c36c052cc0ed5b416125e72d542cb7407
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153749
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgimagenode.hxx b/svgio/inc/svgimagenode.hxx
index 171a863d8fd0..074b659783b3 100644
--- a/svgio/inc/svgimagenode.hxx
+++ b/svgio/inc/svgimagenode.hxx
@@ -43,7 +43,6 @@ namespace svgio::svgreader
 OUString   maXLink;// internal link
 OUString   maUrl;  // external link
 
-OUString   maMimeType; // mimetype and
 OUString   maData; // base64 data
 
 public:
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 1bca409001b6..f556ed6cde02 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -125,7 +125,7 @@ namespace svgio::svgreader
 typedef ::std::vector< OUString > SvgStringVector;
 bool readSvgStringVector(std::u16string_view rCandidate, 
SvgStringVector& rSvgStringVector);
 
-void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rMimeType, OUString& rData);
+void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rData);
 
 OUString consolidateContiguousSpace(const OUString& rCandidate);
 OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault);
diff --git a/svgio/source/svgreader/svgimagenode.cxx 
b/svgio/source/svgreader/svgimagenode.cxx
index d0e821a52092..fa7cbe675a13 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -141,7 +141,7 @@ namespace svgio::svgreader
 
 if(nLen)
 {
-readImageLink(aContent, maXLink, maUrl, maMimeType, 
maData);
+readImageLink(aContent, maXLink, maUrl, maData);
 }
 break;
 }
@@ -204,7 +204,7 @@ namespace svgio::svgreader
 const basegfx::B2DRange aTarget(fX, fY, fX + fWidth, fY + fHeight);
 basegfx::B2DRange aViewBox(aTarget);
 
-if(!maMimeType.isEmpty() && !maData.isEmpty())
+if(!maData.isEmpty())
 {
 // use embedded base64 encoded data
 css::uno::Sequence< sal_Int8 > aPass;
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index c45f4c5e9c61..9539fcf618b9 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1354,11 +1354,10 @@ namespace svgio::svgreader
 return !rSvgStringVector.empty();
 }
 
-void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rMimeType, OUString& rData)
+void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rData)
 {
 rXLink.clear();
 rUrl.clear();
-rMimeType.clear();
 rData.clear();
 
 if(!readLocalLink(rCandidate, rXLink))
@@ -1376,11 +1375,11 @@ namespace svgio::svgreader
 skip_char(rCandidate, ' ', nPos, nLen);
 copyToLimiter(rCandidate, ';', nPos, aBuffer, nLen);
 skip_char(rCandidate, ' ', ';', nPos, nLen);
-rMimeType = aBuffer.makeStringAndClear();
+const OUString aMimeType = aBuffer.makeStringAndClear();
 
-if(!rMimeType.isEmpty() && nPos < nLen)
+if(!aMimeType.isEmpty() && nPos < nLen)
 {
-if(rMimeType.startsWith("image"))
+if(aMimeType.startsWith("image"))
 {
 // image data
 std::u16string_view 
aData(rCandidate.subView(nPos));


[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-28 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk|1 
 svgio/inc/svgfefloodnode.hxx  |   49 +++
 svgio/inc/svgtoken.hxx|3 
 svgio/qa/cppunit/SvgImportTest.cxx|   18 ++
 svgio/qa/cppunit/data/filterFeFlood.svg   |   16 ++
 svgio/source/svgreader/svgdocumenthandler.cxx |   11 +
 svgio/source/svgreader/svgfefloodnode.cxx |  162 ++
 svgio/source/svgreader/svgfilternode.cxx  |6 
 svgio/source/svgreader/svgstyleattributes.cxx |3 
 svgio/source/svgreader/svgtoken.cxx   |5 
 svgio/source/svgreader/svgusenode.cxx |   57 -
 11 files changed, 298 insertions(+), 33 deletions(-)

New commits:
commit 0a18f318a13d4a9b81f717498d3a02ee274542de
Author: Xisco Fauli 
AuthorDate: Tue Jun 27 23:21:25 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 28 10:05:50 2023 +0200

tdf#156066: Add support for feFlood filter

Change-Id: I4d01d40edd6fb91555fd734fc8378df1cbd5743a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153684
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 3702806a311c..20797e339a81 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
 svgio/source/svgreader/svgfecolormatrixnode \
+svgio/source/svgreader/svgfefloodnode \
 svgio/source/svgreader/svgfegaussianblurnode \
 svgio/source/svgreader/svgfeoffsetnode \
 svgio/source/svgreader/svgfilternode \
diff --git a/svgio/inc/svgfefloodnode.hxx b/svgio/inc/svgfefloodnode.hxx
new file mode 100644
index ..a8cb2da47e51
--- /dev/null
+++ b/svgio/inc/svgfefloodnode.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+
+namespace svgio::svgreader
+{
+class SvgFeFloodNode final : public SvgNode
+{
+private:
+SvgNumber maX;
+SvgNumber maY;
+SvgNumber maWidth;
+SvgNumber maHeight;
+SvgPaint maFloodColor;
+SvgNumber maFloodOpacity;
+
+public:
+SvgFeFloodNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeFloodNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index fb2e04c278f4..239cda0eb4cc 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -81,9 +81,12 @@ namespace svgio::svgreader
 ClipPathNode,
 ClipPathProperty,
 FeColorMatrix,
+FeFlood,
 FeGaussianBlur,
 FeOffset,
 Filter,
+FloodColor,
+FloodOpacity,
 Mask,
 ClipPathUnits,
 MaskUnits,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 7e32e83faf3a..9383b7ac5430 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -203,6 +203,24 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterFeOffset)
 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy33", 
"1");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testFilterFeFlood)
+{
+Primitive2DSequence aSequenceTdf132246 = 
parseSvg(u"/svgio/qa/cppunit/data/filterFeFlood.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf132246.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", 
"transparence", "50");
+assertXPath(pDocument, 

[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-27 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk|3 
 svgio/inc/svgfeoffsetnode.hxx |   45 
 svgio/inc/svgtoken.hxx|3 
 svgio/qa/cppunit/SvgImportTest.cxx|   21 +
 svgio/qa/cppunit/data/filterFeOffset.svg  |   18 +
 svgio/source/svgreader/svgdocumenthandler.cxx |   17 +++-
 svgio/source/svgreader/svgfeoffsetnode.cxx|   92 ++
 svgio/source/svgreader/svgfilternode.cxx  |9 ++
 svgio/source/svgreader/svgtoken.cxx   |5 -
 9 files changed, 204 insertions(+), 9 deletions(-)

New commits:
commit c8caee61ff392db8bcf630309324b46d962886e1
Author: Xisco Fauli 
AuthorDate: Mon Jun 26 23:24:52 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 27 14:21:26 2023 +0200

tdf#156068: Add support for feOffset filter

Change-Id: I1b3dea0ee4f9eb2ee7498962b04baaf5ba68855c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153629
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 76c0e87123bb..3702806a311c 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -60,8 +60,9 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgellipsenode \
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
-svgio/source/svgreader/svgfegaussianblurnode \
 svgio/source/svgreader/svgfecolormatrixnode \
+svgio/source/svgreader/svgfegaussianblurnode \
+svgio/source/svgreader/svgfeoffsetnode \
 svgio/source/svgreader/svgfilternode \
 svgio/source/svgreader/svggradientnode \
 svgio/source/svgreader/svggradientstopnode \
diff --git a/svgio/inc/svgfeoffsetnode.hxx b/svgio/inc/svgfeoffsetnode.hxx
new file mode 100644
index ..22bf212d7c20
--- /dev/null
+++ b/svgio/inc/svgfeoffsetnode.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+
+namespace svgio::svgreader
+{
+class SvgFeOffsetNode final : public SvgNode
+{
+private:
+SvgNumber maDx;
+SvgNumber maDy;
+
+public:
+SvgFeOffsetNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeOffsetNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 9c28674b1cfb..fb2e04c278f4 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -80,8 +80,9 @@ namespace svgio::svgreader
 Color,
 ClipPathNode,
 ClipPathProperty,
-FeGaussianBlur,
 FeColorMatrix,
+FeGaussianBlur,
+FeOffset,
 Filter,
 Mask,
 ClipPathUnits,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index c3bbc0f9c211..7e32e83faf3a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -182,6 +182,27 @@ CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur)
 assertXPath(pDocument, "/primitive2D/transform/softedge", "radius", "5");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testFilterFeOffset)
+{
+Primitive2DSequence aSequenceTdf132246 = 
parseSvg(u"/svgio/qa/cppunit/data/filterFeOffset.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf132246.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy11", 
"1");
+assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy12", 
"0");
+assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy13", 
"44");
+assertXPath(pDocument, 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-26 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx   |2 
 svgio/qa/cppunit/SvgImportTest.cxx  |   24 
 svgio/qa/cppunit/data/tdf156038.svg |   34 
 svgio/source/svgreader/svgnode.cxx  |   98 
 4 files changed, 158 insertions(+)

New commits:
commit 930eb99a712a3ad9b76e9edb68bbcea68af36656
Author: Xisco Fauli 
AuthorDate: Mon Jun 26 19:15:03 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 26 22:45:12 2023 +0200

tdf#156038, tdf#78232: support css child combinator

Change-Id: I874c368f66db97017357030867f121996228
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153626
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index a85958936d9e..0d8008d41c90 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -126,6 +126,8 @@ namespace svgio::svgreader
 void fillCssStyleVectorUsingHierarchyAndSelectors(
 const SvgNode& rCurrent,
 const OUString& aConcatenated);
+void fillCssStyleVectorUsingParent(
+const SvgNode& rCurrent);
 
 public:
 SvgNode(
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index abef91413077..7607a5593256 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -344,6 +344,30 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156034)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", 
"color", "#008000");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156038)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156038.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", 
"color", "#ff");
+
+// Without the fix in place, this test would have failed with
+// - Expected: #008000
+// - Actual  : #ff
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#ff");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", 
"color", "#ff");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", 
"color", "#ff");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", 
"color", "#008000");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156018.svg");
diff --git a/svgio/qa/cppunit/data/tdf156038.svg 
b/svgio/qa/cppunit/data/tdf156038.svg
new file mode 100644
index ..9835453e7fdd
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156038.svg
@@ -0,0 +1,34 @@
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 800 800">
+
+
+.g1 > rect {fill:green;}
+#g3 > rect {fill:green;}
+.g4 > #r1 {fill:green;}
+#g3 > .r5 {fill:green;}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 399b92231543..37b34deff0f6 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -184,6 +184,100 @@ namespace {
 }
 }
 
+void SvgNode::fillCssStyleVectorUsingParent(const SvgNode& rCurrent)
+{
+const SvgDocument& rDocument = getDocument();
+
+if(!rDocument.hasGlobalCssStyleAttributes())
+return;
+
+const SvgNode* pParent = rCurrent.getParent();
+
+if (!pParent)
+return;
+
+OUString sParentId;
+if (pParent->getId().has_value())
+{
+sParentId = pParent->getId().value();
+}
+std::vector  aParentClasses = parseClass(*pParent);
+OUString sParentType(SVGTokenToStr(pParent->getType()));
+
+if(rCurrent.getId())
+{
+const OUString& rId = *rCurrent.getId();
+
+if(!rId.isEmpty())
+{
+if (!sParentId.isEmpty())
+{
+const OUString aConcatenated("#" + sParentId + ">#" + 
rId);
+addCssStyle(rDocument, aConcatenated);
+}
+
+

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-06-26 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx  |5 +---
 svgio/inc/svgpolynode.hxx  |6 +
 svgio/source/svgreader/svganode.cxx|2 -
 svgio/source/svgreader/svgcirclenode.cxx   |2 -
 svgio/source/svgreader/svgdocumenthandler.cxx  |4 +--
 svgio/source/svgreader/svgellipsenode.cxx  |2 -
 svgio/source/svgreader/svggnode.cxx|   13 ++--
 svgio/source/svgreader/svggradientnode.cxx |4 ---
 svgio/source/svgreader/svggradientstopnode.cxx |2 -
 svgio/source/svgreader/svgimagenode.cxx|2 -
 svgio/source/svgreader/svglinenode.cxx |2 -
 svgio/source/svgreader/svgmarkernode.cxx   |2 -
 svgio/source/svgreader/svgnode.cxx |   27 -
 svgio/source/svgreader/svgpathnode.cxx |2 -
 svgio/source/svgreader/svgpatternnode.cxx  |2 -
 svgio/source/svgreader/svgpolynode.cxx |   13 +---
 svgio/source/svgreader/svgrectnode.cxx |2 -
 svgio/source/svgreader/svgstyleattributes.cxx  |6 +++--
 svgio/source/svgreader/svgsvgnode.cxx  |2 -
 svgio/source/svgreader/svgtextnode.cxx |2 -
 svgio/source/svgreader/svgtspannode.cxx|2 -
 svgio/source/svgreader/svgusenode.cxx  |2 -
 22 files changed, 48 insertions(+), 58 deletions(-)

New commits:
commit 897fce4abd0c731bf697ca1e38a8049f66f9ac7c
Author: Xisco Fauli 
AuthorDate: Mon Jun 26 13:48:54 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 26 22:44:47 2023 +0200

svgio: simplify code

Change-Id: Ie363236a4b2e2d74d583b9f842b48743eefa9d24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153625
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index af23bc4eb32f..a85958936d9e 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -116,15 +116,14 @@ namespace svgio::svgreader
 
 protected:
 /// helper to evtl. link to css style
-const SvgStyleAttributes* checkForCssStyle(const OUString& 
rClassStr, const SvgStyleAttributes& rOriginal) const;
+const SvgStyleAttributes* checkForCssStyle(const 
SvgStyleAttributes& rOriginal) const;
 
 /// helper for filling the CssStyle vector once dependent on 
mbCssStyleVectorBuilt
-void fillCssStyleVector(const OUString& rClassStr, const 
SvgStyleAttributes& rOriginal);
+void fillCssStyleVector(const SvgStyleAttributes& rOriginal);
 void addCssStyle(
 const SvgDocument& rDocument,
 const OUString& aConcatenated);
 void fillCssStyleVectorUsingHierarchyAndSelectors(
-const OUString& rClassStr,
 const SvgNode& rCurrent,
 const OUString& aConcatenated);
 
diff --git a/svgio/inc/svgpolynode.hxx b/svgio/inc/svgpolynode.hxx
index fd356cd55588..772965475eb9 100644
--- a/svgio/inc/svgpolynode.hxx
+++ b/svgio/inc/svgpolynode.hxx
@@ -37,13 +37,11 @@ namespace svgio::svgreader
 std::optionalmpPolygon;
 std::optional  mpaTransform;
 
-boolmbIsPolyline : 1; // true = polyline, 
false = polygon
-
 public:
 SvgPolyNode(
+SVGToken aType,
 SvgDocument& rDocument,
-SvgNode* pParent,
-bool bIsPolyline);
+SvgNode* pParent);
 virtual ~SvgPolyNode() override;
 
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index 927b13d06eb8..83dd7c50175e 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -35,7 +35,7 @@ namespace svgio::svgreader
 
 const SvgStyleAttributes* SvgANode::getSvgStyleAttributes() const
 {
-return checkForCssStyle("a", maSvgStyleAttributes);
+return checkForCssStyle(maSvgStyleAttributes);
 }
 
 void SvgANode::parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgcirclenode.cxx 
b/svgio/source/svgreader/svgcirclenode.cxx
index 0cf15e5e7ca9..363e85d111ab 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -41,7 +41,7 @@ namespace svgio::svgreader
 
 const SvgStyleAttributes* SvgCircleNode::getSvgStyleAttributes() const
 {
-return checkForCssStyle("circle", maSvgStyleAttributes);
+return checkForCssStyle(maSvgStyleAttributes);
 }
 
 void SvgCircleNode::parseAttribute(const OUString& rTokenName, 
SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-23 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx   |3 
 svgio/qa/cppunit/SvgImportTest.cxx  |   19 
 svgio/qa/cppunit/data/tdf156034.svg |   20 +
 svgio/source/svgreader/svgnode.cxx  |  140 ++--
 4 files changed, 115 insertions(+), 67 deletions(-)

New commits:
commit 45d13c26d815cbbb73db5d327809368c89b9eec3
Author: Xisco Fauli 
AuthorDate: Fri Jun 23 12:59:17 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 23 22:57:22 2023 +0200

tdf#156034: check for css style further up in the hierarchy

Change-Id: I92c6673f1249cc4a273c490cdc0496474ce1f0c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153498
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index f2eb0fcb1b6e..af23bc4eb32f 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -120,6 +120,9 @@ namespace svgio::svgreader
 
 /// helper for filling the CssStyle vector once dependent on 
mbCssStyleVectorBuilt
 void fillCssStyleVector(const OUString& rClassStr, const 
SvgStyleAttributes& rOriginal);
+void addCssStyle(
+const SvgDocument& rDocument,
+const OUString& aConcatenated);
 void fillCssStyleVectorUsingHierarchyAndSelectors(
 const OUString& rClassStr,
 const SvgNode& rCurrent,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index d29cc30bf41c..8e7d86c145f2 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -320,6 +320,25 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#ff");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156034)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156034.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed with
+// - Expected: #008000
+// - Actual  : #ff
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", 
"color", "#008000");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156018.svg");
diff --git a/svgio/qa/cppunit/data/tdf156034.svg 
b/svgio/qa/cppunit/data/tdf156034.svg
new file mode 100644
index ..ed14c5fe4aaf
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156034.svg
@@ -0,0 +1,20 @@
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 300 300">
+
+
+.g1 rect {fill:green;}
+#g3 rect {fill:green;}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 2137209d5599..35277ef0ed87 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -39,53 +39,30 @@ namespace svgio::svgreader
 return nullptr;
 }
 
-void SvgNode::fillCssStyleVectorUsingHierarchyAndSelectors(
-const OUString& rClassStr,
-const SvgNode& rCurrent,
-const OUString& aConcatenated)
+void SvgNode::addCssStyle(const SvgDocument& rDocument, const 
OUString& aConcatenated)
 {
-const SvgDocument& rDocument = getDocument();
+const SvgStyleAttributes* pNew = 
rDocument.findGlobalCssStyleAttributes(aConcatenated);
 
-if(!rDocument.hasGlobalCssStyleAttributes())
-return;
-
-const SvgNode* pParent = rCurrent.getParent();
-
-// check for ID (highest priority)
-if(rCurrent.getId())
+if(pNew)
 {
-const OUString& rId = *rCurrent.getId();
-
-if(rId.getLength())
-{
-const OUString aNewConcatenated(
-"#" + rId + aConcatenated);
-
-if(pParent)
-{
-// check for combined selectors at parent firstso that 
higher specificity will be in front
-
fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *pParent, 
aNewConcatenated);
-}
-
-const SvgStyleAttributes* pNew = 
rDocument.findGlobalCssStyleAttributes(aNewConcatenated);
-
-if(pNew)
-   

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-22 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtoken.hxx  |1 +
 svgio/qa/cppunit/SvgImportTest.cxx  |   17 +
 svgio/qa/cppunit/data/tdf156018.svg |   11 +++
 svgio/source/svgreader/svgnode.cxx  |   15 +++
 svgio/source/svgreader/svgtoken.cxx |   13 +
 5 files changed, 57 insertions(+)

New commits:
commit 079cd3429ace2f9568d42368bb0c56487335d44d
Author: Xisco Fauli 
AuthorDate: Thu Jun 22 18:00:01 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 22 19:50:25 2023 +0200

tdf#156018: check if there is a css style with element inside element

Change-Id: I54fa5bea42560eec5ae51dd7ba07de11f418c75c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153466
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index a28be73df50a..9c28674b1cfb 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -187,6 +187,7 @@ namespace svgio::svgreader
 };
 
 SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent);
+OUString SVGTokenToStr(const SVGToken& rToken);
 
 OUString getStrTitle();
 OUString getStrDesc();
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index df1337090ff3..d29cc30bf41c 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -320,6 +320,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#ff");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156018.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed with
+// - Expected: #008000
+// - Actual  : #ff
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", 
"color", "#008000");
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", 
"color", "#ff");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf155932)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf155932.svg");
diff --git a/svgio/qa/cppunit/data/tdf156018.svg 
b/svgio/qa/cppunit/data/tdf156018.svg
new file mode 100644
index ..cff3f924a589
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156018.svg
@@ -0,0 +1,11 @@
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="-0 0 300 300">
+
+
+g rect {fill:green;}
+
+
+
+
+
+
+
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index d45624d3edc6..2137209d5599 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -160,6 +160,21 @@ namespace svgio::svgreader
 // add CssStyle if found
 maCssStyleVector.push_back(pNew);
 }
+
+// check if there is a css style with element inside element
+if(pParent)
+{
+OUString sParentType(SVGTokenToStr(pParent->getType()));
+
+aNewConcatenated = sParentType + rClassStr;
+pNew = 
rDocument.findGlobalCssStyleAttributes(aNewConcatenated);
+
+if(pNew)
+{
+// add CssStyle if found
+maCssStyleVector.push_back(pNew);
+}
+}
 }
 
 void SvgNode::fillCssStyleVector(const OUString& rClassStr, const 
SvgStyleAttributes& rOriginal)
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index 45af658b1ebd..ed50612323e5 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -243,6 +243,19 @@ SVGToken StrToSVGToken(const OUString& rStr, bool 
bCaseIndependent)
 }
 }
 
+OUString SVGTokenToStr(const SVGToken& rToken)
+{
+for (auto it = aSVGTokenMapperList.begin(); it != 
aSVGTokenMapperList.end(); ++it)
+{
+if (it->second == rToken)
+{
+OUString aFirst(it->first);
+return aFirst;
+}
+}
+return OUString();
+}
+
 OUString getStrTitle()
 {
 return OUString(constToken_Title);


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-20 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx |3 +
 svgio/qa/cppunit/SvgImportTest.cxx|   46 --
 svgio/qa/cppunit/data/tdf155814.svg   |   25 ++
 svgio/source/svgreader/svgstyleattributes.cxx |   42 +++
 svgio/source/svgreader/svgusenode.cxx |   18 --
 5 files changed, 93 insertions(+), 41 deletions(-)

New commits:
commit b0c2e580a1c5b055295d303ebb9c9e905ab4890c
Author: Xisco Fauli 
AuthorDate: Tue Jun 20 18:15:08 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 20 20:52:13 2023 +0200

tdf#155814: only check parent style when it has a local css style

This also fixes the problem for filters and mask, since they
are call from add_postProcess

Adapt some tests to the new xml output. Visually nothing has changed

Change-Id: I65d2491409019f4cd0b1113a9a7931fc602c57b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153355
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 4bdbd3046d75..f2eb0fcb1b6e 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -180,6 +180,9 @@ namespace svgio::svgreader
 
 /// alternative parent
 void setAlternativeParent(const SvgNode* pAlternativeParent = 
nullptr) { mpAlternativeParent = pAlternativeParent; }
+
+/// Check if there is a local css style
+bool hasLocalCssStyle() { return 
static_cast(mpLocalCssStyle); }
 };
 
   class Visitor
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index cb7fc790c375..87c99ba72509 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -163,10 +163,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFeColorMatrix)
 
 CPPUNIT_ASSERT (pDocument);
 
-//assertXPath(pDocument, 
"/primitive2D/transform/mask/transform[1]/modifiedColor", "modifier", "matrix");
-assertXPath(pDocument, 
"/primitive2D/transform/mask/transform[2]/modifiedColor", "modifier", 
"saturate");
-//assertXPath(pDocument, 
"/primitive2D/transform/mask/transform[3]/modifiedColor", "modifier", 
"hueRotate");
-assertXPath(pDocument, 
"/primitive2D/transform/mask/transform[4]/modifiedColor", "modifier", 
"luminance_to_alpha");
+//assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor", 
"modifier", "matrix");
+assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[1]", 
"modifier", "saturate");
+//assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor", 
"modifier", "hueRotate");
+assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[2]", 
"modifier", "luminance_to_alpha");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur)
@@ -717,10 +717,24 @@ CPPUNIT_TEST_FIXTURE(Test, testClipPathAndParentStyle)
 
 CPPUNIT_ASSERT (pDocument);
 
-assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#ff");
-assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 
"color", "#00");
-assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 
"width", "5");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygoncolor", "color", "#ff");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygonstroke/line", "color", "#00");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygonstroke/line", "width", "5");
+
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf155814)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf155814.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
 
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, 
"/primitive2D/transform/mask/mask/transform/unifiedtransparence", 
"transparence", "50");
+assertXPath(pDocument, 
"/primitive2D/transform/mask/mask/transform/unifiedtransparence/polypolygoncolor",
 "color", "#ff");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle)
@@ -735,9 +749,9 @@ CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle)
 
 CPPUNIT_ASSERT (pDocument);
 
-assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#ff");
-assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 
"color", "#cc");
-assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 
"width", "2");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygoncolor", "color", "#ff");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygonstroke/line", "color", "#cc");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/polypolygonstroke/line", "width", "2");
 
 }
 
@@ -915,10 +929,10 @@ CPPUNIT_TEST_FIXTURE(Test, 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2023-06-20 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx  |3 +-
 svgio/qa/cppunit/SvgImportTest.cxx|   14 +++
 svgio/qa/cppunit/data/tdf155932.svg   |   22 ++
 svgio/source/svgreader/svganode.cxx   |2 -
 svgio/source/svgreader/svgcirclenode.cxx  |2 -
 svgio/source/svgreader/svgellipsenode.cxx |2 -
 svgio/source/svgreader/svggnode.cxx   |   31 --
 svgio/source/svgreader/svgimagenode.cxx   |2 -
 svgio/source/svgreader/svglinenode.cxx|2 -
 svgio/source/svgreader/svgpathnode.cxx|2 -
 svgio/source/svgreader/svgpolynode.cxx|2 -
 svgio/source/svgreader/svgrectnode.cxx|2 -
 svgio/source/svgreader/svgstyleattributes.cxx |   22 +++---
 svgio/source/svgreader/svgtextnode.cxx|2 -
 14 files changed, 76 insertions(+), 34 deletions(-)

New commits:
commit 3e0e67a152e9631574e28dacb6e06a96f03ebca2
Author: Xisco Fauli 
AuthorDate: Tue Jun 20 16:47:58 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jun 20 18:29:43 2023 +0200

tdf#155932: tdf#97717: only apply opacity when primitive

Partially revert d47b37eea9779e3c354e6c19a7211a306965b7ef
"tdf#97717: do not call add_postProcess from g element"
since we still need to call add_postProcess from g to
apply the clip-path

Change-Id: Ibdc5afadc0db239d0b0e14810943009a4c0a16a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153353
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 52876ea0576d..b54e3cd627e4 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -293,7 +293,8 @@ namespace svgio::svgreader
 void add_postProcess(
 drawinglayer::primitive2d::Primitive2DContainer& rTarget,
 drawinglayer::primitive2d::Primitive2DContainer&& rSource,
-const std::optional& pTransform) const;
+const std::optional& pTransform,
+bool bIsPrimitive) const;
 
 /// helper to set mpCssStyleParent temporarily for CSS style 
hierarchies
 void setCssStyleParent(const SvgStyleAttributes* pNew) { 
mpCssStyleParent = pNew; }
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 43dde4da9997..cb7fc790c375 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -320,6 +320,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", 
"color", "#ff");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf155932)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf155932.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, 
"/primitive2D/transform/mask/mask/unifiedtransparence", "transparence", "50");
+assertXPath(pDocument, 
"/primitive2D/transform/mask/mask/unifiedtransparence[1]/polypolygoncolor", 
"color", "#ff");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf97717)
 {
 Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg");
diff --git a/svgio/qa/cppunit/data/tdf155932.svg 
b/svgio/qa/cppunit/data/tdf155932.svg
new file mode 100644
index ..b533eda3cd35
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf155932.svg
@@ -0,0 +1,22 @@
+http://www.w3.org/2000/svg;
+  xmlns:xlink="http://www.w3.org/1999/xlink;>
+  
+  
+
+  
+
+  
+  
+
+  
+
+  
+ 
+  
+
+
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index 5d992a3d28ef..927b13d06eb8 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -94,7 +94,7 @@ namespace svgio::svgreader
 
 if(!aContent.empty())
 {
-pStyle->add_postProcess(rTarget, std::move(aContent), 
getTransform());
+pStyle->add_postProcess(rTarget, std::move(aContent), 
getTransform(), true);
 }
 }
 }
diff --git a/svgio/source/svgreader/svgcirclenode.cxx 
b/svgio/source/svgreader/svgcirclenode.cxx
index 0ec940f9f737..0cf15e5e7ca9 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -135,7 +135,7 @@ namespace svgio::svgreader
 
 if(!aNewTarget.empty())
 {
-pStyle->add_postProcess(rTarget, std::move(aNewTarget), 
getTransform());
+pStyle->add_postProcess(rTarget, std::move(aNewTarget), 
getTransform(), true);
 }
 }
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgellipsenode.cxx 

[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-08 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk   |1 
 svgio/inc/svgfecolormatrixnode.hxx   |   51 
 svgio/inc/svgtoken.hxx   |1 
 svgio/qa/cppunit/SvgImportTest.cxx   |   13 
 svgio/qa/cppunit/data/filterLuminanceToAlpha.svg |   11 +++
 svgio/source/svgreader/svgdocumenthandler.cxx|   15 
 svgio/source/svgreader/svgfecolormatrixnode.cxx  |   72 +++
 svgio/source/svgreader/svgfilternode.cxx |7 ++
 svgio/source/svgreader/svgstyleattributes.cxx|5 +
 svgio/source/svgreader/svgtoken.cxx  |2 
 10 files changed, 176 insertions(+), 2 deletions(-)

New commits:
commit b1d1a424a4d291873101f5d2348e5bd9cb9091a4
Author: Xisco Fauli 
AuthorDate: Thu Jun 8 14:31:54 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 8 16:52:57 2023 +0200

tdf#155735: Add basic support for feColorMatrix

for now, it only supports type="luminanceToAlpha"

Change-Id: Ia84df9af08ac2be2e496a5fadb490deaf48210cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152741
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 247653732d6f..6221cb141316 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -58,6 +58,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
 svgio/source/svgreader/svgfegaussianblurnode \
+svgio/source/svgreader/svgfecolormatrixnode \
 svgio/source/svgreader/svgfilternode \
 svgio/source/svgreader/svggradientnode \
 svgio/source/svgreader/svggradientstopnode \
diff --git a/svgio/inc/svgfecolormatrixnode.hxx 
b/svgio/inc/svgfecolormatrixnode.hxx
new file mode 100644
index ..7436f737b04c
--- /dev/null
+++ b/svgio/inc/svgfecolormatrixnode.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+#include 
+
+namespace svgio::svgreader
+{
+enum class Type
+{
+None,
+LuminanceToAlpha
+};
+
+class SvgFeColorMatrixNode final : public SvgNode
+{
+private:
+Type maType;
+
+public:
+SvgFeColorMatrixNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeColorMatrixNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 262b5f3dda55..18c1a092c238 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -81,6 +81,7 @@ namespace svgio::svgreader
 ClipPathNode,
 ClipPathProperty,
 FeGaussianBlur,
+FeColorMatrix,
 Filter,
 Mask,
 ClipPathUnits,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index ce4db97e0954..ad5852127551 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -135,6 +135,19 @@ CPPUNIT_TEST_FIXTURE(Test, testSymbol)
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#00d000");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testFilterLuminanceToAlpha)
+{
+Primitive2DSequence aSequenceTdf132246 = 
parseSvg(u"/svgio/qa/cppunit/data/filterLuminanceToAlpha.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf132246.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf132246);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/modifiedColor");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur)
 {
 Primitive2DSequence aSequenceTdf132246 = 
parseSvg(u"/svgio/qa/cppunit/data/filterFeGaussianBlur.svg");
diff --git 

[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/source

2023-06-07 Thread Xisco Fauli (via logerrit)
 svgio/Library_svgio.mk|1 
 svgio/inc/svgfilternode.hxx   |   37 +
 svgio/inc/svgstyleattributes.hxx  |7 
 svgio/inc/svgtoken.hxx|1 
 svgio/source/svgreader/svgdocumenthandler.cxx |   11 +-
 svgio/source/svgreader/svgfilternode.cxx  |   33 +++
 svgio/source/svgreader/svgstyleattributes.cxx |   44 +-
 svgio/source/svgreader/svgtoken.cxx   |2 +
 8 files changed, 134 insertions(+), 2 deletions(-)

New commits:
commit a4a570222e1270fecf17fba2c35e96907a327dc1
Author: Xisco Fauli 
AuthorDate: Tue Jun 6 17:09:36 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 7 10:45:44 2023 +0200

related: tdf#132246: Add basic filter node

Change-Id: Iff451c441f0fe2c2fd2a14db8214f7a7d554dd15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152680
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 917f9ea4865e..8770f733d441 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgellipsenode \
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
+svgio/source/svgreader/svgfilternode \
 svgio/source/svgreader/svggradientnode \
 svgio/source/svgreader/svggradientstopnode \
 svgio/source/svgreader/svgimagenode \
diff --git a/svgio/inc/svgfilternode.hxx b/svgio/inc/svgfilternode.hxx
new file mode 100644
index ..e6c24450b4e2
--- /dev/null
+++ b/svgio/inc/svgfilternode.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+#include 
+
+namespace svgio::svgreader
+{
+class SvgFilterNode final : public SvgNode
+{
+public:
+SvgFilterNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFilterNode() override;
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 4455f2311b69..52876ea0576d 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -34,6 +34,7 @@ namespace svgio::svgreader {
 class SvgPatternNode;
 class SvgMarkerNode;
 class SvgClipPathNode;
+class SvgFilterNode;
 class SvgMaskNode;
 }
 
@@ -205,6 +206,8 @@ namespace svgio::svgreader
 /// link to content. If set, the node can be fetched on demand
 OUString   maClipPathXLink;
 const SvgClipPathNode* mpClipPathXLink;
+OUString   maFilterXLink;
+const SvgFilterNode*   mpFilterXLink;
 OUString   maMaskXLink;
 const SvgMaskNode* mpMaskXLink;
 
@@ -417,6 +420,10 @@ namespace svgio::svgreader
 OUString getClipPathXLink() const;
 const SvgClipPathNode* accessClipPathXLink() const;
 
+// FilterXLink content
+OUString getFilterXLink() const;
+const SvgFilterNode* accessFilterXLink() const;
+
 // MaskXLink content
 OUString getMaskXLink() const;
 const SvgMaskNode* accessMaskXLink() const;
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 0a24d272be5f..73c083a620e6 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -78,6 +78,7 @@ namespace svgio::svgreader
 Color,
 ClipPathNode,
 ClipPathProperty,
+Filter,
 Mask,
 ClipPathUnits,
 MaskUnits,
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index dc2dd6fa7c6b..ac866b37f0d2 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2023-02-28 Thread Noel Grandin (via logerrit)
 svgio/inc/svgpatternnode.hxx  |   12 ++--
 svgio/source/svgreader/svgpatternnode.cxx |8 
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 08a7f95d68343e260e9b5faace55c0d4caaba5b4
Author: Noel Grandin 
AuthorDate: Tue Feb 28 10:01:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 28 12:13:26 2023 +

no need to allocate SvgUnits separately

it is only one pointer big

Change-Id: Iad5444ed6783abc2916510fd83c5b5a11d17e8f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147950
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index 60c6b7f7ced8..219ca52eae73 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -43,10 +43,10 @@ namespace svgio::svgreader
 SvgNumber   maY;
 SvgNumber   maWidth;
 SvgNumber   maHeight;
-std::unique_ptr
-mpPatternUnits;
-std::unique_ptr
-mpPatternContentUnits;
+std::optional
+moPatternUnits;
+std::optional
+moPatternContentUnits;
 std::optional
 mpaPatternTransform;
 
@@ -99,11 +99,11 @@ namespace svgio::svgreader
 
 /// PatternUnits content
 const SvgUnits* getPatternUnits() const;
-void setPatternUnits(const SvgUnits aPatternUnits) { 
mpPatternUnits.reset( new SvgUnits(aPatternUnits) ); }
+void setPatternUnits(const SvgUnits aPatternUnits) { 
moPatternUnits = aPatternUnits; }
 
 /// PatternContentUnits content
 const SvgUnits* getPatternContentUnits() const;
-void setPatternContentUnits(const SvgUnits aPatternContentUnits) { 
mpPatternContentUnits.reset( new SvgUnits(aPatternContentUnits) ); }
+void setPatternContentUnits(const SvgUnits aPatternContentUnits) { 
moPatternContentUnits = aPatternContentUnits; }
 
 /// PatternTransform content
 std::optional getPatternTransform() const;
diff --git a/svgio/source/svgreader/svgpatternnode.cxx 
b/svgio/source/svgreader/svgpatternnode.cxx
index ff7f5768d3d0..9b94c537eaef 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -402,9 +402,9 @@ namespace svgio::svgreader
 
 const SvgUnits* SvgPatternNode::getPatternUnits() const
 {
-if(mpPatternUnits)
+if(moPatternUnits)
 {
-return mpPatternUnits.get();
+return &*moPatternUnits;
 }
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
@@ -422,9 +422,9 @@ namespace svgio::svgreader
 
 const SvgUnits* SvgPatternNode::getPatternContentUnits() const
 {
-if(mpPatternContentUnits)
+if(moPatternContentUnits)
 {
-return mpPatternContentUnits.get();
+return &*moPatternContentUnits;
 }
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-11-29 Thread Miklos Vajna (via logerrit)
 svgio/inc/svgcharacternode.hxx   |2 +-
 svgio/qa/cppunit/SvgImportTest.cxx   |   24 
 svgio/qa/cppunit/data/tspan-fill-opacity.svg |   15 +++
 svgio/source/svgreader/svgcharacternode.cxx  |   19 +--
 4 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit d34036e60c4e7d13feccd089f7749d35d956b358
Author: Miklos Vajna 
AuthorDate: Tue Nov 29 09:14:08 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 29 11:32:14 2022 +0100

SVG import: add support for semi-transparent text

 from SVG was ignored so far, only taking RGB
colors from the 'fill' attribute, but ignoring transparency.

The problem is that an SVG file is imported by mapping it to
drawinglayer primitives, but TextSimplePortionPrimitive2D takes a
basegfx::BColor as the font color, which doesn't handle transparency.

Fix the problem by rendering SVG similar to how commit
81b0d5393ca4cf2ff0954e53b05928cde047c2e0 (svx: add rendering for
semi-transparent shape text, 2019-11-20) did it for shape text: wrap the
text primitive in a UnifiedTransparencePrimitive2D when opacity is not
1.

Note that the drawinglayer primitive works with transparency and SVG
works with opacity, which is the opposite of each other, but both are
0..1 ranges.

Change-Id: If5c48613b70eac662b54b8c9da835cd0a966ba89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143429
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 50ecda7e3a89..738ddf4d9e73 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -123,7 +123,7 @@ namespace svgio::svgreader
 OUString   maText;
 
 /// local helpers
-
rtl::Reference 
createSimpleTextPrimitive(
+rtl::Reference 
createSimpleTextPrimitive(
 SvgTextPosition& rSvgTextPosition,
 const SvgStyleAttributes& rSvgStyleAttributes) const;
 void decomposeTextWithStyle(
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 9d9fb93dc8c1..cf678964b996 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -84,6 +84,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testTdf97663();
 void testTdf149880();
 void testCssClassRedefinition();
+void testTspanFillOpacity();
 
 Primitive2DSequence parseSvg(std::u16string_view aSource);
 
@@ -134,6 +135,7 @@ public:
 CPPUNIT_TEST(testTdf97663);
 CPPUNIT_TEST(testTdf149880);
 CPPUNIT_TEST(testCssClassRedefinition);
+CPPUNIT_TEST(testTspanFillOpacity);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1127,6 +1129,28 @@ void Test::testCssClassRedefinition()
 pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"familyname", "Open Symbol");
 }
 
+void Test::testTspanFillOpacity()
+{
+// Given an SVG file with :
+std::u16string_view aPath = 
u"/svgio/qa/cppunit/data/tspan-fill-opacity.svg";
+
+// When rendering that SVG:
+Primitive2DSequence aSequence = parseSvg(aPath);
+
+// Then make sure that the text portion is wrapped in a transparency 
primitive with the correct
+// transparency value:
+drawinglayer::Primitive2dXmlDump aDumper;
+xmlDocUniquePtr pDocument = 
aDumper.dumpAndParse(Primitive2DContainer(aSequence));
+sal_Int32 nTransparence = getXPath(pDocument, 
"//textsimpleportion[@text='hello']/parent::unifiedtransparence", 
"transparence").toInt32();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// - XPath 
'//textsimpleportion[@text='hello']/parent::unifiedtransparence' number of 
nodes is incorrect
+// i.e. the relevant  had no  
parent, the text was not
+// semi-transparent.
+CPPUNIT_ASSERT_EQUAL(static_cast(70), nTransparence);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/svgio/qa/cppunit/data/tspan-fill-opacity.svg 
b/svgio/qa/cppunit/data/tspan-fill-opacity.svg
new file mode 100644
index ..ef6d5352a8d2
--- /dev/null
+++ b/svgio/qa/cppunit/data/tspan-fill-opacity.svg
@@ -0,0 +1,15 @@
+
+http://www.w3.org/2000/svg; 
xmlns:presentation="http://sun.com/xmlns/staroffice/presentation; 
xmlns:smil="http://www.w3.org/2001/SMIL20/; 
xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xml:space="preserve">
+  
+
+
+  
+
+  
+  
+
+
+  hello
+
+  
+
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index d2949d5a0630..4ca8a3468c02 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -24,6 +24,7 @@
 #include 
 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-09-28 Thread Noel Grandin (via logerrit)
 svgio/inc/svgcharacternode.hxx|2 
 svgio/inc/svgnode.hxx |2 
 svgio/inc/svgstyleattributes.hxx  |2 
 svgio/inc/svgstylenode.hxx|6 +-
 svgio/inc/svgtools.hxx|   14 ++---
 svgio/source/svgreader/svgcharacternode.cxx   |   14 ++---
 svgio/source/svgreader/svgnode.cxx|2 
 svgio/source/svgreader/svgstyleattributes.cxx |4 -
 svgio/source/svgreader/svgstylenode.cxx   |   16 +++---
 svgio/source/svgreader/svgtools.cxx   |   66 +-
 10 files changed, 64 insertions(+), 64 deletions(-)

New commits:
commit a63fcd0916ebe51d866ed1113babd1a521c175c6
Author: Noel Grandin 
AuthorDate: Wed Sep 28 15:00:44 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 28 16:04:46 2022 +0200

use more string_view in svgio

Change-Id: I30d2f02941673ce33febc4e0f563e77b80a585fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140707
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 9558e7b752b9..50ecda7e3a89 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -45,7 +45,7 @@ namespace svgio::svgreader
 public:
 SvgTextPositions();
 
-void parseTextPositionAttributes(SVGToken aSVGToken, const 
OUString& aContent);
+void parseTextPositionAttributes(SVGToken aSVGToken, 
std::u16string_view aContent);
 
 /// X content
 const SvgNumberVector& getX() const { return maX; }
diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 54016aa34e99..4bdbd3046d75 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -137,7 +137,7 @@ namespace svgio::svgreader
 void accept(Visitor& rVisitor);
 
 /// scan helper to read and interpret a local CssStyle to 
mpLocalCssStyle
-void readLocalCssStyle(const OUString& aContent);
+void readLocalCssStyle(std::u16string_view aContent);
 
 /// style helpers
 void parseAttributes(const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttribs);
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 529e91b75b8e..4455f2311b69 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -297,7 +297,7 @@ namespace svgio::svgreader
 const SvgStyleAttributes* getCssStyleParent() const { return 
mpCssStyleParent; }
 
 /// scan helpers
-void readCssStyle(const OUString& rCandidate);
+void readCssStyle(std::u16string_view rCandidate);
 const SvgStyleAttributes* getParentStyle() const;
 
 SvgStyleAttributes(SvgNode& rOwner);
diff --git a/svgio/inc/svgstylenode.hxx b/svgio/inc/svgstylenode.hxx
index 1a5a43ca858c..8a70d0ec4767 100644
--- a/svgio/inc/svgstylenode.hxx
+++ b/svgio/inc/svgstylenode.hxx
@@ -44,9 +44,9 @@ namespace svgio::svgreader
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 
 /// CssStyleSheet add helpers
-void addCssStyleSheet(const OUString& aSelectors, const 
SvgStyleAttributes& rNewStyle);
-void addCssStyleSheet(const OUString& aSelectors, const OUString& 
aContent);
-void addCssStyleSheet(const OUString& aSelectorsAndContent);
+void addCssStyleSheet(std::u16string_view aSelectors, const 
SvgStyleAttributes& rNewStyle);
+void addCssStyleSheet(std::u16string_view aSelectors, 
std::u16string_view aContent);
+void addCssStyleSheet(std::u16string_view aSelectorsAndContent);
 
 /// textCss access
 bool isTextCss() const { return mbTextCss; }
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 4147344b4640..fd9bdd396d9d 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -108,20 +108,20 @@ namespace svgio::svgreader
 sal_Int32 read_hex(sal_Unicode aChar);
 bool match_colorKeyword(basegfx::BColor& rColor, const OUString& 
rName);
 bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
SvgNumber& rOpacity);
-basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider 
const & rInfoProvider);
-basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider const & rInfoProvider);
-bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum);
-bool readLocalLink(const OUString& rCandidate, OUString& rURL);
+basegfx::B2DRange readViewBox(std::u16string_view rCandidate, 
InfoProvider const & rInfoProvider);
+basegfx::B2DHomMatrix readTransform(std::u16string_view rCandidate, 
InfoProvider const & rInfoProvider);
+bool readSingleNumber(std::u16string_view rCandidate, SvgNumber& 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-09-23 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtools.hxx  |1 
 svgio/source/svgreader/svgtools.cxx |   52 ++--
 2 files changed, 3 insertions(+), 50 deletions(-)

New commits:
commit dcb991bbc6a1a66103b3c0fbc6e996a27e3e90b1
Author: Xisco Fauli 
AuthorDate: Fri Sep 23 12:47:38 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 23 14:41:41 2022 +0200

svgio: Simplify by using replaceAll

Change-Id: Id805787c5b5a812c6fd4fbfe3c3b2905578ce3bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140482
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 66570f00df78..4147344b4640 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -125,7 +125,6 @@ namespace svgio::svgreader
 
 void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rMimeType, OUString& rData);
 
-OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew, bool bRemove);
 OUString consolidateContiguousSpace(const OUString& rCandidate);
 OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault);
 
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index 02a37dc0e8b4..c0bee33995a0 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1375,46 +1375,6 @@ namespace svgio::svgreader
 }
 }
 
-OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew, bool bRemove)
-{
-const sal_Int32 nLen(rCandidate.getLength());
-
-if(nLen)
-{
-sal_Int32 nPos(0);
-OUStringBuffer aBuffer;
-bool bChanged(false);
-
-while(nPos < nLen)
-{
-const sal_Unicode aChar(rCandidate[nPos]);
-
-if(nPattern == aChar)
-{
-bChanged = true;
-
-if(!bRemove)
-{
-aBuffer.append(nNew);
-}
-}
-else
-{
-aBuffer.append(aChar);
-}
-
-nPos++;
-}
-
-if(bChanged)
-{
-return aBuffer.makeStringAndClear();
-}
-}
-
-return rCandidate;
-}
-
 // #i125325#
 OUString removeBlockComments(const OUString& rCandidate)
 {
@@ -1515,15 +1475,9 @@ namespace svgio::svgreader
 
 OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault)
 {
-const sal_Unicode aNewline('\n');
-const sal_Unicode aTab('\t');
-const sal_Unicode aSpace(' ');
-
-// remove all newline characters
-OUString aRetval(convert(rCandidate, aNewline, aSpace, 
bIsDefault));
-
-// convert tab to space
-aRetval = convert(aRetval, aTab, aSpace, false);
+// if xml:space="default" then remove all newline characters, 
otherwise convert them to space
+// convert tab to space too
+OUString aRetval(rCandidate.replaceAll(u"\n", bIsDefault ? u"" : 
u" ").replaceAll(u"\t", u" "));
 
 if(bIsDefault)
 {


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-09-23 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtools.hxx  |2 +-
 svgio/qa/cppunit/SvgImportTest.cxx  |8 +---
 svgio/qa/cppunit/data/textXmlSpace.svg  |   10 +++---
 svgio/source/svgreader/svgcharacternode.cxx |9 +
 svgio/source/svgreader/svgtools.cxx |   12 
 5 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit bdebe856d110700d757625f121879de920b9ef46
Author: Xisco Fauli 
AuthorDate: Thu Sep 22 16:49:30 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 23 12:24:01 2022 +0200

tdf#151118: svg: don't replace newline with space when xml:space="default"

Partially revert ddf695db44bcb23dc2f1459fd439f93c0b6d5f2a
"tdf#151118: svg: fix handling of xml:space="preserve""

See discussion in https://gerrit.libreoffice.org/c/core/+/140404

Thanks to Mike Kaganski for spotting it

Change-Id: Ifdd26b8de2f5cc392127f215e148599ae63036dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140444
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 0a4e200c746b..66570f00df78 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -125,7 +125,7 @@ namespace svgio::svgreader
 
 void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rMimeType, OUString& rData);
 
-OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew);
+OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew, bool bRemove);
 OUString consolidateContiguousSpace(const OUString& rCandidate);
 OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault);
 
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 23734777cf2c..d2cc7bd90828 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -436,9 +436,11 @@ void Test::testTextXmlSpace()
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"text", "a b");
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"text", "a b");
 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"text", "a b");
-assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"text", "a  b");
-assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", 
"text", "a b");
-assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", 
"text", "a   b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"text", "ab");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", 
"text", "a  b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", 
"text", "a b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[7]", 
"text", "a   b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[8]", 
"text", "a b");
 }
 
 void Test::testTdf45771()
diff --git a/svgio/qa/cppunit/data/textXmlSpace.svg 
b/svgio/qa/cppunit/data/textXmlSpace.svg
index 606e2eb7a306..f200d74dd3f3 100644
--- a/svgio/qa/cppunit/data/textXmlSpace.svg
+++ b/svgio/qa/cppunit/data/textXmlSpace.svg
@@ -4,9 +4,13 @@
   a   b
   a
   b
-  a  b
-  a  b
-  a
+  a
+b
+  a  b
+  a b
+  a
   b
+  a
+b
 
 
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 456a3abc8013..9e6f91aa9dd2 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -539,14 +539,7 @@ namespace svgio::svgreader
 
 void SvgCharacterNode::whiteSpaceHandling()
 {
-if (XmlSpace::Default == getXmlSpace())
-{
-maText = xmlSpaceHandling(maText, true);
-}
-else
-{
-maText = xmlSpaceHandling(maText, false);
-}
+maText = xmlSpaceHandling(maText, XmlSpace::Default == 
getXmlSpace());
 }
 
 void SvgCharacterNode::concatenate(std::u16string_view rText)
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index 92b2ecab3fb3..eeca00ac3330 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1375,7 +1375,7 @@ namespace svgio::svgreader
 }
 }
 
-OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew)
+OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew, bool bRemove)
 {
 const sal_Int32 nLen(rCandidate.getLength());
 
@@ -1392,7 +1392,11 @@ namespace svgio::svgreader
 if(nPattern == aChar)
 {
 bChanged = true;
-

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-09-22 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtools.hxx  |5 +--
 svgio/qa/cppunit/SvgImportTest.cxx  |   21 
 svgio/qa/cppunit/data/textXmlSpace.svg  |   12 +
 svgio/source/svgreader/svgcharacternode.cxx |4 +--
 svgio/source/svgreader/svgtools.cxx |   36 +++-
 5 files changed, 47 insertions(+), 31 deletions(-)

New commits:
commit ddf695db44bcb23dc2f1459fd439f93c0b6d5f2a
Author: Xisco Fauli 
AuthorDate: Thu Sep 22 10:59:29 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Sep 22 13:43:59 2022 +0200

tdf#151118: svg: fix handling of xml:space="preserve"

This allows the code to be simplified a bit

Change-Id: If42dd9d3ebd7860ece9ff78cb090ff1b07e1b432
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140404
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index a5a0b3aa418b..0a4e200c746b 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -125,10 +125,9 @@ namespace svgio::svgreader
 
 void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rMimeType, OUString& rData);
 
-OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew, bool bRemove);
+OUString convert(const OUString& rCandidate, sal_Unicode nPattern, 
sal_Unicode nNew);
 OUString consolidateContiguousSpace(const OUString& rCandidate);
-OUString whiteSpaceHandlingDefault(const OUString& rCandidate);
-OUString whiteSpaceHandlingPreserve(const OUString& rCandidate);
+OUString xmlSpaceHandling(const OUString& rCandidate, bool bIsDefault);
 
 // #125325# removes block comment of the general form '/* ... */', 
returns
 // an adapted string or the original if no comments included
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 07a98f4a5a2f..23734777cf2c 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -48,6 +48,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testMarkerOrient();
 void testMarkerInPresentation();
 void testMarkerInCssStyle();
+void testTextXmlSpace();
 void testTdf45771();
 void testTdf97941();
 void testTdf104339();
@@ -97,6 +98,7 @@ public:
 CPPUNIT_TEST(testMarkerOrient);
 CPPUNIT_TEST(testMarkerInPresentation);
 CPPUNIT_TEST(testMarkerInCssStyle);
+CPPUNIT_TEST(testTextXmlSpace);
 CPPUNIT_TEST(testTdf45771);
 CPPUNIT_TEST(testTdf97941);
 CPPUNIT_TEST(testTdf104339);
@@ -420,6 +422,25 @@ void Test::testMarkerInCssStyle()
 assertXPath(pDocument, 
"/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", 
"BUTT");
 }
 
+void Test::testTextXmlSpace()
+{
+//Check tspan fontsize when using relative units
+Primitive2DSequence aSequenceTdf97941 = 
parseSvg(u"/svgio/qa/cppunit/data/textXmlSpace.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceTdf97941.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf97941);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"text", "a b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"text", "a b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"text", "a b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"text", "a  b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", 
"text", "a b");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", 
"text", "a   b");
+}
+
 void Test::testTdf45771()
 {
 //Check text fontsize when using relative units
diff --git a/svgio/qa/cppunit/data/textXmlSpace.svg 
b/svgio/qa/cppunit/data/textXmlSpace.svg
new file mode 100644
index ..606e2eb7a306
--- /dev/null
+++ b/svgio/qa/cppunit/data/textXmlSpace.svg
@@ -0,0 +1,12 @@
+http://www.w3.org/2000/svg; version="1.1"
+   viewBox="0 0 250 250">
+  a  b
+  a   b
+  a
+  b
+  a  b
+  a  b
+  a
+  b
+
+
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 31376ee179a8..456a3abc8013 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -541,11 +541,11 @@ namespace svgio::svgreader
 {
 if (XmlSpace::Default == getXmlSpace())
 {
-maText = whiteSpaceHandlingDefault(maText);
+maText = xmlSpaceHandling(maText, true);
 }
 else
 {
-maText = whiteSpaceHandlingPreserve(maText);
+maText = xmlSpaceHandling(maText, false);
 }
 }
 
diff --git 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-09-21 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgcharacternode.hxx|1 
 svgio/qa/cppunit/SvgImportTest.cxx|   20 +++
 svgio/qa/cppunit/data/tdf103888.svg   |   11 ++
 svgio/source/svgreader/svgcharacternode.cxx   |5 --
 svgio/source/svgreader/svgdocumenthandler.cxx |   44 ++
 5 files changed, 34 insertions(+), 47 deletions(-)

New commits:
commit a42f5faac7c6d4590e632cf40e3ba9eb618e6f56
Author: Xisco Fauli 
AuthorDate: Wed Sep 21 17:25:17 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Sep 21 21:04:40 2022 +0200

tdf#103888: Do not add a gap at the end of each text portion

I can't think of any situation where it's needed

Change-Id: I1c2c6ec3d22eb9263f3c3c20793d9fe3926b8d78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140351
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index b7a0a9a254c9..9558e7b752b9 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -141,7 +141,6 @@ namespace svgio::svgreader
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
 void 
decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, 
SvgTextPosition& rSvgTextPosition) const;
 void whiteSpaceHandling();
-void addGap();
 void concatenate(std::u16string_view rText);
 
 /// Text content
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 7db9c8335b1f..07a98f4a5a2f 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -73,6 +73,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void test123926();
 void test47446();
 void test47446b();
+void testTdf103888();
 void testMaskText();
 void testTdf4();
 void testTdf99115();
@@ -121,6 +122,7 @@ public:
 CPPUNIT_TEST(test123926);
 CPPUNIT_TEST(test47446);
 CPPUNIT_TEST(test47446b);
+CPPUNIT_TEST(testTdf103888);
 CPPUNIT_TEST(testMaskText);
 CPPUNIT_TEST(testTdf4);
 CPPUNIT_TEST(testTdf99115);
@@ -479,7 +481,7 @@ void Test::testTdf85770()
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "11");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"familyname", "Times New Roman");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"fontcolor", "#00");
-assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "Start ");
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"text", "Start");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"height", "11");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"familyname", "Times New Roman");
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", 
"fontcolor", "#00");
@@ -846,6 +848,22 @@ void Test::test47446b()
 
 }
 
+void Test::testTdf103888()
+{
+Primitive2DSequence aSequenceMaskText = 
parseSvg(u"/svgio/qa/cppunit/data/tdf103888.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceMaskText.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskText));
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed here with number 
of nodes is incorrect
+assertXPath(pDocument, 
"/primitive2D/transform/transform/textsimpleportion[1]", "text", "Her");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/textsimpleportion[2]", "text", "vor");
+assertXPath(pDocument, 
"/primitive2D/transform/transform/textsimpleportion[3]", "text", "hebung");
+}
+
 void Test::testMaskText()
 {
 //Check that mask is applied on text
diff --git a/svgio/qa/cppunit/data/tdf103888.svg 
b/svgio/qa/cppunit/data/tdf103888.svg
new file mode 100644
index ..1663fa395e40
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf103888.svg
@@ -0,0 +1,11 @@
+
+
+http://www.w3.org/2000/svg; version="1.1"
+   width="75mm"
+   height="15mm"
+   viewBox="0 0 250 50">
+  Hervorhebung
+
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 0a4731b200d5..31376ee179a8 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -549,11 +549,6 @@ namespace svgio::svgreader
 }
 }
 
-void SvgCharacterNode::addGap()
-{
-maText += " ";
-}
-
 void SvgCharacterNode::concatenate(std::u16string_view rText)
 {
 maText += rText;
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 288b0205397d..dc2dd6fa7c6b 100644
--- 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-07-29 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx  |3 +
 svgio/qa/cppunit/SvgImportTest.cxx|   24 ++
 svgio/qa/cppunit/data/ClipRule.svg|   18 ++
 svgio/source/svgreader/svgstyleattributes.cxx |   44 +++---
 4 files changed, 78 insertions(+), 11 deletions(-)

New commits:
commit 4f61276dae10fdaf2ed33ab23d98adbe311cb7ee
Author: Xisco Fauli 
AuthorDate: Thu Jul 28 18:37:32 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 29 08:21:59 2022 +0200

svgio: Add support for clip-rule="evenodd"

Change-Id: I028aa88bdd72b4f87526a3d1edabd612d7686571
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137577
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 8489430b7546..529e91b75b8e 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -338,6 +338,9 @@ namespace svgio::svgreader
 /// fill rule content
 FillRule getFillRule() const;
 
+/// clip rule content
+FillRule getClipRule() const;
+
 /// fill StrokeDasharray content
 const SvgNumberVector& getStrokeDasharray() const;
 
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index f23556ee621c..8037f850768a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -66,6 +66,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testShapeWithClipPath();
 void testClipPathUsingClipPath();
 void testFillRule();
+void testClipRule();
 void testi125329();
 void testMaskingPath07b();
 void test123926();
@@ -112,6 +113,7 @@ public:
 CPPUNIT_TEST(testShapeWithClipPath);
 CPPUNIT_TEST(testClipPathUsingClipPath);
 CPPUNIT_TEST(testFillRule);
+CPPUNIT_TEST(testClipRule);
 CPPUNIT_TEST(testi125329);
 CPPUNIT_TEST(testMaskingPath07b);
 CPPUNIT_TEST(test123926);
@@ -719,6 +721,28 @@ void Test::testFillRule()
 assertXPath(pDocument, 
"/primitive2D/transform/polypolygonstroke/polypolygon/polygon", 2);
 }
 
+void Test::testClipRule()
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/ClipRule.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the place in place, this test would have failed with
+// - Expected: 5
+// - Actual  : 10
+assertXPath(pDocument, 
"/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5);
+assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", 
"color", "#ff");
+assertXPath(pDocument, 
"/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 5);
+
+assertXPath(pDocument, 
"/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5);
+assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", 
"color", "#ff");
+assertXPath(pDocument, 
"/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 5);
+}
+
 void Test::testi125329()
 {
 //Check style inherit from * css element
diff --git a/svgio/qa/cppunit/data/ClipRule.svg 
b/svgio/qa/cppunit/data/ClipRule.svg
new file mode 100644
index ..55f0cb9eee3a
--- /dev/null
+++ b/svgio/qa/cppunit/data/ClipRule.svg
@@ -0,0 +1,18 @@
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink;>
+  
+  
+
+  
+  
+
+  
+  
+
+  
+
+  
+  
+
+
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 6ad1b1d25cc2..c787c4dffa92 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1125,17 +1125,18 @@ namespace svgio::svgreader
 {
 // create fill
 basegfx::B2DPolyPolygon aPath(rPath);
-const bool bNeedToCheckClipRule(SVGToken::Path == 
mrOwner.getType() || SVGToken::Polygon == mrOwner.getType());
-const bool bClipPathIsNonzero(bNeedToCheckClipRule && 
mbIsClipPathContent && FillRule::nonzero == maClipRule);
-const bool bFillRuleIsNonzero(bNeedToCheckClipRule && 
!mbIsClipPathContent && FillRule::nonzero == getFillRule());
 
-if(bClipPathIsNonzero || bFillRuleIsNonzero)
+if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == 
mrOwner.getType())
 {
-if(getFill() || getSvgGradientNodeFill() || 
getSvgPatternNodeFill()) {
-// nonzero is wanted, solve geometrically (see 
description on basegfx)
-// basegfx::utils::createNonzeroConform() is expensive 
for huge paths
-// 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-07-16 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx   |2 -
 svgio/qa/cppunit/SvgImportTest.cxx |   17 ++
 svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg |   13 
 svgio/source/svgreader/svgstyleattributes.cxx  |   27 +
 4 files changed, 53 insertions(+), 6 deletions(-)

New commits:
commit 82c0a363abbceac6464b62c3571aa3225415c7db
Author: Xisco Fauli 
AuthorDate: Fri Jul 15 02:14:53 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 15 19:10:12 2022 +0200

tdf#97539; if parent is css style, look one level up

if the style attributes are set like

  

it works, however, if it uses a css style like

  

it fails to get the clipPath from the parent, because the css style
is the direct parent, thus, check one level up

Change-Id: Iff6df95c9fa9da4c2f1a986cca0ad82ab1494353
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137094
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 87c17647eeb8..8489430b7546 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -411,7 +411,7 @@ namespace svgio::svgreader
 const OUString& getDesc() const { return maDesc; }
 
 // ClipPathXLink content
-OUString const & getClipPathXLink() const;
+OUString getClipPathXLink() const;
 const SvgClipPathNode* accessClipPathXLink() const;
 
 // MaskXLink content
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 13f135460017..4724b3a6c8eb 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -59,6 +59,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testNoneColor();
 void testTdf97936();
 void testTdf149893();
+void testShapeWithClipPathAndCssStyle();
 void testClipPathAndParentStyle();
 void testClipPathAndStyle();
 void testShapeWithClipPath();
@@ -101,6 +102,7 @@ public:
 CPPUNIT_TEST(testNoneColor);
 CPPUNIT_TEST(testTdf97936);
 CPPUNIT_TEST(testTdf149893);
+CPPUNIT_TEST(testShapeWithClipPathAndCssStyle);
 CPPUNIT_TEST(testClipPathAndParentStyle);
 CPPUNIT_TEST(testClipPathAndStyle);
 CPPUNIT_TEST(testShapeWithClipPath);
@@ -598,6 +600,21 @@ void Test::testTdf149893()
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#008000");
 }
 
+void Test::testShapeWithClipPathAndCssStyle()
+{
+// tdf#97539: Check there is a mask and 3 polygons
+Primitive2DSequence aSequenceClipPathAndStyle = 
parseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg");
+CPPUNIT_ASSERT_EQUAL(1, 
static_cast(aSequenceClipPathAndStyle.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon", 
2);
+assertXPath(pDocument, 
"/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
+}
+
 void Test::testClipPathAndParentStyle()
 {
 //Check that fill color, stroke color and stroke-width are inherited from 
use element
diff --git a/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg 
b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg
new file mode 100644
index ..4b6455c64930
--- /dev/null
+++ b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg
@@ -0,0 +1,13 @@
+
+http://www.w3.org/2000/svg;>
+
+  
+   
+
+  
+
+  
+
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 822ea4c65994..6b676cd952f7 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1196,11 +1196,10 @@ namespace svgio::svgreader
 }
 
 const SvgClipPathNode* pClip = accessClipPathXLink();
-while(pClip)
+if(pClip)
 {
 // #i124852# transform may be needed when 
SvgUnits::userSpaceOnUse
 pClip->apply(aSource, pTransform);
-pClip = pClip->getSvgStyleAttributes()->accessClipPathXLink();
 }
 
 if(!aSource.empty()) // test again, applied clipPath may have lead 
to empty geometry
@@ -1278,7 +1277,7 @@ namespace svgio::svgreader
 maClipRule(FillRule::nonzero),
 maBaselineShift(BaselineShift::Baseline),
 maBaselineShiftNumber(0),
-maResolvingParent(30, 0),
+maResolvingParent(31, 0),
 mbIsClipPathContent(SVGToken::ClipPathNode == mrOwner.getType()),
 mbStrokeDasharraySet(false)
 {
@@ -2812,9 +2811,27 @@ namespace svgio::svgreader
 return 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-07-15 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgstyleattributes.hxx   |3 +--
 svgio/source/svgreader/svganode.cxx|2 +-
 svgio/source/svgreader/svgcirclenode.cxx   |2 +-
 svgio/source/svgreader/svgclippathnode.cxx |2 +-
 svgio/source/svgreader/svgellipsenode.cxx  |2 +-
 svgio/source/svgreader/svggnode.cxx|2 +-
 svgio/source/svgreader/svggradientnode.cxx |2 +-
 svgio/source/svgreader/svggradientstopnode.cxx |2 +-
 svgio/source/svgreader/svgimagenode.cxx|2 +-
 svgio/source/svgreader/svglinenode.cxx |2 +-
 svgio/source/svgreader/svgmarkernode.cxx   |2 +-
 svgio/source/svgreader/svgmasknode.cxx |2 +-
 svgio/source/svgreader/svgpathnode.cxx |2 +-
 svgio/source/svgreader/svgpatternnode.cxx  |2 +-
 svgio/source/svgreader/svgpolynode.cxx |2 +-
 svgio/source/svgreader/svgrectnode.cxx |2 +-
 svgio/source/svgreader/svgstyleattributes.cxx  |7 +++
 svgio/source/svgreader/svgsvgnode.cxx  |2 +-
 svgio/source/svgreader/svgsymbolnode.cxx   |2 +-
 svgio/source/svgreader/svgtextnode.cxx |2 +-
 svgio/source/svgreader/svgtextpathnode.cxx |2 +-
 svgio/source/svgreader/svgtrefnode.cxx |2 +-
 svgio/source/svgreader/svgtspannode.cxx|2 +-
 svgio/source/svgreader/svgusenode.cxx  |2 +-
 24 files changed, 26 insertions(+), 28 deletions(-)

New commits:
commit 242b7d0162d55be0945ca849c3de841fbf6cb475
Author: Xisco Fauli 
AuthorDate: Fri Jul 15 09:27:10 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 15 10:38:08 2022 +0200

svgio: simplify code

Change-Id: I100256b63fadeb4a0e4b8e4cbb67e58d2a1ce433
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137096
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index edba8d0c539f..87c17647eeb8 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -277,8 +277,7 @@ namespace svgio::svgreader
 
 public:
 /// local attribute scanner
-void parseStyleAttribute(SVGToken aSVGToken, const OUString& 
rContent,
- bool bCaseIndependent);
+void parseStyleAttribute(SVGToken aSVGToken, const OUString& 
rContent);
 
 /// helper which does the necessary with a given path
 void add_text(
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index d634be369441..5d992a3d28ef 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -44,7 +44,7 @@ namespace svgio::svgreader
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
 
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svgcirclenode.cxx 
b/svgio/source/svgreader/svgcirclenode.cxx
index a9f8fa75941e..0ec940f9f737 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -50,7 +50,7 @@ namespace svgio::svgreader
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
 
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svgclippathnode.cxx 
b/svgio/source/svgreader/svgclippathnode.cxx
index 3d814694db64..764c874dbe5f 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -53,7 +53,7 @@ namespace svgio::svgreader
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
 
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svgellipsenode.cxx 
b/svgio/source/svgreader/svgellipsenode.cxx
index 2317648ef808..b6208dd3b4db 100644
--- a/svgio/source/svgreader/svgellipsenode.cxx
+++ b/svgio/source/svgreader/svgellipsenode.cxx
@@ -51,7 +51,7 @@ namespace svgio::svgreader
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
 
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svggnode.cxx 
b/svgio/source/svgreader/svggnode.cxx

[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-07-14 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtools.hxx |1 +
 svgio/source/svgreader/svggradientnode.cxx |9 ++---
 svgio/source/svgreader/svgpatternnode.cxx  |9 ++---
 svgio/source/svgreader/svgtextpathnode.cxx |7 +--
 svgio/source/svgreader/svgtools.cxx|   25 +++--
 svgio/source/svgreader/svgtrefnode.cxx |7 +--
 svgio/source/svgreader/svgusenode.cxx  |7 +--
 7 files changed, 27 insertions(+), 38 deletions(-)

New commits:
commit a5d3238104a46f933584cc2a896b00bae82bf4ec
Author: Xisco Fauli 
AuthorDate: Thu Jul 14 12:39:42 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 14 14:34:21 2022 +0200

svgio: factor out common code

Also skip spaces before the #, Something like
xlink:href=" #target" is still valid

Change-Id: Ia62e58ca31bfecd283776ec84fcc4bba1836afab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137074
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index f5e2e03573e6..a5a0b3aa418b 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -111,6 +111,7 @@ namespace svgio::svgreader
 basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider 
const & rInfoProvider);
 basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider const & rInfoProvider);
 bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum);
+bool readLocalLink(const OUString& rCandidate, OUString& rURL);
 bool readLocalUrl(const OUString& rCandidate, OUString& rURL);
 bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, SvgNumber& rOpacity);
 
diff --git a/svgio/source/svgreader/svggradientnode.cxx 
b/svgio/source/svgreader/svggradientnode.cxx
index a6f99f7e5009..7355a1ee22fd 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -215,13 +215,8 @@ namespace svgio::svgreader
 case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
-const sal_Int32 nLen(aContent.getLength());
-
-if(nLen && '#' == aContent[0])
-{
-maXLink = aContent.copy(1);
-tryToFindLink();
-}
+readLocalLink(aContent, maXLink);
+tryToFindLink();
 break;
 }
 default:
diff --git a/svgio/source/svgreader/svgpatternnode.cxx 
b/svgio/source/svgreader/svgpatternnode.cxx
index c8dad353713f..b2f4785b4631 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -170,13 +170,8 @@ namespace svgio::svgreader
 case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
-const sal_Int32 nLen(aContent.getLength());
-
-if(nLen && '#' == aContent[0])
-{
-maXLink = aContent.copy(1);
-tryToFindLink();
-}
+readLocalLink(aContent, maXLink);
+tryToFindLink();
 break;
 }
 default:
diff --git a/svgio/source/svgreader/svgtextpathnode.cxx 
b/svgio/source/svgreader/svgtextpathnode.cxx
index 43fccfa4308f..3c5471bbd946 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -295,12 +295,7 @@ namespace svgio::svgreader
 case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
-const sal_Int32 nLen(aContent.getLength());
-
-if(nLen && '#' == aContent[0])
-{
-maXLink = aContent.copy(1);
-}
+readLocalLink(aContent, maXLink);
 break;
 }
 default:
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index c559bd620fbf..7ab816f9a84d 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1057,6 +1057,24 @@ namespace svgio::svgreader
 return readNumberAndUnit(rCandidate, nPos, aNum, nLen);
 }
 
+bool readLocalLink(const OUString& rCandidate, OUString& rURL)
+{
+sal_Int32 nPos(0);
+const sal_Int32 nLen(rCandidate.getLength());
+
+skip_char(rCandidate, ' ', nPos, nLen);
+
+if(nLen && '#' == rCandidate[nPos])
+{
+++nPos;
+rURL = rCandidate.copy(nPos);
+
+return true;
+}
+
+return false;
+}
+
 bool readLocalUrl(const OUString& rCandidate, OUString& rURL)
 {

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-07-13 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtoken.hxx |1 +
 svgio/qa/cppunit/data/ClipPathAndStyle.svg |4 ++--
 svgio/source/svgreader/svganode.cxx|1 +
 svgio/source/svgreader/svggradientnode.cxx |1 +
 svgio/source/svgreader/svgimagenode.cxx|1 +
 svgio/source/svgreader/svgpatternnode.cxx  |1 +
 svgio/source/svgreader/svgtextpathnode.cxx |1 +
 svgio/source/svgreader/svgtoken.cxx|2 ++
 svgio/source/svgreader/svgtrefnode.cxx |1 +
 svgio/source/svgreader/svgusenode.cxx  |1 +
 10 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 5169378d2a0f0a25013c8a4387a6e3cb1a4a55e9
Author: Xisco Fauli 
AuthorDate: Wed Jul 13 17:03:55 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 13 20:04:57 2022 +0200

svgio: use href along with xlink:href

xlink:href has been deprecated.
See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href

Change-Id: I622cd975c0bcc1a819831d7b9c867312ff59affa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137035
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 16b7aad5f696..0a24d272be5f 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -153,6 +153,7 @@ namespace svgio::svgreader
 GradientUnits,
 GradientTransform,
 SpreadMethod,
+Href,
 XlinkHref,
 StopColor,
 StopOpacity,
diff --git a/svgio/qa/cppunit/data/ClipPathAndStyle.svg 
b/svgio/qa/cppunit/data/ClipPathAndStyle.svg
index 29814fadbb86..f3b1777fa5fa 100644
--- a/svgio/qa/cppunit/data/ClipPathAndStyle.svg
+++ b/svgio/qa/cppunit/data/ClipPathAndStyle.svg
@@ -8,6 +8,6 @@
  fill  : #ff;"/>
   
 
-  
+  
 
-
\ No newline at end of file
+
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index aa473eb9187f..d634be369441 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -64,6 +64,7 @@ namespace svgio::svgreader
 }
 break;
 }
+case SVGToken::Href:
 case SVGToken::XlinkHref:
 //TODO: add support for xlink:href
 break;
diff --git a/svgio/source/svgreader/svggradientnode.cxx 
b/svgio/source/svgreader/svggradientnode.cxx
index db80e8a5c1ae..a6f99f7e5009 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -212,6 +212,7 @@ namespace svgio::svgreader
 }
 break;
 }
+case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
 const sal_Int32 nLen(aContent.getLength());
diff --git a/svgio/source/svgreader/svgimagenode.cxx 
b/svgio/source/svgreader/svgimagenode.cxx
index 2e8c05b0c9f5..1d6fd654bc61 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -134,6 +134,7 @@ namespace svgio::svgreader
 }
 break;
 }
+case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
 const sal_Int32 nLen(aContent.getLength());
diff --git a/svgio/source/svgreader/svgpatternnode.cxx 
b/svgio/source/svgreader/svgpatternnode.cxx
index 1e53cc8b2337..c8dad353713f 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -167,6 +167,7 @@ namespace svgio::svgreader
 }
 break;
 }
+case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
 const sal_Int32 nLen(aContent.getLength());
diff --git a/svgio/source/svgreader/svgtextpathnode.cxx 
b/svgio/source/svgreader/svgtextpathnode.cxx
index 129b2c280b88..43fccfa4308f 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -292,6 +292,7 @@ namespace svgio::svgreader
 {
 break;
 }
+case SVGToken::Href:
 case SVGToken::XlinkHref:
 {
 const sal_Int32 nLen(aContent.getLength());
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index e3c4f85f1436..0b03e2c3f0cd 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -141,6 +141,7 @@ namespace svgio::svgreader
 const char aSVGStrGradientUnits[] = "gradientUnits";
 const char aSVGStrGradientTransform[] = "gradientTransform";
 const char aSVGStrSpreadMethod[] = "spreadMethod";
+const char aSVGStrHref[] = "href";
 const char aSVGStrXlinkHref[] = "xlink:href";
 const char 

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-07-08 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgmarkernode.hxx   |   17 +
 svgio/qa/cppunit/SvgImportTest.cxx|   33 ++
 svgio/qa/cppunit/data/MarkerOrient.svg|   22 +
 svgio/source/svgreader/svgmarkernode.cxx  |8 --
 svgio/source/svgreader/svgstyleattributes.cxx |   13 +++---
 5 files changed, 83 insertions(+), 10 deletions(-)

New commits:
commit 6dd0074e5e42467a7f82e363f67ca95d04466fa9
Author: Xisco Fauli 
AuthorDate: Fri Jul 8 11:54:40 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 8 13:33:45 2022 +0200

tdf#149913: add support for auto-start-reverse

See https://svgwg.org/svg2-draft/painting.html#OrientAttribute

Change-Id: Iedcca7bc79a54333c0f80927364caec82ce61167
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136894
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/svgio/inc/svgmarkernode.hxx b/svgio/inc/svgmarkernode.hxx
index 41c2d71efe41..3f4b08791bd0 100644
--- a/svgio/inc/svgmarkernode.hxx
+++ b/svgio/inc/svgmarkernode.hxx
@@ -34,6 +34,13 @@ namespace svgio::svgreader
 userSpaceOnUse
 };
 
+enum class MarkerOrient
+{
+notset,
+auto_start,
+auto_start_reverse
+};
+
 private:
 /// buffered decomposition
 drawinglayer::primitive2d::Primitive2DContainer aPrimitives;
@@ -51,8 +58,7 @@ namespace svgio::svgreader
 SvgNumber   maMarkerWidth;
 SvgNumber   maMarkerHeight;
 double  mfAngle;
-
-boolmbOrientAuto : 1; // true == on, false == 
fAngle valid
+MarkerOrientmaMarkerOrient;
 
 public:
 SvgMarkerNode(
@@ -94,10 +100,11 @@ namespace svgio::svgreader
 
 /// Angle content, set if found in current context
 double getAngle() const { return mfAngle; }
-void setAngle(double fAngle) { mfAngle = fAngle; mbOrientAuto = 
false; }
+void setAngle(double fAngle) { mfAngle = fAngle;}
 
-/// OrientAuto content, set if found in current context
-bool getOrientAuto() const { return mbOrientAuto; }
+/// MarkerOrient content
+MarkerOrient getMarkerOrient() const { return maMarkerOrient; }
+void setMarkerOrient(const MarkerOrient aMarkerOrient) { 
maMarkerOrient = aMarkerOrient; }
 
 };
 
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 060c18478aae..1ce9b2e0fbfe 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -44,6 +44,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testFontsizeKeywords();
 void testFontsizePercentage();
 void testFontsizeRelative();
+void testMarkerOrient();
 void testTdf45771();
 void testTdf97941();
 void testTdf104339();
@@ -83,6 +84,7 @@ public:
 CPPUNIT_TEST(testFontsizeKeywords);
 CPPUNIT_TEST(testFontsizePercentage);
 CPPUNIT_TEST(testFontsizeRelative);
+CPPUNIT_TEST(testMarkerOrient);
 CPPUNIT_TEST(testTdf45771);
 CPPUNIT_TEST(testTdf97941);
 CPPUNIT_TEST(testTdf104339);
@@ -310,6 +312,37 @@ void Test::testFontsizeRelative()
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", 
"familyname", "serif");
 }
 
+void Test::testMarkerOrient()
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy11", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy12", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy13", "7");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy21", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy22", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy23", 
"13");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy31", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy32", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy33", "1");
+
+assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy11", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy12", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy13", 
"87");
+assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy21", "0");
+assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy22", "0");
+

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2022-07-07 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgtools.hxx|6 +++---
 svgio/qa/cppunit/SvgImportTest.cxx|   18 ++
 svgio/qa/cppunit/data/tdf149893.svg   |3 +++
 svgio/source/svgreader/svgstyleattributes.cxx |8 
 svgio/source/svgreader/svgtools.cxx   |   18 ++
 5 files changed, 34 insertions(+), 19 deletions(-)

New commits:
commit cded65d05a01ac34af750ddb97f1ffb51f3d638a
Author: Xisco Fauli 
AuthorDate: Thu Jul 7 12:33:12 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 7 13:47:51 2022 +0200

tdf#149893: Color names are ASCII case-insensitive

See https://www.w3.org/TR/css-color-3/#html4

Change-Id: Ifdf887bad08ab606abef78fa8335bc49507f4a43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136879
Reviewed-by: Xisco Fauli 
Tested-by: Jenkins

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 6ef52ae5bf6c..f5e2e03573e6 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -106,13 +106,13 @@ namespace svgio::svgreader
 bool readNumberAndUnit(std::u16string_view rCandidate, sal_Int32& 
nPos, SvgNumber& aNum, const sal_Int32 nLen);
 bool readAngle(std::u16string_view rCandidate, sal_Int32& nPos, 
double& fAngle, const sal_Int32 nLen);
 sal_Int32 read_hex(sal_Unicode aChar);
-bool match_colorKeyword(basegfx::BColor& rColor, const OUString& 
rName, bool bCaseIndependent);
-bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
bool bCaseIndependent, SvgNumber& rOpacity);
+bool match_colorKeyword(basegfx::BColor& rColor, const OUString& 
rName);
+bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
SvgNumber& rOpacity);
 basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider 
const & rInfoProvider);
 basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider const & rInfoProvider);
 bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum);
 bool readLocalUrl(const OUString& rCandidate, OUString& rURL);
-bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, bool bCaseIndependent, SvgNumber& rOpacity);
+bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, SvgNumber& rOpacity);
 
 bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& 
rSvgNumberVector);
 ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& 
rInput, const InfoProvider& rInfoProvider);
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 5c041ac3b386..b97185f36af7 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -56,6 +56,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testRGBAColor();
 void testNoneColor();
 void testTdf97936();
+void testTdf149893();
 void testClipPathAndParentStyle();
 void testClipPathAndStyle();
 void testi125329();
@@ -94,6 +95,7 @@ public:
 CPPUNIT_TEST(testRGBAColor);
 CPPUNIT_TEST(testNoneColor);
 CPPUNIT_TEST(testTdf97936);
+CPPUNIT_TEST(testTdf149893);
 CPPUNIT_TEST(testClipPathAndParentStyle);
 CPPUNIT_TEST(testClipPathAndStyle);
 CPPUNIT_TEST(testi125329);
@@ -523,6 +525,22 @@ void Test::testTdf97936()
 assertXPath(pDocument, 
"/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxy", "100");
 }
 
+void Test::testTdf149893()
+{
+Primitive2DSequence aSequenceClipPathAndParentStyle = 
parseSvg(u"/svgio/qa/cppunit/data/tdf149893.svg");
+CPPUNIT_ASSERT_EQUAL(1, 
static_cast(aSequenceClipPathAndParentStyle.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndParentStyle));
+
+CPPUNIT_ASSERT (pDocument);
+
+// Without the fix in place, this test would have failed with
+// - Expected: #008000
+// - Actual  : #00
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#008000");
+}
+
 void Test::testClipPathAndParentStyle()
 {
 //Check that fill color, stroke color and stroke-width are inherited from 
use element
diff --git a/svgio/qa/cppunit/data/tdf149893.svg 
b/svgio/qa/cppunit/data/tdf149893.svg
new file mode 100644
index ..05c41eac96af
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf149893.svg
@@ -0,0 +1,3 @@
+http://www.w3.org/2000/svg;>
+  
+
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index a2ed97a940ed..5e355ea309da 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1301,7 +1301,7 @@ namespace svgio::svgreader
 OUString aURL;
 SvgNumber aOpacity;
 
-

[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-06-27 Thread Noel Grandin (via logerrit)
 svgio/inc/svgcharacternode.hxx  |2 +-
 svgio/inc/svgdocument.hxx   |2 +-
 svgio/source/svgreader/svgcharacternode.cxx |5 +++--
 svgio/source/svgreader/svgdocument.cxx  |5 +++--
 svgio/source/svguno/xsvgparser.cxx  |7 ---
 5 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 448ca8c2729b5a0194906e9c9dae95504d5212b9
Author: Noel Grandin 
AuthorDate: Mon Jun 27 09:48:33 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 27 16:06:51 2022 +0200

clang-tidy modernize-pass-by-value in svgio

Change-Id: I48283b202a0d5b9560a587daa4ebbf86367875ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136453
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index e5c520d69e22..b7a0a9a254c9 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -135,7 +135,7 @@ namespace svgio::svgreader
 SvgCharacterNode(
 SvgDocument& rDocument,
 SvgNode* pParent,
-const OUString& rText);
+OUString aText);
 virtual ~SvgCharacterNode() override;
 
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
diff --git a/svgio/inc/svgdocument.hxx b/svgio/inc/svgdocument.hxx
index ef7817284bee..9f79342c0c55 100644
--- a/svgio/inc/svgdocument.hxx
+++ b/svgio/inc/svgdocument.hxx
@@ -46,7 +46,7 @@ namespace svgio::svgreader
 IdStyleTokenMapper  maIdStyleTokenMapperList;
 
 public:
-explicit SvgDocument(const OUString& rAbsolutePath);
+explicit SvgDocument(OUString aAbsolutePath);
 ~SvgDocument();
 
 SvgDocument(const SvgDocument&) = delete;
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index bdd0c4f3471b..3efda44ee4a9 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace drawinglayer::primitive2d;
@@ -183,9 +184,9 @@ namespace svgio::svgreader
 SvgCharacterNode::SvgCharacterNode(
 SvgDocument& rDocument,
 SvgNode* pParent,
-const OUString& rText)
+OUString aText)
 :   SvgNode(SVGToken::Character, rDocument, pParent),
-maText(rText)
+maText(std::move(aText))
 {
 }
 
diff --git a/svgio/source/svgreader/svgdocument.cxx 
b/svgio/source/svgreader/svgdocument.cxx
index 2b1d534ffd72..69066c96f8b5 100644
--- a/svgio/source/svgreader/svgdocument.cxx
+++ b/svgio/source/svgreader/svgdocument.cxx
@@ -18,11 +18,12 @@
  */
 
 #include 
+#include 
 
 namespace svgio::svgreader
 {
-SvgDocument::SvgDocument(const OUString& rAbsolutePath)
-: maAbsolutePath(rAbsolutePath)
+SvgDocument::SvgDocument(OUString aAbsolutePath)
+: maAbsolutePath(std::move(aAbsolutePath))
 {
 }
 
diff --git a/svgio/source/svguno/xsvgparser.cxx 
b/svgio/source/svguno/xsvgparser.cxx
index 32db2bc773f1..b0acf58d0e87 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -32,6 +32,7 @@
 #include 
 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -49,7 +50,7 @@ namespace svgio::svgreader
  uno::Reference const 
& xSvgDocHdl);
 public:
 explicit XSvgParser(
-uno::Reference< uno::XComponentContext > const & context);
+uno::Reference< uno::XComponentContext > context);
 XSvgParser(const XSvgParser&) = delete;
 XSvgParser& operator=(const XSvgParser&) = delete;
 
@@ -71,8 +72,8 @@ namespace svgio::svgreader
 }
 
 XSvgParser::XSvgParser(
-uno::Reference< uno::XComponentContext > const & context):
-context_(context)
+uno::Reference< uno::XComponentContext > context):
+context_(std::move(context))
 {
 }
 


[Libreoffice-commits] core.git: svgio/inc svgio/source

2022-06-22 Thread offtkp (via logerrit)
 svgio/inc/svgstylenode.hxx  |4 ++--
 svgio/source/svgreader/svgstylenode.cxx |   31 ++-
 2 files changed, 16 insertions(+), 19 deletions(-)

New commits:
commit 99f8e8aa0ccb741c2b5ede6cab75798c1793d899
Author: offtkp 
AuthorDate: Sun Jun 19 23:52:58 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 22 14:14:27 2022 +0200

tdf#149449 Don't ignore CSS class redefinition inside SVGs

Previously if a css class was redefined like so:

.cls2,.cls3{fill:#fff;}.cls-2{opacity:0.1;}

the second definition of .cls-2 would get ignored and opacity would
remain 1.

This patch keeps track of the names of each previously defined class and
makes sure to append the future redefinition instead of ignoring it.

Change-Id: I20b55aea247d11774cd743505a90f1466f622b1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136109
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svgstylenode.hxx b/svgio/inc/svgstylenode.hxx
index 320b4fa17dcc..1a5a43ca858c 100644
--- a/svgio/inc/svgstylenode.hxx
+++ b/svgio/inc/svgstylenode.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
 
@@ -28,7 +29,7 @@ namespace svgio::svgreader
 {
 private:
 /// use styles
-std::vector< SvgStyleAttributes* >  maSvgStyleAttributes;
+std::unordered_map< OUString, std::unique_ptr 
> maSvgStyleAttributes;
 
 boolmbTextCss : 1; // true == 
type is 'text/css'
 
@@ -36,7 +37,6 @@ namespace svgio::svgreader
 SvgStyleNode(
 SvgDocument& rDocument,
 SvgNode* pParent);
-virtual ~SvgStyleNode() override;
 
 /// #i125258# tell if this node is allowed to have a parent style 
(e.g. defs do not)
 virtual bool supportsParentStyle() const override;
diff --git a/svgio/source/svgreader/svgstylenode.cxx 
b/svgio/source/svgreader/svgstylenode.cxx
index 89f6200138bd..f9d33d61ced3 100644
--- a/svgio/source/svgreader/svgstylenode.cxx
+++ b/svgio/source/svgreader/svgstylenode.cxx
@@ -31,15 +31,6 @@ namespace svgio::svgreader
 {
 }
 
-SvgStyleNode::~SvgStyleNode()
-{
-while(!maSvgStyleAttributes.empty())
-{
-delete *(maSvgStyleAttributes.end() - 1);
-maSvgStyleAttributes.pop_back();
-}
-}
-
 // #i125258# no parent when we are a CssStyle holder to break 
potential loops because
 // when using CssStyles we jump uncontrolled inside the node tree 
hierarchy
 bool SvgStyleNode::supportsParentStyle() const
@@ -148,13 +139,6 @@ namespace svgio::svgreader
 if(aSelectors.isEmpty() || aContent.isEmpty())
 return;
 
-// create new style and add to local list (for ownership control)
-SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
-maSvgStyleAttributes.push_back(pNewStyle);
-
-// fill with content
-pNewStyle->readCssStyle(aContent);
-
 // comma-separated split (Css abbreviation for same style for 
multiple selectors)
 const sal_Int32 nLen(aSelectors.getLength());
 sal_Int32 nPos(0);
@@ -168,9 +152,22 @@ namespace svgio::svgreader
 
 const OUString aSingleName(aToken.makeStringAndClear().trim());
 
+// add the current css class only if wasn't previously added
+auto [aIterator, bIsNew] = 
maSvgStyleAttributes.try_emplace(aSingleName);
+if (bIsNew)
+{
+// create new style and add to local list (for ownership 
control) and
+// in case it's written to again in future classes to 
prevent overwrites
+aIterator->second = 
std::make_unique(*this);
+}
+const std::unique_ptr& pCurrentStyle = 
aIterator->second;
+
+// fill with content
+pCurrentStyle->readCssStyle(aContent);
+
 if(aSingleName.getLength())
 {
-addCssStyleSheet(aSingleName, *pNewStyle);
+addCssStyleSheet(aSingleName, *pCurrentStyle);
 }
 
 if(nInitPos == nPos)


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source svl/IwyuFilter_svl.yaml svl/source svtools/inc svtools/IwyuFilter_svtools.yaml svtools/source svx/inc svx/IwyuFilter_svx.yaml svx/qa svx

2022-03-03 Thread Gabor Kelemen (via logerrit)
 svgio/inc/svganode.hxx  |1 
 svgio/inc/svgcirclenode.hxx |1 
 svgio/inc/svgclippathnode.hxx   |1 
 svgio/inc/svgellipsenode.hxx|1 
 svgio/inc/svggnode.hxx  |1 
 svgio/inc/svggradientnode.hxx   |2 -
 svgio/inc/svgimagenode.hxx  |1 
 svgio/inc/svglinenode.hxx   |1 
 svgio/inc/svgmasknode.hxx   |1 
 svgio/inc/svgnode.hxx   |2 -
 svgio/inc/svgrectnode.hxx   |1 
 svgio/inc/svgstyleattributes.hxx|1 
 svgio/inc/svgtextnode.hxx   |1 
 svgio/inc/svgusenode.hxx|1 
 svgio/qa/cppunit/SvgImportTest.cxx  |1 
 svgio/source/svgreader/SvgNumber.cxx|2 -
 svgio/source/svgreader/svgtools.cxx |1 
 svgio/source/svguno/xsvgparser.cxx  |1 
 svl/IwyuFilter_svl.yaml |2 +
 svl/source/config/cjkoptions.cxx|3 --
 svl/source/config/itemholder2.cxx   |1 
 svl/source/config/languageoptions.cxx   |5 
 svl/source/crypto/cryptosign.cxx|1 
 svl/source/fsstor/oinputstreamcontainer.hxx |1 
 svl/source/fsstor/ostreamcontainer.hxx  |1 
 svl/source/inc/items_helper.hxx |4 ---
 svl/source/items/itempool.cxx   |1 
 svl/source/items/sitem.cxx  |3 --
 svl/source/misc/gridprinter.cxx |6 ++--
 svl/source/misc/sharedstringpool.cxx|2 -
 svl/source/numbers/currencytable.cxx|1 
 svl/source/numbers/supservs.hxx |2 -
 svtools/IwyuFilter_svtools.yaml |3 ++
 svtools/inc/borderline.hrc  |1 
 svtools/inc/langtab.hrc |1 
 svtools/inc/strings.hxx |2 +
 svtools/inc/table/defaultinputhandler.hxx   |1 
 svtools/source/brwbox/editbrowsebox2.cxx|1 
 svtools/source/config/fontsubstconfig.cxx   |2 -
 svtools/source/config/htmlcfg.cxx   |3 --
 svtools/source/config/itemholder2.cxx   |1 
 svtools/source/config/optionsdrawinglayer.cxx   |1 
 svtools/source/config/printoptions.cxx  |3 --
 svtools/source/control/asynclink.cxx|3 --
 svtools/source/control/ctrltool.cxx |1 
 svtools/source/control/inettbc.cxx  |1 
 svtools/source/control/toolbarmenu.cxx  |1 
 svtools/source/control/valueimp.hxx |1 
 svtools/source/control/valueset.cxx |1 
 svtools/source/dialogs/ServerDetailsControls.hxx|1 
 svtools/source/filter/DocumentToGraphicRenderer.cxx |1 
 svtools/source/misc/acceleratorexecute.cxx  |1 
 svtools/source/svhtml/htmlout.cxx   |1 
 svtools/source/svrtf/svparser.cxx   |1 
 svtools/source/table/cellvalueconversion.cxx|1 
 svtools/source/table/cellvalueconversion.hxx|2 -
 svx/IwyuFilter_svx.yaml |9 +++
 svx/inc/fieldunit.hrc   |1 
 svx/inc/fmstring.hrc|2 +
 svx/inc/formnavi.hrc|2 +
 svx/inc/frmsel.hrc  |1 
 svx/inc/numberingtype.hrc   |2 +
 svx/inc/rotationstrings.hrc |2 +
 svx/inc/samecontent.hrc |2 +
 svx/inc/sdr/primitive2d/primitivefactory2d.hxx  |7 -
 svx/inc/spacing.hrc |2 +
 svx/inc/swframeposstrings.hrc   |2 +
 svx/inc/tabwin.hrc  |2 +
 svx/inc/tbxcolorupdate.hxx  |1 
 svx/inc/textchaincursor.hxx |2 +
 svx/inc/txenctab.hrc|1 
 svx/qa/unit/customshapes.cxx  

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2021-12-23 Thread Hossein (via logerrit)
 svgio/inc/svgnode.hxx  |2 +-
 svgio/inc/svgtextnode.hxx  |2 --
 svgio/inc/svgtspannode.hxx |2 +-
 svgio/qa/cppunit/SvgImportTest.cxx |   20 
 svgio/qa/cppunit/data/em_units.svg |   14 ++
 svgio/source/svgreader/svgtextnode.cxx |4 
 6 files changed, 36 insertions(+), 8 deletions(-)

New commits:
commit 4e2e57b530544736804ab663f832173ba1d78559
Author: Hossein 
AuthorDate: Mon Dec 20 05:44:23 2021 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Dec 24 02:00:18 2021 +0100

tdf#97663 SVGIO: Fix line spacing for 

tdf#97663 is a regression caused by the commit
701324a1e1f7e0c181ff1a50956ced686785ea53. The previous patch caused
LO to forget the size of the font which was needed to calculate line
height based on em units.

em, px, pt, cm, in...
https://www.w3.org/Style/Examples/007/units.en.html

Accompanied with this fix is a unit test provided to avoid this
issue in the future.

The fix can be tested with:

make CPPUNIT_TEST_NAME="testTdf97663" -sr \
CppunitTest_svgio

The em_units.svg is opened with Firefox, Chrome and Inkscape and the
rendering in LibreOffice is compatible with the rendering in these
applications.

Change-Id: Idaecd9fb18101f7925fe2a917f7fc3fe7257ebc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127130
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 63c6b2318406..58b1682506f2 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -159,7 +159,7 @@ namespace svgio::svgreader
 virtual double getCurrentFontSizeInherited() const override;
 virtual double getCurrentXHeightInherited() const override;
 
-virtual double getCurrentFontSize() const;
+double getCurrentFontSize() const;
 double getCurrentXHeight() const;
 
 /// Id access
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index b72d1043b8c0..37983ad31531 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -58,8 +58,6 @@ namespace svgio::svgreader
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
 
-virtual double getCurrentFontSize() const override;
-
 /// transform content, set if found in current context
 const std::optional& getTransform() const { 
return mpaTransform; }
 void setTransform(const std::optional& 
pMatrix) { mpaTransform = pMatrix; }
diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx
index af4ae8268b5c..10a7b7ee16a9 100644
--- a/svgio/inc/svgtspannode.hxx
+++ b/svgio/inc/svgtspannode.hxx
@@ -42,7 +42,7 @@ namespace svgio::svgreader
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 
-virtual double getCurrentFontSize() const override;
+double getCurrentFontSize() const;
 
 /// access to SvgTextPositions
 const SvgTextPositions& getSvgTextPositions() const { return 
maSvgTextPositions; }
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index a46285ee7f64..cba534bfc5a5 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -70,6 +70,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testTdf101237();
 void testTdf94765();
 void testBehaviourWhenWidthAndHeightIsOrIsNotSet();
+void testTdf97663();
 
 Primitive2DSequence parseSvg(std::u16string_view aSource);
 
@@ -105,6 +106,7 @@ public:
 CPPUNIT_TEST(testTdf101237);
 CPPUNIT_TEST(testTdf94765);
 CPPUNIT_TEST(testBehaviourWhenWidthAndHeightIsOrIsNotSet);
+CPPUNIT_TEST(testTdf97663);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -808,6 +810,24 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet()
 }
 }
 
+void Test::testTdf97663()
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/em_units.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+// This can be dumped to a file using dumper.dump(container, file_url)
+Primitive2DContainer container = 
comphelper::sequenceToContainer(aSequence);
+xmlDocUniquePtr pDocument = dumper.dumpAndParse(container);
+
+CPPUNIT_ASSERT (pDocument);
+
+// tdf#97663: Without the fix in place, this test would have failed with
+// - Expected: 236
+// - Actual  : 204
+assertXPath(pDocument, 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-11-11 Thread Mike Kaganski (via logerrit)
 svgio/inc/SvgNumber.hxx   |   13 +
 svgio/source/svgreader/SvgNumber.cxx  |   16 +---
 svgio/source/svgreader/svgstyleattributes.cxx |6 +++---
 svgio/source/svgreader/svgsvgnode.cxx |6 +++---
 4 files changed, 20 insertions(+), 21 deletions(-)

New commits:
commit 4cdca3702cda246ecc490c65973e525ff5cf25ab
Author: Mike Kaganski 
AuthorDate: Thu Nov 11 10:27:23 2021 +0300
Commit: Mike Kaganski 
CommitDate: Thu Nov 11 10:18:07 2021 +0100

Use o3tl::convert

Change-Id: I62239252efed514de7db88b4bea6f4d4d719fb17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125021
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx
index 9b6907a02031..4d03335cf424 100644
--- a/svgio/inc/SvgNumber.hxx
+++ b/svgio/inc/SvgNumber.hxx
@@ -25,9 +25,6 @@
 namespace svgio::svgreader
 {
 
-// recommended value for this device dependent unit, see CSS2 section 4.3.2 
Lengths
-constexpr const double F_SVG_PIXEL_PER_INCH = 96.0;
-
 enum class NumberType
 {
 xcoordinate,
@@ -52,11 +49,11 @@ enum class SvgUnit
 ex,// relative to current x-height
 
 px,// 'user unit'
-pt,// points, 1.25 px
-pc,// 15.0 px
-cm,// 35.43307 px
-mm,// 3.543307 px
-in,// 90 px
+pt,// points, 1/72 in
+pc,// 1/6 in
+cm,
+mm,
+in,
 
 percent,   // relative to range
 none   // for stroke-miterlimit, which has no unit
diff --git a/svgio/source/svgreader/SvgNumber.cxx 
b/svgio/source/svgreader/SvgNumber.cxx
index 9a11c1979962..d5cd9b819ff2 100644
--- a/svgio/source/svgreader/SvgNumber.cxx
+++ b/svgio/source/svgreader/SvgNumber.cxx
@@ -18,6 +18,8 @@
  */
 
 #include 
+
+#include 
 #include 
 
 namespace svgio::svgreader
@@ -40,15 +42,15 @@ double SvgNumber::solveNonPercentage(const InfoProvider& 
rInfoProvider) const
 case SvgUnit::px:
 return mfNumber;
 case SvgUnit::pt:
-return mfNumber * F_SVG_PIXEL_PER_INCH / 72.0;
+return o3tl::convert(mfNumber, o3tl::Length::pt, o3tl::Length::px);
 case SvgUnit::pc:
-return mfNumber * F_SVG_PIXEL_PER_INCH / 6.0;
+return o3tl::convert(mfNumber, o3tl::Length::pc, o3tl::Length::px);
 case SvgUnit::cm:
-return mfNumber * F_SVG_PIXEL_PER_INCH / 2.54;
+return o3tl::convert(mfNumber, o3tl::Length::cm, o3tl::Length::px);
 case SvgUnit::mm:
-return mfNumber * 0.1 * F_SVG_PIXEL_PER_INCH / 2.54;
+return o3tl::convert(mfNumber, o3tl::Length::mm, o3tl::Length::px);
 case SvgUnit::in:
-return mfNumber * F_SVG_PIXEL_PER_INCH;
+return o3tl::convert(mfNumber, o3tl::Length::in, o3tl::Length::px);
 case SvgUnit::none:
 {
 SAL_WARN("svgio", "Design error, this case should have been 
handled in the caller");
@@ -84,8 +86,8 @@ double SvgNumber::solve(const InfoProvider& rInfoProvider, 
NumberType aNumberTyp
 aViewPort = basegfx::B2DRange(
 0.0,
 0.0,
-210.0 * F_SVG_PIXEL_PER_INCH / 2.54,
-297.0 * F_SVG_PIXEL_PER_INCH / 2.54);
+o3tl::convert(210.0, o3tl::Length::cm, o3tl::Length::px), // 
should it be mm?
+o3tl::convert(297.0, o3tl::Length::cm, o3tl::Length::px));
 
 }
 
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 8a61d2e9dfe6..e7a0d90b7efc 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 const int nStyleDepthLimit = 1024;
 
@@ -2494,9 +2495,8 @@ namespace svgio::svgreader
 
 SvgNumber SvgStyleAttributes::getFontSizeNumber() const
 {
-// default size is 'medium' or 16px, which is equal to the default 
PPI used in svgio ( 96.0 )
-// converted to pixels
-const double aDefaultSize = F_SVG_PIXEL_PER_INCH / 6.0;
+// default size is 'medium', i.e. 12 pt, or 16px
+constexpr double aDefaultSize = o3tl::convert(12.0, 
o3tl::Length::pt, o3tl::Length::px);
 
 if(maFontSizeNumber.isSet())
 {
diff --git a/svgio/source/svgreader/svgsvgnode.cxx 
b/svgio/source/svgreader/svgsvgnode.cxx
index 027f9e505ae7..7132c2e6d7bc 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace svgio::svgreader
@@ -677,9 +678,8 @@ namespace svgio::svgreader
 if(bEmbedInFinalTransformPxTo100ThMM)
 {
 // embed in transform primitive to scale to 
1/100th mm
- 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-10-11 Thread Noel Grandin (via logerrit)
 svgio/inc/svgcharacternode.hxx  |   10 +-
 svgio/source/svgreader/svgcharacternode.cxx |   10 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 7a6bd120d8a09e6289ea372935cca40635b99b2e
Author: Noel Grandin 
AuthorDate: Mon Oct 11 18:52:31 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 11 21:06:28 2021 +0200

loplugin:moveparam in svgio

Change-Id: I4badd081340c9f8e8fcce97bd730f9c7da046382
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123426
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index f663cf9d9d0e..e5c520d69e22 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -49,23 +49,23 @@ namespace svgio::svgreader
 
 /// X content
 const SvgNumberVector& getX() const { return maX; }
-void setX(const SvgNumberVector& aX) { maX = aX; }
+void setX(SvgNumberVector&& aX) { maX = std::move(aX); }
 
 /// Y content
 const SvgNumberVector& getY() const { return maY; }
-void setY(const SvgNumberVector& aY) { maY = aY; }
+void setY(SvgNumberVector&& aY) { maY = std::move(aY); }
 
 /// Dx content
 const SvgNumberVector& getDx() const { return maDx; }
-void setDx(const SvgNumberVector& aDx) { maDx = aDx; }
+void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); }
 
 /// Dy content
 const SvgNumberVector& getDy() const { return maDy; }
-void setDy(const SvgNumberVector& aDy) { maDy = aDy; }
+void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); }
 
 /// Rotate content
 const SvgNumberVector& getRotate() const { return maRotate; }
-void setRotate(const SvgNumberVector& aRotate) { maRotate = 
aRotate; }
+void setRotate(SvgNumberVector&& aRotate) { maRotate = 
std::move(aRotate); }
 
 /// TextLength content
 const SvgNumber& getTextLength() const { return maTextLength; }
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 37e41e77bc8e..7bc2944f7058 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -47,7 +47,7 @@ namespace svgio::svgreader
 
 if(readSvgNumberVector(aContent, aVector))
 {
-setX(aVector);
+setX(std::move(aVector));
 }
 }
 break;
@@ -60,7 +60,7 @@ namespace svgio::svgreader
 
 if(readSvgNumberVector(aContent, aVector))
 {
-setY(aVector);
+setY(std::move(aVector));
 }
 }
 break;
@@ -73,7 +73,7 @@ namespace svgio::svgreader
 
 if(readSvgNumberVector(aContent, aVector))
 {
-setDx(aVector);
+setDx(std::move(aVector));
 }
 }
 break;
@@ -86,7 +86,7 @@ namespace svgio::svgreader
 
 if(readSvgNumberVector(aContent, aVector))
 {
-setDy(aVector);
+setDy(std::move(aVector));
 }
 }
 break;
@@ -99,7 +99,7 @@ namespace svgio::svgreader
 
 if(readSvgNumberVector(aContent, aVector))
 {
-setRotate(aVector);
+setRotate(std::move(aVector));
 }
 }
 break;


[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-09-22 Thread Stephan Bergmann (via logerrit)
 svgio/inc/svgnode.hxx  |3 +-
 svgio/source/svgreader/svgnode.cxx |   41 ++---
 2 files changed, 23 insertions(+), 21 deletions(-)

New commits:
commit 8f2f2a8d131eef60164c0586fb73b69fd950f15d
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 20:01:06 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 22 21:13:42 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: svgio

Change-Id: Ia48465b86e6b2e5362b95a2b228414bfc6ac6490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122481
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 93c303fa2df7..63c6b2318406 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -72,7 +73,7 @@ namespace svgio::svgreader
 // helper to convert a string associated with a token of type 
SVGTokenDisplay
 // to the enum Display. Empty strings return the default 
'Display_inline' with
 // which members should be initialized
-Display getDisplayFromContent(const OUString& aContent);
+Display getDisplayFromContent(std::u16string_view aContent);
 
   class Visitor;
 
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index c01539ba389a..3bc3fb76baca 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -333,79 +334,79 @@ namespace svgio::svgreader
 }
 }
 
-Display getDisplayFromContent(const OUString& aContent)
+Display getDisplayFromContent(std::u16string_view aContent)
 {
-if(!aContent.isEmpty())
+if(!aContent.empty())
 {
-if(aContent.startsWith("inline"))
+if(o3tl::starts_with(aContent, u"inline"))
 {
 return Display::Inline;
 }
-else if(aContent.startsWith("none"))
+else if(o3tl::starts_with(aContent, u"none"))
 {
 return Display::None;
 }
-else if(aContent.startsWith("inherit"))
+else if(o3tl::starts_with(aContent, u"inherit"))
 {
 return Display::Inherit;
 }
-else if(aContent.startsWith("block"))
+else if(o3tl::starts_with(aContent, u"block"))
 {
 return Display::Block;
 }
-else if(aContent.startsWith("list-item"))
+else if(o3tl::starts_with(aContent, u"list-item"))
 {
 return Display::ListItem;
 }
-else if(aContent.startsWith("run-in"))
+else if(o3tl::starts_with(aContent, u"run-in"))
 {
 return Display::RunIn;
 }
-else if(aContent.startsWith("compact"))
+else if(o3tl::starts_with(aContent, u"compact"))
 {
 return Display::Compact;
 }
-else if(aContent.startsWith("marker"))
+else if(o3tl::starts_with(aContent, u"marker"))
 {
 return Display::Marker;
 }
-else if(aContent.startsWith("table"))
+else if(o3tl::starts_with(aContent, u"table"))
 {
 return Display::Table;
 }
-else if(aContent.startsWith("inline-table"))
+else if(o3tl::starts_with(aContent, u"inline-table"))
 {
 return Display::InlineTable;
 }
-else if(aContent.startsWith("table-row-group"))
+else if(o3tl::starts_with(aContent, u"table-row-group"))
 {
 return Display::TableRowGroup;
 }
-else if(aContent.startsWith("table-header-group"))
+else if(o3tl::starts_with(aContent, u"table-header-group"))
 {
 return Display::TableHeaderGroup;
 }
-else if(aContent.startsWith("table-footer-group"))
+else if(o3tl::starts_with(aContent, u"table-footer-group"))
 {
 return Display::TableFooterGroup;
 }
-else if(aContent.startsWith("table-row"))
+else if(o3tl::starts_with(aContent, u"table-row"))
 {
 return Display::TableRow;
 }
-else if(aContent.startsWith("table-column-group"))
+else if(o3tl::starts_with(aContent, 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-08-22 Thread Noel Grandin (via logerrit)
 svgio/inc/svganode.hxx|6 +++---
 svgio/inc/svgcirclenode.hxx   |6 +++---
 svgio/inc/svgclippathnode.hxx |8 
 svgio/inc/svgellipsenode.hxx  |6 +++---
 svgio/inc/svggnode.hxx|6 +++---
 svgio/inc/svggradientnode.hxx |6 +++---
 svgio/inc/svgimagenode.hxx|6 +++---
 svgio/inc/svglinenode.hxx |6 +++---
 svgio/inc/svgmasknode.hxx |8 
 svgio/inc/svgpathnode.hxx |6 +++---
 svgio/inc/svgpatternnode.hxx  |6 +++---
 svgio/inc/svgpolynode.hxx |6 +++---
 svgio/inc/svgrectnode.hxx |6 +++---
 svgio/inc/svgstyleattributes.hxx  |2 +-
 svgio/inc/svgtextnode.hxx |6 +++---
 svgio/inc/svgusenode.hxx  |7 ---
 svgio/source/svgreader/svganode.cxx   |2 +-
 svgio/source/svgreader/svgcirclenode.cxx  |2 +-
 svgio/source/svgreader/svgclippathnode.cxx|4 ++--
 svgio/source/svgreader/svgellipsenode.cxx |2 +-
 svgio/source/svgreader/svggnode.cxx   |2 +-
 svgio/source/svgreader/svggradientnode.cxx|   18 --
 svgio/source/svgreader/svgimagenode.cxx   |2 +-
 svgio/source/svgreader/svglinenode.cxx|2 +-
 svgio/source/svgreader/svgmasknode.cxx|4 ++--
 svgio/source/svgreader/svgpathnode.cxx|2 +-
 svgio/source/svgreader/svgpatternnode.cxx |8 
 svgio/source/svgreader/svgpolynode.cxx|2 +-
 svgio/source/svgreader/svgrectnode.cxx|2 +-
 svgio/source/svgreader/svgstyleattributes.cxx |2 +-
 svgio/source/svgreader/svgtextnode.cxx|2 +-
 svgio/source/svgreader/svgusenode.cxx |2 +-
 svgio/source/svgreader/svgvisitor.cxx |2 +-
 33 files changed, 74 insertions(+), 83 deletions(-)

New commits:
commit 008f28c9e01114e731f785e9e238236a1ed069d2
Author: Noel Grandin 
AuthorDate: Sat Aug 21 20:14:04 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 22 16:24:05 2021 +0200

no need to use unique_ptr for B2DHomMatrix

it is already a COW type

Change-Id: Ide1dedfb8be7593bf45b0e78899450f04291f09e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120828
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index ac47da7d5cc7..3fa49442b35e 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -33,7 +33,7 @@ namespace svgio::svgreader
 SvgStyleAttributes  maSvgStyleAttributes;
 
 /// variable scan values, dependent of given XAttributeList
-std::unique_ptr  mpaTransform;
+std::optional  mpaTransform;
 
 public:
 SvgANode(
@@ -46,8 +46,8 @@ namespace svgio::svgreader
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
 
 /// transform content
-const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
-void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new 
basegfx::B2DHomMatrix(*pMatrix) ); }
+const std::optional& getTransform() const { 
return mpaTransform; }
+void setTransform(const std::optional& 
pMatrix) { mpaTransform = pMatrix; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index 2ffcaa2ecd67..6e06ca141437 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -36,7 +36,7 @@ namespace svgio::svgreader
 SvgNumber   maCx;
 SvgNumber   maCy;
 SvgNumber   maR;
-std::unique_ptr  mpaTransform;
+std::optional  mpaTransform;
 
 public:
 SvgCircleNode(
@@ -58,8 +58,8 @@ namespace svgio::svgreader
 const SvgNumber& getR() const { return maR; }
 
 /// transform content, set if found in current context
-const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
-void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new 
basegfx::B2DHomMatrix(*pMatrix) ); }
+const std::optional& getTransform() const { 
return mpaTransform; }
+void setTransform(const std::optional& 
pMatrix) { mpaTransform = pMatrix; }
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index aa2bb68931e1..6f4ab5b4b97d 100644
--- a/svgio/inc/svgclippathnode.hxx
+++ 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-05-01 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/svgstyleattributes.hxx  |  174 ++--
 svgio/source/svgreader/svgcharacternode.cxx   |   54 ++--
 svgio/source/svgreader/svgnode.cxx|2 
 svgio/source/svgreader/svgstyleattributes.cxx |  350 +-
 4 files changed, 290 insertions(+), 290 deletions(-)

New commits:
commit fd32860c303061a4df4981c0c1fd7a87af792bf2
Author: Tomaž Vajngerl 
AuthorDate: Sat May 1 13:09:37 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 1 09:30:13 2021 +0200

svgio: convert enum to enum class in svgstyleattributes.hxx

Change-Id: I97ac8922f4d6b921c2ef862f2168d14b66d8fc53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114958
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 1bb7c757b2b3..b1c9da120573 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -39,134 +39,134 @@ namespace svgio::svgreader {
 
 namespace svgio::svgreader
 {
-enum StrokeLinecap
+enum class StrokeLinecap
 {
-StrokeLinecap_notset,
-StrokeLinecap_butt,
-StrokeLinecap_round,
-StrokeLinecap_square
+notset,
+butt,
+round,
+square
 };
 
-enum StrokeLinejoin
+enum class StrokeLinejoin
 {
-StrokeLinejoin_notset,
-StrokeLinejoin_miter,
-StrokeLinejoin_round,
-StrokeLinejoin_bevel
+notset,
+miter,
+round,
+bevel
 };
 
-enum FontSize
+enum class FontSize
 {
-FontSize_notset,
-FontSize_xx_small,
-FontSize_x_small,
-FontSize_small,
-FontSize_smaller,
-FontSize_medium,
-FontSize_large,
-FontSize_larger,
-FontSize_x_large,
-FontSize_xx_large,
-FontSize_initial
+notset,
+xx_small,
+x_small,
+small,
+smaller,
+medium,
+large,
+larger,
+x_large,
+xx_large,
+initial
 };
 
-enum FontStretch
+enum class FontStretch
 {
-FontStretch_notset,
-FontStretch_normal,
-FontStretch_wider,
-FontStretch_narrower,
-FontStretch_ultra_condensed,
-FontStretch_extra_condensed,
-FontStretch_condensed,
-FontStretch_semi_condensed,
-FontStretch_semi_expanded,
-FontStretch_expanded,
-FontStretch_extra_expanded,
-FontStretch_ultra_expanded
+notset,
+normal,
+wider,
+narrower,
+ultra_condensed,
+extra_condensed,
+condensed,
+semi_condensed,
+semi_expanded,
+expanded,
+extra_expanded,
+ultra_expanded
 };
 
 FontStretch getWider(FontStretch aSource);
 FontStretch getNarrower(FontStretch aSource);
 
-enum FontStyle
+enum class FontStyle
 {
-FontStyle_notset,
-FontStyle_normal,
-FontStyle_italic,
-FontStyle_oblique
+notset,
+normal,
+italic,
+oblique
 };
 
-enum FontWeight
+enum class FontWeight
 {
-FontWeight_notset,
-FontWeight_100,
-FontWeight_200,
-FontWeight_300,
-FontWeight_400, // same as FontWeight_normal
-FontWeight_500,
-FontWeight_600,
-FontWeight_700, // same as FontWeight_bold
-FontWeight_800,
-FontWeight_900,
-FontWeight_bolder,
-FontWeight_lighter,
+notset,
+N100,
+N200,
+N300,
+N400, // same as normal
+N500,
+N600,
+N700, // same as bold
+N800,
+N900,
+bolder,
+lighter,
 };
 
 FontWeight getBolder(FontWeight aSource);
 FontWeight getLighter(FontWeight aSource);
 ::FontWeight getVclFontWeight(FontWeight aSource);
 
-enum TextAlign
+enum class TextAlign
 {
-TextAlign_notset,
-TextAlign_left,
-TextAlign_right,
-TextAlign_center,
-TextAlign_justify
+notset,
+left,
+right,
+center,
+justify
 };
 
-enum TextDecoration
+enum class TextDecoration
 {
-TextDecoration_notset,
-TextDecoration_none,
-TextDecoration_underline,
-

[Libreoffice-commits] core.git: svgio/inc

2021-05-01 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/svganode.hxx|5 +
 svgio/inc/svgcharacternode.hxx|   14 +-
 svgio/inc/svgcirclenode.hxx   |5 +
 svgio/inc/svgclippathnode.hxx |5 +
 svgio/inc/svgdocument.hxx |5 +
 svgio/inc/svgdocumenthandler.hxx  |5 +
 svgio/inc/svgellipsenode.hxx  |5 +
 svgio/inc/svggnode.hxx|5 +
 svgio/inc/svggradientnode.hxx |5 +
 svgio/inc/svggradientstopnode.hxx |5 +
 svgio/inc/svgimagenode.hxx|5 +
 svgio/inc/svglinenode.hxx |5 +
 svgio/inc/svgmarkernode.hxx   |5 +
 svgio/inc/svgmasknode.hxx |5 +
 svgio/inc/svgnode.hxx |5 +
 svgio/inc/svgpaint.hxx|5 +
 svgio/inc/svgpathnode.hxx |5 +
 svgio/inc/svgpatternnode.hxx  |5 +
 svgio/inc/svgpolynode.hxx |5 +
 svgio/inc/svgrectnode.hxx |5 +
 svgio/inc/svgstyleattributes.hxx  |5 +
 svgio/inc/svgstylenode.hxx|5 +
 svgio/inc/svgsvgnode.hxx  |5 +
 svgio/inc/svgsymbolnode.hxx   |5 +
 svgio/inc/svgtextnode.hxx |5 +
 svgio/inc/svgtextpathnode.hxx |5 +
 svgio/inc/svgtitledescnode.hxx|6 +-
 svgio/inc/svgtoken.hxx|5 +
 svgio/inc/svgtools.hxx|6 +-
 svgio/inc/svgtrefnode.hxx |5 +
 svgio/inc/svgtspannode.hxx|5 +
 svgio/inc/svgusenode.hxx  |5 +
 svgio/inc/svgvisitor.hxx  |5 +
 33 files changed, 33 insertions(+), 143 deletions(-)

New commits:
commit c70b342d6c903839528947be9885d9cbedf36d41
Author: Tomaž Vajngerl 
AuthorDate: Sat May 1 12:39:54 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 1 09:29:46 2021 +0200

svgio: use pragma once in the header files

Change-Id: I781e2083f4aab2e11bf78c3b941701ff7dd35772
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114957
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 897e1ebe6e60..ac47da7d5cc7 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVGIO_INC_SVGANODE_HXX
-#define INCLUDED_SVGIO_INC_SVGANODE_HXX
+#pragma once
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
@@ -53,6 +52,4 @@ namespace svgio::svgreader
 
 } // end of namespace svgio::svgreader
 
-#endif // INCLUDED_SVGIO_INC_SVGANODE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 2a3331808949..f663cf9d9d0e 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
-#define INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
+#pragma once
 
 #include 
 #include 
@@ -77,11 +76,6 @@ namespace svgio::svgreader
 void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
 };
 
-} // end of namespace svgio::svgreader
-
-
-namespace svgio::svgreader
-{
 class SvgTextPosition
 {
 private:
@@ -122,11 +116,6 @@ namespace svgio::svgreader
 double consumeRotation();
 };
 
-} // end of namespace svgio::svgreader
-
-
-namespace svgio::svgreader
-{
 class SvgCharacterNode final : public SvgNode
 {
 private:
@@ -161,6 +150,5 @@ namespace svgio::svgreader
 
 } // end of namespace svgio::svgreader
 
-#endif // INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index afb63d7ede8a..2ffcaa2ecd67 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVGIO_INC_SVGCIRCLENODE_HXX
-#define INCLUDED_SVGIO_INC_SVGCIRCLENODE_HXX
+#pragma once
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
@@ -65,6 +64,4 @@ namespace svgio::svgreader
 
 } // end of namespace svgio::svgreader
 
-#endif // INCLUDED_SVGIO_INC_SVGCIRCLENODE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index dacbf398f97d..aa2bb68931e1 100644
--- a/svgio/inc/svgclippathnode.hxx
+++ b/svgio/inc/svgclippathnode.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SVGIO_INC_SVGCLIPPATHNODE_HXX
-#define INCLUDED_SVGIO_INC_SVGCLIPPATHNODE_HXX
+#pragma once
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
@@ -63,6 +62,4 @@ namespace svgio::svgreader
 
 } // end of namespace svgio::svgreader
 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-05-01 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/SvgNumber.hxx |5 -
 svgio/source/svgreader/svgtools.cxx |5 -
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 0d62ee66d6c02f0b3c38d1d0fa52f9cd86207a98
Author: Tomaž Vajngerl 
AuthorDate: Sat May 1 12:24:56 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 1 09:28:56 2021 +0200

svgio: move isPositive to the SvgNumber header file

Change-Id: I05c7d59000ac7f14a5d34ed30273379f6fc31677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114955
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx
index a4942719a2f4..9b6907a02031 100644
--- a/svgio/inc/SvgNumber.hxx
+++ b/svgio/inc/SvgNumber.hxx
@@ -100,7 +100,10 @@ public:
 return mbSet;
 }
 
-bool isPositive() const;
+bool isPositive() const
+{
+return basegfx::fTools::moreOrEqual(mfNumber, 0.0);
+}
 
 // Only usable in cases, when the unit is not SvgUnit::percent, otherwise 
use method solve
 double solveNonPercentage(const InfoProvider& rInfoProvider) const;
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index beb735e2044e..66f89f2d60e1 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -267,11 +267,6 @@ namespace svgio::svgreader
 return 0.0;
 }
 
-bool SvgNumber::isPositive() const
-{
-return basegfx::fTools::moreOrEqual(mfNumber, 0.0);
-}
-
 void skip_char(std::u16string_view rCandidate, sal_Unicode nChar, 
sal_Int32& nPos, const sal_Int32 nLen)
 {
 while(nPos < nLen && nChar == rCandidate[nPos])
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-04-30 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/svgnode.hxx   |   46 +++
 svgio/source/svgreader/svganode.cxx |2 -
 svgio/source/svgreader/svgcharacternode.cxx |2 -
 svgio/source/svgreader/svgclippathnode.cxx  |2 -
 svgio/source/svgreader/svggnode.cxx |2 -
 svgio/source/svgreader/svgimagenode.cxx |2 -
 svgio/source/svgreader/svgmarkernode.cxx|2 -
 svgio/source/svgreader/svgmasknode.cxx  |2 -
 svgio/source/svgreader/svgnode.cxx  |   56 ++--
 svgio/source/svgreader/svgpatternnode.cxx   |2 -
 svgio/source/svgreader/svgusenode.cxx   |2 -
 svgio/source/svguno/xsvgparser.cxx  |4 +-
 12 files changed, 62 insertions(+), 62 deletions(-)

New commits:
commit 83ff99bae3034e6ae029475dd0cf0ecc64756f6a
Author: Tomaž Vajngerl 
AuthorDate: Fri Apr 30 23:01:57 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 1 05:05:27 2021 +0200

convert enums to enum classes in svgnode.hxx

converted XmlSpace, Display

Change-Id: I4aced2d7c2f6fcb4adc59949a6ac22d4ddd375a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114953
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 95d3a03be1d1..fcf31f296ba7 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -40,34 +40,34 @@ namespace svgio::svgreader
 
 namespace svgio::svgreader
 {
-enum XmlSpace
+enum class XmlSpace
 {
-XmlSpace_notset,
-XmlSpace_default,
-XmlSpace_preserve
+NotSet,
+Default,
+Preserve
 };
 
 // display property (see SVG 1.1. 11.5), not inheritable
-enum Display // #i121656#
+enum class Display // #i121656#
 {
-Display_inline, // the default
-Display_block,
-Display_list_item,
-Display_run_in,
-Display_compact,
-Display_marker,
-Display_table,
-Display_inline_table,
-Display_table_row_group,
-Display_table_header_group,
-Display_table_footer_group,
-Display_table_row,
-Display_table_column_group,
-Display_table_column,
-Display_table_cell,
-Display_table_caption,
-Display_none,
-Display_inherit
+Inline, // the default
+Block,
+ListItem,
+RunIn,
+Compact,
+Marker,
+Table,
+InlineTable,
+TableRowGroup,
+TableHeaderGroup,
+TableFooterGroup,
+TableRow,
+TableColumnGroup,
+TableColumn,
+TableCell,
+TableCaption,
+None,
+Inherit
 };
 
 // helper to convert a string associated with a token of type 
SVGTokenDisplay
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index ad4483423100..6065ed498e42 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -84,7 +84,7 @@ namespace svgio::svgreader
 
 const double fOpacity(pStyle->getOpacity().getNumber());
 
-if(fOpacity > 0.0 && Display_none != getDisplay())
+if (fOpacity > 0.0 && Display::None != getDisplay())
 {
 drawinglayer::primitive2d::Primitive2DContainer aContent;
 
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index ff30730cf1eb..e0b66c6f8ee2 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -524,7 +524,7 @@ namespace svgio::svgreader
 
 void SvgCharacterNode::whiteSpaceHandling()
 {
-if(XmlSpace_default == getXmlSpace())
+if (XmlSpace::Default == getXmlSpace())
 {
 maText = whiteSpaceHandlingDefault(maText);
 }
diff --git a/svgio/source/svgreader/svgclippathnode.cxx 
b/svgio/source/svgreader/svgclippathnode.cxx
index a90d6adb8c2b..1a8269684095 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -125,7 +125,7 @@ namespace svgio::svgreader
 drawinglayer::primitive2d::Primitive2DContainer& rContent,
 const basegfx::B2DHomMatrix* pTransform) const
 {
-if(rContent.empty() || Display_none == getDisplay())
+if (rContent.empty() || Display::None == getDisplay())
 return;
 
 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
diff --git a/svgio/source/svgreader/svggnode.cxx 
b/svgio/source/svgreader/svggnode.cxx
index 1d32de448517..e186387a80ba 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-04-30 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/svgtools.hxx|   62 +--
 svgio/source/svgreader/svgcharacternode.cxx   |   16 +--
 svgio/source/svgreader/svgcirclenode.cxx  |4 
 svgio/source/svgreader/svgclippathnode.cxx|8 -
 svgio/source/svgreader/svgellipsenode.cxx |8 -
 svgio/source/svgreader/svggradientnode.cxx|   22 ++--
 svgio/source/svgreader/svgimagenode.cxx   |8 -
 svgio/source/svgreader/svglinenode.cxx|8 -
 svgio/source/svgreader/svgmasknode.cxx|   40 +++
 svgio/source/svgreader/svgnode.cxx|4 
 svgio/source/svgreader/svgpatternnode.cxx |   30 ++---
 svgio/source/svgreader/svgrectnode.cxx|   12 +-
 svgio/source/svgreader/svgstyleattributes.cxx |   80 +++
 svgio/source/svgreader/svgsvgnode.cxx |   36 +++---
 svgio/source/svgreader/svgtextpathnode.cxx|2 
 svgio/source/svgreader/svgtools.cxx   |  138 +-
 svgio/source/svgreader/svgusenode.cxx |4 
 17 files changed, 241 insertions(+), 241 deletions(-)

New commits:
commit bd0c965b1ba9a15497f92102d5d11c84df091b2f
Author: Tomaž Vajngerl 
AuthorDate: Fri Apr 30 22:47:30 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat May 1 04:29:31 2021 +0200

convert enums to enum classes in svgtools.hxx

converted SvgUnits, NumberType, SvgUnit, SvgAlign

Change-Id: I703b1d9396f42b3af1a36c683628e90161f2717d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114952
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 82d58cc2e472..c4a88d89d05f 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -44,13 +44,13 @@ namespace svgio::svgreader
 static constexpr OUStringLiteral aStrEvenOdd = u"evenodd";
 };
 
-enum SvgUnits
+enum class SvgUnits
 {
 userSpaceOnUse,
 objectBoundingBox
 };
 
-enum NumberType
+enum class NumberType
 {
 xcoordinate,
 ycoordinate,
@@ -68,20 +68,20 @@ namespace svgio::svgreader
 virtual double getCurrentXHeightInherited() const = 0;
 };
 
-enum SvgUnit
+enum class SvgUnit
 {
-Unit_em = 0,// relative to current font size
-Unit_ex,// relative to current x-height
-
-Unit_px,// 'user unit'
-Unit_pt,// points, 1.25 px
-Unit_pc,// 15.0 px
-Unit_cm,// 35.43307 px
-Unit_mm,// 3.543307 px
-Unit_in,// 90 px
-
-Unit_percent,   // relative to range
-Unit_none   // for stroke-miterlimit, which has no unit
+em = 0,// relative to current font size
+ex,// relative to current x-height
+
+px,// 'user unit'
+pt,// points, 1.25 px
+pc,// 15.0 px
+cm,// 35.43307 px
+mm,// 3.543307 px
+in,// 90 px
+
+percent,   // relative to range
+none   // for stroke-miterlimit, which has no unit
 };
 
 class SvgNumber
@@ -95,12 +95,12 @@ namespace svgio::svgreader
 public:
 SvgNumber()
 :   mfNumber(0.0),
-meUnit(Unit_px),
+meUnit(SvgUnit::px),
 mbSet(false)
 {
 }
 
-SvgNumber(double fNum, SvgUnit aSvgUnit = Unit_px, bool bSet = 
true)
+SvgNumber(double fNum, SvgUnit aSvgUnit = SvgUnit::px, bool bSet = 
true)
 :   mfNumber(fNum),
 meUnit(aSvgUnit),
 mbSet(bSet)
@@ -124,28 +124,28 @@ namespace svgio::svgreader
 
 bool isPositive() const;
 
-// Only usable in cases, when the unit is not Unit_percent, 
otherwise use method solve
+// Only usable in cases, when the unit is not SvgUnit::percent, 
otherwise use method solve
 double solveNonPercentage(const InfoProvider& rInfoProvider) const;
 
-double solve(const InfoProvider& rInfoProvider, NumberType 
aNumberType = length) const;
+double solve(const InfoProvider& rInfoProvider, NumberType 
aNumberType = NumberType::length) const;
 
 
 };
 
 typedef ::std::vector< SvgNumber > SvgNumberVector;
 
-enum SvgAlign
+enum class SvgAlign
 {
-Align_none,
-Align_xMinYMin,
-Align_xMidYMin,
-Align_xMaxYMin,
-Align_xMinYMid,
-Align_xMidYMid, // default
-Align_xMaxYMid,
-Align_xMinYMax,
-Align_xMidYMax,
-Align_xMaxYMax
+none,
+xMinYMin,
+xMidYMin,
+xMaxYMin,
+xMinYMid,
+

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-04-30 Thread Tomaž Vajngerl (via logerrit)
 svgio/inc/svgtoken.hxx |  270 -
 svgio/source/svgreader/svganode.cxx|8 
 svgio/source/svgreader/svgcharacternode.cxx|   16 -
 svgio/source/svgreader/svgcirclenode.cxx   |   12 -
 svgio/source/svgreader/svgclippathnode.cxx |8 
 svgio/source/svgreader/svgdocumenthandler.cxx  |  156 +++---
 svgio/source/svgreader/svgellipsenode.cxx  |   14 -
 svgio/source/svgreader/svggnode.cxx|   12 -
 svgio/source/svgreader/svggradientnode.cxx |   32 +-
 svgio/source/svgreader/svggradientstopnode.cxx |6 
 svgio/source/svgreader/svgimagenode.cxx|   18 -
 svgio/source/svgreader/svglinenode.cxx |   14 -
 svgio/source/svgreader/svgmarkernode.cxx   |   20 -
 svgio/source/svgreader/svgmasknode.cxx |   18 -
 svgio/source/svgreader/svgnode.cxx |   28 +-
 svgio/source/svgreader/svgpathnode.cxx |   10 
 svgio/source/svgreader/svgpatternnode.cxx  |   24 +-
 svgio/source/svgreader/svgpolynode.cxx |8 
 svgio/source/svgreader/svgrectnode.cxx |   18 -
 svgio/source/svgreader/svgstyleattributes.cxx  |  118 +-
 svgio/source/svgreader/svgstylenode.cxx|4 
 svgio/source/svgreader/svgsvgnode.cxx  |   18 -
 svgio/source/svgreader/svgsymbolnode.cxx   |8 
 svgio/source/svgreader/svgtextnode.cxx |   18 -
 svgio/source/svgreader/svgtextpathnode.cxx |   12 -
 svgio/source/svgreader/svgtitledescnode.cxx|2 
 svgio/source/svgreader/svgtoken.cxx|  268 
 svgio/source/svgreader/svgtools.cxx|   26 +-
 svgio/source/svgreader/svgtrefnode.cxx |6 
 svgio/source/svgreader/svgtspannode.cxx|4 
 svgio/source/svgreader/svgusenode.cxx  |   18 -
 svgio/source/svgreader/svgvisitor.cxx  |6 
 32 files changed, 600 insertions(+), 600 deletions(-)

New commits:
commit 91daf2c6b1661f27df6ee41f7395ed0fcb677cf0
Author: Tomaž Vajngerl 
AuthorDate: Wed Apr 28 13:08:07 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Apr 30 12:20:52 2021 +0200

svgio: change SVGToken enum to enum class

Change-Id: Ic2618c91b1793463b7ce0a42ec1db100d11acfa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114898
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index b1d55b4e2d17..fe5e67a630bb 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -25,159 +25,159 @@
 namespace svgio::svgreader
 {
 // SVG token mapper with hashing
-enum SVGToken
+enum class SVGToken
 {
-SVGTokenUnknown = 0,
+Unknown = 0,
 
 // diverse attribute tokens
-SVGTokenWidth,
-SVGTokenHeight,
-SVGTokenViewBox,
-SVGTokenTransform,
-SVGTokenStyle,
-SVGTokenDisplay, // #i121656#
-SVGTokenD,
-SVGTokenX,
-SVGTokenY,
-SVGTokenXmlns,
-SVGTokenVersion,
-SVGTokenId,
-SVGTokenRx,
-SVGTokenRy,
-SVGTokenPoints,
-SVGTokenDx,
-SVGTokenDy,
-SVGTokenRotate,
-SVGTokenTextLength,
-SVGTokenLengthAdjust,
-SVGTokenFont,
-SVGTokenFontFamily,
-SVGTokenFontSize,
-SVGTokenFontSizeAdjust,
-SVGTokenFontStretch,
-SVGTokenFontStyle,
-SVGTokenFontVariant,
-SVGTokenFontWeight,
-SVGTokenDirection,
-SVGTokenLetterSpacing,
-SVGTokenTextDecoration,
-SVGTokenUnicodeBidi,
-SVGTokenWordSpacing,
-SVGTokenCharacter, // not in the hash, just for simple text 
handling in SvgCharacterNode
-SVGTokenTspan,
-SVGTokenTref,
-SVGTokenTextPath,
-SVGTokenStartOffset,
-SVGTokenMethod,
-SVGTokenSpacing,
-SVGTokenTextAlign,
-SVGTokenPathLength,
-SVGTokenType,
-SVGTokenClass,
-SVGTokenTextAnchor,
-SVGTokenXmlSpace,
-SVGTokenColor,
-SVGTokenClipPathNode,
-SVGTokenClipPathProperty,
-SVGTokenMask,
-SVGTokenClipPathUnits,
-SVGTokenMaskUnits,
-SVGTokenMaskContentUnits,
-SVGTokenClipRule,
-SVGTokenMarker,
-SVGTokenMarkerStart,
-SVGTokenMarkerMid,
-SVGTokenMarkerEnd,
-SVGTokenRefX,
-SVGTokenRefY,
-SVGTokenMarkerUnits,
-SVGTokenMarkerWidth,
-SVGTokenMarkerHeight,
-SVGTokenOrient,
-SVGTokenPattern,
-SVGTokenPatternUnits,
-SVGTokenPatternContentUnits,
-SVGTokenPatternTransform,
-  

[Libreoffice-commits] core.git: svgio/inc svgio/source

2021-02-20 Thread Noel (via logerrit)
 svgio/inc/svgcharacternode.hxx  |3 ++-
 svgio/source/svgreader/svgcharacternode.cxx |4 ++--
 svgio/source/svguno/xsvgparser.cxx  |   11 +--
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit f56ae6badbb1eeb53c443bedbe8e96fd36ed426c
Author: Noel 
AuthorDate: Sat Feb 20 12:49:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Feb 20 17:48:01 2021 +0100

loplugin:refcounting in svgio

Change-Id: Id7669026fbe4b6cc92e2b137cba0c6c3c33f7712
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111259
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 46d7ec995b18..2a3331808949 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
 
 #include 
+#include 
 
 #include 
 
@@ -133,7 +134,7 @@ namespace svgio::svgreader
 OUString   maText;
 
 /// local helpers
-drawinglayer::primitive2d::TextSimplePortionPrimitive2D* 
createSimpleTextPrimitive(
+
rtl::Reference 
createSimpleTextPrimitive(
 SvgTextPosition& rSvgTextPosition,
 const SvgStyleAttributes& rSvgStyleAttributes) const;
 void decomposeTextWithStyle(
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index dc24adc7ffc0..a0ab6d9b08a9 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -209,12 +209,12 @@ namespace svgio::svgreader
 }
 }
 
-drawinglayer::primitive2d::TextSimplePortionPrimitive2D* 
SvgCharacterNode::createSimpleTextPrimitive(
+
rtl::Reference 
SvgCharacterNode::createSimpleTextPrimitive(
 SvgTextPosition& rSvgTextPosition,
 const SvgStyleAttributes& rSvgStyleAttributes) const
 {
 // prepare retval, index and length
-drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pRetval = 
nullptr;
+
rtl::Reference pRetval;
 sal_uInt32 nLength(getText().getLength());
 
 if(nLength)
diff --git a/svgio/source/svguno/xsvgparser.cxx 
b/svgio/source/svguno/xsvgparser.cxx
index 511640e6f6d7..ddd9d20cd74c 100644
--- a/svgio/source/svguno/xsvgparser.cxx
+++ b/svgio/source/svguno/xsvgparser.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -124,9 +125,8 @@ namespace svgio::svgreader
 if(xSVGStream.is())
 {
 // local document handler
-SvgDocHdl* pSvgDocHdl = new SvgDocHdl(aAbsolutePath);
-uno::Reference 
xSvgDocHdl(pSvgDocHdl);
-parseSvgXML(xSVGStream, xSvgDocHdl);
+rtl::Reference pSvgDocHdl = new 
SvgDocHdl(aAbsolutePath);
+parseSvgXML(xSVGStream, pSvgDocHdl);
 
 // decompose to primitives
 for(std::unique_ptr const & pCandidate : 
pSvgDocHdl->getSvgDocument().getSvgNodeVector())
@@ -154,9 +154,8 @@ namespace svgio::svgreader
 if (!xSvgStream.is())
 return aAnyResult;
 
-SvgDocHdl* pSvgDocHdl = new SvgDocHdl(aAbsolutePath);
-uno::Reference xSvgDocHdl(pSvgDocHdl);
-parseSvgXML(xSvgStream, xSvgDocHdl);
+rtl::Reference pSvgDocHdl = new 
SvgDocHdl(aAbsolutePath);
+parseSvgXML(xSvgStream, pSvgDocHdl);
 
 // decompose to primitives
 for (std::unique_ptr const & pCandidate : 
pSvgDocHdl->getSvgDocument().getSvgNodeVector())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc

2020-07-20 Thread Noel Grandin (via logerrit)
 svgio/inc/svganode.hxx|8 +++-
 svgio/inc/svgcharacternode.hxx|   24 +---
 svgio/inc/svgcirclenode.hxx   |8 +++-
 svgio/inc/svgclippathnode.hxx |8 +++-
 svgio/inc/svgdocument.hxx |8 +++-
 svgio/inc/svgdocumenthandler.hxx  |8 +++-
 svgio/inc/svgellipsenode.hxx  |8 +++-
 svgio/inc/svggnode.hxx|8 +++-
 svgio/inc/svggradientnode.hxx |8 +++-
 svgio/inc/svggradientstopnode.hxx |8 +++-
 svgio/inc/svgimagenode.hxx|8 +++-
 svgio/inc/svglinenode.hxx |8 +++-
 svgio/inc/svgmarkernode.hxx   |8 +++-
 svgio/inc/svgmasknode.hxx |8 +++-
 svgio/inc/svgnode.hxx |   19 +++
 svgio/inc/svgpaint.hxx|8 +++-
 svgio/inc/svgpathnode.hxx |8 +++-
 svgio/inc/svgpatternnode.hxx  |8 +++-
 svgio/inc/svgpolynode.hxx |8 +++-
 svgio/inc/svgrectnode.hxx |8 +++-
 svgio/inc/svgstyleattributes.hxx  |8 +++-
 svgio/inc/svgstylenode.hxx|8 +++-
 svgio/inc/svgsvgnode.hxx  |8 +++-
 svgio/inc/svgsymbolnode.hxx   |8 +++-
 svgio/inc/svgtextnode.hxx |8 +++-
 svgio/inc/svgtextpathnode.hxx |8 +++-
 svgio/inc/svgtitledescnode.hxx|8 +++-
 svgio/inc/svgtoken.hxx|8 +++-
 svgio/inc/svgtools.hxx|7 ++-
 svgio/inc/svgtrefnode.hxx |8 +++-
 svgio/inc/svgtspannode.hxx|8 +++-
 svgio/inc/svgusenode.hxx  |8 +++-
 svgio/inc/svgvisitor.hxx  |5 +
 33 files changed, 106 insertions(+), 181 deletions(-)

New commits:
commit 982a9a2059225fb2890e5582969e43858b4a0ee9
Author: Noel Grandin 
AuthorDate: Sun Jul 19 21:10:11 2020 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 20 08:42:57 2020 +0200

compact namespace: svgio

Change-Id: I249fbc53ac766c0491b956bb8618be6bfa24558c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99011
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 677fedf3fb07..897e1ebe6e60 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -25,9 +25,7 @@
 #include 
 #include 
 
-namespace svgio
-{
-namespace svgreader
+namespace svgio::svgreader
 {
 class SvgANode final : public SvgNode
 {
@@ -52,8 +50,8 @@ namespace svgio
 const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
 void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new 
basegfx::B2DHomMatrix(*pMatrix) ); }
 };
-} // end of namespace svgreader
-} // end of namespace svgio
+
+} // end of namespace svgio::svgreader
 
 #endif // INCLUDED_SVGIO_INC_SVGANODE_HXX
 
diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index 647d327494ee..988c30001df9 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -24,9 +24,7 @@
 
 namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
 
-namespace svgio
-{
-namespace svgreader
+namespace svgio::svgreader
 {
 class SvgTextPositions
 {
@@ -73,13 +71,11 @@ namespace svgio
 bool getLengthAdjust() const { return mbLengthAdjust; }
 void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
 };
-} // end of namespace svgreader
-} // end of namespace svgio
 
+} // end of namespace svgio::svgreader
 
-namespace svgio
-{
-namespace svgreader
+
+namespace svgio::svgreader
 {
 class SvgTextPosition
 {
@@ -120,13 +116,11 @@ namespace svgio
 bool isRotated() const;
 double consumeRotation();
 };
-} // end of namespace svgreader
-} // end of namespace svgio
+
+} // end of namespace svgio::svgreader
 
 
-namespace svgio
-{
-namespace svgreader
+namespace svgio::svgreader
 {
 class SvgCharacterNode final : public SvgNode
 {
@@ -159,8 +153,8 @@ namespace svgio
 /// Text content
 const OUString& getText() const { return maText; }
 };
-} // end of namespace svgreader
-} // end of namespace svgio
+
+} // end of namespace svgio::svgreader
 
 #endif // INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
 
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index bdca4ba15d2e..afb63d7ede8a 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -25,9 +25,7 @@
 #include 
 #include 
 
-namespace svgio
-{
-namespace svgreader
+namespace svgio::svgreader
 {
 class SvgCircleNode final : public SvgNode
 {
@@ -64,8 +62,8 @@ namespace svgio
 const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
   

[Libreoffice-commits] core.git: svgio/inc svgio/IwyuFilter_svgio.yaml svgio/qa svgio/source

2019-12-20 Thread Gabor Kelemen (via logerrit)
 svgio/IwyuFilter_svgio.yaml   |2 ++
 svgio/inc/svganode.hxx|1 +
 svgio/inc/svgcirclenode.hxx   |1 +
 svgio/inc/svgclippathnode.hxx |1 +
 svgio/inc/svgellipsenode.hxx  |1 +
 svgio/inc/svggnode.hxx|1 +
 svgio/inc/svgimagenode.hxx|1 +
 svgio/inc/svglinenode.hxx |1 +
 svgio/inc/svgmasknode.hxx |1 +
 svgio/inc/svgnode.hxx |3 +--
 svgio/inc/svgpathnode.hxx |2 ++
 svgio/inc/svgpatternnode.hxx  |1 +
 svgio/inc/svgpolynode.hxx |1 +
 svgio/inc/svgrectnode.hxx |1 +
 svgio/inc/svgstyleattributes.hxx  |2 +-
 svgio/inc/svgsymbolnode.hxx   |1 -
 svgio/inc/svgtextnode.hxx |1 +
 svgio/inc/svgtextpathnode.hxx |1 -
 svgio/inc/svgtools.hxx|4 ++--
 svgio/inc/svgtspannode.hxx|1 -
 svgio/inc/svgusenode.hxx  |1 +
 svgio/qa/cppunit/SvgImportTest.cxx|1 -
 svgio/qa/cppunit/SvgRead.cxx  |   20 +---
 svgio/source/svgreader/svgcharacternode.cxx   |1 -
 svgio/source/svgreader/svgcirclenode.cxx  |1 +
 svgio/source/svgreader/svgellipsenode.cxx |1 +
 svgio/source/svgreader/svgimagenode.cxx   |2 --
 svgio/source/svgreader/svglinenode.cxx|2 +-
 svgio/source/svgreader/svgnode.cxx|1 -
 svgio/source/svgreader/svgpolynode.cxx|2 +-
 svgio/source/svgreader/svgrectnode.cxx|1 +
 svgio/source/svgreader/svgstyleattributes.cxx |1 -
 svgio/source/svgreader/svgsymbolnode.cxx  |2 --
 svgio/source/svgreader/svgtextnode.cxx|2 --
 svgio/source/svgreader/svgtextpathnode.cxx|2 --
 svgio/source/svgreader/svgtools.cxx   |2 +-
 svgio/source/svgreader/svgvisitor.cxx |3 ---
 svgio/source/svguno/xsvgparser.cxx|2 --
 svgio/source/svguno/xsvgparser.hxx|1 -
 39 files changed, 28 insertions(+), 48 deletions(-)

New commits:
commit aa7a23f4f71853b7a256435404b7f73ddefc061e
Author: Gabor Kelemen 
AuthorDate: Mon Dec 16 18:54:31 2019 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 20 10:31:39 2019 +0100

tdf#42949 Fix IWYU warnings in svgio/

Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I66cde1ea02569cd8244b23be16a5550cac8adf12
Reviewed-on: https://gerrit.libreoffice.org/85237
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svgio/IwyuFilter_svgio.yaml b/svgio/IwyuFilter_svgio.yaml
new file mode 100644
index ..c8d76fb67a7d
--- /dev/null
+++ b/svgio/IwyuFilter_svgio.yaml
@@ -0,0 +1,2 @@
+---
+assumeFilename: svgio/source/svgreader/svgdocument.cxx
diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 1af4316c7222..7da88306f277 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index 87105da64b42..7ae0f6751f4c 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index 5f88c4ff..1aeca2655967 100644
--- a/svgio/inc/svgclippathnode.hxx
+++ b/svgio/inc/svgclippathnode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svgellipsenode.hxx b/svgio/inc/svgellipsenode.hxx
index 4960e4b50d5c..dfc2e9273152 100644
--- a/svgio/inc/svgellipsenode.hxx
+++ b/svgio/inc/svgellipsenode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svggnode.hxx b/svgio/inc/svggnode.hxx
index 760887b3df02..8810659da221 100644
--- a/svgio/inc/svggnode.hxx
+++ b/svgio/inc/svggnode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svgimagenode.hxx b/svgio/inc/svgimagenode.hxx
index 8295de58734e..f9a971a5f4cc 100644
--- a/svgio/inc/svgimagenode.hxx
+++ b/svgio/inc/svgimagenode.hxx
@@ -22,6 +22,7 @@
 
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
+#include 
 #include 
 
 namespace svgio
diff --git a/svgio/inc/svglinenode.hxx b/svgio/inc/svglinenode.hxx
index 54abc7d0e59a..ab7ab577ab9b 100644
--- a/svgio/inc/svglinenode.hxx
+++ b/svgio/inc/svglinenode.hxx
@@ -22,6 +22,7 @@
 
 #include 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2019-08-25 Thread Noel Grandin (via logerrit)
 svgio/inc/svggradientnode.hxx  |   14 +++---
 svgio/inc/svgmarkernode.hxx|2 +-
 svgio/inc/svgnode.hxx  |2 +-
 svgio/inc/svgpatternnode.hxx   |2 +-
 svgio/inc/svgsvgnode.hxx   |2 +-
 svgio/inc/svgtoken.hxx |4 ++--
 svgio/inc/svgtools.hxx |2 +-
 svgio/source/svgreader/svggradientnode.cxx |   14 +++---
 svgio/source/svgreader/svgmarkernode.cxx   |2 +-
 svgio/source/svgreader/svgnode.cxx |2 +-
 svgio/source/svgreader/svgpatternnode.cxx  |2 +-
 svgio/source/svgreader/svgsvgnode.cxx  |2 +-
 svgio/source/svgreader/svgtoken.cxx|4 ++--
 13 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit b8db9688a4bdfbe272993ee9808c23d5d7dae879
Author: Noel Grandin 
AuthorDate: Sat Aug 24 20:33:21 2019 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 25 08:14:02 2019 +0200

loplugin:returnconstval in svgio

Change-Id: Idb195e43303e22ddf36a4529dd9704725c4de0e5
Reviewed-on: https://gerrit.libreoffice.org/78061
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index 1542796b48fc..c55074f97a10 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -77,25 +77,25 @@ namespace svgio
 void 
collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector& 
aVector) const;
 
 /// x1 content
-const SvgNumber getX1() const;
+SvgNumber getX1() const;
 
 /// y1 content
-const SvgNumber getY1() const;
+SvgNumber getY1() const;
 
 /// x2 content
-const SvgNumber getX2() const;
+SvgNumber getX2() const;
 
 /// y2 content
-const SvgNumber getY2() const;
+SvgNumber getY2() const;
 
 /// Cx content
-const SvgNumber getCx() const;
+SvgNumber getCx() const;
 
 /// Cy content
-const SvgNumber getCy() const;
+SvgNumber getCy() const;
 
 /// R content
-const SvgNumber getR() const;
+SvgNumber getR() const;
 
 /// Fx content
 const SvgNumber* getFx() const;
diff --git a/svgio/inc/svgmarkernode.hxx b/svgio/inc/svgmarkernode.hxx
index 61098a35b740..135dc3c4fea8 100644
--- a/svgio/inc/svgmarkernode.hxx
+++ b/svgio/inc/svgmarkernode.hxx
@@ -70,7 +70,7 @@ namespace svgio
 const drawinglayer::primitive2d::Primitive2DContainer& 
getMarkerPrimitives() const;
 
 /// InfoProvider support for % values
-virtual const basegfx::B2DRange getCurrentViewPort() const 
override;
+virtual basegfx::B2DRange getCurrentViewPort() const override;
 
 /// viewBox content
 const basegfx::B2DRange* getViewBox() const { return 
mpViewBox.get(); }
diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 86a83e6afab6..697c8c312a38 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -160,7 +160,7 @@ namespace svgio
 const std::vector< std::unique_ptr > & getChildren() 
const { return maChildren; }
 
 /// InfoProvider support for %, em and ex values
-virtual const basegfx::B2DRange getCurrentViewPort() const 
override;
+virtual basegfx::B2DRange getCurrentViewPort() const override;
 virtual double getCurrentFontSizeInherited() const override;
 virtual double getCurrentXHeightInherited() const override;
 
diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index 956c8da1812e..79dc7581c590 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -78,7 +78,7 @@ namespace svgio
 const drawinglayer::primitive2d::Primitive2DContainer& 
getPatternPrimitives() const;
 
 /// InfoProvider support for % values
-virtual const basegfx::B2DRange getCurrentViewPort() const 
override;
+virtual basegfx::B2DRange getCurrentViewPort() const override;
 
 /// viewBox content
 const basegfx::B2DRange* getViewBox() const;
diff --git a/svgio/inc/svgsvgnode.hxx b/svgio/inc/svgsvgnode.hxx
index defb46f7c894..feb669fe7bc5 100644
--- a/svgio/inc/svgsvgnode.hxx
+++ b/svgio/inc/svgsvgnode.hxx
@@ -69,7 +69,7 @@ namespace svgio
 // The returned 'CurrentViewPort' is the viewport as it is set by 
this svg element
 // and as it is needed to resolve relative values in children
 // The method does not check for invalid width and height
-virtual const basegfx::B2DRange getCurrentViewPort() const 
override;
+virtual basegfx::B2DRange getCurrentViewPort() const override;
 
 /// viewBox content
 const basegfx::B2DRange* getViewBox() 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-10-18 Thread Libreoffice Gerrit user
 svgio/inc/svgmarkernode.hxx   |2 +-
 svgio/source/svgreader/svgmarkernode.cxx  |6 +++---
 svgio/source/svgreader/svgstyleattributes.cxx |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit d0e77848853d60f01308df309d73fa2d7389d0ce
Author: Stephan Bergmann 
AuthorDate: Thu Oct 18 13:54:54 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 18 21:50:43 2018 +0200

Turn SvgMarkerNode::MarkerUnits into scoped enum

...to avoid -Werror,-Wshadow from Clang trunk with
 "Improve -Wshadow warnings with 
enumerators",
warning about shadowing of userSpaceOnUse in enum SvgUnits in
svgio/inc/svgtools.hxx

Change-Id: Ie1438e6ad0f73c73ad643157e5f8366a6e3f6851
Reviewed-on: https://gerrit.libreoffice.org/61933
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/svgio/inc/svgmarkernode.hxx b/svgio/inc/svgmarkernode.hxx
index 23d768cc8f7b..61098a35b740 100644
--- a/svgio/inc/svgmarkernode.hxx
+++ b/svgio/inc/svgmarkernode.hxx
@@ -31,7 +31,7 @@ namespace svgio
 class SvgMarkerNode : public SvgNode
 {
 public:
-enum MarkerUnits
+enum class MarkerUnits
 {
 strokeWidth,
 userSpaceOnUse
diff --git a/svgio/source/svgreader/svgmarkernode.cxx 
b/svgio/source/svgreader/svgmarkernode.cxx
index 2e33fa640c50..35ac4fff1662 100644
--- a/svgio/source/svgreader/svgmarkernode.cxx
+++ b/svgio/source/svgreader/svgmarkernode.cxx
@@ -32,7 +32,7 @@ namespace svgio
 maSvgAspectRatio(),
 maRefX(0),
 maRefY(0),
-maMarkerUnits(strokeWidth),
+maMarkerUnits(MarkerUnits::strokeWidth),
 maMarkerWidth(3),
 maMarkerHeight(3),
 mfAngle(0.0),
@@ -106,11 +106,11 @@ namespace svgio
 {
 if(aContent.startsWith("strokeWidth"))
 {
-setMarkerUnits(strokeWidth);
+setMarkerUnits(MarkerUnits::strokeWidth);
 }
 else 
if(aContent.match(commonStrings::aStrUserSpaceOnUse))
 {
-setMarkerUnits(userSpaceOnUse);
+setMarkerUnits(MarkerUnits::userSpaceOnUse);
 }
 }
 break;
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 3bd5dac3c483..7780d8aa4e5f 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -832,7 +832,7 @@ namespace svgio
 {
 double fTargetWidth(rMarker.getMarkerWidth().isSet() ? 
rMarker.getMarkerWidth().solve(mrOwner, xcoordinate) : 3.0);
 double fTargetHeight(rMarker.getMarkerHeight().isSet() ? 
rMarker.getMarkerHeight().solve(mrOwner, xcoordinate) : 3.0);
-const bool bStrokeWidth(SvgMarkerNode::strokeWidth == 
rMarker.getMarkerUnits());
+const bool 
bStrokeWidth(SvgMarkerNode::MarkerUnits::strokeWidth == 
rMarker.getMarkerUnits());
 const double fStrokeWidth(getStrokeWidth().isSet() ? 
getStrokeWidth().solve(mrOwner) : 1.0);
 
 if(bStrokeWidth)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-08-31 Thread Libreoffice Gerrit user
 svgio/inc/svgstyleattributes.hxx  |2 
 svgio/source/svgreader/svgstyleattributes.cxx |  184 +-
 2 files changed, 94 insertions(+), 92 deletions(-)

New commits:
commit 1fe8479e5ba4ec092d6dc6d88a1edd5fb4487542
Author: Caolán McNamara 
AuthorDate: Thu Aug 30 14:05:20 2018 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 31 09:27:10 2018 +0200

tdf#119557 style hierarchy isn't stable so looping check fails falsely

Given the css stuff a given style can end up with itself as a grandparent 
but
then the css mutates things so it doesn't loop around to give itself as a
grandgrandparent.

So undo the loop detection check and turn it into a parse depth test
instead with an arbitrary, but high, level

Change-Id: If28684ad2b2adc664bc2da6b176b93248b377162
Reviewed-on: https://gerrit.libreoffice.org/59813
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 44f4d35ab9b4..a024dc68b789 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -231,7 +231,7 @@ namespace svgio
 BaselineShift   maBaselineShift;
 SvgNumber   maBaselineShiftNumber;
 
-mutable boolmbResolvingParent;
+mutable std::vector maResolvingParent;
 
 // defines if this attributes are part of a ClipPath. If yes,
 // rough geometry will be created on decomposition by patching
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 8e6d9ea49fef..5f5d9df13584 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -43,6 +43,8 @@
 #include 
 #include 
 
+const int nStyleDepthLimit = 1024;
+
 namespace svgio
 {
 namespace svgreader
@@ -1292,7 +1294,7 @@ namespace svgio
 maClipRule(FillRule_nonzero),
 maBaselineShift(BaselineShift_Baseline),
 maBaselineShiftNumber(0),
-mbResolvingParent(false),
+maResolvingParent(30, 0),
 mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()),
 mbStrokeDasharraySet(false)
 {
@@ -2032,11 +2034,11 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if (pSvgStyleAttributes && !mbResolvingParent)
+if (pSvgStyleAttributes && maResolvingParent[0] < 
nStyleDepthLimit)
 {
-mbResolvingParent = true;
+++maResolvingParent[0];
 const basegfx::BColor* pFill = 
pSvgStyleAttributes->getFill();
-mbResolvingParent = false;
+--maResolvingParent[0];
 
 if(mbIsClipPathContent)
 {
@@ -2077,11 +2079,11 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if (pSvgStyleAttributes && !mbResolvingParent)
+if (pSvgStyleAttributes && maResolvingParent[1] < 
nStyleDepthLimit)
 {
-mbResolvingParent = true;
+++maResolvingParent[1];
 auto ret = pSvgStyleAttributes->getStroke();
-mbResolvingParent = false;
+--maResolvingParent[1];
 return ret;
 }
 }
@@ -2111,11 +2113,11 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if (pSvgStyleAttributes && !mbResolvingParent)
+if (pSvgStyleAttributes && maResolvingParent[2] < 
nStyleDepthLimit)
 {
-mbResolvingParent = true;
+++maResolvingParent[2];
 auto ret = pSvgStyleAttributes->getSvgGradientNodeFill();
-mbResolvingParent = false;
+--maResolvingParent[2];
 return ret;
 }
 }
@@ -2133,11 +2135,11 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if (pSvgStyleAttributes && !mbResolvingParent)
+if (pSvgStyleAttributes && maResolvingParent[3] < 
nStyleDepthLimit)
 {
-mbResolvingParent = true;
+++maResolvingParent[3];
 auto ret = pSvgStyleAttributes->getSvgGradientNodeStroke();
-mbResolvingParent = false;
+--maResolvingParent[3];
 return ret;
 }
 }
@@ -2155,11 +2157,11 @@ namespace svgio
 {
   

[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-07-24 Thread Libreoffice Gerrit user
 svgio/inc/svgstyleattributes.hxx  |1 
 svgio/source/svgreader/svgstyleattributes.cxx |  199 ++
 2 files changed, 144 insertions(+), 56 deletions(-)

New commits:
commit 37ce56416d67ecd6a8d1bfa762c45ec04a00e51b
Author: Caolán McNamara 
AuthorDate: Mon Jul 23 17:37:04 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 24 09:32:30 2018 +0200

crashtesting: infinite recurse with moz609361-1.svg

Change-Id: I18c2dd159dd7a64c3627abdb472d65013453b1b9
Reviewed-on: https://gerrit.libreoffice.org/57891
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index c642f169f9c6..44f4d35ab9b4 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -231,6 +231,7 @@ namespace svgio
 BaselineShift   maBaselineShift;
 SvgNumber   maBaselineShiftNumber;
 
+mutable boolmbResolvingParent;
 
 // defines if this attributes are part of a ClipPath. If yes,
 // rough geometry will be created on decomposition by patching
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 7cc0a05b..17efe6793b3e 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1289,6 +1289,7 @@ namespace svgio
 maClipRule(FillRule_nonzero),
 maBaselineShift(BaselineShift_Baseline),
 maBaselineShiftNumber(0),
+mbResolvingParent(false),
 mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()),
 mbStrokeDasharraySet(false)
 {
@@ -2028,9 +2029,11 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
+mbResolvingParent = true;
 const basegfx::BColor* pFill = 
pSvgStyleAttributes->getFill();
+mbResolvingParent = false;
 
 if(mbIsClipPathContent)
 {
@@ -2071,9 +2074,12 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
-return pSvgStyleAttributes->getStroke();
+mbResolvingParent = true;
+auto ret = pSvgStyleAttributes->getStroke();
+mbResolvingParent = false;
+return ret;
 }
 }
 
@@ -2102,9 +2108,12 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
-return pSvgStyleAttributes->getSvgGradientNodeFill();
+mbResolvingParent = true;
+auto ret = pSvgStyleAttributes->getSvgGradientNodeFill();
+mbResolvingParent = false;
+return ret;
 }
 }
 
@@ -2121,9 +2130,12 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
-return pSvgStyleAttributes->getSvgGradientNodeStroke();
+mbResolvingParent = true;
+auto ret = pSvgStyleAttributes->getSvgGradientNodeStroke();
+mbResolvingParent = false;
+return ret;
 }
 }
 
@@ -2140,9 +2152,12 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
-return pSvgStyleAttributes->getSvgPatternNodeFill();
+mbResolvingParent = true;
+auto ret = pSvgStyleAttributes->getSvgPatternNodeFill();
+mbResolvingParent = false;
+return ret;
 }
 }
 
@@ -2159,9 +2174,12 @@ namespace svgio
 {
 const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
 
-if(pSvgStyleAttributes)
+if (pSvgStyleAttributes && !mbResolvingParent)
 {
-return pSvgStyleAttributes->getSvgPatternNodeStroke();
+mbResolvingParent 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-07-24 Thread Libreoffice Gerrit user
 svgio/inc/svgnode.hxx  |2 ++
 svgio/source/svgreader/svgnode.cxx |7 +++
 2 files changed, 9 insertions(+)

New commits:
commit 20bb79886de5b7e24b6796aaa9811153abda86c9
Author: Caolán McNamara 
AuthorDate: Mon Jul 23 21:30:05 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 24 09:32:08 2018 +0200

crashtesting: infinite recurse with moz384637-1.svg

Change-Id: Ia4bbc9d471c63812dc3ef490f32e8490bda72bfe
Reviewed-on: https://gerrit.libreoffice.org/57888
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 45d9730be909..2db5d490fa14 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -114,6 +114,8 @@ namespace svgio
 /// possible local CssStyle, e.g. style="fill:red; stroke:red;"
 std::unique_ptrmpLocalCssStyle;
 
+mutable boolmbDecomposing;
+
 // flag if maCssStyleVector is already computed (done only once)
 boolmbCssStyleVectorBuilt : 1;
 
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index f6395a24527d..56389ef14124 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -267,6 +267,7 @@ namespace svgio
 maDisplay(Display_inline),
 maCssStyleVector(),
 mpLocalCssStyle(nullptr),
+mbDecomposing(false),
 mbCssStyleVectorBuilt(false)
 {
 OSL_ENSURE(SVGTokenUnknown != maType, "SvgNode with unknown type 
created (!)");
@@ -464,6 +465,9 @@ namespace svgio
 
 void 
SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& 
rTarget, bool bReferenced) const
 {
+if (mbDecomposing) //guard against infinite recurse
+return;
+
 if(Display_none == getDisplay())
 {
 return;
@@ -499,6 +503,8 @@ namespace svgio
 
 if(!rChildren.empty())
 {
+mbDecomposing = true;
+
 const sal_uInt32 nCount(rChildren.size());
 
 for(sal_uInt32 a(0); a < nCount; a++)
@@ -571,6 +577,7 @@ namespace svgio
 }
 }
 }
+mbDecomposing = false;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-07-23 Thread Libreoffice Gerrit user
 svgio/inc/svgpatternnode.hxx  |1 
 svgio/source/svgreader/svgpatternnode.cxx |   71 +-
 2 files changed, 52 insertions(+), 20 deletions(-)

New commits:
commit 2a1e975f4fa67162f3c7b37939fa0a3b771376f5
Author: Caolán McNamara 
AuthorDate: Mon Jul 23 16:10:08 2018 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 23 22:17:40 2018 +0200

crashtesting: infinite recurse with moz455984-5.svg

Change-Id: Idef368c44454ae144b091132cd0d6103f92a6dde
Reviewed-on: https://gerrit.libreoffice.org/57854
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index 5aa93b373217..956c8da1812e 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -55,6 +55,7 @@ namespace svgio
 /// link to another pattern used as style. If maXLink
 /// is set, the node can be fetched on demand by using
 // tryToFindLink (buffered)
+mutable bool mbResolvingLink; // protect against infinite link 
recursion
 OUString   maXLink;
 const SvgPatternNode*   mpXLink;
 
diff --git a/svgio/source/svgreader/svgpatternnode.cxx 
b/svgio/source/svgreader/svgpatternnode.cxx
index 758a6022f841..5b3d2d726abe 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -47,6 +47,7 @@ namespace svgio
 mpPatternUnits(nullptr),
 mpPatternContentUnits(nullptr),
 mpaPatternTransform(nullptr),
+mbResolvingLink(false),
 maXLink(),
 mpXLink(nullptr)
 {
@@ -271,9 +272,12 @@ namespace svgio
 {
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getPatternPrimitives();
+mbResolvingLink = true;
+const drawinglayer::primitive2d::Primitive2DContainer& ret 
= mpXLink->getPatternPrimitives();
+mbResolvingLink = false;
+return ret;
 }
 }
 
@@ -301,9 +305,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getViewBox();
+mbResolvingLink = true;
+auto ret = mpXLink->getViewBox();
+mbResolvingLink = false;
+return ret;
 }
 
 return nullptr;
@@ -318,9 +325,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getSvgAspectRatio();
+mbResolvingLink = true;
+const SvgAspectRatio& ret = mpXLink->getSvgAspectRatio();
+mbResolvingLink = false;
+return ret;
 }
 
 return maSvgAspectRatio;
@@ -335,9 +345,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getX();
+mbResolvingLink = true;
+const SvgNumber& ret = mpXLink->getX();
+mbResolvingLink = false;
+return ret;
 }
 
 return maX;
@@ -352,9 +365,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getY();
+mbResolvingLink = true;
+const SvgNumber& ret = mpXLink->getY();
+mbResolvingLink = false;
+return ret;
 }
 
 return maY;
@@ -369,9 +385,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getWidth();
+mbResolvingLink = true;
+const SvgNumber& ret = mpXLink->getWidth();
+mbResolvingLink = false;
+return ret;
 }
 
 return maWidth;
@@ -386,9 +405,12 @@ namespace svgio
 
 const_cast< SvgPatternNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getHeight();
+mbResolvingLink = true;
+const SvgNumber& ret = mpXLink->getHeight();
+mbResolvingLink = false;
+return ret;
 }

[Libreoffice-commits] core.git: svgio/inc svgio/source

2018-07-18 Thread Libreoffice Gerrit user
 svgio/inc/svggradientnode.hxx  |1 
 svgio/source/svgreader/svggradientnode.cxx |   75 -
 2 files changed, 55 insertions(+), 21 deletions(-)

New commits:
commit f35e3b36b0df830d0259d9d754c3da1946da3e6b
Author: Caolán McNamara 
AuthorDate: Wed Jul 18 12:12:05 2018 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 18 15:37:16 2018 +0200

crashtesting: infinite recurse on moz330387-6.svg

Change-Id: I3c39d49504a4651b92f41c07e4cef8887366dc2b
Reviewed-on: https://gerrit.libreoffice.org/57626
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index 3710519dc392..1542796b48fc 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -56,6 +56,7 @@ namespace svgio
 /// link to another gradient used as style. If maXLink
 /// is set, the node can be fetched on demand by using
 // tryToFindLink (buffered)
+mutable bool mbResolvingLink; // protect against infinite link 
recursion
 OUString   maXLink;
 const SvgGradientNode*  mpXLink;
 
diff --git a/svgio/source/svgreader/svggradientnode.cxx 
b/svgio/source/svgreader/svggradientnode.cxx
index 4496a809a8cf..efbfdccaadb5 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -51,6 +51,7 @@ namespace svgio
 maGradientUnits(objectBoundingBox),
 maSpreadMethod(drawinglayer::primitive2d::SpreadMethod::Pad),
 mpaGradientTransform(nullptr),
+mbResolvingLink(false),
 maXLink(),
 mpXLink(nullptr)
 {
@@ -246,9 +247,11 @@ namespace svgio
 {
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
+mbResolvingLink = true;
 mpXLink->collectGradientEntries(aVector);
+mbResolvingLink = false;
 }
 }
 else
@@ -312,9 +315,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getX1();
+mbResolvingLink = true;
+auto ret = mpXLink->getX1();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 0%
@@ -330,9 +336,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getY1();
+mbResolvingLink = true;
+auto ret = mpXLink->getY1();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 0%
@@ -348,9 +357,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getX2();
+mbResolvingLink = true;
+auto ret = mpXLink->getX2();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 100%
@@ -366,9 +378,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getY2();
+mbResolvingLink = true;
+auto ret = mpXLink->getY2();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 0%
@@ -384,9 +399,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getCx();
+mbResolvingLink = true;
+auto ret = mpXLink->getCx();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 50%
@@ -402,9 +420,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)
+if (mpXLink && !mbResolvingLink)
 {
-return mpXLink->getCy();
+mbResolvingLink = true;
+auto ret = mpXLink->getCy();
+mbResolvingLink = false;
+return ret;
 }
 
 // default is 50%
@@ -420,9 +441,12 @@ namespace svgio
 
 const_cast< SvgGradientNode* >(this)->tryToFindLink();
 
-if(mpXLink)

[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2017-07-21 Thread Noel Grandin
 svgio/inc/svgpatternnode.hxx  |2 +-
 svgio/inc/svgstyleattributes.hxx  |2 +-
 svgio/inc/svgtextnode.hxx |2 +-
 svgio/inc/svgtools.hxx|4 ++--
 svgio/qa/cppunit/SvgImportTest.cxx|4 ++--
 svgio/source/svgreader/svgdocumenthandler.cxx |2 +-
 svgio/source/svgreader/svgpatternnode.cxx |2 +-
 svgio/source/svgreader/svgstyleattributes.cxx |2 +-
 svgio/source/svgreader/svgtextnode.cxx|2 +-
 svgio/source/svgreader/svgtools.cxx   |4 ++--
 10 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 65c69af584152a5f8f3d2f9752d9f051660b7755
Author: Noel Grandin 
Date:   Thu Jul 20 15:44:23 2017 +0200

loplugin:constparams in svgio

Change-Id: I35dd8b1373ce3c46a10b1da1ddc6dc3722ffa760
Reviewed-on: https://gerrit.libreoffice.org/40245
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgpatternnode.hxx b/svgio/inc/svgpatternnode.hxx
index f22439eae86a..4a3247542220 100644
--- a/svgio/inc/svgpatternnode.hxx
+++ b/svgio/inc/svgpatternnode.hxx
@@ -69,7 +69,7 @@ namespace svgio
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 
 /// global helpers
-void getValuesRelative(double& rfX, double& rfY, double& rfW, 
double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const;
+void getValuesRelative(double& rfX, double& rfY, double& rfW, 
double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode const & rUser) const;
 
 /// get pattern primitives buffered, uses decomposeSvgNode 
internally
 const drawinglayer::primitive2d::Primitive2DContainer& 
getPatternPrimitives() const;
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index ab9b0479bf13..7eb7261f39f5 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -289,7 +289,7 @@ namespace svgio
 /// helper which does the necessary with a given path
 void add_text(
 drawinglayer::primitive2d::Primitive2DContainer& rTarget,
-drawinglayer::primitive2d::Primitive2DContainer& rSource) 
const;
+drawinglayer::primitive2d::Primitive2DContainer const & 
rSource) const;
 void add_path(
 const basegfx::B2DPolyPolygon& rPath,
 drawinglayer::primitive2d::Primitive2DContainer& rTarget,
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index db1f26076e03..589f806ec8a9 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -48,7 +48,7 @@ namespace svgio
 static void addTextPrimitives(
 const SvgNode& rCandidate,
 drawinglayer::primitive2d::Primitive2DContainer& rTarget,
-drawinglayer::primitive2d::Primitive2DContainer& rSource);
+drawinglayer::primitive2d::Primitive2DContainer const & 
rSource);
 
 public:
 SvgTextNode(
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 7d339fac6230..c37dc5d2c274 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -194,8 +194,8 @@ namespace svgio
 sal_Int32 read_hex(sal_Unicode aChar);
 bool match_colorKeyword(basegfx::BColor& rColor, const OUString& 
rName, bool bCaseIndependent);
 bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
bool bCaseIndependent, SvgNumber& rOpacity);
-basegfx::B2DRange readViewBox(const OUString& rCandidate, 
InfoProvider& rInfoProvider);
-basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider& rInfoProvider);
+basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider 
const & rInfoProvider);
+basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider const & rInfoProvider);
 bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum);
 bool readLocalUrl(const OUString& rCandidate, OUString& rURL);
 bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, bool bCaseIndependent, SvgNumber& rOpacity);
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 9a612f427114..da3e200a6285 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -36,7 +36,7 @@ using drawinglayer::primitive2d::Primitive2DContainer;
 
 class Test : public test::BootstrapFixture, public XmlTestTools
 {
-void checkRectPrimitive(Primitive2DSequence& rPrimitive);
+void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
 
 void testStyles();
 void testTdf87309();
@@ -113,7 +113,7 @@ Primitive2DSequence Test::parseSvg(const char* 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2017-07-13 Thread Caolán McNamara
 svgio/inc/svgusenode.hxx  |2 ++
 svgio/source/svgreader/svgusenode.cxx |7 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 304b16c3bf6fba2fa28e723d1cb58157201b5c1f
Author: Caolán McNamara 
Date:   Thu Jul 13 16:23:32 2017 +0100

Resolves: tdf#108903 avoid recurse to death

Change-Id: Iadde719a024c5fce97aa0f4c58947a5012639a84
Reviewed-on: https://gerrit.libreoffice.org/39918
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/svgio/inc/svgusenode.hxx b/svgio/inc/svgusenode.hxx
index 05c0063699c5..7a438c11e960 100644
--- a/svgio/inc/svgusenode.hxx
+++ b/svgio/inc/svgusenode.hxx
@@ -45,6 +45,8 @@ namespace svgio
 /// link to content. If maXLink is set, the node can be fetched
 // on demand
 OUString   maXLink;
+/// detect if maXLink causes a loop to ourself during decomposing
+mutable bool   mbDecomposingSvgNode;
 
 public:
 SvgUseNode(
diff --git a/svgio/source/svgreader/svgusenode.cxx 
b/svgio/source/svgreader/svgusenode.cxx
index 104eb727bfed..bcde39f53e4a 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -35,7 +35,8 @@ namespace svgio
 maY(),
 maWidth(),
 maHeight(),
-maXLink()
+maXLink(),
+mbDecomposingSvgNode(false)
 {
 }
 
@@ -142,7 +143,7 @@ namespace svgio
 // try to access link to content
 const SvgNode* pXLink = getDocument().findSvgNodeById(maXLink);
 
-if(pXLink && Display_none != pXLink->getDisplay())
+if (pXLink && Display_none != pXLink->getDisplay() && 
!mbDecomposingSvgNode)
 {
 // decompose children
 drawinglayer::primitive2d::Primitive2DContainer aNewTarget;
@@ -150,9 +151,11 @@ namespace svgio
 // todo: in case mpXLink is a SVGTokenSvg or SVGTokenSymbol the
 // SVG docs want the getWidth() and getHeight() from this node
 // to be valid for the subtree.
+mbDecomposingSvgNode = true;
 const_cast< SvgNode* >(pXLink)->setAlternativeParent(this);
 pXLink->decomposeSvgNode(aNewTarget, true);
 const_cast< SvgNode* >(pXLink)->setAlternativeParent();
+mbDecomposingSvgNode = true;
 
 if(!aNewTarget.empty())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2017-05-04 Thread Noel Grandin
 svgio/inc/svgcharacternode.hxx |2 +-
 svgio/inc/svgstyleattributes.hxx   |2 +-
 svgio/source/svgreader/svganode.cxx|2 +-
 svgio/source/svgreader/svgcharacternode.cxx|2 +-
 svgio/source/svgreader/svgcirclenode.cxx   |2 +-
 svgio/source/svgreader/svgclippathnode.cxx |2 +-
 svgio/source/svgreader/svgellipsenode.cxx  |2 +-
 svgio/source/svgreader/svggnode.cxx|2 +-
 svgio/source/svgreader/svggradientnode.cxx |2 +-
 svgio/source/svgreader/svggradientstopnode.cxx |2 +-
 svgio/source/svgreader/svgimagenode.cxx|2 +-
 svgio/source/svgreader/svglinenode.cxx |2 +-
 svgio/source/svgreader/svgmarkernode.cxx   |2 +-
 svgio/source/svgreader/svgmasknode.cxx |2 +-
 svgio/source/svgreader/svgpathnode.cxx |2 +-
 svgio/source/svgreader/svgpatternnode.cxx  |2 +-
 svgio/source/svgreader/svgpolynode.cxx |2 +-
 svgio/source/svgreader/svgrectnode.cxx |2 +-
 svgio/source/svgreader/svgstyleattributes.cxx  |3 +--
 svgio/source/svgreader/svgsvgnode.cxx  |2 +-
 svgio/source/svgreader/svgsymbolnode.cxx   |2 +-
 svgio/source/svgreader/svgtextnode.cxx |4 ++--
 svgio/source/svgreader/svgtextpathnode.cxx |2 +-
 svgio/source/svgreader/svgtrefnode.cxx |2 +-
 svgio/source/svgreader/svgtspannode.cxx|4 ++--
 svgio/source/svgreader/svgusenode.cxx  |2 +-
 26 files changed, 28 insertions(+), 29 deletions(-)

New commits:
commit 44752e2627378c55efeac88f537314bbd3078b6a
Author: Noel Grandin 
Date:   Wed May 3 12:10:50 2017 +0200

loplugin:checkunusedparams in svgio

Change-Id: I2e05fc51715902737ead6e57d0fbe167d715b822
Reviewed-on: https://gerrit.libreoffice.org/37194
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index d0c74d18d217..13f44304c62e 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -43,7 +43,7 @@ namespace svgio
 public:
 SvgTextPositions();
 
-void parseTextPositionAttributes(const OUString& rTokenName, 
SVGToken aSVGToken, const OUString& aContent);
+void parseTextPositionAttributes(SVGToken aSVGToken, const 
OUString& aContent);
 
 /// X content
 const SvgNumberVector& getX() const { return maX; }
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index 2021204276ab..b9f655eba3d2 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -284,7 +284,7 @@ namespace svgio
 
 public:
 /// local attribute scanner
-void parseStyleAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& rContent,
+void parseStyleAttribute(SVGToken aSVGToken, const OUString& 
rContent,
  bool bCaseIndependent);
 
 /// helper which does the necessary with a given path
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
index 7b61fcbfc934..8c53d8d660bb 100644
--- a/svgio/source/svgreader/svganode.cxx
+++ b/svgio/source/svgreader/svganode.cxx
@@ -49,7 +49,7 @@ namespace svgio
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, 
aContent, false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
 
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 254919025056..3e20bc5ecac6 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -41,7 +41,7 @@ namespace svgio
 {
 }
 
-void SvgTextPositions::parseTextPositionAttributes(const OUString& 
/*rTokenName*/, SVGToken aSVGToken, const OUString& aContent)
+void SvgTextPositions::parseTextPositionAttributes(SVGToken aSVGToken, 
const OUString& aContent)
 {
 // parse own
 switch(aSVGToken)
diff --git a/svgio/source/svgreader/svgcirclenode.cxx 
b/svgio/source/svgreader/svgcirclenode.cxx
index 29d0395eb6eb..d71e5d9cdbf0 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -52,7 +52,7 @@ namespace svgio
 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
 
 // read style attributes
-maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, 
aContent, false);
+maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, 
false);
 
 // parse own

[Libreoffice-commits] core.git: svgio/inc svgio/source

2017-01-18 Thread Noel Grandin
 svgio/inc/svganode.hxx |7 ---
 svgio/inc/svgcirclenode.hxx|7 ---
 svgio/inc/svgclippathnode.hxx  |7 ---
 svgio/inc/svgellipsenode.hxx   |7 ---
 svgio/inc/svggnode.hxx |7 ---
 svgio/inc/svggradientnode.hxx  |3 ++-
 svgio/inc/svgimagenode.hxx |8 +---
 svgio/inc/svglinenode.hxx  |7 ---
 svgio/inc/svgmarkernode.hxx|8 +---
 svgio/inc/svgmasknode.hxx  |8 +---
 svgio/inc/svgrectnode.hxx  |7 ---
 svgio/inc/svgsvgnode.hxx   |8 +---
 svgio/inc/svgsymbolnode.hxx|6 --
 svgio/inc/svgtextnode.hxx  |8 +---
 svgio/inc/svgusenode.hxx   |8 +---
 svgio/source/svgreader/svganode.cxx|1 -
 svgio/source/svgreader/svgcirclenode.cxx   |1 -
 svgio/source/svgreader/svgclippathnode.cxx |1 -
 svgio/source/svgreader/svgellipsenode.cxx  |1 -
 svgio/source/svgreader/svggnode.cxx|1 -
 svgio/source/svgreader/svggradientnode.cxx |   11 +++
 svgio/source/svgreader/svgimagenode.cxx|1 -
 svgio/source/svgreader/svglinenode.cxx |1 -
 svgio/source/svgreader/svgmarkernode.cxx   |1 -
 svgio/source/svgreader/svgmasknode.cxx |1 -
 svgio/source/svgreader/svgrectnode.cxx |1 -
 svgio/source/svgreader/svgsvgnode.cxx  |1 -
 svgio/source/svgreader/svgsymbolnode.cxx   |1 -
 svgio/source/svgreader/svgtextnode.cxx |1 -
 svgio/source/svgreader/svgusenode.cxx  |1 -
 30 files changed, 67 insertions(+), 64 deletions(-)

New commits:
commit 2da34e265db6ca56e43d9b2ab8cee04b1cc4fb29
Author: Noel Grandin 
Date:   Wed Jan 18 09:48:47 2017 +0200

new loplugin: useuniqueptr: svgio

Change-Id: I645ac954ac519fe713f4347cdf69780b0f8070e4
Reviewed-on: https://gerrit.libreoffice.org/33252
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/svgio/inc/svganode.hxx b/svgio/inc/svganode.hxx
index 1f5774a..b7660a0 100644
--- a/svgio/inc/svganode.hxx
+++ b/svgio/inc/svganode.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 namespace svgio
 {
@@ -34,7 +35,7 @@ namespace svgio
 SvgStyleAttributes  maSvgStyleAttributes;
 
 /// variable scan values, dependent of given XAttributeList
-basegfx::B2DHomMatrix*  mpaTransform;
+std::unique_ptr  mpaTransform;
 
 public:
 SvgANode(
@@ -47,8 +48,8 @@ namespace svgio
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
 
 /// transform content
-const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
-void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) 
mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
+void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new 
basegfx::B2DHomMatrix(*pMatrix) ); }
 };
 } // end of namespace svgreader
 } // end of namespace svgio
diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index cd19de4..68fc3e9 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 namespace svgio
 {
@@ -37,7 +38,7 @@ namespace svgio
 SvgNumber   maCx;
 SvgNumber   maCy;
 SvgNumber   maR;
-basegfx::B2DHomMatrix*  mpaTransform;
+std::unique_ptr  mpaTransform;
 
 public:
 SvgCircleNode(
@@ -59,8 +60,8 @@ namespace svgio
 const SvgNumber& getR() const { return maR; }
 
 /// transform content, set if found in current context
-const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
-void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) 
mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform.get(); }
+void setTransform(const basegfx::B2DHomMatrix* pMatrix) { 
mpaTransform.reset(); if(pMatrix) mpaTransform.reset( new 
basegfx::B2DHomMatrix(*pMatrix) ); }
 };
 } // end of namespace svgreader
 } // end of namespace svgio
diff --git a/svgio/inc/svgclippathnode.hxx b/svgio/inc/svgclippathnode.hxx
index a273932..202fc2c 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-10-20 Thread Noel Grandin
 svgio/inc/svgcirclenode.hxx|3 --
 svgio/inc/svgellipsenode.hxx   |4 --
 svgio/inc/svggradientnode.hxx  |9 --
 svgio/inc/svggradientstopnode.hxx  |1 
 svgio/inc/svgimagenode.hxx |8 -
 svgio/inc/svglinenode.hxx  |4 --
 svgio/inc/svgmarkernode.hxx|6 
 svgio/inc/svgmasknode.hxx  |6 
 svgio/inc/svgpathnode.hxx  |1 
 svgio/inc/svgpatternnode.hxx   |5 ---
 svgio/inc/svgpolynode.hxx  |4 --
 svgio/inc/svgrectnode.hxx  |6 
 svgio/inc/svgstyleattributes.hxx   |   20 -
 svgio/inc/svgsvgnode.hxx   |8 -
 svgio/inc/svgsymbolnode.hxx|3 --
 svgio/inc/svgtextnode.hxx  |3 --
 svgio/inc/svgtextpathnode.hxx  |1 
 svgio/inc/svgusenode.hxx   |7 
 svgio/source/svgreader/svgcirclenode.cxx   |6 ++--
 svgio/source/svgreader/svgellipsenode.cxx  |8 ++---
 svgio/source/svgreader/svggradientnode.cxx |   18 ++--
 svgio/source/svgreader/svggradientstopnode.cxx |2 -
 svgio/source/svgreader/svgimagenode.cxx|   12 
 svgio/source/svgreader/svglinenode.cxx |8 ++---
 svgio/source/svgreader/svgmarkernode.cxx   |   12 
 svgio/source/svgreader/svgmasknode.cxx |   12 
 svgio/source/svgreader/svgpathnode.cxx |2 -
 svgio/source/svgreader/svgpatternnode.cxx  |   10 +++---
 svgio/source/svgreader/svgpolynode.cxx |6 ++--
 svgio/source/svgreader/svgrectnode.cxx |   12 
 svgio/source/svgreader/svgstyleattributes.cxx  |   36 -
 svgio/source/svgreader/svgsvgnode.cxx  |   12 
 svgio/source/svgreader/svgsymbolnode.cxx   |2 -
 svgio/source/svgreader/svgtextnode.cxx |2 -
 svgio/source/svgreader/svgtextpathnode.cxx |2 -
 svgio/source/svgreader/svgusenode.cxx  |8 ++---
 36 files changed, 85 insertions(+), 184 deletions(-)

New commits:
commit 58072c5a7f409cd500ecdc4e81a8f536aa3dda59
Author: Noel Grandin 
Date:   Wed Oct 19 12:21:42 2016 +0200

loplugin:expandablemethodds in svgio

Change-Id: Iac2aa6dae56d96819589d198be5875ecfe14f26f
Reviewed-on: https://gerrit.libreoffice.org/30056
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgcirclenode.hxx b/svgio/inc/svgcirclenode.hxx
index edb0523..cd19de4 100644
--- a/svgio/inc/svgcirclenode.hxx
+++ b/svgio/inc/svgcirclenode.hxx
@@ -51,15 +51,12 @@ namespace svgio
 
 /// Cx content, set if found in current context
 const SvgNumber& getCx() const { return maCx; }
-void setCx(const SvgNumber& rCx) { maCx = rCx; }
 
 /// Cy content, set if found in current context
 const SvgNumber& getCy() const { return maCy; }
-void setCy(const SvgNumber& rCy) { maCy = rCy; }
 
 /// R content, set if found in current context
 const SvgNumber& getR() const { return maR; }
-void setR(const SvgNumber& rR) { maR = rR; }
 
 /// transform content, set if found in current context
 const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
diff --git a/svgio/inc/svgellipsenode.hxx b/svgio/inc/svgellipsenode.hxx
index d0ad622..ad7d223 100644
--- a/svgio/inc/svgellipsenode.hxx
+++ b/svgio/inc/svgellipsenode.hxx
@@ -52,19 +52,15 @@ namespace svgio
 
 /// Cx content, set if found in current context
 const SvgNumber& getCx() const { return maCx; }
-void setCx(const SvgNumber& rCx) { maCx = rCx; }
 
 /// Cy content, set if found in current context
 const SvgNumber& getCy() const { return maCy; }
-void setCy(const SvgNumber& rCy) { maCy = rCy; }
 
 /// Rx content, set if found in current context
 const SvgNumber& getRx() const { return maRx; }
-void setRx(const SvgNumber& rRx) { maRx = rRx; }
 
 /// Ry content, set if found in current context
 const SvgNumber& getRy() const { return maRy; }
-void setRy(const SvgNumber& rRy) { maRy = rRy; }
 
 /// transform content, set if found in current context
 const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
diff --git a/svgio/inc/svggradientnode.hxx b/svgio/inc/svggradientnode.hxx
index 3a10ed7..cffd427 100644
--- a/svgio/inc/svggradientnode.hxx
+++ b/svgio/inc/svggradientnode.hxx
@@ -76,39 +76,30 @@ namespace svgio
 
 /// x1 content
 const SvgNumber getX1() const;
-void 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-04-12 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgnode.hxx |2 +-
 svgio/source/svgreader/svgnode.cxx|   11 +--
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit afe7392f88d8aa42f20a62788a14a132617f6602
Author: Xisco Fauli 
Date:   Mon Apr 11 01:57:47 2016 +0200

SVG: Clean up this code a litle bit

Change-Id: Ib941321d43a9a04d57f3c7c4a55528927fed5036
Reviewed-on: https://gerrit.libreoffice.org/24009
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index 3ad7b0f..0184f29 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -123,7 +123,7 @@ namespace svgio
 const SvgStyleAttributes* checkForCssStyle(const OUString& 
rClassStr, const SvgStyleAttributes& rOriginal) const;
 
 /// helper for filling the CssStyle vector once dependent on 
mbCssStyleVectorBuilt
-void fillCssStyleVector(const OUString& rClassStr);
+void fillCssStyleVector(const OUString& rClassStr, const 
SvgStyleAttributes& rOriginal);
 void fillCssStyleVectorUsingHierarchyAndSelectors(
 const OUString& rClassStr,
 const SvgNode& rCurrent,
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index b1de51d..c9bd15a 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -162,7 +162,7 @@ namespace svgio
 }
 }
 
-void SvgNode::fillCssStyleVector(const OUString& rClassStr)
+void SvgNode::fillCssStyleVector(const OUString& rClassStr, const 
SvgStyleAttributes& rOriginal)
 {
 OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector 
called double ?!?");
 mbCssStyleVectorBuilt = true;
@@ -199,6 +199,9 @@ namespace svgio
 // add CssStyle for selector '*' if found
 maCssStyleVector.push_back(pNew);
 }
+
+//local attributes
+maCssStyleVector.push_back();
 }
 
 const SvgStyleAttributes* SvgNode::checkForCssStyle(const OUString& 
rClassStr, const SvgStyleAttributes& rOriginal) const
@@ -206,7 +209,7 @@ namespace svgio
 if(!mbCssStyleVectorBuilt)
 {
 // build needed CssStyleVector for local node
-const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr);
+const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr, 
rOriginal);
 }
 
 if(maCssStyleVector.empty())
@@ -232,7 +235,6 @@ namespace svgio
 // for the element containing the hierarchy) in a vector of 
pointers and to use that.
 // Resetting the CssStyleParent on rOriginal is probably not 
needed
 // but simply safer to do.
-const_cast< SvgStyleAttributes& 
>(rOriginal).setCssStyleParent(nullptr);
 
 // loop over the existing CssStyles and link them. There is a 
first one, take
 // as current
@@ -246,9 +248,6 @@ namespace svgio
 pCurrent = pNext;
 }
 
-// pCurrent is the last used CssStyle, let it point to the 
original style
-pCurrent->setCssStyleParent();
-
 // return 1st CssStyle as style chain start element (only for 
the
 // local element, still no hierarchy used here)
 return maCssStyleVector[0];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-03-09 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |5 ++
 svgio/source/svgreader/svgstyleattributes.cxx|   46 ++-
 2 files changed, 41 insertions(+), 10 deletions(-)

New commits:
commit ecc7f698b5f080530f006218fa3dd82da43d9abb
Author: Xisco Fauli 
Date:   Mon Mar 7 23:05:59 2016 +0100

SVGIO: Fix problem when style's parent contains a mask element

Change-Id: I26aab6c0f959f6cc78d040f59f1acf0c7e29931b
Reviewed-on: https://gerrit.libreoffice.org/23045
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index fcd6114..f711feb 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -33,6 +33,7 @@ namespace svgio { namespace svgreader {
 class SvgPatternNode;
 class SvgMarkerNode;
 class SvgClipPathNode;
+class SvgMaskNode;
 }}
 
 
@@ -218,6 +219,7 @@ namespace svgio
 OUString   maClipPathXLink;
 const SvgClipPathNode* mpClipPathXLink;
 OUString   maMaskXLink;
+const SvgMaskNode* mpMaskXLink;
 
 /// link to markers. If set, the node can be fetched on demand
 OUString   maMarkerStartXLink;
@@ -447,7 +449,8 @@ namespace svgio
 const SvgClipPathNode* accessClipPathXLink() const;
 
 // MaskXLink content
-const OUString getMaskXLink() const { return maMaskXLink; }
+OUString getMaskXLink() const;
+const SvgMaskNode* accessMaskXLink() const;
 
 // MarkerStartXLink content
 OUString getMarkerStartXLink() const;
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 691a1f8..b226770 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1154,16 +1154,11 @@ namespace svgio
 
 if(!aSource.empty()) // test again, applied clipPath may have 
lead to empty geometry
 {
-if(!getMaskXLink().isEmpty())
+const SvgMaskNode* mpMask = accessMaskXLink();
+if(mpMask)
 {
-// try to access linked Mask
-const SvgMaskNode* mpMask = dynamic_cast< const 
SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(getMaskXLink()));
-
-if(mpMask)
-{
-// #i124852# transform may be needed when 
userSpaceOnUse
-mpMask->apply(aSource, pTransform);
-}
+// #i124852# transform may be needed when 
userSpaceOnUse
+mpMask->apply(aSource, pTransform);
 }
 
 if(!aSource.empty()) // test again, applied mask may have 
lead to empty geometry
@@ -1212,6 +1207,7 @@ namespace svgio
 maClipPathXLink(),
 mpClipPathXLink(nullptr),
 maMaskXLink(),
+mpMaskXLink(nullptr),
 maMarkerStartXLink(),
 mpMarkerStartXLink(nullptr),
 maMarkerMidXLink(),
@@ -2687,6 +2683,38 @@ namespace svgio
 return mpClipPathXLink;
 }
 
+OUString SvgStyleAttributes::getMaskXLink() const
+{
+if(!maMaskXLink.isEmpty())
+{
+return maMaskXLink;
+}
+
+const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+if(pSvgStyleAttributes && 
!pSvgStyleAttributes->maMaskXLink.isEmpty())
+{
+return pSvgStyleAttributes->getMaskXLink();
+}
+
+return OUString();
+}
+
+const SvgMaskNode* SvgStyleAttributes::accessMaskXLink() const
+{
+if(!mpMaskXLink)
+{
+const OUString aMask(getMaskXLink());
+
+if(!aMask.isEmpty())
+{
+const_cast< SvgStyleAttributes* >(this)->mpMaskXLink = 
dynamic_cast< const SvgMaskNode* 
>(mrOwner.getDocument().findSvgNodeById(getMaskXLink()));
+}
+}
+
+return mpMaskXLink;
+}
+
 OUString SvgStyleAttributes::getMarkerStartXLink() const
 {
 if(!maMarkerStartXLink.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-03-07 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |5 ++
 svgio/source/svgreader/svgstyleattributes.cxx|   46 ++-
 2 files changed, 41 insertions(+), 10 deletions(-)

New commits:
commit d5649ae7b76278cb3155f951d6327157c7c92b65
Author: Xisco Fauli 
Date:   Sun Mar 6 19:03:27 2016 +0100

SVGIO: tdf#97539: clip-path elements might contain...

reference to other clip-paths

Change-Id: I3722b31cefa4df6225e369b3d1db9f46be5933ff
Reviewed-on: https://gerrit.libreoffice.org/22956
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index f0c21ba..fcd6114 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -32,6 +32,7 @@ namespace svgio { namespace svgreader {
 class SvgGradientNode;
 class SvgPatternNode;
 class SvgMarkerNode;
+class SvgClipPathNode;
 }}
 
 
@@ -215,6 +216,7 @@ namespace svgio
 
 /// link to content. If set, the node can be fetched on demand
 OUString   maClipPathXLink;
+const SvgClipPathNode* mpClipPathXLink;
 OUString   maMaskXLink;
 
 /// link to markers. If set, the node can be fetched on demand
@@ -441,7 +443,8 @@ namespace svgio
 void setDesc(const OUString& rNew) { maDesc = rNew; }
 
 // ClipPathXLink content
-const OUString getClipPathXLink() const { return maClipPathXLink; }
+OUString getClipPathXLink() const;
+const SvgClipPathNode* accessClipPathXLink() const;
 
 // MaskXLink content
 const OUString getMaskXLink() const { return maMaskXLink; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 3e454e4..691a1f8 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1145,16 +1145,11 @@ namespace svgio
 aSource = drawinglayer::primitive2d::Primitive2DContainer 
{ xRef };
 }
 
-if(!getClipPathXLink().isEmpty())
+const SvgClipPathNode* mpClip = accessClipPathXLink();
+if(mpClip)
 {
-// try to access linked ClipPath
-const SvgClipPathNode* mpClip = dynamic_cast< const 
SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink()));
-
-if(mpClip)
-{
-// #i124852# transform may be needed when 
userSpaceOnUse
-mpClip->apply(aSource, pTransform);
-}
+// #i124852# transform may be needed when userSpaceOnUse
+mpClip->apply(aSource, pTransform);
 }
 
 if(!aSource.empty()) // test again, applied clipPath may have 
lead to empty geometry
@@ -1215,6 +1210,7 @@ namespace svgio
 maTitle(),
 maDesc(),
 maClipPathXLink(),
+mpClipPathXLink(nullptr),
 maMaskXLink(),
 maMarkerStartXLink(),
 mpMarkerStartXLink(nullptr),
@@ -2659,6 +2655,38 @@ namespace svgio
 return nullptr;
 }
 
+OUString SvgStyleAttributes::getClipPathXLink() const
+{
+if(!maClipPathXLink.isEmpty())
+{
+return maClipPathXLink;
+}
+
+const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+if(pSvgStyleAttributes && 
!pSvgStyleAttributes->maClipPathXLink.isEmpty())
+{
+return pSvgStyleAttributes->getClipPathXLink();
+}
+
+return OUString();
+}
+
+const SvgClipPathNode* SvgStyleAttributes::accessClipPathXLink() const
+{
+if(!mpClipPathXLink)
+{
+const OUString aClipPath(getClipPathXLink());
+
+if(!aClipPath.isEmpty())
+{
+const_cast< SvgStyleAttributes* >(this)->mpClipPathXLink = 
dynamic_cast< const SvgClipPathNode* 
>(mrOwner.getDocument().findSvgNodeById(getClipPathXLink()));
+}
+}
+
+return mpClipPathXLink;
+}
+
 OUString SvgStyleAttributes::getMarkerStartXLink() const
 {
 if(!maMarkerStartXLink.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/Library_svgio.mk svgio/source

2016-03-03 Thread Xisco Fauli
 svgio/Library_svgio.mk|1 
 svgio/inc/svgio/svgreader/svganode.hxx|   58 +
 svgio/inc/svgio/svgreader/svgtoken.hxx|1 
 svgio/source/svgreader/svganode.cxx   |  109 ++
 svgio/source/svgreader/svgdocumenthandler.cxx |9 ++
 svgio/source/svgreader/svgtoken.cxx   |2 
 6 files changed, 180 insertions(+)

New commits:
commit 57de81580dc3a9c53c43871150109181da1bb646
Author: Xisco Fauli 
Date:   Wed Mar 2 00:45:14 2016 +0100

tdf#98113: SVGIO: Add SvgANode class to handle transport ...

... attribute in anchor elements.

I used Svggnode class a a reference for this.

Change-Id: Id2a58bd913f9984dc91163ca0f333c016aa981f1
Reviewed-on: https://gerrit.libreoffice.org/22822
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 

diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index bea40eb..3ba1891 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgdocumenthandler \
 svgio/source/svgreader/svgellipsenode \
 svgio/source/svgreader/svggnode \
+svgio/source/svgreader/svganode \
 svgio/source/svgreader/svggradientnode \
 svgio/source/svgreader/svggradientstopnode \
 svgio/source/svgreader/svgimagenode \
diff --git a/svgio/inc/svgio/svgreader/svganode.hxx 
b/svgio/inc/svgio/svgreader/svganode.hxx
new file mode 100644
index 000..d58224a
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svganode.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGANODE_HXX
+#define INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGANODE_HXX
+
+#include 
+#include 
+
+namespace svgio
+{
+namespace svgreader
+{
+class SvgANode : public SvgNode
+{
+private:
+/// use styles
+SvgStyleAttributes  maSvgStyleAttributes;
+
+/// variable scan values, dependent of given XAttributeList
+basegfx::B2DHomMatrix*  mpaTransform;
+
+public:
+SvgANode(
+SvgDocument& rDocument,
+SvgNode* pParent);
+virtual ~SvgANode();
+
+virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
+virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
+virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
+
+/// transform content
+const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
+void setTransform(const basegfx::B2DHomMatrix* pMatrix = nullptr) 
{ if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) 
mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+};
+} // end of namespace svgreader
+} // end of namespace svgio
+
+#endif // INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGANODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx 
b/svgio/inc/svgio/svgreader/svgtoken.hxx
index adc6783..112102f 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -127,6 +127,7 @@ namespace svgio
 SVGTokenSvg,
 SVGTokenSymbol,
 SVGTokenUse,
+SVGTokenA,
 
 // shape elements
 SVGTokenCircle,
diff --git a/svgio/source/svgreader/svganode.cxx 
b/svgio/source/svgreader/svganode.cxx
new file mode 100644
index 000..70c53d5
--- /dev/null
+++ b/svgio/source/svgreader/svganode.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not 

[Libreoffice-commits] core.git: svgio/inc

2016-02-29 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 817f6bd75e98a321c238b5906bfcb031908914b2
Author: Xisco Fauli 
Date:   Sun Feb 28 22:54:44 2016 +0100

fix typo

Change-Id: I3e1e28269d8b2d6d45bba6bc43aa8f20c1963956
Reviewed-on: https://gerrit.libreoffice.org/22793
Tested-by: Jenkins 
Reviewed-by: Ashod Nakashian 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 33258d5..f0c21ba 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -228,7 +228,7 @@ namespace svgio
 /// fill rule
 FillRulemaFillRule;
 
-// ClipRule setting (only valid wne mbIsClipPathContent == true, 
default is FillRule_nonzero)
+// ClipRule setting (only valid when mbIsClipPathContent == true, 
default is FillRule_nonzero)
 FillRulemaClipRule;
 
 // BaselineShift: Type and number (in case of 
BaselineShift_Percentage or BaselineShift_Length)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-02-27 Thread Xisco Faulí
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |2 +-
 svgio/source/svgreader/svgstyleattributes.cxx|   17 -
 2 files changed, 1 insertion(+), 18 deletions(-)

New commits:
commit 85fcf15ff41ceb95f46dee586ff7187551be4955
Author: Xisco Faulí 
Date:   Sat Feb 27 00:17:25 2016 +

Revert "SVGIO: tdf#97539: clip-path elements might contain..."

This reverts commit 7b7ffedfa6357b902a5e354d986dac39a3b2f462.

Change-Id: I018830e17cb83c5fe3574b76939673877ac2004d
Reviewed-on: https://gerrit.libreoffice.org/22726
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 011b5f3..33258d5 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -441,7 +441,7 @@ namespace svgio
 void setDesc(const OUString& rNew) { maDesc = rNew; }
 
 // ClipPathXLink content
-OUString getClipPathXLink() const;
+const OUString getClipPathXLink() const { return maClipPathXLink; }
 
 // MaskXLink content
 const OUString getMaskXLink() const { return maMaskXLink; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 56a1ac5..3e454e4 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -2659,23 +2659,6 @@ namespace svgio
 return nullptr;
 }
 
-OUString SvgStyleAttributes::getClipPathXLink() const
-{
-if(!maClipPathXLink.isEmpty())
-{
-return maClipPathXLink;
-}
-
-const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
-
-if(pSvgStyleAttributes)
-{
-return pSvgStyleAttributes->getClipPathXLink();
-}
-
-return OUString();
-}
-
 OUString SvgStyleAttributes::getMarkerStartXLink() const
 {
 if(!maMarkerStartXLink.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2016-02-18 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgtspannode.hxx |2 ++
 svgio/qa/cppunit/SvgImportTest.cxx |   17 +
 svgio/qa/cppunit/data/tdf97941.svg |6 ++
 svgio/source/svgreader/svgtspannode.cxx|5 +
 4 files changed, 30 insertions(+)

New commits:
commit 85c789be1f94777b582977e69b16665a47dc364f
Author: Xisco Fauli 
Date:   Thu Feb 18 00:08:13 2016 +0100

SVGIO: tdf#97941: Don't double tspan fontsize

Same as in 701324a1e1f7e0c181ff1a50956ced686785ea53

Change-Id: I531bef4821008ef71951506c133f999b9ab4f4ff
Reviewed-on: https://gerrit.libreoffice.org/22450
Tested-by: Jenkins 
Reviewed-by: Xisco Faulí 

diff --git a/svgio/inc/svgio/svgreader/svgtspannode.hxx 
b/svgio/inc/svgio/svgreader/svgtspannode.hxx
index 53532c6..fd906e0 100644
--- a/svgio/inc/svgio/svgreader/svgtspannode.hxx
+++ b/svgio/inc/svgio/svgreader/svgtspannode.hxx
@@ -46,6 +46,8 @@ namespace svgio
 virtual const SvgStyleAttributes* getSvgStyleAttributes() const 
override;
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 
+virtual double getCurrentFontSize() const override;
+
 /// access to SvgTextPositions
 const SvgTextPositions& getSvgTextPositions() const { return 
maSvgTextPositions; }
 };
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 2030598..7870188 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -43,6 +43,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testFontsizeKeywords();
 void testFontsizePercentage();
 void testTdf45771();
+void testTdf97941();
 void testTdf85770();
 void testTdf79163();
 void testTdf97542_1();
@@ -63,6 +64,7 @@ public:
 CPPUNIT_TEST(testFontsizeKeywords);
 CPPUNIT_TEST(testFontsizePercentage);
 CPPUNIT_TEST(testTdf45771);
+CPPUNIT_TEST(testTdf97941);
 CPPUNIT_TEST(testTdf85770);
 CPPUNIT_TEST(testTdf79163);
 CPPUNIT_TEST(testTdf97542_1);
@@ -208,6 +210,7 @@ void Test::testFontsizePercentage()
 
 void Test::testTdf45771()
 {
+//Check text fontsize when using relative units
 Primitive2DSequence aSequenceTdf45771 = 
parseSvg("/svgio/qa/cppunit/data/tdf45771.svg");
 CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf45771.getLength());
 
@@ -219,6 +222,20 @@ void Test::testTdf45771()
 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "32");
 }
 
+void Test::testTdf97941()
+{
+//Check tspan fontsize when using relative units
+Primitive2DSequence aSequenceTdf97941 = 
parseSvg("/svgio/qa/cppunit/data/tdf97941.svg");
+CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf97941.getLength());
+
+Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceTdf97941));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", 
"height", "48");
+}
+
 void Test::testTdf85770()
 {
 Primitive2DSequence aSequenceTdf85770 = 
parseSvg("/svgio/qa/cppunit/data/tdf85770.svg");
diff --git a/svgio/qa/cppunit/data/tdf97941.svg 
b/svgio/qa/cppunit/data/tdf97941.svg
new file mode 100644
index 000..cfe1ca8
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf97941.svg
@@ -0,0 +1,6 @@
+
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink;>
+
+
+   Sample
+
diff --git a/svgio/source/svgreader/svgtspannode.cxx 
b/svgio/source/svgreader/svgtspannode.cxx
index e930795..962f1c8 100644
--- a/svgio/source/svgreader/svgtspannode.cxx
+++ b/svgio/source/svgreader/svgtspannode.cxx
@@ -68,6 +68,11 @@ namespace svgio
 }
 }
 
+double SvgTspanNode::getCurrentFontSize() const
+{
+return getCurrentFontSizeInherited();
+}
+
 } // end of namespace svgreader
 } // end of namespace svgio
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-02-16 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |2 +-
 svgio/source/svgreader/svgstyleattributes.cxx|   17 +
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 7b7ffedfa6357b902a5e354d986dac39a3b2f462
Author: Xisco Fauli 
Date:   Wed Feb 17 00:25:15 2016 +0100

SVGIO: tdf#97539: clip-path elements might contain...

reference to other clip-paths

Change-Id: I0c426c892da2478293b78ea93db087d781275896
Reviewed-on: https://gerrit.libreoffice.org/22411
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 33258d5..011b5f3 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -441,7 +441,7 @@ namespace svgio
 void setDesc(const OUString& rNew) { maDesc = rNew; }
 
 // ClipPathXLink content
-const OUString getClipPathXLink() const { return maClipPathXLink; }
+OUString getClipPathXLink() const;
 
 // MaskXLink content
 const OUString getMaskXLink() const { return maMaskXLink; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 698f7e8..bf4f057 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -2648,6 +2648,23 @@ namespace svgio
 return nullptr;
 }
 
+OUString SvgStyleAttributes::getClipPathXLink() const
+{
+if(!maClipPathXLink.isEmpty())
+{
+return maClipPathXLink;
+}
+
+const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+if(pSvgStyleAttributes)
+{
+return pSvgStyleAttributes->getClipPathXLink();
+}
+
+return OUString();
+}
+
 OUString SvgStyleAttributes::getMarkerStartXLink() const
 {
 if(!maMarkerStartXLink.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/qa svgio/source

2016-02-13 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgtools.hxx|4 +-
 svgio/qa/cppunit/SvgImportTest.cxx|   32 
 svgio/qa/cppunit/data/RGBAColor.svg   |4 ++
 svgio/qa/cppunit/data/RGBColor.svg|4 ++
 svgio/source/svgreader/svgstyleattributes.cxx |   28 --
 svgio/source/svgreader/svgtools.cxx   |   50 +-
 6 files changed, 107 insertions(+), 15 deletions(-)

New commits:
commit 3c8b880c5edc1dcbf0f481c558c6093513df6b45
Author: Xisco Fauli 
Date:   Fri Feb 12 01:36:58 2016 +0100

SVGIO: tdf#97659: Add support for RGBA

Change-Id: Icbf3796cdc95f91d298a5ca52d44931b3985eac6
Reviewed-on: https://gerrit.libreoffice.org/22303
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx 
b/svgio/inc/svgio/svgreader/svgtools.hxx
index 27b687f..a9dba7f 100644
--- a/svgio/inc/svgio/svgreader/svgtools.hxx
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -201,12 +201,12 @@ namespace svgio
 bool readAngle(const OUString& rCandidate, sal_Int32& nPos, double& 
fAngle, const sal_Int32 nLen);
 sal_Int32 read_hex(const sal_Unicode& rChar);
 bool match_colorKeyword(basegfx::BColor& rColor, const OUString& 
rName, bool bCaseIndependent);
-bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
bool bCaseIndependent);
+bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, 
bool bCaseIndependent, SvgNumber& rOpacity);
 basegfx::B2DRange readViewBox(const OUString& rCandidate, 
InfoProvider& rInfoProvider);
 basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, 
InfoProvider& rInfoProvider);
 bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum);
 bool readLocalUrl(const OUString& rCandidate, OUString& rURL);
-bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, bool bCaseIndependent);
+bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, 
OUString& rURL, bool bCaseIndependent, SvgNumber& rOpacity);
 
 bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& 
rSvgNumberVector);
 ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& 
rInput, const InfoProvider& rInfoProvider, NumberType aNumberType = length);
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 182c4fe..2030598 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -48,6 +48,8 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
 void testTdf97542_1();
 void testTdf97542_2();
 void testTdf97543();
+void testRGBColor();
+void testRGBAColor();
 
 Primitive2DSequence parseSvg(const char* aSource);
 
@@ -66,6 +68,8 @@ public:
 CPPUNIT_TEST(testTdf97542_1);
 CPPUNIT_TEST(testTdf97542_2);
 CPPUNIT_TEST(testTdf97543);
+CPPUNIT_TEST(testRGBColor);
+CPPUNIT_TEST(testRGBAColor);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -232,6 +236,7 @@ void Test::testTdf85770()
 
 void Test::testTdf79163()
 {
+//Check Opacity
 Primitive2DSequence aSequenceTdf79163 = 
parseSvg("/svgio/qa/cppunit/data/tdf79163.svg");
 CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf79163.getLength());
 
@@ -284,6 +289,33 @@ void Test::testTdf97543()
 
 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#00cc00");
 }
+
+void Test::testRGBColor()
+{
+Primitive2DSequence aSequenceRGBColor = 
parseSvg("/svgio/qa/cppunit/data/RGBColor.svg");
+CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceRGBColor.getLength());
+
+Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceRGBColor));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", 
"#646464");
+}
+
+void Test::testRGBAColor()
+{
+Primitive2DSequence aSequenceRGBAColor = 
parseSvg("/svgio/qa/cppunit/data/RGBAColor.svg");
+CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceRGBAColor.getLength());
+
+Primitive2dXmlDump dumper;
+xmlDocPtr pDocument = 
dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceRGBAColor));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", 
"transparence", "0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/svgio/qa/cppunit/data/RGBAColor.svg 
b/svgio/qa/cppunit/data/RGBAColor.svg
new file mode 100644
index 000..ddd7a3c
--- /dev/null
+++ b/svgio/qa/cppunit/data/RGBAColor.svg
@@ -0,0 +1,4 @@
+
+http://www.w3.org/2000/svg; 
xmlns:xlink="http://www.w3.org/1999/xlink;>
+   
+
diff --git a/svgio/qa/cppunit/data/RGBColor.svg 
b/svgio/qa/cppunit/data/RGBColor.svg
new file mode 100644
index 000..ad60d5b
--- /dev/null
+++ 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-02-06 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |5 +++--
 svgio/source/svgreader/svgstyleattributes.cxx|   23 ++-
 2 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 842313c23ec96aeb99b68f28e7d48cc9e263a0a8
Author: Xisco Fauli 
Date:   Sat Feb 6 17:04:41 2016 +0100

tdf#97543 SVGIO: Rework getVisibility()

Change-Id: Idb3eaa27e3e8ec177ebd2bad81f53c4d3da9d241
Reviewed-on: https://gerrit.libreoffice.org/22169
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 9d589d1..47bace0 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -170,6 +170,7 @@ namespace svgio
 
 enum Visibility
 {
+Visibility_notset,
 Visibility_visible,
 Visibility_hidden,
 Visibility_collapse,
@@ -429,8 +430,8 @@ namespace svgio
 void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { 
maOpacity = rOpacity; }
 
 /// Visibility
-Visibility getVisibility() const { return maVisibility; }
-void setVisibility(Visibility eVisibility) { maVisibility = 
eVisibility; }
+Visibility getVisibility() const;
+void setVisibility(const Visibility aVisibility = 
Visibility_notset) { maVisibility = aVisibility; }
 
 // Title content
 const OUString& getTitle() const { return maTitle; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index e733396..f3eec06 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1211,7 +1211,7 @@ namespace svgio
 maTextAnchor(TextAnchor_notset),
 maColor(),
 maOpacity(),
-maVisibility(Visibility_visible),
+maVisibility(Visibility_notset),
 maTitle(),
 maDesc(),
 maClipPathXLink(),
@@ -1237,10 +1237,6 @@ namespace svgio
 mbIsClipPathContent = pParentStyle->mbIsClipPathContent;
 }
 }
-if(pParentStyle)
-{
-maVisibility = pParentStyle->maVisibility;
-}
 }
 
 SvgStyleAttributes::~SvgStyleAttributes()
@@ -2185,6 +2181,23 @@ namespace svgio
 return SvgNumber(1.0);
 }
 
+Visibility SvgStyleAttributes::getVisibility() const
+{
+if(Visibility_notset == maVisibility || Visibility_inherit == 
maVisibility)
+{
+const SvgStyleAttributes* pSvgStyleAttributes = 
getParentStyle();
+
+if(pSvgStyleAttributes)
+{
+return pSvgStyleAttributes->getVisibility();
+}
+//default is Visible
+return Visibility_visible;
+}
+
+return maVisibility;
+}
+
 FillRule SvgStyleAttributes::getFillRule() const
 {
 if(FillRule_notset != maFillRule)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-02-01 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |2 -
 svgio/source/svgreader/svgstyleattributes.cxx|   28 ---
 2 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit 359f43f8e76c3bd85c3daf35b5a6d925a4c8c64f
Author: Xisco Fauli 
Date:   Sat Jan 30 01:50:07 2016 +0100

tdf#79163: SVGIO: Fix problem with opacity attribute

Opacity attribute didn't work because it was always set to 1.0

Change-Id: I3a2029ef23acf9d8c0f346e04341db33c6802b8e
Reviewed-on: https://gerrit.libreoffice.org/21911
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 02cf55d..9d589d1 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -425,7 +425,7 @@ namespace svgio
 const basegfx::BColor* getCurrentColor() const;
 
 /// Opacity content
-SvgNumber getOpacity() const { return maOpacity; }
+SvgNumber getOpacity() const;
 void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { 
maOpacity = rOpacity; }
 
 /// Visibility
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 3e3fa00..e733396 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1056,7 +1056,7 @@ namespace svgio
 return;
 }
 
-const double fOpacity(getOpacity().getNumber());
+const double fOpacity(getOpacity().solve(mrOwner));
 
 if(basegfx::fTools::equalZero(fOpacity))
 {
@@ -1113,7 +1113,7 @@ namespace svgio
 {
 if(!rSource.empty())
 {
-const double fOpacity(getOpacity().getNumber());
+const double fOpacity(getOpacity().solve(mrOwner));
 
 if(basegfx::fTools::equalZero(fOpacity))
 {
@@ -1210,7 +1210,7 @@ namespace svgio
 maTextDecoration(TextDecoration_notset),
 maTextAnchor(TextAnchor_notset),
 maColor(),
-maOpacity(1.0),
+maOpacity(),
 maVisibility(Visibility_visible),
 maTitle(),
 maDesc(),
@@ -2163,6 +2163,28 @@ namespace svgio
 return SvgNumber(1.0);
 }
 
+SvgNumber SvgStyleAttributes::getOpacity() const
+{
+if(mbIsClipPathContent)
+{
+return SvgNumber(1.0);
+}
+else if(maOpacity.isSet())
+{
+return maOpacity;
+}
+
+const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+
+if(pSvgStyleAttributes)
+{
+return pSvgStyleAttributes->getOpacity();
+}
+
+// default is 1
+return SvgNumber(1.0);
+}
+
 FillRule SvgStyleAttributes::getFillRule() const
 {
 if(FillRule_notset != maFillRule)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-01-27 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgnode.hxx |2 +-
 svgio/inc/svgio/svgreader/svgtextnode.hxx |2 ++
 svgio/source/svgreader/svgtextnode.cxx|5 +
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 701324a1e1f7e0c181ff1a50956ced686785ea53
Author: Xisco Fauli 
Date:   Tue Jan 26 01:29:22 2016 +0100

SVGIO: tdf#45771: Fix issue when text size is twice its size...

... when using relative units (em, ex)

This is because for nodes of type textnode, getFontSizeNumber
is called from SvgCharacterNode::createSimpleTextPrimitive
and from SvgNode::getCurrentFontSize(), so avoid the second call.

Change-Id: Ibd418708a572e3c1643164a900fac7e7481afe81
Reviewed-on: https://gerrit.libreoffice.org/21801
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index ab7f28a..d72cde3 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -160,7 +160,7 @@ namespace svgio
 virtual double getCurrentFontSizeInherited() const override;
 virtual double getCurrentXHeightInherited() const override;
 
-double getCurrentFontSize() const;
+virtual double getCurrentFontSize() const;
 double getCurrentXHeight() const;
 
 /// Id access
diff --git a/svgio/inc/svgio/svgreader/svgtextnode.hxx 
b/svgio/inc/svgio/svgreader/svgtextnode.hxx
index 7922f13..86c1321 100644
--- a/svgio/inc/svgio/svgreader/svgtextnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgtextnode.hxx
@@ -58,6 +58,8 @@ namespace svgio
 virtual void parseAttribute(const OUString& rTokenName, SVGToken 
aSVGToken, const OUString& aContent) override;
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool 
bReferenced) const override;
 
+virtual double getCurrentFontSize() const override;
+
 /// transform content, set if found in current context
 const basegfx::B2DHomMatrix* getTransform() const { return 
mpaTransform; }
 void setTransform(const basegfx::B2DHomMatrix* pMatrix = nullptr) 
{ if(mpaTransform) delete mpaTransform; mpaTransform = nullptr; if(pMatrix) 
mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
diff --git a/svgio/source/svgreader/svgtextnode.cxx 
b/svgio/source/svgreader/svgtextnode.cxx
index 4637bce..ae7d0e1 100644
--- a/svgio/source/svgreader/svgtextnode.cxx
+++ b/svgio/source/svgreader/svgtextnode.cxx
@@ -260,6 +260,11 @@ namespace svgio
 }
 }
 }
+
+double SvgTextNode::getCurrentFontSize() const
+{
+return getCurrentFontSizeInherited();
+}
 } // end of namespace svgreader
 } // end of namespace svgio
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-01-22 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgtools.hxx|2 +-
 svgio/source/svgreader/svgstyleattributes.cxx |5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 288d1f802d306dc741df60c029c50850e7e5fd6b
Author: Xisco Fauli 
Date:   Wed Jan 20 00:13:18 2016 +0100

tdf#97275 SVGIO: Change default PPI to 96 in svg import...

... thus default font size is 16px from now on.

More information: https://gerrit.libreoffice.org/#/c/21542/

Change-Id: If19b5be08d57a9d630647b9ad51a4bb6956c70ed
Reviewed-on: https://gerrit.libreoffice.org/21617
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx 
b/svgio/inc/svgio/svgreader/svgtools.hxx
index 71fee9e..27b687f 100644
--- a/svgio/inc/svgio/svgreader/svgtools.hxx
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -36,7 +36,7 @@ namespace svgio
 #endif
 
 // recommended value for this device dependent unit, see CSS2 section 4.3.2 
Lengths
-#define F_SVG_PIXEL_PER_INCH  90.0
+#define F_SVG_PIXEL_PER_INCH  96.0
 
 // common non-token strings
 struct commonStrings
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 171545d..0bb05b4 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -2337,8 +2337,9 @@ namespace svgio
 return maFontSizeNumber;
 }
 
-// default is 'medium'
-const double aDefaultSize = 12.0;
+// default size is 'medium' or 16px, which is equal to the default 
PPI used in svgio ( 96.0 )
+// converted to pixels
+const double aDefaultSize = F_SVG_PIXEL_PER_INCH / 6.0;
 
 //In CSS2, the suggested scaling factor between adjacent indexes 
is 1.2
 switch(maFontSize)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2016-01-20 Thread Xisco Fauli
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |   23 +++-
 svgio/source/svgreader/svgcharacternode.cxx  |4 
 svgio/source/svgreader/svgnode.cxx   |4 
 svgio/source/svgreader/svgstyleattributes.cxx|  129 ---
 4 files changed, 140 insertions(+), 20 deletions(-)

New commits:
commit 406cdc29039e5e65bacfcd635de8022642d63547
Author: Xisco Fauli 
Date:   Sun Jan 17 19:17:46 2016 +0100

SVGIO: Add support to font-size keywords

Similar to 0cae9c32ce9884a9809e220ba80b7c4cb4059565

Change-Id: Iac7a6bb30b36e51ea67a6c4f7b3421f480eeea57
Reviewed-on: https://gerrit.libreoffice.org/21542
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index c227986..02cf55d 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -56,6 +56,21 @@ namespace svgio
 StrokeLinejoin_bevel
 };
 
+enum FontSize
+{
+FontSize_notset,
+FontSize_xx_small,
+FontSize_x_small,
+FontSize_small,
+FontSize_smaller,
+FontSize_medium,
+FontSize_large,
+FontSize_larger,
+FontSize_x_large,
+FontSize_xx_large,
+FontSize_initial
+};
+
 enum FontStretch
 {
 FontStretch_notset,
@@ -183,7 +198,8 @@ namespace svgio
 SvgNumber   maStrokeMiterLimit;
 SvgNumber   maStrokeOpacity;
 SvgStringVector maFontFamily;
-SvgNumber   maFontSize;
+FontSizemaFontSize;
+SvgNumber   maFontSizeNumber;
 FontStretch maFontStretch;
 FontStyle   maFontStyle;
 FontVariant maFontVariant;
@@ -369,8 +385,9 @@ namespace svgio
 void setFontFamily(const SvgStringVector& rSvgStringVector = 
SvgStringVector()) { maFontFamily = rSvgStringVector; }
 
 /// FontSize content
-SvgNumber getFontSize() const;
-void setFontSize(const SvgNumber& rFontSize = SvgNumber()) { 
maFontSize = rFontSize; }
+void setFontSize(const FontSize aFontSize = FontSize_notset) { 
maFontSize = aFontSize; }
+void setFontSizeNumber(const SvgNumber& rFontSize = SvgNumber()) { 
maFontSizeNumber = rFontSize; }
+SvgNumber getFontSizeNumber() const;
 
 /// FontStretch content
 FontStretch getFontStretch() const;
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 9cc4c23..e5bc0a5 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -272,8 +272,8 @@ namespace svgio
 bRTL,
 bBiDiStrong);
 
-// prepare FontSize
-double 
fFontWidth(rSvgStyleAttributes.getFontSize().solve(*this));
+// prepare FontSizeNumber
+double 
fFontWidth(rSvgStyleAttributes.getFontSizeNumber().solve(*this));
 double fFontHeight(fFontWidth);
 
 // prepare locale
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 4e90d51..b1de51d 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -624,7 +624,7 @@ namespace svgio
 double SvgNode::getCurrentFontSize() const
 {
 if(getSvgStyleAttributes())
-return getSvgStyleAttributes()->getFontSize().solve(*this, 
xcoordinate);
+return 
getSvgStyleAttributes()->getFontSizeNumber().solve(*this, xcoordinate);
 
 return getCurrentFontSizeInherited();
 }
@@ -645,7 +645,7 @@ namespace svgio
 {
 if(getSvgStyleAttributes())
 // for XHeight, use FontSize currently
-return getSvgStyleAttributes()->getFontSize().solve(*this, 
ycoordinate);
+return 
getSvgStyleAttributes()->getFontSizeNumber().solve(*this, ycoordinate);
 
 return getCurrentXHeightInherited();
 }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 1c93bd9..171545d 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1201,6 +1201,7 @@ namespace svgio
 maStrokeOpacity(),
 maFontFamily(),
 maFontSize(),
+maFontSizeNumber(),
 maFontStretch(FontStretch_notset),
 maFontStyle(FontStyle_notset),
 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2015-07-16 Thread Noel Grandin
 svgio/inc/svgio/svgreader/svgcharacternode.hxx   |3 ---
 svgio/inc/svgio/svgreader/svgdocument.hxx|1 -
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |7 ---
 svgio/inc/svgio/svgreader/svgsvgnode.hxx |1 -
 svgio/inc/svgio/svgreader/svgsymbolnode.hxx  |2 --
 svgio/inc/svgio/svgreader/svgtextpathnode.hxx|2 --
 svgio/inc/svgio/svgreader/svgtools.hxx   |1 -
 svgio/inc/svgio/svgreader/svgusenode.hxx |2 --
 svgio/source/svgreader/svgcharacternode.cxx  |3 +--
 9 files changed, 1 insertion(+), 21 deletions(-)

New commits:
commit ee79541aa892ff218e1dc3f869a3ac11b6f296ba
Author: Noel Grandin n...@peralex.com
Date:   Wed Jul 15 15:28:37 2015 +0200

loplugin:unusedmethods svgio

Change-Id: I0dd601429b70dc09780e31079a6f7c0570652fe9
Reviewed-on: https://gerrit.libreoffice.org/17114
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/svgio/inc/svgio/svgreader/svgcharacternode.hxx 
b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
index 192f24d..23d7809 100644
--- a/svgio/inc/svgio/svgreader/svgcharacternode.hxx
+++ b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
@@ -101,7 +101,6 @@ namespace svgio
 /// bitfield
 boolmbLengthAdjust : 1; // true = spacing, 
false = spacingAndGlyphs
 boolmbAbsoluteX : 1;
-boolmbAbsoluteY : 1;
 
 public:
 SvgTextPosition(
@@ -112,11 +111,9 @@ namespace svgio
 // data read access
 const SvgTextPosition* getParent() const { return mpParent; }
 const ::std::vector double  getX() const { return maX; }
-const ::std::vector double  getY() const { return maY; }
 double getTextLength() const { return mfTextLength; }
 bool getLengthAdjust() const { return mbLengthAdjust; }
 bool getAbsoluteX() const { return mbAbsoluteX; }
-bool getAbsoluteY() const { return mbAbsoluteY; }
 
 // get/set absolute, current, advancing position
 const basegfx::B2DPoint getPosition() const { return maPosition; }
diff --git a/svgio/inc/svgio/svgreader/svgdocument.hxx 
b/svgio/inc/svgio/svgreader/svgdocument.hxx
index e0d0141..46aee7a 100644
--- a/svgio/inc/svgio/svgreader/svgdocument.hxx
+++ b/svgio/inc/svgio/svgreader/svgdocument.hxx
@@ -61,7 +61,6 @@ namespace svgio
 void removeSvgNodeFromMapper(const OUString rStr);
 
 /// find a node by its Id
-bool hasSvgNodesById() const { return 
!maIdTokenMapperList.empty(); }
 const SvgNode* findSvgNodeById(const OUString rStr) const;
 
 /// add/remove styles to mapper
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 5a67aa1..cb1982d 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -335,7 +335,6 @@ namespace svgio
 
 /// fill rule content
 FillRule getFillRule() const;
-void setFillRule(const FillRule aFillRule = FillRule_notset) { 
maFillRule = aFillRule; }
 
 /// fill StrokeDasharray content
 const SvgNumberVector getStrokeDasharray() const;
@@ -382,7 +381,6 @@ namespace svgio
 void setFontStyle(const FontStyle aFontStyle = FontStyle_notset) { 
maFontStyle = aFontStyle; }
 
 /// FontVariant content
-FontVariant getFontVariant() const;
 void setFontVariant(const FontVariant aFontVariant = 
FontVariant_notset) { maFontVariant = aFontVariant; }
 
 /// FontWeight content
@@ -427,26 +425,21 @@ namespace svgio
 
 // ClipPathXLink content
 const OUString getClipPathXLink() const { return maClipPathXLink; }
-void setClipPathXLink(const OUString rNew) { maClipPathXLink = 
rNew; }
 
 // MaskXLink content
 const OUString getMaskXLink() const { return maMaskXLink; }
-void setMaskXLink(const OUString rNew) { maMaskXLink = rNew; }
 
 // MarkerStartXLink content
 OUString getMarkerStartXLink() const;
 const SvgMarkerNode* accessMarkerStartXLink() const;
-void setMarkerStartXLink(const OUString rNew) { 
maMarkerStartXLink = rNew; }
 
 // MarkerMidXLink content
 OUString getMarkerMidXLink() const;
 const SvgMarkerNode* accessMarkerMidXLink() const;
-void setMarkerMidXLink(const OUString rNew) { maMarkerMidXLink = 
rNew; }
 
 // MarkerEndXLink content
 OUString getMarkerEndXLink() const;
 const SvgMarkerNode* accessMarkerEndXLink() const;
-void setMarkerEndXLink(const OUString rNew) { maMarkerEndXLink = 
rNew; }
 
 // BaselineShift
 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2015-02-06 Thread Chr . Rossmanith
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |3 +++
 svgio/source/svgreader/svgstyleattributes.cxx|   17 +
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit d0cfd49dc530574cbbc0a95c173de8936bc9c8ca
Author: Chr. Rossmanith chrrossman...@gmx.de
Date:   Tue Feb 3 21:20:20 2015 +0100

tdf#87309: SVG - use black as default currentColor if no color was specified

improves import of attachment 
https://bugs.documentfoundation.org/attachment.cgi?id=110836 from issue 62284

Change-Id: Icb056774746ce270138a54e9dfe9ca6987a64769
Reviewed-on: https://gerrit.libreoffice.org/14242
Reviewed-by: Katarina Behrens bu...@bubli.org
Tested-by: Katarina Behrens bu...@bubli.org

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 693772b..ac3fbf8 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -406,6 +406,9 @@ namespace svgio
 const basegfx::BColor* getColor() const;
 void setColor(const SvgPaint rColor) { maColor = rColor; }
 
+/// Resolve current color (defaults to black if no color is 
specified)
+const basegfx::BColor* getCurrentColor() const;
+
 /// Opacity content
 SvgNumber getOpacity() const { return maOpacity; }
 void setOpacity(const SvgNumber rOpacity = SvgNumber()) { 
maOpacity = rOpacity; }
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 182448f..fa71c63 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1888,19 +1888,28 @@ namespace svgio
 return false;
 }
 
+const basegfx::BColor* SvgStyleAttributes::getCurrentColor() const
+{
+static basegfx::BColor aBlack(0.0, 0.0, 0.0);
+const basegfx::BColor *aColor = getColor();
+if( aColor )
+return aColor;
+else
+return aBlack;
+}
+
 const basegfx::BColor* SvgStyleAttributes::getFill() const
 {
 if(mbIsClipPathContent)
 {
 static basegfx::BColor aBlack(0.0, 0.0, 0.0);
-
 return aBlack;
 }
 else if(maFill.isSet())
 {
 if(maFill.isCurrent())
 {
-return getColor();
+return getCurrentColor();
 }
 else if(maFill.isOn())
 {
@@ -1930,7 +1939,7 @@ namespace svgio
 {
 if(maStroke.isCurrent())
 {
-return getColor();
+return getCurrentColor();
 }
 else if(maStroke.isOn())
 {
@@ -1954,7 +1963,7 @@ namespace svgio
 {
 if(maStopColor.isCurrent())
 {
-return *getColor();
+return *getCurrentColor();
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-11-01 Thread Chr . Rossmanith
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |   13 
 svgio/inc/svgio/svgreader/svgtoken.hxx   |1 
 svgio/source/svgreader/svgnode.cxx   |   24 +++
 svgio/source/svgreader/svgstyleattributes.cxx|   24 +++
 svgio/source/svgreader/svgtoken.cxx  |2 +
 5 files changed, 56 insertions(+), 8 deletions(-)

New commits:
commit 501f25e3291dd0ab38e3612de2fc160d953c1846
Author: Chr. Rossmanith chrrossman...@gmx.de
Date:   Sat Nov 1 22:22:38 2014 +0100

SVG: handle visibility property

improve import of masking-path-08-b.svg of the W3C svg test suite when 
using insert-media-image

Change-Id: Ib4d48165f982e394e2171ac82e6cc06911553904
Reviewed-on: https://gerrit.libreoffice.org/12168
Reviewed-by: Christina Roßmanith chrrossman...@web.de
Tested-by: Christina Roßmanith chrrossman...@web.de

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index ab40e9d..693772b 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -153,6 +153,14 @@ namespace svgio
 BaselineShift_Length
 };
 
+enum Visibility
+{
+Visibility_visible,
+Visibility_hidden,
+Visibility_collapse,
+Visibility_inherit
+};
+
 class SvgStyleAttributes
 {
 private:
@@ -185,6 +193,7 @@ namespace svgio
 TextAnchor  maTextAnchor;
 SvgPaintmaColor;
 SvgNumber   maOpacity;
+Visibility  maVisibility;
 OUString   maTitle;
 OUString   maDesc;
 
@@ -401,6 +410,10 @@ namespace svgio
 SvgNumber getOpacity() const { return maOpacity; }
 void setOpacity(const SvgNumber rOpacity = SvgNumber()) { 
maOpacity = rOpacity; }
 
+/// Visibility
+Visibility getVisibility() const { return maVisibility; }
+void setVisibility(Visibility eVisibility) { maVisibility = 
eVisibility; }
+
 // Title content
 const OUString getTitle() const { return maTitle; }
 void setTitle(const OUString rNew) { maTitle = rNew; }
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx 
b/svgio/inc/svgio/svgreader/svgtoken.hxx
index 87d23b6..8d60847 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -102,6 +102,7 @@ namespace svgio
 SVGTokenPatternContentUnits,
 SVGTokenPatternTransform,
 SVGTokenOpacity,
+SVGTokenVisibility,
 SVGTokenTitle,
 SVGTokenDesc,
 
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 723ddbf..d084868 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -496,6 +496,12 @@ namespace svgio
 return;
 }
 
+const SvgStyleAttributes* pStyles = getSvgStyleAttributes();
+if(pStyles  (Visibility_hidden == pStyles-getVisibility() || 
Visibility_collapse == pStyles-getVisibility()))
+{
+return;
+}
+
 if(!bReferenced)
 {
 if(SVGTokenDefs == getType() ||
@@ -534,16 +540,20 @@ namespace svgio
 
 if(pCandidate  Display_none != pCandidate-getDisplay())
 {
-drawinglayer::primitive2d::Primitive2DSequence 
aNewTarget;
+const SvgStyleAttributes* pChildStyles = 
pCandidate-getSvgStyleAttributes();
+if(pChildStyles  Visibility_hidden != 
pChildStyles-getVisibility())
+{
+drawinglayer::primitive2d::Primitive2DSequence 
aNewTarget;
 
-pCandidate-decomposeSvgNode(aNewTarget, bReferenced);
+pCandidate-decomposeSvgNode(aNewTarget, 
bReferenced);
 
-if(aNewTarget.hasElements())
-{
-
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget,
 aNewTarget);
+if(aNewTarget.hasElements())
+{
+
drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget,
 aNewTarget);
+}
 }
 }
-else
+else if(!pCandidate)
 {
 OSL_ENSURE(false, Null-Pointer in child node list 
(!));
 }
@@ -551,8 +561,6 @@ namespace svgio
 
 if(rTarget.hasElements())
 {
-

[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-10-13 Thread Armin Le Grand
 svgio/inc/svgio/svgreader/svgtools.hxx|4 ++
 svgio/source/svgreader/svgdocumenthandler.cxx |   11 +
 svgio/source/svgreader/svgtools.cxx   |   51 ++
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit c18591107d9c856b15fa884eaed354d021ec4262
Author: Armin Le Grand a...@apache.org
Date:   Fri Oct 10 15:52:52 2014 +

Resolves: #i125325# added code to handle block comments...

in Css style definitions

(cherry picked from commit 7b071b828a5f602cc30c17ddd871a75426a53faf)

Conflicts:
svgio/source/svgreader/svgtools.cxx

Change-Id: I094228ea398686c5b39f5f279a964a2df7b00368

diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx 
b/svgio/inc/svgio/svgreader/svgtools.hxx
index 555a075..a2f1940 100644
--- a/svgio/inc/svgio/svgreader/svgtools.hxx
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -224,6 +224,10 @@ namespace svgio
 OUString whiteSpaceHandlingDefault(const OUString rCandidate);
 OUString whiteSpaceHandlingPreserve(const OUString rCandidate);
 
+// #125325# removes block comment of the general form '/* ... */', 
returns
+// an adapted string or the original if no comments included
+OUString removeBlockComments(const OUString rCandidate);
+
 } // end of namespace svgreader
 } // end of namespace svgio
 
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 1cb1a54..d816f54 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -519,7 +519,16 @@ namespace svgio
 if(maCssContents.size())
 {
 // need to interpret css styles and remember them as 
StyleSheets
-pCssStyle-addCssStyleSheet(*(maCssContents.end() - 
1));
+// #125325# Caution! the Css content may contain block 
comments
+// (see 
http://www.w3.org/wiki/CSS_basics#CSS_comments). These need
+// to be removed first
+const OUString 
aCommentFreeSource(removeBlockComments(*(maCssContents.end() - 1)));
+
+if(aCommentFreeSource.getLength())
+{
+pCssStyle-addCssStyleSheet(aCommentFreeSource);
+}
+
 maCssContents.pop_back();
 }
 else
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index f3faa47..a4d594a 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1513,6 +1513,57 @@ namespace svgio
 return rCandidate;
 }
 
+// #i125325#
+OUString removeBlockComments(const OUString rCandidate)
+{
+const sal_Int32 nLen(rCandidate.getLength());
+
+if(nLen)
+{
+sal_Int32 nPos(0);
+OUStringBuffer aBuffer;
+bool bChanged(false);
+sal_Int32 nInsideComment(0);
+const sal_Unicode aCommentSlash('/');
+const sal_Unicode aCommentStar('*');
+
+while(nPos  nLen)
+{
+const sal_Unicode aChar(rCandidate[nPos]);
+const bool bStart(aCommentSlash == aChar  nPos + 1  
nLen  aCommentStar == rCandidate[nPos + 1]);
+const bool bEnd(aCommentStar == aChar  nPos + 1  nLen 
 aCommentSlash == rCandidate[nPos + 1]);
+
+if(bStart)
+{
+nPos += 2;
+nInsideComment++;
+bChanged = true;
+}
+else if(bEnd)
+{
+nPos += 2;
+nInsideComment--;
+}
+else
+{
+if(!nInsideComment)
+{
+aBuffer.append(aChar);
+}
+
+nPos++;
+}
+}
+
+if(bChanged)
+{
+return aBuffer.makeStringAndClear();
+}
+}
+
+return rCandidate;
+}
+
 OUString consolidateContiguosSpace(const OUString rCandidate)
 {
 const sal_Int32 nLen(rCandidate.getLength());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-08-07 Thread Armin Le Grand
 svgio/inc/svgio/svgreader/svgdocument.hxx  |5 
 svgio/inc/svgio/svgreader/svgnode.hxx  |4 
 svgio/inc/svgio/svgreader/svgstylenode.hxx |8 -
 svgio/source/svgreader/svgdocument.cxx |   10 +
 svgio/source/svgreader/svgnode.cxx |  188 +
 svgio/source/svgreader/svgstylenode.cxx|  160 +---
 6 files changed, 250 insertions(+), 125 deletions(-)

New commits:
commit 2c7d4665a08591aea2cf30d09485ae166d997138
Author: Armin Le Grand a...@apache.org
Date:   Tue Jul 29 14:36:29 2014 +

Related: #i125293# More unified (still simple) CssStyles and solvers

(cherry picked from commit b760428400bbc7ab3db4d5de6239589e79981a06)

Conflicts:
svgio/inc/svgio/svgreader/svgdocument.hxx
svgio/inc/svgio/svgreader/svgnode.hxx
svgio/inc/svgio/svgreader/svgstylenode.hxx
svgio/source/svgreader/svgdocument.cxx
svgio/source/svgreader/svgnode.cxx
svgio/source/svgreader/svgstylenode.cxx

Change-Id: Ifcfc665df18f56e2cbc359411b633271c3b8d4bb

diff --git a/svgio/inc/svgio/svgreader/svgdocument.hxx 
b/svgio/inc/svgio/svgreader/svgdocument.hxx
index e61b291..cbc651b 100644
--- a/svgio/inc/svgio/svgreader/svgdocument.hxx
+++ b/svgio/inc/svgio/svgreader/svgdocument.hxx
@@ -65,10 +65,11 @@ namespace svgio
 
 /// add/remove styles to mapper
 void addSvgStyleAttributesToMapper(const OUString rStr, const 
SvgStyleAttributes rSvgStyleAttributes);
+void removeSvgStyleAttributesFromMapper(const OUString rStr);
 
 /// find a style by it's Id
-bool hasSvgStyleAttributesById() const { return 
!maIdStyleTokenMapperList.empty(); }
-const SvgStyleAttributes* findSvgStyleAttributesById(const 
OUString rStr) const;
+bool hasGlobalCssStyleAttributes() const { return 
!maIdStyleTokenMapperList.empty(); }
+const SvgStyleAttributes* findGlobalCssStyleAttributes(const 
OUString rStr) const;
 
 /// data read access
 const SvgNodeVector getSvgNodeVector() const { return maNodes; }
diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index 4793ddf..9fa9e72 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -126,6 +126,10 @@ namespace svgio
 
 /// helper for filling the CssStyle vector once dependent on 
mbCssStyleVectorBuilt
 void fillCssStyleVector(const OUString rClassStr);
+void fillCssStyleVectorUsingHierarchyAndSelectors(
+const OUString rClassStr,
+const SvgNode rCurrent,
+OUString aConcatenated);
 
 public:
 SvgNode(
diff --git a/svgio/inc/svgio/svgreader/svgstylenode.hxx 
b/svgio/inc/svgio/svgreader/svgstylenode.hxx
index fc851df..e113ea9 100644
--- a/svgio/inc/svgio/svgreader/svgstylenode.hxx
+++ b/svgio/inc/svgio/svgreader/svgstylenode.hxx
@@ -45,8 +45,12 @@ namespace svgio
 /// #i125258# tell if this node is allowed to have a parent style 
(e.g. defs do not)
 virtual bool supportsParentStyle() const SAL_OVERRIDE;
 
-virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent) SAL_OVERRIDE;
-void addCssStyleSheet(const OUString aContent);
+virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent);
+
+/// CssStyleSheet add helpers
+void addCssStyleSheet(const OUString aSelectors, const 
SvgStyleAttributes rNewStyle);
+void addCssStyleSheet(const OUString aSelectors, const OUString 
aContent);
+void addCssStyleSheet(const OUString aSelectorsAndContent);
 
 /// textCss access
 bool isTextCss() const { return mbTextCss; }
diff --git a/svgio/source/svgreader/svgdocument.cxx 
b/svgio/source/svgreader/svgdocument.cxx
index ff95628..6f4e0a5 100644
--- a/svgio/source/svgreader/svgdocument.cxx
+++ b/svgio/source/svgreader/svgdocument.cxx
@@ -85,7 +85,15 @@ namespace svgio
 }
 }
 
-const SvgStyleAttributes* 
SvgDocument::findSvgStyleAttributesById(const OUString rStr) const
+void SvgDocument::removeSvgStyleAttributesFromMapper(const OUString 
rStr)
+{
+if(!rStr.isEmpty())
+{
+maIdStyleTokenMapperList.erase(rStr);
+}
+}
+
+const SvgStyleAttributes* 
SvgDocument::findGlobalCssStyleAttributes(const OUString rStr) const
 {
 const IdStyleTokenMapper::const_iterator 
aResult(maIdStyleTokenMapperList.find(rStr));
 
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 1652a25..d771c51 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -40,102 +40,96 @@ namespace svgio
 return 0;
   

[Libreoffice-commits] core.git: svgio/inc

2014-08-07 Thread Stephan Bergmann
 svgio/inc/svgio/svgreader/svgstylenode.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 90ebe26e5d7c23579987bdb4115167beb6f6a66f
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 7 23:18:37 2014 +0200

loplugin:saloverride

Change-Id: Ifbcd602203708519f7b4416cf31d94d45b552556

diff --git a/svgio/inc/svgio/svgreader/svgstylenode.hxx 
b/svgio/inc/svgio/svgreader/svgstylenode.hxx
index e113ea9..d2f9e60 100644
--- a/svgio/inc/svgio/svgreader/svgstylenode.hxx
+++ b/svgio/inc/svgio/svgreader/svgstylenode.hxx
@@ -45,7 +45,7 @@ namespace svgio
 /// #i125258# tell if this node is allowed to have a parent style 
(e.g. defs do not)
 virtual bool supportsParentStyle() const SAL_OVERRIDE;
 
-virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent);
+virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent) SAL_OVERRIDE;
 
 /// CssStyleSheet add helpers
 void addCssStyleSheet(const OUString aSelectors, const 
SvgStyleAttributes rNewStyle);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-08-07 Thread Stephan Bergmann
 svgio/inc/svgio/svgreader/svgnode.hxx |2 +-
 svgio/source/svgreader/svgnode.cxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit f120be20792ab862389a3dc24d9706821f91c571
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 7 23:18:54 2014 +0200

loplugin:passstuffbyref

Change-Id: Ib2b244f466d21835229a5a42e6decf4cf4aba653

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index 9fa9e72..ac91af9 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -129,7 +129,7 @@ namespace svgio
 void fillCssStyleVectorUsingHierarchyAndSelectors(
 const OUString rClassStr,
 const SvgNode rCurrent,
-OUString aConcatenated);
+const OUString aConcatenated);
 
 public:
 SvgNode(
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index d771c51..b68d083 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -43,7 +43,7 @@ namespace svgio
 void SvgNode::fillCssStyleVectorUsingHierarchyAndSelectors(
 const OUString rClassStr,
 const SvgNode rCurrent,
-OUString aConcatenated)
+const OUString aConcatenated)
 {
 const SvgDocument rDocument = getDocument();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-07-16 Thread Armin Le Grand
 svgio/inc/svgio/svgreader/svgnode.hxx|3 +
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |1 
 svgio/inc/svgio/svgreader/svgstylenode.hxx   |3 +
 svgio/inc/svgio/svgreader/svgsvgnode.hxx |7 ++
 svgio/source/svgreader/svggnode.cxx  |   48 +++---
 svgio/source/svgreader/svggradientnode.cxx   |1 
 svgio/source/svgreader/svgnode.cxx   |6 ++
 svgio/source/svgreader/svgstyleattributes.cxx|   22 +++-
 svgio/source/svgreader/svgstylenode.cxx  |   13 
 svgio/source/svgreader/svgsvgnode.cxx|   60 ++-
 svgio/source/svgreader/svgtitledescnode.cxx  |1 
 11 files changed, 133 insertions(+), 32 deletions(-)

New commits:
commit 0879a639bc7c734f0847f74b965809f9107b3195
Author: Armin Le Grand a...@apache.org
Date:   Wed Jul 16 09:42:11 2014 +

Resolves: #i125258# reworked some of the style hierarchy stuff

(cherry picked from commit 3b13e15a7174f5177700fdcd4864b64fbf0b3535)

Conflicts:
svgio/inc/svgio/svgreader/svgstylenode.hxx
svgio/source/svgreader/svggnode.cxx
svgio/source/svgreader/svgstyleattributes.cxx
svgio/source/svgreader/svgstylenode.cxx
svgio/source/svgreader/svgsvgnode.cxx

Change-Id: I5cfe6871ab235305f206d83d643884b493901dfe

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index 38ae243..cc88b26 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -127,6 +127,9 @@ namespace svgio
 virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent);
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence rTarget, bool 
bReferenced) const;
 
+/// #i125258# tell if this node is allowed to have a parent style 
(e.g. defs do not)
+virtual bool supportsParentStyle() const;
+
 /// basic data read access
 SVGToken getType() const { return maType; }
 const SvgDocument getDocument() const { return mrDocument; }
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 1f16a3b..345eb65 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -283,6 +283,7 @@ namespace svgio
 ~SvgStyleAttributes();
 
 /// fill content
+bool isFillSet() const; // #i125258# ask if fill is a direct hard 
attribute (no hierarchy)
 const basegfx::BColor* getFill() const;
 void setFill(const SvgPaint rFill) { maFill = rFill; }
 
diff --git a/svgio/inc/svgio/svgreader/svgstylenode.hxx 
b/svgio/inc/svgio/svgreader/svgstylenode.hxx
index 23e0230..fc851df 100644
--- a/svgio/inc/svgio/svgreader/svgstylenode.hxx
+++ b/svgio/inc/svgio/svgreader/svgstylenode.hxx
@@ -42,6 +42,9 @@ namespace svgio
 SvgNode* pParent);
 virtual ~SvgStyleNode();
 
+/// #i125258# tell if this node is allowed to have a parent style 
(e.g. defs do not)
+virtual bool supportsParentStyle() const SAL_OVERRIDE;
+
 virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent) SAL_OVERRIDE;
 void addCssStyleSheet(const OUString aContent);
 
diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx 
b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
index 27180bf..d4fb304 100644
--- a/svgio/inc/svgio/svgreader/svgsvgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
@@ -41,6 +41,13 @@ namespace svgio
 SvgNumber   maHeight;
 SvgNumber   maVersion;
 
+/// #i125258# bitfield
+boolmbStyleAttributesInitialized : 1;
+
+// #i125258# on-demand init hard attributes when this is the 
outmost svg element
+// and more (see implementation)
+void initializeStyleAttributes();
+
 public:
 SvgSvgNode(
 SvgDocument rDocument,
diff --git a/svgio/source/svgreader/svggnode.cxx 
b/svgio/source/svgreader/svggnode.cxx
index 45fa6a3..c3957c7 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -43,13 +43,16 @@ namespace svgio
 
 const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const
 {
-const SvgStyleAttributes* aCheckCssStyle = 
checkForCssStyle(OUString(g), maSvgStyleAttributes);
-const SvgStyleAttributes* aGetCssStyleParent = 
maSvgStyleAttributes.getCssStyleParent();
-
-if (aGetCssStyleParent == NULL)
-return aCheckCssStyle;
-
-return aGetCssStyleParent;
+if (SVGTokenDefs == getType())
+{
+// #i125258# call parent for SVGTokenDefs
+

[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-07-15 Thread Joren De Cuyper
 svgio/inc/svgio/svgreader/svgdocumenthandler.hxx |2 +
 svgio/inc/svgio/svgreader/svgtoken.hxx   |2 +
 svgio/source/svgreader/svgdocumenthandler.cxx|   27 ++-
 svgio/source/svgreader/svgtoken.cxx  |3 ++
 4 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 5bd241b99b76ae7f4b3c1d4f2bcbaf7c487bb339
Author: Joren De Cuyper jore...@libreoffice.org
Date:   Tue Jul 15 00:02:44 2014 +0200

fdo#50114 ingore flowRoot element during svg import

This element is not specified in any released svg specification.
It might be mentioned in svg1.2 but since this is not yet released/
or will even not be released ever - ignore it.

Change-Id: Iaf5a392893070fda9e7a420bc951c8565bcfb37f
Reviewed-on: https://gerrit.libreoffice.org/10312
Reviewed-by: Tomaž Vajngerl qui...@gmail.com
Tested-by: Tomaž Vajngerl qui...@gmail.com

diff --git a/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx 
b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx
index 7269e3f..8656689 100644
--- a/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx
+++ b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx
@@ -41,6 +41,8 @@ namespace svgio
 // text collector string stack for css styles
 std::vector OUString maCssContents;
 
+boolbSkip;
+
 public:
 SvgDocHdl(const OUString rAbsolutePath);
 virtual ~SvgDocHdl();
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx 
b/svgio/inc/svgio/svgreader/svgtoken.hxx
index fa6986e..4596fb2 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -178,6 +178,8 @@ namespace svgio
 SVGTokenText,
 SVGTokenBaselineShift,
 
+SVGTokenFlowRoot,
+
 SVGTokenLast
 };
 
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx 
b/svgio/source/svgreader/svgdocumenthandler.cxx
index 25772aa..3817612 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -137,7 +137,8 @@ namespace svgio
 SvgDocHdl::SvgDocHdl(const OUString aAbsolutePath)
 :   maDocument(aAbsolutePath),
 mpTarget(0),
-maCssContents()
+maCssContents(),
+bSkip(false)
 {
 }
 
@@ -167,8 +168,11 @@ namespace svgio
 
 void SvgDocHdl::startElement( const OUString aName, const 
uno::Reference xml::sax::XAttributeList  xAttribs ) throw 
(xml::sax::SAXException, uno::RuntimeException, std::exception)
 {
+if (bSkip)
+return;
 if(!aName.isEmpty())
 {
+
 const SVGToken aSVGToken(StrToSVGToken(aName));
 
 switch(aSVGToken)
@@ -364,6 +368,13 @@ namespace svgio
 break;
 }
 
+// ignore FlowRoot and child nodes
+case SVGTokenFlowRoot:
+{
+bSkip = true;
+break;
+}
+
 default:
 {
 /// invalid token, ignore
@@ -388,6 +399,13 @@ namespace svgio
 SvgStyleNode* pCssStyle(SVGTokenStyle == aSVGToken ? 
static_cast SvgStyleNode* (mpTarget) : 0);
 SvgTitleDescNode* pSvgTitleDescNode(SVGTokenTitle == aSVGToken 
|| SVGTokenDesc == aSVGToken ? static_cast SvgTitleDescNode* (mpTarget) : 0);
 
+// if we are in skipping mode and we reach the flowRoot end 
tag: stop skipping mode
+if(bSkip  aSVGToken == SVGTokenFlowRoot)
+bSkip = false;
+// we are in skipping mode: do nothing until we found the 
flowRoot end tag
+else if(bSkip)
+return;
+
 switch(aSVGToken)
 {
 /// valid tokens for which a new one was created
@@ -457,6 +475,13 @@ namespace svgio
 }
 break;
 }
+
+case SVGTokenFlowRoot:
+{
+bSkip = false;
+break;
+}
+
 default:
 {
 /// invalid token, ignore
diff --git a/svgio/source/svgreader/svgtoken.cxx 
b/svgio/source/svgreader/svgtoken.cxx
index 337a26d..db494b1 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -160,6 +160,8 @@ namespace svgio
 static OUString aSVGStrText(text);
 static OUString aSVGStrBaselineShift(baseline-shift);
 
+static OUString aSVGStrFlowRoot(flowRoot);
+
 SVGToken StrToSVGToken(const OUString rStr)
 {
 typedef boost::unordered_map OUString, SVGToken, 
OUStringHash,::std::equal_to OUString

[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-07-04 Thread Armin Le Grand
 svgio/inc/svgio/svgreader/svgclippathnode.hxx |6 --
 svgio/inc/svgio/svgreader/svgmasknode.hxx |6 --
 svgio/source/svgreader/svgclippathnode.cxx|   12 +++-
 svgio/source/svgreader/svgmasknode.cxx|   17 -
 svgio/source/svgreader/svgstyleattributes.cxx |6 --
 5 files changed, 39 insertions(+), 8 deletions(-)

New commits:
commit 7c4fb287bb1e69725560cd4688e1d1d99d4498e0
Author: Armin Le Grand a...@apache.org
Date:   Thu Jul 3 15:49:09 2014 +

Resolves: #i124852# Corrected mask and clip polygons for userSpaceOnUse

(cherry picked from commit 247d5bc4d13c8ab299f8ca72768946f59815dca4)

Change-Id: I328a55e940db64d3dad04902bf81ede56a0dfe73

diff --git a/svgio/inc/svgio/svgreader/svgclippathnode.hxx 
b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
index d7fbf9b..36586d8 100644
--- a/svgio/inc/svgio/svgreader/svgclippathnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
@@ -47,8 +47,10 @@ namespace svgio
 virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent) SAL_OVERRIDE;
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence rTarget, bool 
bReferenced) const SAL_OVERRIDE;
 
-/// apply contained clipPath to given geometry
-void apply(drawinglayer::primitive2d::Primitive2DSequence 
rTarget) const;
+/// apply contained clipPath to given geometry #i124852# transform 
may be needed
+void apply(
+drawinglayer::primitive2d::Primitive2DSequence rTarget,
+const basegfx::B2DHomMatrix* pTransform) const;
 
 /// clipPathUnits content
 SvgUnits getClipPathUnits() const { return maClipPathUnits; }
diff --git a/svgio/inc/svgio/svgreader/svgmasknode.hxx 
b/svgio/inc/svgio/svgreader/svgmasknode.hxx
index e0f66b1..897401f 100644
--- a/svgio/inc/svgio/svgreader/svgmasknode.hxx
+++ b/svgio/inc/svgio/svgreader/svgmasknode.hxx
@@ -52,8 +52,10 @@ namespace svgio
 virtual void parseAttribute(const OUString rTokenName, SVGToken 
aSVGToken, const OUString aContent) SAL_OVERRIDE;
 virtual void 
decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence rTarget, bool 
bReferenced) const SAL_OVERRIDE;
 
-/// apply contained clipPath to given geometry
-void apply(drawinglayer::primitive2d::Primitive2DSequence 
rTarget) const;
+/// apply contained clipPath to given geometry #i124852# transform 
may be needed
+void apply(
+drawinglayer::primitive2d::Primitive2DSequence rTarget,
+const basegfx::B2DHomMatrix* pTransform) const;
 
 /// x content, set if found in current context
 const SvgNumber getX() const { return maX; }
diff --git a/svgio/source/svgreader/svgclippathnode.cxx 
b/svgio/source/svgreader/svgclippathnode.cxx
index c8b7e18..0a7f0f4 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -125,7 +125,9 @@ namespace svgio
 }
 }
 
-void 
SvgClipPathNode::apply(drawinglayer::primitive2d::Primitive2DSequence 
rContent) const
+void SvgClipPathNode::apply(
+drawinglayer::primitive2d::Primitive2DSequence rContent,
+const basegfx::B2DHomMatrix* pTransform) const
 {
 if(rContent.hasElements()  Display_none != getDisplay())
 {
@@ -172,6 +174,14 @@ namespace svgio
 aContentRange.getRange(),
 aContentRange.getMinimum()));
 }
+else // userSpaceOnUse
+{
+// #i124852#
+if(pTransform)
+{
+aClipPolyPolygon.transform(*pTransform);
+}
+}
 
 // #i124313# try to avoid creating an embedding to a 
MaskPrimitive2D if
 // possible; MaskPrimitive2D processing is potentially 
expensive
diff --git a/svgio/source/svgreader/svgmasknode.cxx 
b/svgio/source/svgreader/svgmasknode.cxx
index 7d3a72b..e80f2e8 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -190,7 +190,9 @@ namespace svgio
 }
 }
 
-void 
SvgMaskNode::apply(drawinglayer::primitive2d::Primitive2DSequence rTarget) 
const
+void SvgMaskNode::apply(
+drawinglayer::primitive2d::Primitive2DSequence rTarget,
+const basegfx::B2DHomMatrix* pTransform) const
 {
 if(rTarget.hasElements()  Display_none != getDisplay())
 {
@@ -252,6 +254,19 @@ namespace svgio
 
 aMaskTarget = 
drawinglayer::primitive2d::Primitive2DSequence(xTransform, 1);
 }
+ 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2014-02-26 Thread Alexander Wilms
 svgio/inc/svgio/svgreader/svgcharacternode.hxx|   10 +-
 svgio/inc/svgio/svgreader/svgcirclenode.hxx   |4 ++--
 svgio/inc/svgio/svgreader/svgclippathnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgdocument.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgdocumenthandler.hxx  |6 +++---
 svgio/inc/svgio/svgreader/svgellipsenode.hxx  |4 ++--
 svgio/inc/svgio/svgreader/svggnode.hxx|4 ++--
 svgio/inc/svgio/svgreader/svggradientnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svggradientstopnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgimagenode.hxx|4 ++--
 svgio/inc/svgio/svgreader/svglinenode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgmarkernode.hxx   |4 ++--
 svgio/inc/svgio/svgreader/svgmasknode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgnode.hxx |6 +++---
 svgio/inc/svgio/svgreader/svgpaint.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgpathnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgpatternnode.hxx  |4 ++--
 svgio/inc/svgio/svgreader/svgpolynode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgrectnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx  |6 +++---
 svgio/inc/svgio/svgreader/svgstylenode.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgsvgnode.hxx  |4 ++--
 svgio/inc/svgio/svgreader/svgsymbolnode.hxx   |4 ++--
 svgio/inc/svgio/svgreader/svgtextnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgtextpathnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgtitledescnode.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgtoken.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgtools.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgtrefnode.hxx |4 ++--
 svgio/inc/svgio/svgreader/svgtspannode.hxx|4 ++--
 svgio/inc/svgio/svgreader/svgusenode.hxx  |4 ++--
 svgio/source/svgreader/svgcharacternode.cxx   |   10 +-
 svgio/source/svgreader/svgcirclenode.cxx  |4 ++--
 svgio/source/svgreader/svgclippathnode.cxx|4 ++--
 svgio/source/svgreader/svgdocument.cxx|4 ++--
 svgio/source/svgreader/svgdocumenthandler.cxx |8 
 svgio/source/svgreader/svgellipsenode.cxx |4 ++--
 svgio/source/svgreader/svggnode.cxx   |4 ++--
 svgio/source/svgreader/svggradientnode.cxx|4 ++--
 svgio/source/svgreader/svggradientstopnode.cxx|4 ++--
 svgio/source/svgreader/svgimagenode.cxx   |4 ++--
 svgio/source/svgreader/svglinenode.cxx|4 ++--
 svgio/source/svgreader/svgmarkernode.cxx  |4 ++--
 svgio/source/svgreader/svgmasknode.cxx|4 ++--
 svgio/source/svgreader/svgpaint.cxx   |4 ++--
 svgio/source/svgreader/svgpathnode.cxx|4 ++--
 svgio/source/svgreader/svgpatternnode.cxx |4 ++--
 svgio/source/svgreader/svgpolynode.cxx|4 ++--
 svgio/source/svgreader/svgrectnode.cxx|4 ++--
 svgio/source/svgreader/svgstyleattributes.cxx |4 ++--
 svgio/source/svgreader/svgstylenode.cxx   |4 ++--
 svgio/source/svgreader/svgsvgnode.cxx |6 +++---
 svgio/source/svgreader/svgsymbolnode.cxx  |4 ++--
 svgio/source/svgreader/svgtextnode.cxx|4 ++--
 svgio/source/svgreader/svgtextpathnode.cxx|6 +++---
 svgio/source/svgreader/svgtitledescnode.cxx   |4 ++--
 svgio/source/svgreader/svgtoken.cxx   |4 ++--
 svgio/source/svgreader/svgtools.cxx   |4 ++--
 svgio/source/svgreader/svgtrefnode.cxx|4 ++--
 svgio/source/svgreader/svgtspannode.cxx   |4 ++--
 svgio/source/svgreader/svgusenode.cxx |4 ++--
 61 files changed, 135 insertions(+), 135 deletions(-)

New commits:
commit 65d6ecfd4e69c2f6b8346e8b655914d5ac5a0286
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 20:43:34 2014 +0100

Remove visual noise from svgio

Change-Id: I5295d5204c3f42b67b877aefba605dc22279eab0
Reviewed-on: https://gerrit.libreoffice.org/8318
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/svgio/inc/svgio/svgreader/svgcharacternode.hxx 
b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
index 5c0ffaf..bc5aea6 100644
--- a/svgio/inc/svgio/svgreader/svgcharacternode.hxx
+++ b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
@@ -22,12 +22,12 @@
 
 #include svgio/svgreader/svgnode.hxx
 
-//
+
 // predefines
 
 namespace drawinglayer { namespace primitive2d { class 
TextSimplePortionPrimitive2D; }}
 
-//
+
 
 namespace svgio
 {
@@ -82,7 +82,7 @@ namespace svgio
 } // end of namespace 

[Libreoffice-commits] core.git: svgio/inc svgio/source

2013-09-15 Thread Chr . Rossmanith
 svgio/inc/svgio/svgreader/svgsvgnode.hxx   |4 ++--
 svgio/source/svgreader/svgclippathnode.cxx |2 +-
 svgio/source/svgreader/svggnode.cxx|2 +-
 svgio/source/svgreader/svgmasknode.cxx |2 +-
 svgio/source/svgreader/svgsvgnode.cxx  |4 ++--
 svgio/source/svgreader/svgusenode.cxx  |2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 768c41469e5af7a27778b946c6865ebe3a6d5799
Author: Chr. Rossmanith chrrossman...@gmx.de
Date:   Sat Sep 7 15:33:37 2013 +0200

childs - children (in comments)

Change-Id: Ib91c2b0195f2db5c8a35997d5d07d3c04e9e69b7

diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx 
b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
index 8455b7c..749cb2f 100644
--- a/svgio/inc/svgio/svgreader/svgsvgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
@@ -58,9 +58,9 @@ namespace svgio
 virtual void seekReferenceWidth(double fWidth, bool bHasFound) 
const;
 virtual void seekReferenceHeight(double fHeight, bool bHasFound) 
const;
 
-/// InfoProvider support for % values in childs
+/// InfoProvider support for % values in children
 // The returned 'CurrentViewPort' is the viewport as it is set by 
this svg element
-// and as it is needed to resolve relative values in childs
+// and as it is needed to resolve relative values in children
 // The method does not check for invalid width and height
 virtual const basegfx::B2DRange getCurrentViewPort() const;
 
diff --git a/svgio/source/svgreader/svgclippathnode.cxx 
b/svgio/source/svgreader/svgclippathnode.cxx
index c0858ce..4c8cce9 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -103,7 +103,7 @@ namespace svgio
 {
 drawinglayer::primitive2d::Primitive2DSequence aNewTarget;
 
-// decompose childs
+// decompose children
 SvgNode::decomposeSvgNode(aNewTarget, bReferenced);
 
 if(aNewTarget.hasElements())
diff --git a/svgio/source/svgreader/svggnode.cxx 
b/svgio/source/svgreader/svggnode.cxx
index 4f3e23b..bd41365 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -94,7 +94,7 @@ namespace svgio
 {
 drawinglayer::primitive2d::Primitive2DSequence aContent;
 
-// decompose childs
+// decompose children
 SvgNode::decomposeSvgNode(aContent, bReferenced);
 
 if(aContent.hasElements())
diff --git a/svgio/source/svgreader/svgmasknode.cxx 
b/svgio/source/svgreader/svgmasknode.cxx
index fc8e307..460b7f4 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -171,7 +171,7 @@ namespace svgio
 {
 drawinglayer::primitive2d::Primitive2DSequence aNewTarget;
 
-// decompose childs
+// decompose children
 SvgNode::decomposeSvgNode(aNewTarget, bReferenced);
 
 if(aNewTarget.hasElements())
diff --git a/svgio/source/svgreader/svgsvgnode.cxx 
b/svgio/source/svgreader/svgsvgnode.cxx
index 5798fd7..0bf1b45 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -246,7 +246,7 @@ namespace svgio
 {
 drawinglayer::primitive2d::Primitive2DSequence aSequence;
 
-// decompose childs
+// decompose children
 SvgNode::decomposeSvgNode(aSequence, bReferenced);
 
 if(aSequence.hasElements())
@@ -697,7 +697,7 @@ namespace svgio
 return SvgNode::getCurrentViewPort();
 }
 }
-// ToDo: Is it possible to decompose and use the bounding box of the childs, 
if even the
+// ToDo: Is it possible to decompose and use the bounding box of the children, 
if even the
 //   outermost svg has no information to resolve percentage? Is it worth, 
how expensive is it?
 
 }
diff --git a/svgio/source/svgreader/svgusenode.cxx 
b/svgio/source/svgreader/svgusenode.cxx
index 4db965a..b545c7a 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -147,7 +147,7 @@ namespace svgio
 
 if(mpXLink  Display_none != mpXLink-getDisplay())
 {
-// decompose childs
+// decompose children
 drawinglayer::primitive2d::Primitive2DSequence aNewTarget;
 
 // todo: in case mpXLink is a SVGTokenSvg or SVGTokenSymbol the
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >