core.git: svgio/inc svgio/source

2024-04-21 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgfefloodnode.hxx  |1 -
 svgio/inc/svgfeimagenode.hxx  |1 -
 svgio/source/svgreader/svgfefloodnode.cxx |   11 ---
 svgio/source/svgreader/svgfeimagenode.cxx |   11 ---
 4 files changed, 24 deletions(-)

New commits:
commit ae5e743f90fbb4e7016d6d9f4c22bce971a5f5cb
Author: Xisco Fauli 
AuthorDate: Sun Apr 21 19:04:08 2024 +0200
Commit: Xisco Fauli 
CommitDate: Sun Apr 21 22:34:44 2024 +0200

svgio: feImage and feFlood don't support the in attribute

Added by mistake in b22039cff8380b158307e75762bd3e4ca045d77b
"related: tdf#159947: only parse in/result if the element supports them"

See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/in

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

diff --git a/svgio/inc/svgfefloodnode.hxx b/svgio/inc/svgfefloodnode.hxx
index 8aba2c3b0340..39e5cb6b1890 100644
--- a/svgio/inc/svgfefloodnode.hxx
+++ b/svgio/inc/svgfefloodnode.hxx
@@ -27,7 +27,6 @@ namespace svgio::svgreader
 class SvgFeFloodNode final : public SvgFilterNode
 {
 private:
-OUString maIn;
 OUString maResult;
 SvgNumber maX;
 SvgNumber maY;
diff --git a/svgio/inc/svgfeimagenode.hxx b/svgio/inc/svgfeimagenode.hxx
index ab303fdc92fe..743568fa65ce 100644
--- a/svgio/inc/svgfeimagenode.hxx
+++ b/svgio/inc/svgfeimagenode.hxx
@@ -27,7 +27,6 @@ namespace svgio::svgreader
 class SvgFeImageNode final : public SvgFilterNode
 {
 private:
-OUString maIn;
 OUString maResult;
 OUString maUrl; // external link
 OUString maData; // base64 data
diff --git a/svgio/source/svgreader/svgfefloodnode.cxx 
b/svgio/source/svgreader/svgfefloodnode.cxx
index ede285b6d756..8ac62d79c8d9 100644
--- a/svgio/source/svgreader/svgfefloodnode.cxx
+++ b/svgio/source/svgreader/svgfefloodnode.cxx
@@ -49,11 +49,6 @@ void SvgFeFloodNode::parseAttribute(SVGToken aSVGToken, 
const OUString& aContent
 readLocalCssStyle(aContent);
 break;
 }
-case SVGToken::In:
-{
-maIn = aContent.trim();
-break;
-}
 case SVGToken::Result:
 {
 maResult = aContent.trim();
@@ -145,12 +140,6 @@ void 
SvgFeFloodNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTar
 if (fWidth <= 0.0 || fHeight <= 0.0)
 return;
 
-if (const drawinglayer::primitive2d::Primitive2DContainer* rSource
-= pParent->findGraphicSource(maIn))
-{
-rTarget = *rSource;
-}
-
 const double fX(maX.solve(*this, NumberType::xcoordinate));
 const double fY(maY.solve(*this, NumberType::ycoordinate));
 const basegfx::B2DRange aRange(fX, fY, fX + fWidth, fY + fHeight);
diff --git a/svgio/source/svgreader/svgfeimagenode.cxx 
b/svgio/source/svgreader/svgfeimagenode.cxx
index c7b1f65b8f2d..6a7e5dd9d9c3 100644
--- a/svgio/source/svgreader/svgfeimagenode.cxx
+++ b/svgio/source/svgreader/svgfeimagenode.cxx
@@ -46,11 +46,6 @@ void SvgFeImageNode::parseAttribute(SVGToken aSVGToken, 
const OUString& aContent
 readLocalCssStyle(aContent);
 break;
 }
-case SVGToken::In:
-{
-maIn = aContent.trim();
-break;
-}
 case SVGToken::Result:
 {
 maResult = aContent.trim();
@@ -79,12 +74,6 @@ void SvgFeImageNode::parseAttribute(SVGToken aSVGToken, 
const OUString& aContent
 void SvgFeImageNode::apply(drawinglayer::primitive2d::Primitive2DContainer& 
rTarget,
const SvgFilterNode* pParent) const
 {
-if (const drawinglayer::primitive2d::Primitive2DContainer* rSource
-= pParent->findGraphicSource(maIn))
-{
-rTarget = *rSource;
-}
-
 BitmapEx aBitmapEx;
 
 if (!maData.isEmpty())


core.git: svgio/inc svgio/source

2024-04-18 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgfilternode.hxx   |3 ++
 svgio/source/svgreader/svgfeblendnode.cxx |   21 +---
 svgio/source/svgreader/svgfecompositenode.cxx |   27 +-
 svgio/source/svgreader/svgfilternode.cxx  |   21 
 4 files changed, 28 insertions(+), 44 deletions(-)

New commits:
commit 176406a07edc29f59a67464c7812358f46421f4d
Author: Xisco Fauli 
AuthorDate: Wed Apr 17 22:08:31 2024 +0200
Commit: Xisco Fauli 
CommitDate: Thu Apr 18 17:24:10 2024 +0200

svgio: factor out common code

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

diff --git a/svgio/inc/svgfilternode.hxx b/svgio/inc/svgfilternode.hxx
index 7aa522173a87..ec42d3c52df4 100644
--- a/svgio/inc/svgfilternode.hxx
+++ b/svgio/inc/svgfilternode.hxx
@@ -23,6 +23,7 @@
 #include "svgnode.hxx"
 #include "svgstyleattributes.hxx"
 #include 
+#include 
 
 typedef std::unordered_map
 IdGraphicSourceMapper;
@@ -46,6 +47,8 @@ public:
  drawinglayer::primitive2d::Primitive2DContainer 
pGraphicSource) const;
 const drawinglayer::primitive2d::Primitive2DContainer*
 findGraphicSource(const OUString& rStr) const;
+
+static BitmapEx convertToBitmapEx(const 
drawinglayer::primitive2d::Primitive2DContainer* pSeq);
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/source/svgreader/svgfeblendnode.cxx 
b/svgio/source/svgreader/svgfeblendnode.cxx
index d106ea6e643b..e1440185ff23 100644
--- a/svgio/source/svgreader/svgfeblendnode.cxx
+++ b/svgio/source/svgreader/svgfeblendnode.cxx
@@ -111,15 +111,7 @@ void 
SvgFeBlendNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTar
 {
 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
 aRange = pSource->getB2DRange(aViewInformation2D);
-basegfx::B2DHomMatrix aEmbedding(
-basegfx::utils::createTranslateB2DHomMatrix(-aRange.getMinX(), 
-aRange.getMinY()));
-aEmbedding.scale(aRange.getWidth(), aRange.getHeight());
-const drawinglayer::primitive2d::Primitive2DReference xEmbedRef(
-new drawinglayer::primitive2d::TransformPrimitive2D(
-aEmbedding, 
drawinglayer::primitive2d::Primitive2DContainer(*pSource)));
-drawinglayer::primitive2d::Primitive2DContainer xEmbedSeq{ 
xEmbedRef };
-aBmpEx = drawinglayer::convertToBitmapEx(std::move(xEmbedSeq), 
aViewInformation2D,
- aRange.getWidth(), 
aRange.getHeight(), 50);
+aBmpEx = convertToBitmapEx(pSource);
 }
 
 if (const drawinglayer::primitive2d::Primitive2DContainer* pSource2
@@ -127,16 +119,7 @@ void 
SvgFeBlendNode::apply(drawinglayer::primitive2d::Primitive2DContainer& rTar
 {
 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
 aRange2 = pSource2->getB2DRange(aViewInformation2D);
-basegfx::B2DHomMatrix 
aEmbedding(basegfx::utils::createTranslateB2DHomMatrix(
--aRange2.getMinX(), -aRange2.getMinY()));
-aEmbedding.scale(aRange2.getWidth(), aRange2.getHeight());
-const drawinglayer::primitive2d::Primitive2DReference xEmbedRef(
-new drawinglayer::primitive2d::TransformPrimitive2D(
-aEmbedding, 
drawinglayer::primitive2d::Primitive2DContainer(*pSource2)));
-drawinglayer::primitive2d::Primitive2DContainer xEmbedSeq{ 
xEmbedRef };
-aBmpEx2
-= drawinglayer::convertToBitmapEx(std::move(xEmbedSeq), 
aViewInformation2D,
-  aRange2.getWidth(), 
aRange2.getHeight(), 50);
+aBmpEx2 = convertToBitmapEx(pSource2);
 }
 
 basegfx::B2DRectangle aBaseRect(std::min(aRange.getMinX(), 
aRange2.getMinX()),
diff --git a/svgio/source/svgreader/svgfecompositenode.cxx 
b/svgio/source/svgreader/svgfecompositenode.cxx
index 28f161d7b6ce..c396eec78c0a 100644
--- a/svgio/source/svgreader/svgfecompositenode.cxx
+++ b/svgio/source/svgreader/svgfecompositenode.cxx
@@ -216,18 +216,7 @@ void 
SvgFeCompositeNode::apply(drawinglayer::primitive2d::Primitive2DContainer&
 {
 const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
 aRange = pSource->getB2DRange(aViewInformation2D);
-basegfx::B2DHomMatrix aEmbedding(
-basegfx::utils::createTranslateB2DHomMatrix(-aRange.getMinX(), 
-aRange.getMinY()));
-
-aEmbedding.scale(aRange.getWidth(), aRange.getHeight());
-
-const drawinglayer::primitive2d::Primitive2DReference xEmbedRef(
-new drawinglayer::primitive2d::TransformPrimitive2D(
-aEmbedding, 

core.git: svgio/inc svgio/source

2024-03-28 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgnode.hxx |4 +--
 svgio/inc/svgtools.hxx|2 -
 svgio/source/svgreader/svgnode.cxx|   34 +++---
 svgio/source/svgreader/svgstyleattributes.cxx |2 -
 svgio/source/svgreader/svgstylenode.cxx   |   31 +--
 svgio/source/svgreader/svgtools.cxx   |6 ++--
 6 files changed, 13 insertions(+), 66 deletions(-)

New commits:
commit 128274d59847288d4c3463fea42b6f57ec089ec0
Author: Xisco Fauli 
AuthorDate: Thu Mar 28 11:02:50 2024 +0100
Commit: Xisco Fauli 
CommitDate: Thu Mar 28 19:42:54 2024 +0100

svgio: simplify code

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

diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 16c1f50bc3db..073b011c5f6c 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -21,6 +21,7 @@
 
 #include "SvgNumber.hxx"
 #include "svgtoken.hxx"
+#include "svgtools.hxx"
 #include 
 #include 
 #include 
@@ -96,7 +97,7 @@ namespace svgio::svgreader
 std::optional   mpClass;
 
 /// systemLanguage values
-std::vector  maSystemLanguage;
+SvgStringVector  maSystemLanguage;
 
 /// XmlSpace value
 XmlSpacemaXmlSpace;
@@ -179,7 +180,6 @@ namespace svgio::svgreader
 
 /// SystemLanguage access
 std::vector const & getSystemLanguage() const { return 
maSystemLanguage; }
-void setSystemLanguage(OUString const &);
 
 /// XmlSpace access
 XmlSpace getXmlSpace() const;
diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx
index 6dc882b6afb2..dfeb12d9ea49 100644
--- a/svgio/inc/svgtools.hxx
+++ b/svgio/inc/svgtools.hxx
@@ -122,7 +122,7 @@ namespace svgio::svgreader
 SvgAspectRatio readSvgAspectRatio(std::u16string_view rCandidate);
 
 typedef ::std::vector< OUString > SvgStringVector;
-bool readSvgStringVector(std::u16string_view rCandidate, 
SvgStringVector& rSvgStringVector);
+bool readSvgStringVector(std::u16string_view rCandidate, 
SvgStringVector& rSvgStringVector, sal_Unicode nSeparator);
 
 void readImageLink(const OUString& rCandidate, OUString& rXLink, 
OUString& rUrl, OUString& rData);
 
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 20a48de25977..781faaf4b2a7 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -525,9 +525,11 @@ namespace {
 }
 case SVGToken::SystemLanguage:
 {
-if(!aContent.isEmpty())
+SvgStringVector aSvgStringVector;
+
+if(readSvgStringVector(aContent, aSvgStringVector, ','))
 {
-setSystemLanguage(aContent);
+maSystemLanguage = aSvgStringVector;
 }
 break;
 }
@@ -755,34 +757,6 @@ namespace {
 mrDocument.addSvgNodeToMapper(*mpClass, *this);
 }
 
-void SvgNode::setSystemLanguage(OUString const & rSystemClass)
-{
-const sal_Int32 nLen(rSystemClass.getLength());
-sal_Int32 nPos(0);
-OUStringBuffer aToken;
-
-// split into single tokens (currently only comma separator)
-while(nPos < nLen)
-{
-const sal_Int32 nInitPos(nPos);
-copyToLimiter(rSystemClass, u',', nPos, aToken, nLen);
-skip_char(rSystemClass, u',', nPos, nLen);
-const OUString aLang(o3tl::trim(aToken));
-aToken.setLength(0);
-
-if(!aLang.isEmpty())
-{
-maSystemLanguage.push_back(aLang);
-}
-
-if(nInitPos == nPos)
-{
-OSL_ENSURE(false, "Could not interpret on current position 
(!)");
-nPos++;
-}
-}
-}
-
 XmlSpace SvgNode::getXmlSpace() const
 {
 if(maXmlSpace != XmlSpace::NotSet)
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx 
b/svgio/source/svgreader/svgstyleattributes.cxx
index 0ae986f010cd..63be6afe270c 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1513,7 +1513,7 @@ namespace svgio::svgreader
 {
 SvgStringVector aSvgStringVector;
 
-if(readSvgStringVector(aContent, aSvgStringVector))
+if(readSvgStringVector(aContent, aSvgStringVector, ','))
 {
 maFontFamily = aSvgStringVector;
 }
diff --git 

core.git: svgio/inc svgio/source

2024-03-12 Thread Xisco Fauli (via logerrit)
 svgio/inc/svgfecolormatrixnode.hxx   |5 +
 svgio/inc/svgfedropshadownode.hxx|5 +
 svgio/inc/svgfefloodnode.hxx |5 +
 svgio/inc/svgfegaussianblurnode.hxx  |5 +
 svgio/inc/svgfeimagenode.hxx |5 +
 svgio/inc/svgfeoffsetnode.hxx|5 +
 svgio/inc/svgfilternode.hxx  |   19 +++--
 svgio/source/svgreader/svgfecolormatrixnode.cxx  |   24 ++-
 svgio/source/svgreader/svgfedropshadownode.cxx   |   24 ++-
 svgio/source/svgreader/svgfefloodnode.cxx|   24 ++-
 svgio/source/svgreader/svgfegaussianblurnode.cxx |   24 ++-
 svgio/source/svgreader/svgfeimagenode.cxx|   24 ++-
 svgio/source/svgreader/svgfeoffsetnode.cxx   |   24 ++-
 svgio/source/svgreader/svgfilternode.cxx |   76 ---
 svgio/source/svgreader/svgstyleattributes.cxx|2 
 15 files changed, 185 insertions(+), 86 deletions(-)

New commits:
commit b22039cff8380b158307e75762bd3e4ca045d77b
Author: Xisco Fauli 
AuthorDate: Tue Mar 12 17:19:45 2024 +0100
Commit: Xisco Fauli 
CommitDate: Tue Mar 12 22:39:20 2024 +0100

related: tdf#159947: only parse in/result if the element supports them

There are some filters ( e.g. feMerge ) that do not support
in or result attributes

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

diff --git a/svgio/inc/svgfecolormatrixnode.hxx 
b/svgio/inc/svgfecolormatrixnode.hxx
index e2c74a03748f..4e0ad7d2aa3c 100644
--- a/svgio/inc/svgfecolormatrixnode.hxx
+++ b/svgio/inc/svgfecolormatrixnode.hxx
@@ -36,6 +36,8 @@ enum class ColorType
 class SvgFeColorMatrixNode final : public SvgFilterNode
 {
 private:
+OUString maIn;
+OUString maResult;
 ColorType maType;
 OUString maValuesContent;
 
@@ -45,7 +47,8 @@ public:
 
 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) 
override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+   const SvgFilterNode* pParent) const override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfedropshadownode.hxx 
b/svgio/inc/svgfedropshadownode.hxx
index 04b3190f1dea..c68cdf655567 100644
--- a/svgio/inc/svgfedropshadownode.hxx
+++ b/svgio/inc/svgfedropshadownode.hxx
@@ -27,6 +27,8 @@ namespace svgio::svgreader
 class SvgFeDropShadowNode final : public SvgFilterNode
 {
 private:
+OUString maIn;
+OUString maResult;
 SvgNumber maDx;
 SvgNumber maDy;
 SvgNumber maStdDeviation;
@@ -39,7 +41,8 @@ public:
 
 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) 
override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+   const SvgFilterNode* pParent) const override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfefloodnode.hxx b/svgio/inc/svgfefloodnode.hxx
index e74794b97237..8aba2c3b0340 100644
--- a/svgio/inc/svgfefloodnode.hxx
+++ b/svgio/inc/svgfefloodnode.hxx
@@ -27,6 +27,8 @@ namespace svgio::svgreader
 class SvgFeFloodNode final : public SvgFilterNode
 {
 private:
+OUString maIn;
+OUString maResult;
 SvgNumber maX;
 SvgNumber maY;
 SvgNumber maWidth;
@@ -40,7 +42,8 @@ public:
 
 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) 
override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+   const SvgFilterNode* pParent) const override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfegaussianblurnode.hxx 
b/svgio/inc/svgfegaussianblurnode.hxx
index 14732a968e2d..10e6a16b1ce3 100644
--- a/svgio/inc/svgfegaussianblurnode.hxx
+++ b/svgio/inc/svgfegaussianblurnode.hxx
@@ -28,6 +28,8 @@ namespace svgio::svgreader
 class SvgFeGaussianBlurNode final : public SvgFilterNode
 {
 private:
+OUString maIn;
+OUString maResult;
 SvgNumber maStdDeviation;
 
 public:
@@ -36,7 +38,8 @@ public:
 
 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) 
override;
 
-void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const 
override;
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+   const SvgFilterNode* pParent) const override;
 };
 
 } // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgfeimagenode.hxx b/svgio/inc/svgfeimagenode.hxx
index 0b05173494d0..ab303fdc92fe 100644
--- a/svgio/inc/svgfeimagenode.hxx
+++ b/svgio/inc/svgfeimagenode.hxx
@@ -27,6 +27,8 @@ 

[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/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/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/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/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/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/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/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/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/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/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/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/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 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 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/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/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/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/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 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


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

2013-06-27 Thread Thorsten Behrens
 svgio/inc/svgio/svgreader/svgnode.hxx  |9 ++---
 svgio/inc/svgio/svgreader/svgtools.hxx |8 +---
 svgio/source/svgreader/svgnode.cxx |   32 
 svgio/source/svgreader/svgtools.cxx|4 ++--
 4 files changed, 33 insertions(+), 20 deletions(-)

New commits:
commit d9b09a3ff38b2cf11ee0b9f9f03d47375f2b11e8
Author: Thorsten Behrens tbehr...@suse.com
Date:   Thu Jun 27 20:41:29 2013 +0200

Fix fdo#65847 - avoid infinite recursion in style resolution.

That was previously asking back the node for the font size, which
was again asking the SvgNumber, which was ...
In this case, if the node has relative sizes, this is always
relative to the parent.

Change-Id: Iaa81d0238d9eb73f5af24df347d12d7cb8ba8c0a

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx 
b/svgio/inc/svgio/svgreader/svgnode.hxx
index 725fb5c..7c1c39b 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -134,9 +134,12 @@ namespace svgio
 const SvgNodeVector getChildren() const { return maChildren; }
 
 /// InfoProvider support for %, em and ex values
-virtual const basegfx::B2DRange* getCurrentViewPort() const;
-virtual double getCurrentFontSize() const;
-virtual double getCurrentXHeight() const;
+virtual const basegfx::B2DRange* getCurrentViewPort() const 
SAL_OVERRIDE;
+virtual double getCurrentFontSizeInherited() const SAL_OVERRIDE;
+virtual double getCurrentXHeightInherited() const SAL_OVERRIDE;
+
+double getCurrentFontSize() const;
+double getCurrentXHeight() const;
 
 /// Id access
 const OUString* getId() const { return mpId; }
diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx 
b/svgio/inc/svgio/svgreader/svgtools.hxx
index 0dbedf8..138a065 100644
--- a/svgio/inc/svgio/svgreader/svgtools.hxx
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -62,10 +62,12 @@ namespace svgio
 class InfoProvider
 {
 public:
-virtual ~InfoProvider() {}
+virtual ~InfoProvider() {}
 virtual const basegfx::B2DRange* getCurrentViewPort() const = 0;
-virtual double getCurrentFontSize() const = 0;
-virtual double getCurrentXHeight() const = 0;
+/// return font size of node inherited from parents
+virtual double getCurrentFontSizeInherited() const = 0;
+/// return xheight of node inherited from parents
+virtual double getCurrentXHeightInherited() const = 0;
 };
 
 enum SvgUnit
diff --git a/svgio/source/svgreader/svgnode.cxx 
b/svgio/source/svgreader/svgnode.cxx
index 3bc092d..e1698e8 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -491,13 +491,9 @@ namespace svgio
 }
 }
 
-double SvgNode::getCurrentFontSize() const
+double SvgNode::getCurrentFontSizeInherited() const
 {
-if(getSvgStyleAttributes())
-{
-return getSvgStyleAttributes()-getFontSize().solve(*this, 
xcoordinate);
-}
-else if(getParent())
+if(getParent())
 {
 return getParent()-getCurrentFontSize();
 }
@@ -507,14 +503,17 @@ namespace svgio
 }
 }
 
-double SvgNode::getCurrentXHeight() const
+double SvgNode::getCurrentFontSize() const
 {
 if(getSvgStyleAttributes())
-{
-// for XHeight, use FontSize currently
-return getSvgStyleAttributes()-getFontSize().solve(*this, 
ycoordinate);
-}
-else if(getParent())
+return getSvgStyleAttributes()-getFontSize().solve(*this, 
xcoordinate);
+
+return getCurrentFontSizeInherited();
+}
+
+double SvgNode::getCurrentXHeightInherited() const
+{
+if(getParent())
 {
 return getParent()-getCurrentXHeight();
 }
@@ -524,6 +523,15 @@ namespace svgio
 }
 }
 
+double SvgNode::getCurrentXHeight() const
+{
+if(getSvgStyleAttributes())
+// for XHeight, use FontSize currently
+return getSvgStyleAttributes()-getFontSize().solve(*this, 
ycoordinate);
+
+return getCurrentXHeightInherited();
+}
+
 void SvgNode::setId(const OUString* pfId)
 {
 if(mpId)
diff --git a/svgio/source/svgreader/svgtools.cxx 
b/svgio/source/svgreader/svgtools.cxx
index 2b89f0d..7607a43 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -159,11 +159,11 @@ namespace svgio
 {
 case Unit_em:
 {
-return mfNumber * 

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

2013-06-18 Thread Armin Le Grand
 svgio/inc/svgio/svgreader/svgstyleattributes.hxx |   18 +
 svgio/inc/svgio/svgreader/svgtoken.hxx   |1 
 svgio/source/svgreader/svgcharacternode.cxx  |   32 +
 svgio/source/svgreader/svgdocumenthandler.cxx|   22 ++
 svgio/source/svgreader/svgnode.cxx   |2 
 svgio/source/svgreader/svgstyleattributes.cxx|   77 +++
 svgio/source/svgreader/svgtoken.cxx  |2 
 7 files changed, 152 insertions(+), 2 deletions(-)

New commits:
commit b4219ea230a9635ca2422421324af5c407216e03
Author: Armin Le Grand a...@apache.org
Date:   Tue Jun 18 09:44:12 2013 +

Resolves: #i122524# fixed some text import aspects for super/sub-baseline

(cherry picked from commit def95cfb69619071811fb8e564eb4187f59f4b99)

Conflicts:
svgio/source/svgreader/svgtoken.cxx

Change-Id: I1208229a86807ce271a823415e9b8f0baf955e01

diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx 
b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index a84fd46..13e3705 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -143,6 +143,15 @@ namespace svgio
 FillRule_evenodd
 };
 
+enum BaselineShift
+{
+BaselineShift_Baseline,
+BaselineShift_Sub,
+BaselineShift_Super,
+BaselineShift_Percentage,
+BaselineShift_Length
+};
+
 class SvgStyleAttributes
 {
 private:
@@ -196,6 +205,10 @@ namespace svgio
 // ClipRule setting (only valid wne mbIsClipPathContent == true, 
default is FillRule_nonzero)
 FillRulemaClipRule;
 
+// BaselineShift: Type and number (in case of 
BaselineShift_Percentage or BaselineShift_Length)
+BaselineShift   maBaselineShift;
+SvgNumber   maBaselineShiftNumber;
+
 /// bitfield
 
 // defines if this attributes are part of a ClipPath. If yes,
@@ -422,6 +435,11 @@ namespace svgio
 const SvgMarkerNode* accessMarkerEndXLink() const;
 void setMarkerEndXLink(const OUString rNew) { maMarkerEndXLink = 
rNew; }
 
+// BaselineShift
+void setBaselineShift(const BaselineShift aBaselineShift = 
BaselineShift_Baseline) { maBaselineShift = aBaselineShift; }
+BaselineShift getBaselineShift() const { return maBaselineShift; }
+void setBaselineShiftNumber(const SvgNumber rBaselineShift = 
SvgNumber()) { maBaselineShiftNumber = rBaselineShift; }
+SvgNumber getBaselineShiftNumber() const;
 };
 } // end of namespace svgreader
 } // end of namespace svgio
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx 
b/svgio/inc/svgio/svgreader/svgtoken.hxx
index 2e1f8c4..8594ca7 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -178,6 +178,7 @@ namespace svgio
 
 // text tokens
 SVGTokenText,
+SVGTokenBaselineShift,
 
 SVGTokenLast
 };
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index b154645..0d2d575 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -403,6 +403,38 @@ namespace svgio
 }
 }
 
+// get BaselineShift
+const BaselineShift 
aBaselineShift(rSvgStyleAttributes.getBaselineShift());
+
+// apply BaselineShift
+switch(aBaselineShift)
+{
+case BaselineShift_Sub:
+{
+aPosition.setY(aPosition.getY() + 
aTextLayouterDevice.getUnderlineOffset());
+break;
+}
+case BaselineShift_Super:
+{
+aPosition.setY(aPosition.getY() + 
aTextLayouterDevice.getOverlineOffset());
+break;
+}
+case BaselineShift_Percentage:
+case BaselineShift_Length:
+{
+const SvgNumber 
aNumber(rSvgStyleAttributes.getBaselineShiftNumber());
+const double mfBaselineShift(aNumber.solve(*this, 
length));
+
+aPosition.setY(aPosition.getY() + mfBaselineShift);
+break;
+}
+default: // BaselineShift_Baseline
+{
+// nothing to do
+break;
+}
+}
+
 // get fill color
 const basegfx::BColor aFill(rSvgStyleAttributes.getFill()
 ? *rSvgStyleAttributes.getFill()
diff --git