summaryrefslogtreecommitdiff
path: root/svgio/inc/svgio
diff options
context:
space:
mode:
Diffstat (limited to 'svgio/inc/svgio')
-rw-r--r--svgio/inc/svgio/svgiodllapi.h33
-rw-r--r--svgio/inc/svgio/svgreader/svgcharacternode.hxx184
-rw-r--r--svgio/inc/svgio/svgreader/svgcirclenode.hxx80
-rw-r--r--svgio/inc/svgio/svgreader/svgclippathnode.hxx73
-rw-r--r--svgio/inc/svgio/svgreader/svgdocument.hxx90
-rw-r--r--svgio/inc/svgio/svgreader/svgdocumenthandler.hxx75
-rw-r--r--svgio/inc/svgio/svgreader/svgellipsenode.hxx85
-rw-r--r--svgio/inc/svgio/svgreader/svggnode.hxx66
-rw-r--r--svgio/inc/svgio/svgreader/svggradientnode.hxx137
-rw-r--r--svgio/inc/svgio/svgreader/svggradientstopnode.hxx64
-rw-r--r--svgio/inc/svgio/svgreader/svgimagenode.hxx99
-rw-r--r--svgio/inc/svgio/svgreader/svglinenode.hxx85
-rw-r--r--svgio/inc/svgio/svgreader/svgmarkernode.hxx123
-rw-r--r--svgio/inc/svgio/svgreader/svgmasknode.hxx98
-rw-r--r--svgio/inc/svgio/svgreader/svgnode.hxx127
-rw-r--r--svgio/inc/svgio/svgreader/svgpaint.hxx65
-rw-r--r--svgio/inc/svgio/svgreader/svgpathnode.hxx75
-rw-r--r--svgio/inc/svgio/svgreader/svgpatternnode.hxx126
-rw-r--r--svgio/inc/svgio/svgreader/svgpolynode.hxx78
-rw-r--r--svgio/inc/svgio/svgreader/svgrectnode.hxx95
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx411
-rw-r--r--svgio/inc/svgio/svgreader/svgstylenode.hxx64
-rw-r--r--svgio/inc/svgio/svgreader/svgsvgnode.hxx97
-rw-r--r--svgio/inc/svgio/svgreader/svgsymbolnode.hxx68
-rw-r--r--svgio/inc/svgio/svgreader/svgtextnode.hxx80
-rw-r--r--svgio/inc/svgio/svgreader/svgtextpathnode.hxx86
-rw-r--r--svgio/inc/svgio/svgreader/svgtoken.hxx194
-rw-r--r--svgio/inc/svgio/svgreader/svgtools.hxx229
-rw-r--r--svgio/inc/svgio/svgreader/svgtrefnode.hxx65
-rw-r--r--svgio/inc/svgio/svgreader/svgtspannode.hxx64
-rw-r--r--svgio/inc/svgio/svgreader/svgusenode.hxx89
31 files changed, 3305 insertions, 0 deletions
diff --git a/svgio/inc/svgio/svgiodllapi.h b/svgio/inc/svgio/svgiodllapi.h
new file mode 100644
index 000000000000..c28ff1192427
--- /dev/null
+++ b/svgio/inc/svgio/svgiodllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_SVGIODLLAPI_H
+#define INCLUDED_SVGIODLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(SVGIO_DLLIMPLEMENTATION)
+#define SVGIO_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SVGIO_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define SVGIO_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_SVGIODLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgcharacternode.hxx b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
new file mode 100644
index 000000000000..55d056aadd52
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgcharacternode.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace primitive2d { class TextSimplePortionPrimitive2D; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTextPositions
+ {
+ private:
+ SvgNumberVector maX;
+ SvgNumberVector maY;
+ SvgNumberVector maDx;
+ SvgNumberVector maDy;
+ SvgNumberVector maRotate;
+ SvgNumber maTextLength;
+
+ /// bitfield
+ bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
+
+ public:
+ SvgTextPositions();
+
+ void parseTextPositionAttributes(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// X content
+ const SvgNumberVector& getX() const { return maX; }
+ void setX(const SvgNumberVector& aX) { maX = aX; }
+
+ /// Y content
+ const SvgNumberVector& getY() const { return maY; }
+ void setY(const SvgNumberVector& aY) { maY = aY; }
+
+ /// Dx content
+ const SvgNumberVector& getDx() const { return maDx; }
+ void setDx(const SvgNumberVector& aDx) { maDx = aDx; }
+
+ /// Dy content
+ const SvgNumberVector& getDy() const { return maDy; }
+ void setDy(const SvgNumberVector& aDy) { maDy = aDy; }
+
+ /// Rotate content
+ const SvgNumberVector& getRotate() const { return maRotate; }
+ void setRotate(const SvgNumberVector& aRotate) { maRotate = aRotate; }
+
+ /// TextLength content
+ const SvgNumber& getTextLength() const { return maTextLength; }
+ void setTextLength(const SvgNumber& rTextLength = SvgNumber()) { maTextLength = rTextLength; }
+
+ /// LengthAdjust content
+ bool getLengthAdjust() const { return mbLengthAdjust; }
+ void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTextPosition
+ {
+ private:
+ SvgTextPosition* mpParent;
+ ::std::vector< double > maX;
+ ::std::vector< double > maY;
+ ::std::vector< double > maRotate;
+ double mfTextLength;
+
+ // absolute, current, advancing position
+ basegfx::B2DPoint maPosition;
+
+ // advancing rotation index
+ sal_uInt32 mnRotationIndex;
+
+ /// bitfield
+ bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
+ bool mbAbsoluteX : 1;
+ bool mbAbsoluteY : 1;
+
+ public:
+ SvgTextPosition(
+ SvgTextPosition* pParent,
+ const InfoProvider& rInfoProvider,
+ const SvgTextPositions& rSvgTextPositions);
+
+ // 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; }
+ void setPosition(const basegfx::B2DPoint& rNew) { maPosition = rNew; }
+
+ // rotation handling
+ bool isRotated() const;
+ double consumeRotation();
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgCharacterNode : public SvgNode
+ {
+ private:
+ /// the string data
+ rtl::OUString maText;
+
+ /// local helpers
+ drawinglayer::primitive2d::TextSimplePortionPrimitive2D* createSimpleTextPrimitive(
+ SvgTextPosition& rSvgTextPosition,
+ const SvgStyleAttributes& rSvgStyleAttributes) const;
+ void decomposeTextWithStyle(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ SvgTextPosition& rSvgTextPosition,
+ const SvgStyleAttributes& rSvgStyleAttributes) const;
+
+ public:
+ SvgCharacterNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent,
+ const rtl::OUString& rText);
+ virtual ~SvgCharacterNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const;
+ void whiteSpaceHandling();
+ void addGap();
+ void concatenate(const rtl::OUString& rText);
+
+ /// Text content
+ const rtl::OUString& getText() const { return maText; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGCHARACTERNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgcirclenode.hxx b/svgio/inc/svgio/svgreader/svgcirclenode.hxx
new file mode 100644
index 000000000000..ddfde9caab00
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgcirclenode.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGCIRCLENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGCIRCLENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgCircleNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maCx;
+ SvgNumber maCy;
+ SvgNumber maR;
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ public:
+ SvgCircleNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgCircleNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// Cx content, set if found in current context
+ const SvgNumber& getCx() const { return maCx; }
+ void setCx(const SvgNumber& rCx = SvgNumber()) { maCx = rCx; }
+
+ /// Cy content, set if found in current context
+ const SvgNumber& getCy() const { return maCy; }
+ void setCy(const SvgNumber& rCy = SvgNumber()) { maCy = rCy; }
+
+ /// R content, set if found in current context
+ const SvgNumber& getR() const { return maR; }
+ void setR(const SvgNumber& rR = SvgNumber()) { maR = rR; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGCIRCLENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgclippathnode.hxx b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
new file mode 100644
index 000000000000..95d485ac5dad
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGCLIPPATHNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGCLIPPATHNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgClipPathNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgUnits maClipPathUnits;
+
+ public:
+ SvgClipPathNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgClipPathNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// apply contained clipPath to given geometry
+ void apply(drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+
+ /// clipPathUnits content
+ SvgUnits getClipPathUnits() const { return maClipPathUnits; }
+ void setClipPathUnits(const SvgUnits aClipPathUnits) { maClipPathUnits = aClipPathUnits; }
+
+ /// transform content
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGCLIPPATHNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgdocument.hxx b/svgio/inc/svgio/svgreader/svgdocument.hxx
new file mode 100644
index 000000000000..ae30fe40b73d
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgdocument.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGDOCUMENT_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGDOCUMENT_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <boost/utility.hpp>
+#include <svgio/svgreader/svgnode.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgDocument : private boost::noncopyable
+ {
+ private:
+ /// the document hierarchy with all root nodes
+ SvgNodeVector maNodes;
+
+ /// the absolute path of the Svg file in progress (if available)
+ const rtl::OUString maAbsolutePath;
+
+ /// hash mapper to find nodes by their id
+ typedef boost::unordered_map< const rtl::OUString, const SvgNode*,
+ rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > IdTokenMapper;
+ typedef std::pair< const rtl::OUString, const SvgNode* > IdTokenValueType;
+ IdTokenMapper maIdTokenMapperList;
+
+ /// hash mapper to find css styles by their id
+ typedef boost::unordered_map< const rtl::OUString, const SvgStyleAttributes*, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > IdStyleTokenMapper;
+ typedef std::pair< const rtl::OUString, const SvgStyleAttributes* > IdStyleTokenValueType;
+ IdStyleTokenMapper maIdStyleTokenMapperList;
+
+ public:
+ SvgDocument(const rtl::OUString& rAbsolutePath);
+ ~SvgDocument();
+
+ /// append anopther root node, ownership changes
+ void appendNode(SvgNode* pNode);
+
+ /// add/remove nodes with Id to mapper
+ void addSvgNodeToMapper(const rtl::OUString& rStr, const SvgNode& rNode);
+ void removeSvgNodeFromMapper(const rtl::OUString& rStr);
+
+ /// find a node by it's Id
+ bool hasSvgNodesById() const { return !maIdTokenMapperList.empty(); }
+ const SvgNode* findSvgNodeById(const rtl::OUString& rStr) const;
+
+ /// add/remove styles to mapper
+ void addSvgStyleAttributesToMapper(const rtl::OUString& rStr, const SvgStyleAttributes& rSvgStyleAttributes);
+ void removeSvgStyleAttributesFromMapper(const rtl::OUString& rStr);
+
+ /// find a style by it's Id
+ bool hasSvgStyleAttributesById() const { return !maIdStyleTokenMapperList.empty(); }
+ const SvgStyleAttributes* findSvgStyleAttributesById(const rtl::OUString& rStr) const;
+
+ /// data read access
+ const SvgNodeVector& getSvgNodeVector() const { return maNodes; }
+ const rtl::OUString& getAbsolutePath() const { return maAbsolutePath; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGDOCUMENT_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx
new file mode 100644
index 000000000000..04ced2ec1cc3
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <svgio/svgreader/svgdocument.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace svgio { namespace svgreader { class SvgCharacterNode; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgDocHdl : public cppu::WeakImplHelper1< com::sun::star::xml::sax::XDocumentHandler >
+ {
+ private:
+ // the complete SVG Document
+ SvgDocument maDocument;
+
+ // current node for parsing
+ SvgNode* mpTarget;
+
+ // text collector string stack for css styles
+ std::vector< rtl::OUString > maCssContents;
+
+ public:
+ SvgDocHdl(const rtl::OUString& rAbsolutePath);
+ ~SvgDocHdl();
+
+ // Methods XDocumentHandler
+ virtual void SAL_CALL startDocument( ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument( ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+
+ const SvgDocument& getSvgDocument() const { return maDocument; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgellipsenode.hxx b/svgio/inc/svgio/svgreader/svgellipsenode.hxx
new file mode 100644
index 000000000000..5e501c666a87
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgellipsenode.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGELLIPSENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGELLIPSENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgEllipseNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maCx;
+ SvgNumber maCy;
+ SvgNumber maRx;
+ SvgNumber maRy;
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ public:
+ SvgEllipseNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgEllipseNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// Cx content, set if found in current context
+ const SvgNumber& getCx() const { return maCx; }
+ void setCx(const SvgNumber& rCx = SvgNumber()) { maCx = rCx; }
+
+ /// Cy content, set if found in current context
+ const SvgNumber& getCy() const { return maCy; }
+ void setCy(const SvgNumber& rCy = SvgNumber()) { maCy = rCy; }
+
+ /// Rx content, set if found in current context
+ const SvgNumber& getRx() const { return maRx; }
+ void setRx(const SvgNumber& rRx = SvgNumber()) { maRx = rRx; }
+
+ /// Ry content, set if found in current context
+ const SvgNumber& getRy() const { return maRy; }
+ void setRy(const SvgNumber& rRy = SvgNumber()) { maRy = rRy; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGELLIPSENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svggnode.hxx b/svgio/inc/svgio/svgreader/svggnode.hxx
new file mode 100644
index 000000000000..0bd334dd9257
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svggnode.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGGNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGGNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgGNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ public:
+ SvgGNode(
+ SVGToken aType,
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgGNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// transform content
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGGNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svggradientnode.hxx b/svgio/inc/svgio/svgreader/svggradientnode.hxx
new file mode 100644
index 000000000000..7e9e336bf229
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svggradientnode.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGGRADIENTNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGGRADIENTNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgGradientNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// linear gradient values
+ SvgNumber maX1;
+ SvgNumber maY1;
+ SvgNumber maX2;
+ SvgNumber maY2;
+
+ /// radial gradient values
+ SvgNumber maCx;
+ SvgNumber maCy;
+ SvgNumber maR;
+ SvgNumber maFx;
+ SvgNumber maFy;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgUnits maGradientUnits;
+ drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
+ basegfx::B2DHomMatrix* mpaGradientTransform;
+
+ /// link to another gradient used as style. If maXLink
+ /// is set, the node can be fetched on demand by using
+ // tryToFindLink (buffered)
+ rtl::OUString maXLink;
+ const SvgGradientNode* mpXLink;
+
+ /// link on demand
+ void tryToFindLink();
+
+ public:
+ SvgGradientNode(
+ SVGToken aType,
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgGradientNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// collect gradient stop entries
+ void collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector& aVector) const;
+
+ /// x1 content
+ const SvgNumber getX1() const;
+ void setX1(const SvgNumber& rX1 = SvgNumber()) { maX1 = rX1; }
+
+ /// y1 content
+ const SvgNumber getY1() const;
+ void setY1(const SvgNumber& rY1 = SvgNumber()) { maY1 = rY1; }
+
+ /// x2 content
+ const SvgNumber getX2() const;
+ void setX2(const SvgNumber& rX2 = SvgNumber()) { maX2 = rX2; }
+
+ /// y2 content
+ const SvgNumber getY2() const;
+ void setY2(const SvgNumber& rY2 = SvgNumber()) { maY2 = rY2; }
+
+ /// Cx content
+ const SvgNumber getCx() const;
+ void setCx(const SvgNumber& rCx = SvgNumber()) { maCx = rCx; }
+
+ /// Cy content
+ const SvgNumber getCy() const;
+ void setCy(const SvgNumber& rCy = SvgNumber()) { maCy = rCy; }
+
+ /// R content
+ const SvgNumber getR() const;
+ void setR(const SvgNumber& rR = SvgNumber()) { maR = rR; }
+
+ /// Fx content
+ const SvgNumber* getFx() const;
+ void setFx(const SvgNumber& rFx = SvgNumber()) { maFx = rFx; }
+
+ /// Fy content
+ const SvgNumber* getFy() const;
+ void setFy(const SvgNumber& rFy = SvgNumber()) { maFy = rFy; }
+
+ /// gradientUnits content
+ SvgUnits getGradientUnits() const { return maGradientUnits; }
+ void setGradientUnits(const SvgUnits aGradientUnits) { maGradientUnits = aGradientUnits; }
+
+ /// SpreadMethod content
+ drawinglayer::primitive2d::SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
+ void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod) { maSpreadMethod = aSpreadMethod; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getGradientTransform() const;
+ void setGradientTransform(const basegfx::B2DHomMatrix* pMatrix = 0);
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGGRADIENTNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svggradientstopnode.hxx b/svgio/inc/svgio/svgreader/svggradientstopnode.hxx
new file mode 100644
index 000000000000..274b25e61891
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svggradientstopnode.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGGRADIENTSTOPNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGGRADIENTSTOPNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgGradientStopNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// local attributes
+ SvgNumber maOffset;
+
+ public:
+ SvgGradientStopNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgGradientStopNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// offset content
+ const SvgNumber getOffset() const { return maOffset; }
+ void setOffset(const SvgNumber& rOffset = SvgNumber()) { maOffset = rOffset; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGGRADIENTSTOPNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgimagenode.hxx b/svgio/inc/svgio/svgreader/svgimagenode.hxx
new file mode 100644
index 000000000000..afdf886ab2c3
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgimagenode.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGIMAGENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGIMAGENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgImageNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgAspectRatio maSvgAspectRatio;
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+
+ rtl::OUString maXLink; // internal link
+ rtl::OUString maUrl; // external link
+
+ rtl::OUString maMimeType; // mimetype and
+ rtl::OUString maData; // base64 data
+
+ public:
+ SvgImageNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgImageNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// SvgAspectRatio content
+ const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
+ void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ /// x content, set if found in current context
+ const SvgNumber& getX() const { return maX; }
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// y content, set if found in current context
+ const SvgNumber& getY() const { return maY; }
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// width content, set if found in current context
+ const SvgNumber& getWidth() const { return maWidth; }
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// height content, set if found in current context
+ const SvgNumber& getHeight() const { return maHeight; }
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+
+ /// XLink access
+ const rtl::OUString& getXLink() const { return maXLink; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGIMAGENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svglinenode.hxx b/svgio/inc/svgio/svgreader/svglinenode.hxx
new file mode 100644
index 000000000000..4ee18b7bfa32
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svglinenode.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGLINENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGLINENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgLineNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maX1;
+ SvgNumber maY1;
+ SvgNumber maX2;
+ SvgNumber maY2;
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ public:
+ SvgLineNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgLineNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// X1 content, set if found in current context
+ const SvgNumber& getX1() const { return maX1; }
+ void setX1(const SvgNumber& rX1 = SvgNumber()) { maX1 = rX1; }
+
+ /// Y1 content, set if found in current context
+ const SvgNumber& getY1() const { return maY1; }
+ void setY1(const SvgNumber& rY1 = SvgNumber()) { maY1 = rY1; }
+
+ /// X2 content, set if found in current context
+ const SvgNumber& getX2() const { return maX2; }
+ void setX2(const SvgNumber& rX2 = SvgNumber()) { maX2 = rX2; }
+
+ /// Y2 content, set if found in current context
+ const SvgNumber& getY2() const { return maY2; }
+ void setY2(const SvgNumber& rY2 = SvgNumber()) { maY2 = rY2; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGLINENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgmarkernode.hxx b/svgio/inc/svgio/svgreader/svgmarkernode.hxx
new file mode 100644
index 000000000000..947f5099bd3a
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgmarkernode.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgMarkerNode : public SvgNode
+ {
+ public:
+ enum MarkerUnits
+ {
+ strokeWidth,
+ userSpaceOnUse
+ };
+
+ private:
+ /// buffered decomposition
+ drawinglayer::primitive2d::Primitive2DSequence aPrimitives;
+
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DRange* mpViewBox;
+ SvgAspectRatio maSvgAspectRatio;
+ SvgNumber maRefX;
+ SvgNumber maRefY;
+ MarkerUnits maMarkerUnits;
+ SvgNumber maMarkerWidth;
+ SvgNumber maMarkerHeight;
+ double mfAngle;
+
+ /// bitfield
+ bool mbOrientAuto : 1; // true == on, false == fAngle valid
+
+ public:
+ SvgMarkerNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgMarkerNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// get marker primitives buffered, uses decomposeSvgNode internally
+ const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const;
+
+ /// InfoProvider support for % values
+ virtual const basegfx::B2DRange* getCurrentViewPort() const;
+
+ /// viewBox content
+ const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
+ void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+
+ /// SvgAspectRatio content
+ const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
+ void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
+
+ /// RefX content, set if found in current context
+ const SvgNumber& getRefX() const { return maRefX; }
+ void setRefX(const SvgNumber& rRefX = SvgNumber()) { maRefX = rRefX; }
+
+ /// RefY content, set if found in current context
+ const SvgNumber& getRefY() const { return maRefY; }
+ void setRefY(const SvgNumber& rRefY = SvgNumber()) { maRefY = rRefY; }
+
+ /// MarkerUnits content
+ MarkerUnits getMarkerUnits() const { return maMarkerUnits; }
+ void setMarkerUnits(const MarkerUnits aMarkerUnits) { maMarkerUnits = aMarkerUnits; }
+
+ /// MarkerWidth content, set if found in current context
+ const SvgNumber& getMarkerWidth() const { return maMarkerWidth; }
+ void setMarkerWidth(const SvgNumber& rMarkerWidth = SvgNumber()) { maMarkerWidth = rMarkerWidth; }
+
+ /// MarkerHeight content, set if found in current context
+ const SvgNumber& getMarkerHeight() const { return maMarkerHeight; }
+ void setMarkerHeight(const SvgNumber& rMarkerHeight = SvgNumber()) { maMarkerHeight = rMarkerHeight; }
+
+ /// Angle content, set if found in current context
+ double getAngle() const { return mfAngle; }
+ void setAngle(double fAngle = 0.0) { mfAngle = fAngle; mbOrientAuto = false; }
+
+ /// OrientAuto content, set if found in current context
+ bool getOrientAuto() const { return mbOrientAuto; }
+ void setOrientAuto(bool bOrientAuto = true) { mbOrientAuto = bOrientAuto; }
+
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgmasknode.hxx b/svgio/inc/svgio/svgreader/svgmasknode.hxx
new file mode 100644
index 000000000000..a5914d7eb327
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgmasknode.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGMASKNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGMASKNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgMaskNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgUnits maMaskUnits;
+ SvgUnits maMaskContentUnits;
+
+ public:
+ SvgMaskNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgMaskNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// apply contained clipPath to given geometry
+ void apply(drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+
+ /// x content, set if found in current context
+ const SvgNumber& getX() const { return maX; }
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// y content, set if found in current context
+ const SvgNumber& getY() const { return maY; }
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// width content, set if found in current context
+ const SvgNumber& getWidth() const { return maWidth; }
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// height content, set if found in current context
+ const SvgNumber& getHeight() const { return maHeight; }
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+
+ /// transform content
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ /// MaskUnits content
+ SvgUnits getMaskUnits() const { return maMaskUnits; }
+ void setMaskUnits(const SvgUnits aMaskUnits) { maMaskUnits = aMaskUnits; }
+
+ /// MaskContentUnits content
+ SvgUnits getMaskContentUnits() const { return maMaskContentUnits; }
+ void setMaskContentUnits(const SvgUnits aMaskContentUnits) { maMaskContentUnits = aMaskContentUnits; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGMASKNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx
new file mode 100644
index 000000000000..5b3a2694dd18
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgtools.hxx>
+#include <svgio/svgreader/svgtoken.hxx>
+#include <svgio/svgreader/svgpaint.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgNode;
+ class SvgDocument;
+ class SvgStyleAttributes;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ typedef ::std::vector< SvgNode* > SvgNodeVector;
+
+ enum XmlSpace
+ {
+ XmlSpace_notset,
+ XmlSpace_default,
+ XmlSpace_preserve
+ };
+
+ class SvgNode : private boost::noncopyable, public InfoProvider
+ {
+ private:
+ /// basic data, Type, document we belong to and parent (if not root)
+ SVGToken maType;
+ SvgDocument& mrDocument;
+ const SvgNode* mpParent;
+ const SvgNode* mpAlternativeParent;
+
+ /// sub hierarchy
+ SvgNodeVector maChildren;
+
+ /// Id svan value
+ rtl::OUString* mpId;
+
+ /// Class svan value
+ rtl::OUString* mpClass;
+
+ /// XmlSpace value
+ XmlSpace maXmlSpace;
+
+ public:
+ SvgNode(
+ SVGToken aType,
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgNode();
+
+ void parseAttributes(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs);
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// basic data read access
+ SVGToken getType() const { return maType; }
+ const SvgDocument& getDocument() const { return mrDocument; }
+ const SvgNode* getParent() const { if(mpAlternativeParent) return mpAlternativeParent; return mpParent; }
+ 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;
+
+ /// Id access
+ const rtl::OUString* getId() const { return mpId; }
+ void setId(const rtl::OUString* pfId = 0);
+
+ /// Class access
+ const rtl::OUString* getClass() const { return mpClass; }
+ void setClass(const rtl::OUString* pfClass = 0);
+
+ /// XmlSpace access
+ XmlSpace getXmlSpace() const;
+ void setXmlSpace(XmlSpace eXmlSpace = XmlSpace_notset) { maXmlSpace = eXmlSpace; }
+
+ /// alternative parent
+ void setAlternativeParent(const SvgNode* pAlternativeParent = 0) { mpAlternativeParent = pAlternativeParent; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgpaint.hxx b/svgio/inc/svgio/svgreader/svgpaint.hxx
new file mode 100644
index 000000000000..361125d107df
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgpaint.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGPAINT_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGPAINT_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgPaint
+ {
+ private:
+ basegfx::BColor maColor;
+
+ /// bitfield
+ bool mbSet : 1;
+ bool mbOn : 1;
+ bool mbCurrent : 1;
+
+ public:
+ SvgPaint(const basegfx::BColor& rColor = basegfx::BColor(0.0, 0.0, 0.0), bool bSet = false, bool bOn = false, bool bCurrent = false)
+ : maColor(rColor),
+ mbSet(bSet),
+ mbOn(bOn),
+ mbCurrent(bCurrent)
+ {
+ }
+
+ const basegfx::BColor& getBColor() const { return maColor; }
+ bool isSet() const { return mbSet; }
+ bool isOn() const { return mbOn; }
+ bool isCurrent() const { return mbCurrent; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGPAINT_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgpathnode.hxx b/svgio/inc/svgio/svgreader/svgpathnode.hxx
new file mode 100644
index 000000000000..a7506cee7f8e
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgpathnode.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGPATHNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGPATHNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgPathNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DPolyPolygon* mpPolyPolygon;
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgNumber maPathLength;
+
+ public:
+ SvgPathNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgPathNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// path content, set if found in current context
+ const basegfx::B2DPolyPolygon* getPath() const { return mpPolyPolygon; }
+ void setPath(const basegfx::B2DPolyPolygon* pPath = 0) { if(mpPolyPolygon) delete mpPolyPolygon; mpPolyPolygon = 0; if(pPath) mpPolyPolygon = new basegfx::B2DPolyPolygon(*pPath); }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ /// PathLength content
+ const SvgNumber& getPathLength() const { return maPathLength; }
+ void setPathLength(const SvgNumber& rPathLength = SvgNumber()) { maPathLength = rPathLength; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGPATHNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgpatternnode.hxx b/svgio/inc/svgio/svgreader/svgpatternnode.hxx
new file mode 100644
index 000000000000..946fdbfcb1a5
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgpatternnode.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGPATTERNNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGPATTERNNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgPatternNode : public SvgNode
+ {
+ private:
+ /// buffered decomposition
+ drawinglayer::primitive2d::Primitive2DSequence aPrimitives;
+
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DRange* mpViewBox;
+ SvgAspectRatio maSvgAspectRatio;
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+ SvgUnits* mpPatternUnits;
+ SvgUnits* mpPatternContentUnits;
+ basegfx::B2DHomMatrix* mpaPatternTransform;
+
+ /// link to another pattern used as style. If maXLink
+ /// is set, the node can be fetched on demand by using
+ // tryToFindLink (buffered)
+ rtl::OUString maXLink;
+ const SvgPatternNode* mpXLink;
+
+ /// link on demand
+ void tryToFindLink();
+
+ public:
+ SvgPatternNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgPatternNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// global helpers
+ void getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const;
+
+ /// get pattern primitives buffered, uses decomposeSvgNode internally
+ const drawinglayer::primitive2d::Primitive2DSequence& getPatternPrimitives() const;
+
+ /// InfoProvider support for % values
+ virtual const basegfx::B2DRange* getCurrentViewPort() const;
+
+ /// viewBox content
+ const basegfx::B2DRange* getViewBox() const;
+ void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+
+ /// SvgAspectRatio content
+ const SvgAspectRatio& getSvgAspectRatio() const;
+ void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
+
+ /// X content, set if found in current context
+ const SvgNumber& getX() const;
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// Y content, set if found in current context
+ const SvgNumber& getY() const;
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// Width content, set if found in current context
+ const SvgNumber& getWidth() const;
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// Height content, set if found in current context
+ const SvgNumber& getHeight() const;
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+
+ /// PatternUnits content
+ const SvgUnits* getPatternUnits() const;
+ void setPatternUnits(const SvgUnits aPatternUnits) { if(mpPatternUnits) delete mpPatternUnits; mpPatternUnits = 0; mpPatternUnits = new SvgUnits(aPatternUnits); }
+
+ /// PatternContentUnits content
+ const SvgUnits* getPatternContentUnits() const;
+ void setPatternContentUnits(const SvgUnits aPatternContentUnits) { if(mpPatternContentUnits) delete mpPatternContentUnits; mpPatternContentUnits = 0; mpPatternContentUnits = new SvgUnits(aPatternContentUnits); }
+
+ /// PatternTransform content
+ const basegfx::B2DHomMatrix* getPatternTransform() const;
+ void setPatternTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaPatternTransform) delete mpaPatternTransform; mpaPatternTransform = 0; if(pMatrix) mpaPatternTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGPATTERNNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgpolynode.hxx b/svgio/inc/svgio/svgreader/svgpolynode.hxx
new file mode 100644
index 000000000000..5ebd8076bb58
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgpolynode.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGPOLYNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGPOLYNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgPolyNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DPolygon* mpPolygon;
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ /// bitfield
+ bool mbIsPolyline : 1; // true = polyline, false = polygon
+
+ public:
+ SvgPolyNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent,
+ bool bIsPolyline);
+ virtual ~SvgPolyNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// type read access
+ bool isPolyline() const { return mbIsPolyline; }
+
+ /// Polygon content, set if found in current context
+ const basegfx::B2DPolygon* getPolygon() const { return mpPolygon; }
+ void setPolygon(const basegfx::B2DPolygon* pPolygon = 0) { if(mpPolygon) delete mpPolygon; mpPolygon = 0; if(pPolygon) mpPolygon = new basegfx::B2DPolygon(*pPolygon); }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGPOLYNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgrectnode.hxx b/svgio/inc/svgio/svgreader/svgrectnode.hxx
new file mode 100644
index 000000000000..f6e10eac2e98
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgrectnode.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGRECTNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGRECTNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgRectNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+ SvgNumber maRx;
+ SvgNumber maRy;
+ basegfx::B2DHomMatrix* mpaTransform;
+
+ public:
+ SvgRectNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgRectNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// x content, set if found in current context
+ const SvgNumber& getX() const { return maX; }
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// y content, set if found in current context
+ const SvgNumber& getY() const { return maY; }
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// width content, set if found in current context
+ const SvgNumber& getWidth() const { return maWidth; }
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// height content, set if found in current context
+ const SvgNumber& getHeight() const { return maHeight; }
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+
+ /// Rx content, set if found in current context
+ const SvgNumber& getRx() const { return maRx; }
+ void setRx(const SvgNumber& rRx = SvgNumber()) { maRx = rRx; }
+
+ /// Ry content, set if found in current context
+ const SvgNumber& getRy() const { return maRy; }
+ void setRy(const SvgNumber& rRy = SvgNumber()) { maRy = rRy; }
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGRECTNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
new file mode 100644
index 000000000000..66789586ad6b
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -0,0 +1,411 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGSTYLEATTRIBUTES_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGSTYLEATTRIBUTES_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgpaint.hxx>
+#include <svgio/svgreader/svgnode.hxx>
+#include <vcl/vclenum.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace svgio { namespace svgreader {
+ class SvgGradientNode;
+ class SvgPatternNode;
+ class SvgMarkerNode;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ enum StrokeLinecap
+ {
+ StrokeLinecap_notset,
+ StrokeLinecap_butt,
+ StrokeLinecap_round,
+ StrokeLinecap_square
+ };
+
+ enum StrokeLinejoin
+ {
+ StrokeLinejoin_notset,
+ StrokeLinejoin_miter,
+ StrokeLinejoin_round,
+ StrokeLinejoin_bevel
+ };
+
+ enum 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
+ };
+
+ FontStretch getWider(FontStretch aSource);
+ FontStretch getNarrower(FontStretch aSource);
+
+ enum FontStyle
+ {
+ FontStyle_notset,
+ FontStyle_normal,
+ FontStyle_italic,
+ FontStyle_oblique
+ };
+
+ enum FontVariant
+ {
+ FontVariant_notset,
+ FontVariant_normal,
+ FontVariant_small_caps
+ };
+
+ enum 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,
+ };
+
+ FontWeight getBolder(FontWeight aSource);
+ FontWeight getLighter(FontWeight aSource);
+ ::FontWeight getVclFontWeight(FontWeight aSource);
+
+ enum TextAlign
+ {
+ TextAlign_notset,
+ TextAlign_left,
+ TextAlign_right,
+ TextAlign_center,
+ TextAlign_justify
+ };
+
+ enum TextDecoration
+ {
+ TextDecoration_notset,
+ TextDecoration_none,
+ TextDecoration_underline,
+ TextDecoration_overline,
+ TextDecoration_line_through,
+ TextDecoration_blink
+ };
+
+ enum TextAnchor
+ {
+ TextAnchor_notset,
+ TextAnchor_start,
+ TextAnchor_middle,
+ TextAnchor_end
+ };
+
+ class SvgStyleAttributes
+ {
+ private:
+ SvgNode& mrOwner;
+ const SvgStyleAttributes* mpCssStyleParent;
+
+ SvgPaint maFill;
+ SvgPaint maStroke;
+ SvgPaint maStopColor;
+ SvgNumber maStrokeWidth;
+ SvgNumber maStopOpacity;
+ const SvgGradientNode* mpSvgGradientNodeFill;
+ const SvgGradientNode* mpSvgGradientNodeStroke;
+ const SvgPatternNode* mpSvgPatternNodeFill;
+ const SvgPatternNode* mpSvgPatternNodeStroke;
+ SvgNumber maFillOpacity;
+ SvgNumberVector maStrokeDasharray;
+ SvgNumber maStrokeDashOffset;
+ StrokeLinecap maStrokeLinecap;
+ StrokeLinejoin maStrokeLinejoin;
+ SvgNumber maStrokeMiterLimit;
+ SvgNumber maStrokeOpacity;
+ SvgStringVector maFontFamily;
+ SvgNumber maFontSize;
+ FontStretch maFontStretch;
+ FontStyle maFontStyle;
+ FontVariant maFontVariant;
+ FontWeight maFontWeight;
+ TextAlign maTextAlign;
+ TextDecoration maTextDecoration;
+ TextAnchor maTextAnchor;
+ SvgPaint maColor;
+ SvgNumber maOpacity;
+
+ /// link to content. If set, the node can be fetched on demand
+ rtl::OUString maClipPathXLink;
+ rtl::OUString maMaskXLink;
+
+ /// link to markers. If set, the node can be fetched on demand
+ rtl::OUString maMarkerStartXLink;
+ const SvgMarkerNode* mpMarkerStartXLink;
+ rtl::OUString maMarkerMidXLink;
+ const SvgMarkerNode* mpMarkerMidXLink;
+ rtl::OUString maMarkerEndXLink;
+ const SvgMarkerNode* mpMarkerEndXLink;
+
+ /// bitfield
+ bool maFillRule : 1; // true: NonZero, false: EvenOdd
+ bool maFillRuleSet : 1;
+
+ // defines if this attributes are part of a ClipPath. If yes,
+ // rough geometry will be created on decomposition by patching
+ // vaules for fill, stroke, strokeWidth and others
+ bool mbIsClipPathContent : 1;
+
+ // ClipRule setting (only valid wne mbIsClipPathContent == true)
+ bool mbClipRule : 1; // true == nonzero(default), false == evenodd
+
+ /// internal helpers
+ void add_fillGradient(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const SvgGradientNode& rFillGradient,
+ const basegfx::B2DRange& rGeoRange) const;
+ void add_fillPatternTransform(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const SvgPatternNode& rFillGradient,
+ const basegfx::B2DRange& rGeoRange) const;
+ void add_fillPattern(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const SvgPatternNode& rFillGradient,
+ const basegfx::B2DRange& rGeoRange) const;
+ void add_fill(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DRange& rGeoRange) const;
+ void add_stroke(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DRange& rGeoRange) const;
+ bool prepare_singleMarker(
+ drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives,
+ basegfx::B2DHomMatrix& rMarkerTransform,
+ basegfx::B2DRange& rClipRange,
+ const SvgMarkerNode& rMarker) const;
+ void add_singleMarker(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives,
+ const basegfx::B2DHomMatrix& rMarkerTransform,
+ const basegfx::B2DRange& rClipRange,
+ const SvgMarkerNode& rMarker,
+ const basegfx::B2DPolygon& rCandidate,
+ const sal_uInt32 nIndex) const;
+ void add_markers(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+
+ public:
+ /// local attribute scanner
+ void parseStyleAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// helper which does the necessary with a given path
+ void add_text(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ drawinglayer::primitive2d::Primitive2DSequence& rSource) const;
+ void add_path(
+ const basegfx::B2DPolyPolygon& rPath,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+ void add_postProcess(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::Primitive2DSequence& rSource,
+ const basegfx::B2DHomMatrix* pTransform) const;
+
+ /// helper to evtl. link to css style
+ void checkForCssStyle(const rtl::OUString& rClassStr) const;
+
+ /// scan helpers
+ void readStyle(const rtl::OUString& rCandidate);
+ const SvgStyleAttributes* getParentStyle() const;
+
+ SvgStyleAttributes(SvgNode& rOwner);
+ ~SvgStyleAttributes();
+
+ /// fill content
+ const basegfx::BColor* getFill() const;
+ void setFill(const SvgPaint& rFill) { maFill = rFill; }
+
+ /// stroke content
+ const basegfx::BColor* getStroke() const;
+ void setStroke(const SvgPaint& rStroke) { maStroke = rStroke; }
+
+ /// stop color content
+ const basegfx::BColor& getStopColor() const;
+ void setStopColor(const SvgPaint& rStopColor) { maStopColor = rStopColor; }
+
+ /// stroke-width content
+ const SvgNumber getStrokeWidth() const;
+ void setStrokeWidth(const SvgNumber& rStrokeWidth = SvgNumber()) { maStrokeWidth = rStrokeWidth; }
+
+ /// stop opacity content
+ const SvgNumber getStopOpacity() const;
+ void setStopOpacity(const SvgNumber& rStopOpacity = SvgNumber()) { maStopOpacity = rStopOpacity; }
+
+ /// access to evtl. set fill gradient
+ const SvgGradientNode* getSvgGradientNodeFill() const;
+ void setSvgGradientNodeFill(const SvgGradientNode* pNew) { mpSvgGradientNodeFill = pNew; }
+
+ /// access to evtl. set fill pattern
+ const SvgPatternNode* getSvgPatternNodeFill() const;
+ void setSvgPatternNodeFill(const SvgPatternNode* pNew) { mpSvgPatternNodeFill = pNew; }
+
+ /// access to evtl. set stroke gradient
+ const SvgGradientNode* getSvgGradientNodeStroke() const;
+ void setSvgGradientNodeStroke(const SvgGradientNode* pNew) { mpSvgGradientNodeStroke = pNew; }
+
+ /// access to evtl. set stroke pattern
+ const SvgPatternNode* getSvgPatternNodeStroke() const;
+ void setSvgPatternNodeStroke(const SvgPatternNode* pNew) { mpSvgPatternNodeStroke = pNew; }
+
+ /// fill opacity content
+ const SvgNumber getFillOpacity() const;
+ void setFillOpacity(const SvgNumber& rFillOpacity = SvgNumber()) { maFillOpacity = rFillOpacity; }
+
+ /// fill rule content
+ bool getFillRule() const;
+ void setFillRule(const bool* pFillRule = 0);
+
+ /// fill StrokeDasharray content
+ const SvgNumberVector& getStrokeDasharray() const;
+ void setStrokeDasharray(const SvgNumberVector& rStrokeDasharray = SvgNumberVector()) { maStrokeDasharray = rStrokeDasharray; }
+
+ /// StrokeDashOffset content
+ const SvgNumber getStrokeDashOffset() const;
+ void setStrokeDashOffset(const SvgNumber& rStrokeDashOffset = SvgNumber()) { maStrokeDashOffset = rStrokeDashOffset; }
+
+ /// StrokeLinecap content
+ StrokeLinecap getStrokeLinecap() const;
+ void setStrokeLinecap(const StrokeLinecap aStrokeLinecap = StrokeLinecap_notset) { maStrokeLinecap = aStrokeLinecap; }
+
+ /// StrokeLinejoin content
+ StrokeLinejoin getStrokeLinejoin() const;
+ void setStrokeLinejoin(const StrokeLinejoin aStrokeLinejoin = StrokeLinejoin_notset) { maStrokeLinejoin = aStrokeLinejoin; }
+
+ /// StrokeMiterLimit content
+ const SvgNumber getStrokeMiterLimit() const;
+ void setStrokeMiterLimit(const SvgNumber& rStrokeMiterLimit = SvgNumber()) { maStrokeMiterLimit = rStrokeMiterLimit; }
+
+ /// StrokeOpacity content
+ const SvgNumber getStrokeOpacity() const;
+ void setStrokeOpacity(const SvgNumber& rStrokeOpacity = SvgNumber()) { maStrokeOpacity = rStrokeOpacity; }
+
+ /// Font content
+ const SvgStringVector& getFontFamily() const;
+ void setFontFamily(const SvgStringVector& rSvgStringVector = SvgStringVector()) { maFontFamily = rSvgStringVector; }
+
+ /// FontSize content
+ const SvgNumber getFontSize() const;
+ void setFontSize(const SvgNumber& rFontSize = SvgNumber()) { maFontSize = rFontSize; }
+
+ /// FontStretch content
+ FontStretch getFontStretch() const;
+ void setFontStretch(const FontStretch aFontStretch = FontStretch_notset) { maFontStretch = aFontStretch; }
+
+ /// FontStyle content
+ FontStyle getFontStyle() const;
+ 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
+ FontWeight getFontWeight() const;
+ void setFontWeight(const FontWeight aFontWeight = FontWeight_notset) { maFontWeight = aFontWeight; }
+
+ /// TextAlign content
+ TextAlign getTextAlign() const;
+ void setTextAlign(const TextAlign aTextAlign = TextAlign_notset) { maTextAlign = aTextAlign; }
+
+ /// TextDecoration content
+ const SvgStyleAttributes* getTextDecorationDefiningSvgStyleAttributes() const;
+ TextDecoration getTextDecoration() const;
+ void setTextDecoration(const TextDecoration aTextDecoration = TextDecoration_notset) { maTextDecoration = aTextDecoration; }
+
+ /// TextAnchor content
+ TextAnchor getTextAnchor() const;
+ void setTextAnchor(const TextAnchor aTextAnchor = TextAnchor_notset) { maTextAnchor = aTextAnchor; }
+
+ /// Color content
+ const basegfx::BColor* getColor() const;
+ void setColor(const SvgPaint& rColor) { maColor = rColor; }
+
+ /// Opacity content
+ const SvgNumber getOpacity() const { return maOpacity; }
+ void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; }
+
+ // ClipPathXLink content
+ const rtl::OUString getClipPathXLink() const { return maClipPathXLink; }
+ void setClipPathXLink(const rtl::OUString& rNew) { maClipPathXLink = rNew; }
+
+ // MaskXLink content
+ const rtl::OUString getMaskXLink() const { return maMaskXLink; }
+ void setMaskXLink(const rtl::OUString& rNew) { maMaskXLink = rNew; }
+
+ // MarkerStartXLink content
+ const rtl::OUString getMarkerStartXLink() const;
+ const SvgMarkerNode* accessMarkerStartXLink() const;
+ void setMarkerStartXLink(const rtl::OUString& rNew) { maMarkerStartXLink = rNew; }
+
+ // MarkerMidXLink content
+ const rtl::OUString getMarkerMidXLink() const;
+ const SvgMarkerNode* accessMarkerMidXLink() const;
+ void setMarkerMidXLink(const rtl::OUString& rNew) { maMarkerMidXLink = rNew; }
+
+ // MarkerEndXLink content
+ const rtl::OUString getMarkerEndXLink() const;
+ const SvgMarkerNode* accessMarkerEndXLink() const;
+ void setMarkerEndXLink(const rtl::OUString& rNew) { maMarkerEndXLink = rNew; }
+
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGSTYLEATTRIBUTES_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgstylenode.hxx b/svgio/inc/svgio/svgreader/svgstylenode.hxx
new file mode 100644
index 000000000000..37a7ef7d8eb3
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgstylenode.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGSTYLENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGSTYLENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgStyleNode : public SvgNode
+ {
+ private:
+ /// use styles
+ std::vector< SvgStyleAttributes* > maSvgStyleAttributes;
+
+ /// bitfield
+ bool mbTextCss : 1; // true == type is 'text/css'
+
+ public:
+ SvgStyleNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgStyleNode();
+
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ void addCssStyleSheet(const rtl::OUString& aContent);
+
+ /// textCss access
+ bool isTextCss() const { return mbTextCss; }
+ void setTextCss(bool bNew) { mbTextCss = bNew; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGSTYLENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
new file mode 100644
index 000000000000..0da68741b636
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgSvgNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DRange* mpViewBox;
+ SvgAspectRatio maSvgAspectRatio;
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+ SvgNumber maVersion;
+
+ public:
+ SvgSvgNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgSvgNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// InfoProvider support for % values
+ virtual const basegfx::B2DRange* getCurrentViewPort() const;
+
+ /// viewBox content
+ const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
+ void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+
+ /// SvgAspectRatio content
+ const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
+ void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
+
+ /// x content
+ const SvgNumber& getX() const { return maX; }
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// y content
+ const SvgNumber& getY() const { return maY; }
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// width content
+ const SvgNumber& getWidth() const { return maWidth; }
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// height content
+ const SvgNumber& getHeight() const { return maHeight; }
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+
+ /// version content
+ const SvgNumber& getVersion() const { return maVersion; }
+ void setVersion(const SvgNumber& rVersion = SvgNumber()) { maVersion = rVersion; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgsymbolnode.hxx b/svgio/inc/svgio/svgreader/svgsymbolnode.hxx
new file mode 100644
index 000000000000..b4fd0428c7d3
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgsymbolnode.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGSYMBOLNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGSYMBOLNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgSymbolNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DRange* mpViewBox;
+ SvgAspectRatio maSvgAspectRatio;
+
+ public:
+ SvgSymbolNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgSymbolNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// viewBox content
+ const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
+ void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
+
+ /// SvgAspectRatio content
+ const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
+ void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGSYMBOLNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtextnode.hxx b/svgio/inc/svgio/svgreader/svgtextnode.hxx
new file mode 100644
index 000000000000..59ff27eac756
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtextnode.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTEXTNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTEXTNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <svgio/svgreader/svgcharacternode.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTextNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgTextPositions maSvgTextPositions;
+
+ /// local helpers
+ void DecomposeChild(
+ const SvgNode& rCandidate,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ SvgTextPosition& rSvgTextPosition) const;
+ void addTextPrimitives(
+ const SvgNode& rCandidate,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ drawinglayer::primitive2d::Primitive2DSequence& rSource) const;
+
+ public:
+ SvgTextNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgTextNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// transform content, set if found in current context
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ /// access to SvgTextPositions
+ const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTEXTNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtextpathnode.hxx b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx
new file mode 100644
index 000000000000..8c9a1d13281f
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTEXTPATHNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTEXTPATHNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <svgio/svgreader/svgpathnode.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTextPathNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// link to path content. If maXLink
+ /// is set, the node can be fetched on demand
+ rtl::OUString maXLink;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgNumber maStartOffset;
+
+ /// bitfield
+ bool mbMethod : 1; // true = align, false = stretch
+ bool mbSpacing : 1; // true = auto, false = exact
+
+ public:
+ SvgTextPathNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgTextPathNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ void decomposePathNode(
+ const drawinglayer::primitive2d::Primitive2DSequence& rPathContent,
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DPoint& rTextStart) const;
+ bool isValid() const;
+
+ /// StartOffset content
+ const SvgNumber& getStartOffset() const { return maStartOffset; }
+ void setStartOffset(const SvgNumber& rStartOffset = SvgNumber()) { maStartOffset = rStartOffset; }
+
+ /// Method content
+ bool getMethod() const { return mbMethod; }
+ void setMethod(bool bNew) { mbMethod = bNew; }
+
+ /// Spacing content
+ bool getSpacing() const { return mbSpacing; }
+ void setSpacing(bool bNew) { mbSpacing = bNew; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTEXTPATHNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx b/svgio/inc/svgio/svgreader/svgtoken.hxx
new file mode 100644
index 000000000000..c0c68fbef3ba
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTOKEN_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTOKEN_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <rtl/ustring.hxx>
+#include <boost/unordered_map.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ // SVG token mapper with hashing
+ enum SVGToken
+ {
+ SVGTokenUnknown = 0,
+
+ // diverse attribute tokens
+ SVGTokenWidth,
+ SVGTokenHeight,
+ SVGTokenViewBox,
+ SVGTokenTransform,
+ SVGTokenStyle,
+ 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,
+ SVGTokenOpacity,
+
+ // AspectRatio and params
+ SVGTokenPreserveAspectRatio,
+ SVGTokenDefer,
+ SVGTokenNone,
+ SVGTokenXMinYMin,
+ SVGTokenXMidYMin,
+ SVGTokenXMaxYMin,
+ SVGTokenXMinYMid,
+ SVGTokenXMidYMid,
+ SVGTokenXMaxYMid,
+ SVGTokenXMinYMax,
+ SVGTokenXMidYMax,
+ SVGTokenXMaxYMax,
+ SVGTokenMeet,
+ SVGTokenSlice,
+
+ // structural elements
+ SVGTokenDefs,
+ SVGTokenG,
+ SVGTokenSvg,
+ SVGTokenSymbol,
+ SVGTokenUse,
+
+ // shape elements
+ SVGTokenCircle,
+ SVGTokenEllipse,
+ SVGTokenLine,
+ SVGTokenPath,
+ SVGTokenPolygon,
+ SVGTokenPolyline,
+ SVGTokenRect,
+ SVGTokenImage,
+
+ // gradient elements and tokens
+ SVGTokenLinearGradient,
+ SVGTokenRadialGradient,
+ SVGTokenStop,
+ SVGTokenOffset,
+ SVGTokenX1,
+ SVGTokenY1,
+ SVGTokenX2,
+ SVGTokenY2,
+ SVGTokenCx,
+ SVGTokenCy,
+ SVGTokenFx,
+ SVGTokenFy,
+ SVGTokenR,
+ SVGTokenGradientUnits,
+ SVGTokenGradientTransform,
+ SVGTokenSpreadMethod,
+ SVGTokenXlinkHref,
+ SVGTokenStopColor,
+ SVGTokenStopOpacity,
+
+ // fill tokens
+ SVGTokenFill,
+ SVGTokenFillOpacity,
+ SVGTokenFillRule,
+
+ // stroke tokens
+ SVGTokenStroke,
+ SVGTokenStrokeDasharray,
+ SVGTokenStrokeDashoffset,
+ SVGTokenStrokeLinecap,
+ SVGTokenStrokeLinejoin,
+ SVGTokenStrokeMiterlimit,
+ SVGTokenStrokeOpacity,
+ SVGTokenStrokeWidth,
+
+ // text tokens
+ SVGTokenText,
+
+ SVGTokenLast
+ };
+
+ SVGToken StrToSVGToken(const rtl::OUString& rStr);
+
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTOKEN_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx b/svgio/inc/svgio/svgreader/svgtools.hxx
new file mode 100644
index 000000000000..5f9645e6d0cf
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTOOLS_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTOOLS_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <svgio/svgreader/svgpaint.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+#ifdef DBG_UTIL
+ // error helper
+ void myAssert(const rtl::OUString& rMessage);
+#endif
+
+ // common non-token strings
+ struct commonStrings
+ {
+ static const rtl::OUString aStrUserSpaceOnUse;
+ static const rtl::OUString aStrObjectBoundingBox;
+ static const rtl::OUString aStrNonzero;
+ static const rtl::OUString aStrEvenOdd;
+ };
+
+ enum SvgUnits
+ {
+ userSpaceOnUse,
+ objectBoundingBox
+ };
+
+ enum NumberType
+ {
+ xcoordinate,
+ ycoordinate,
+ length
+ };
+
+ class InfoProvider
+ {
+ public:
+ virtual ~InfoProvider() {}
+ virtual const basegfx::B2DRange* getCurrentViewPort() const = 0;
+ virtual double getCurrentFontSize() const = 0;
+ virtual double getCurrentXHeight() const = 0;
+ };
+
+ enum 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
+ };
+
+ class SvgNumber
+ {
+ private:
+ double mfNumber;
+ SvgUnit meUnit;
+
+ /// bitfield
+ bool mbSet : 1;
+
+ public:
+ SvgNumber()
+ : mfNumber(0.0),
+ meUnit(Unit_px),
+ mbSet(false)
+ {
+ }
+
+ SvgNumber(double fNum, SvgUnit aSvgUnit = Unit_px, bool bSet = true)
+ : mfNumber(fNum),
+ meUnit(aSvgUnit),
+ mbSet(bSet)
+ {
+ }
+
+ double getNumber() const
+ {
+ return mfNumber;
+ }
+
+ SvgUnit getUnit() const
+ {
+ return meUnit;
+ }
+
+ bool isSet() const
+ {
+ return mbSet;
+ }
+
+ bool isPositive() const;
+
+ double solve(const InfoProvider& rInfoProvider, NumberType aNumberType = length) const;
+ };
+
+ typedef ::std::vector< SvgNumber > SvgNumberVector;
+
+ enum SvgAlign
+ {
+ Align_none,
+ Align_xMinYMin,
+ Align_xMidYMin,
+ Align_xMaxYMin,
+ Align_xMinYMid,
+ Align_xMidYMid, // default
+ Align_xMaxYMid,
+ Align_xMinYMax,
+ Align_xMidYMax,
+ Align_xMaxYMax
+ };
+
+ class SvgAspectRatio
+ {
+ private:
+ SvgAlign maSvgAlign;
+
+ /// bitfield
+ bool mbDefer : 1; // default is false
+ bool mbMeetOrSlice : 1; // true = meet (default), false = slice
+ bool mbSet : 1;
+
+ public:
+ SvgAspectRatio()
+ : maSvgAlign(Align_xMidYMid),
+ mbDefer(false),
+ mbMeetOrSlice(true),
+ mbSet(false)
+ {
+ }
+
+ SvgAspectRatio(SvgAlign aSvgAlign, bool bDefer, bool bMeetOrSlice)
+ : maSvgAlign(aSvgAlign),
+ mbDefer(bDefer),
+ mbMeetOrSlice(bMeetOrSlice),
+ mbSet(true)
+ {
+ }
+
+ /// data read access
+ SvgAlign getSvgAlign() const { return maSvgAlign; }
+ bool isDefer() const { return mbDefer; }
+ bool isMeetOrSlice() const { return mbMeetOrSlice; }
+ bool isSet() const { return mbSet; }
+
+ /// tooling
+ static basegfx::B2DHomMatrix createLinearMapping(const basegfx::B2DRange& rTarget, const basegfx::B2DRange& rSource);
+ basegfx::B2DHomMatrix createMapping(const basegfx::B2DRange& rTarget, const basegfx::B2DRange& rSource) const;
+ };
+
+ void skip_char(const rtl::OUString& rCandidate, const sal_Unicode& rChar, sal_Int32& nPos, const sal_Int32 nLen);
+ void skip_char(const rtl::OUString& rCandidate, const sal_Unicode& rCharA, const sal_Unicode& rCharB, sal_Int32& nPos, const sal_Int32 nLen);
+ void copySign(const rtl::OUString& rCandidate, sal_Int32& nPos, rtl::OUStringBuffer& rTarget, const sal_Int32 nLen);
+ void copyNumber(const rtl::OUString& rCandidate, sal_Int32& nPos, rtl::OUStringBuffer& rTarget, const sal_Int32 nLen);
+ void copyHex(const rtl::OUString& rCandidate, sal_Int32& nPos, rtl::OUStringBuffer& rTarget, const sal_Int32 nLen);
+ void copyString(const rtl::OUString& rCandidate, sal_Int32& nPos, rtl::OUStringBuffer& rTarget, const sal_Int32 nLen);
+ void copyToLimiter(const rtl::OUString& rCandidate, const sal_Unicode& rLimiter, sal_Int32& nPos, rtl::OUStringBuffer& rTarget, const sal_Int32 nLen);
+ bool readNumber(const rtl::OUString& rCandidate, sal_Int32& nPos, double& fNum, const sal_Int32 nLen);
+ SvgUnit readUnit(const rtl::OUString& rCandidate, sal_Int32& nPos, const sal_Int32 nLen);
+ bool readNumberAndUnit(const rtl::OUString& rCandidate, sal_Int32& nPos, SvgNumber& aNum, const sal_Int32 nLen);
+ bool readAngle(const rtl::OUString& rCandidate, sal_Int32& nPos, double& fAngle, const sal_Int32 nLen);
+ sal_Int32 read_hex(const sal_Unicode& rChar);
+ bool match_colorKeyword(basegfx::BColor& rColor, const rtl::OUString& rName);
+ bool read_color(const rtl::OUString& rCandidate, basegfx::BColor& rColor);
+ basegfx::B2DRange readViewBox(const rtl::OUString& rCandidate, InfoProvider& rInfoProvider);
+ basegfx::B2DHomMatrix readTransform(const rtl::OUString& rCandidate, InfoProvider& rInfoProvider);
+ bool readSingleNumber(const rtl::OUString& rCandidate, SvgNumber& aNum);
+ bool readLocalUrl(const rtl::OUString& rCandidate, rtl::OUString& rURL);
+ bool readSvgPaint(const rtl::OUString& rCandidate, SvgPaint& rSvgPaint, rtl::OUString& rURL);
+
+ bool readSvgNumberVector(const rtl::OUString& rCandidate, SvgNumberVector& rSvgNumberVector);
+ ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& rInput, const InfoProvider& rInfoProvider, NumberType aNumberType = length);
+
+ SvgAspectRatio readSvgAspectRatio(const rtl::OUString& rCandidate);
+
+ typedef ::std::vector< rtl::OUString > SvgStringVector;
+ bool readSvgStringVector(const rtl::OUString& rCandidate, SvgStringVector& rSvgStringVector);
+
+ void readImageLink(const rtl::OUString& rCandidate, rtl::OUString& rXLink, rtl::OUString& rUrl, rtl::OUString& rMimeType, rtl::OUString& rData);
+
+ rtl::OUString convert(const rtl::OUString& rCandidate, const sal_Unicode& rPattern, const sal_Unicode& rNew, bool bRemove);
+ rtl::OUString consolidateContiguosSpace(const rtl::OUString& rCandidate);
+ rtl::OUString whiteSpaceHandlingDefault(const rtl::OUString& rCandidate);
+ rtl::OUString whiteSpaceHandlingPreserve(const rtl::OUString& rCandidate);
+
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTOOLS_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtrefnode.hxx b/svgio/inc/svgio/svgreader/svgtrefnode.hxx
new file mode 100644
index 000000000000..782faa17d089
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtrefnode.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTREFNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTREFNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <svgio/svgreader/svgtextnode.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTrefNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// link to text content. If maXLink
+ /// is set, the node can be fetched on demand
+ rtl::OUString maXLink;
+
+ public:
+ SvgTrefNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgTrefNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// access to referenced SvgTextNode
+ const SvgTextNode* getReferencedSvgTextNode() const;
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTREFNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgtspannode.hxx b/svgio/inc/svgio/svgreader/svgtspannode.hxx
new file mode 100644
index 000000000000..24bf96812fb7
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgtspannode.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_SVGTSPANNODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_SVGTSPANNODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgcharacternode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+#include <svgio/svgreader/svgtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgTspanNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ SvgTextPositions maSvgTextPositions;
+
+ public:
+ SvgTspanNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgTspanNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+
+ /// access to SvgTextPositions
+ const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_SVGTSPANNODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgio/svgreader/svgusenode.hxx b/svgio/inc/svgio/svgreader/svgusenode.hxx
new file mode 100644
index 000000000000..d7613e68092f
--- /dev/null
+++ b/svgio/inc/svgio/svgreader/svgusenode.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVGIO_SVGREADER_USENODE_HXX
+#define INCLUDED_SVGIO_SVGREADER_USENODE_HXX
+
+#include <svgio/svgiodllapi.h>
+#include <svgio/svgreader/svgnode.hxx>
+#include <svgio/svgreader/svgstyleattributes.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace svgio
+{
+ namespace svgreader
+ {
+ class SvgUseNode : public SvgNode
+ {
+ private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ basegfx::B2DHomMatrix* mpaTransform;
+ SvgNumber maX;
+ SvgNumber maY;
+ SvgNumber maWidth;
+ SvgNumber maHeight;
+
+ /// link to content. If maXLink is set, the node can be fetched
+ // on demand
+ rtl::OUString maXLink;
+
+ public:
+ SvgUseNode(
+ SvgDocument& rDocument,
+ SvgNode* pParent);
+ virtual ~SvgUseNode();
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
+ virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
+
+ /// transform content
+ const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; }
+ void setTransform(const basegfx::B2DHomMatrix* pMatrix = 0) { if(mpaTransform) delete mpaTransform; mpaTransform = 0; if(pMatrix) mpaTransform = new basegfx::B2DHomMatrix(*pMatrix); }
+
+ /// x content
+ const SvgNumber& getX() const { return maX; }
+ void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
+
+ /// y content
+ const SvgNumber& getY() const { return maY; }
+ void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
+
+ /// width content
+ const SvgNumber& getWidth() const { return maWidth; }
+ void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
+
+ /// height content
+ const SvgNumber& getHeight() const { return maHeight; }
+ void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
+ };
+ } // end of namespace svgreader
+} // end of namespace svgio
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_SVGIO_SVGREADER_USENODE_HXX
+
+// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */