1ddde725dSArmin Le Grand /************************************************************** 2ddde725dSArmin Le Grand * 3ddde725dSArmin Le Grand * Licensed to the Apache Software Foundation (ASF) under one 4ddde725dSArmin Le Grand * or more contributor license agreements. See the NOTICE file 5ddde725dSArmin Le Grand * distributed with this work for additional information 6ddde725dSArmin Le Grand * regarding copyright ownership. The ASF licenses this file 7ddde725dSArmin Le Grand * to you under the Apache License, Version 2.0 (the 8ddde725dSArmin Le Grand * "License"); you may not use this file except in compliance 9ddde725dSArmin Le Grand * with the License. You may obtain a copy of the License at 10ddde725dSArmin Le Grand * 11ddde725dSArmin Le Grand * http://www.apache.org/licenses/LICENSE-2.0 12ddde725dSArmin Le Grand * 13ddde725dSArmin Le Grand * Unless required by applicable law or agreed to in writing, 14ddde725dSArmin Le Grand * software distributed under the License is distributed on an 15ddde725dSArmin Le Grand * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ddde725dSArmin Le Grand * KIND, either express or implied. See the License for the 17ddde725dSArmin Le Grand * specific language governing permissions and limitations 18ddde725dSArmin Le Grand * under the License. 19ddde725dSArmin Le Grand * 20ddde725dSArmin Le Grand *************************************************************/ 21ddde725dSArmin Le Grand 22ddde725dSArmin Le Grand #ifndef INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX 23ddde725dSArmin Le Grand #define INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX 24ddde725dSArmin Le Grand 25ddde725dSArmin Le Grand #include <svgio/svgiodllapi.h> 26ddde725dSArmin Le Grand #include <svgio/svgreader/svgtools.hxx> 27ddde725dSArmin Le Grand #include <svgio/svgreader/svgtoken.hxx> 28ddde725dSArmin Le Grand #include <svgio/svgreader/svgpaint.hxx> 29ddde725dSArmin Le Grand #include <basegfx/matrix/b2dhommatrix.hxx> 30ddde725dSArmin Le Grand #include <com/sun/star/xml/sax/XAttributeList.hpp> 31ddde725dSArmin Le Grand #include <vector> 32ddde725dSArmin Le Grand #include <hash_map> 33ddde725dSArmin Le Grand 34ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 35ddde725dSArmin Le Grand // predefines 36ddde725dSArmin Le Grand namespace svgio 37ddde725dSArmin Le Grand { 38ddde725dSArmin Le Grand namespace svgreader 39ddde725dSArmin Le Grand { 40ddde725dSArmin Le Grand class SvgNode; 41ddde725dSArmin Le Grand class SvgDocument; 42ddde725dSArmin Le Grand class SvgStyleAttributes; 43ddde725dSArmin Le Grand } 44ddde725dSArmin Le Grand } 45ddde725dSArmin Le Grand 46ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 47ddde725dSArmin Le Grand 48ddde725dSArmin Le Grand namespace svgio 49ddde725dSArmin Le Grand { 50ddde725dSArmin Le Grand namespace svgreader 51ddde725dSArmin Le Grand { 52ddde725dSArmin Le Grand typedef ::std::vector< SvgNode* > SvgNodeVector; 53ddde725dSArmin Le Grand 54ddde725dSArmin Le Grand enum XmlSpace 55ddde725dSArmin Le Grand { 56ddde725dSArmin Le Grand XmlSpace_notset, 57ddde725dSArmin Le Grand XmlSpace_default, 58ddde725dSArmin Le Grand XmlSpace_preserve 59ddde725dSArmin Le Grand }; 60ddde725dSArmin Le Grand 61ddde725dSArmin Le Grand class SvgNode : private boost::noncopyable, public InfoProvider 62ddde725dSArmin Le Grand { 63ddde725dSArmin Le Grand private: 64ddde725dSArmin Le Grand /// basic data, Type, document we belong to and parent (if not root) 65ddde725dSArmin Le Grand SVGToken maType; 66ddde725dSArmin Le Grand SvgDocument& mrDocument; 67ddde725dSArmin Le Grand const SvgNode* mpParent; 68ddde725dSArmin Le Grand const SvgNode* mpAlternativeParent; 69ddde725dSArmin Le Grand 70ddde725dSArmin Le Grand /// sub hierarchy 71ddde725dSArmin Le Grand SvgNodeVector maChildren; 72ddde725dSArmin Le Grand 73ddde725dSArmin Le Grand /// Id svan value 74ddde725dSArmin Le Grand rtl::OUString* mpId; 75ddde725dSArmin Le Grand 76ddde725dSArmin Le Grand /// Class svan value 77ddde725dSArmin Le Grand rtl::OUString* mpClass; 78ddde725dSArmin Le Grand 79ddde725dSArmin Le Grand /// XmlSpace value 80ddde725dSArmin Le Grand XmlSpace maXmlSpace; 81ddde725dSArmin Le Grand 82ddde725dSArmin Le Grand public: 83ddde725dSArmin Le Grand SvgNode( 84ddde725dSArmin Le Grand SVGToken aType, 85ddde725dSArmin Le Grand SvgDocument& rDocument, 86ddde725dSArmin Le Grand SvgNode* pParent); 87ddde725dSArmin Le Grand virtual ~SvgNode(); 88ddde725dSArmin Le Grand 89ddde725dSArmin Le Grand void parseAttributes(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs); 90ddde725dSArmin Le Grand virtual const SvgStyleAttributes* getSvgStyleAttributes() const; 91ddde725dSArmin Le Grand virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent); 92ddde725dSArmin Le Grand virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const; 93ddde725dSArmin Le Grand 94ddde725dSArmin Le Grand /// basic data read access 95*e2bf1e9dSArmin Le Grand SVGToken getType() const { return maType; } 96ddde725dSArmin Le Grand const SvgDocument& getDocument() const { return mrDocument; } 97ddde725dSArmin Le Grand const SvgNode* getParent() const { if(mpAlternativeParent) return mpAlternativeParent; return mpParent; } 98ddde725dSArmin Le Grand const SvgNodeVector& getChildren() const { return maChildren; } 99ddde725dSArmin Le Grand 100ddde725dSArmin Le Grand /// InfoProvider support for %, em and ex values 101ddde725dSArmin Le Grand virtual const basegfx::B2DRange* getCurrentViewPort() const; 102ddde725dSArmin Le Grand virtual double getCurrentFontSize() const; 103ddde725dSArmin Le Grand virtual double getCurrentXHeight() const; 104ddde725dSArmin Le Grand 105ddde725dSArmin Le Grand /// Id access 106ddde725dSArmin Le Grand const rtl::OUString* getId() const { return mpId; } 107ddde725dSArmin Le Grand void setId(const rtl::OUString* pfId = 0); 108ddde725dSArmin Le Grand 109ddde725dSArmin Le Grand /// Class access 110ddde725dSArmin Le Grand const rtl::OUString* getClass() const { return mpClass; } 111ddde725dSArmin Le Grand void setClass(const rtl::OUString* pfClass = 0); 112ddde725dSArmin Le Grand 113ddde725dSArmin Le Grand /// XmlSpace access 114ddde725dSArmin Le Grand XmlSpace getXmlSpace() const; 115ddde725dSArmin Le Grand void setXmlSpace(XmlSpace eXmlSpace = XmlSpace_notset) { maXmlSpace = eXmlSpace; } 116ddde725dSArmin Le Grand 117ddde725dSArmin Le Grand /// alternative parent 118ddde725dSArmin Le Grand void setAlternativeParent(const SvgNode* pAlternativeParent = 0) { mpAlternativeParent = pAlternativeParent; } 119ddde725dSArmin Le Grand }; 120ddde725dSArmin Le Grand } // end of namespace svgreader 121ddde725dSArmin Le Grand } // end of namespace svgio 122ddde725dSArmin Le Grand 123ddde725dSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 124ddde725dSArmin Le Grand 125ddde725dSArmin Le Grand #endif //INCLUDED_SVGIO_SVGREADER_SVGNODE_HXX 126ddde725dSArmin Le Grand 127ddde725dSArmin Le Grand // eof 128