xref: /trunk/main/svgio/inc/svgio/svgreader/svgsvgnode.hxx (revision 67a4c099c6673ea241c6dfd8f5db5f99b4ca16de)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
23 #define INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
24 
25 #include <svgio/svgiodllapi.h>
26 #include <svgio/svgreader/svgstyleattributes.hxx>
27 
28 //////////////////////////////////////////////////////////////////////////////
29 
30 namespace svgio
31 {
32     namespace svgreader
33     {
34         class SvgSvgNode : public SvgNode
35         {
36         private:
37             /// use styles
38             SvgStyleAttributes      maSvgStyleAttributes;
39 
40             /// variable scan values, dependent of given XAttributeList
41             basegfx::B2DRange*      mpViewBox;
42             SvgAspectRatio          maSvgAspectRatio;
43             SvgNumber               maX;
44             SvgNumber               maY;
45             SvgNumber               maWidth;
46             SvgNumber               maHeight;
47             SvgNumber               maVersion;
48 
49         public:
50             SvgSvgNode(
51                 SvgDocument& rDocument,
52                 SvgNode* pParent);
53             virtual ~SvgSvgNode();
54 
55             virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
56             virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
57             virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const;
58 
59             /// InfoProvider support for % values
60             virtual const basegfx::B2DRange* getCurrentViewPort() const;
61 
62             /// viewBox content
63             const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
64             void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
65 
66             /// SvgAspectRatio content
67             const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
68             void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
69 
70             /// x content
71             const SvgNumber& getX() const { return maX; }
72             void setX(const SvgNumber& rX = SvgNumber()) { maX = rX; }
73 
74             /// y content
75             const SvgNumber& getY() const { return maY; }
76             void setY(const SvgNumber& rY = SvgNumber()) { maY = rY; }
77 
78             /// width content
79             const SvgNumber& getWidth() const { return maWidth; }
80             void setWidth(const SvgNumber& rWidth = SvgNumber()) { maWidth = rWidth; }
81 
82             /// height content
83             const SvgNumber& getHeight() const { return maHeight; }
84             void setHeight(const SvgNumber& rHeight = SvgNumber()) { maHeight = rHeight; }
85 
86             /// version content
87             const SvgNumber& getVersion() const { return maVersion; }
88             void setVersion(const SvgNumber& rVersion = SvgNumber()) { maVersion = rVersion; }
89         };
90     } // end of namespace svgreader
91 } // end of namespace svgio
92 
93 //////////////////////////////////////////////////////////////////////////////
94 
95 #endif //INCLUDED_SVGIO_SVGREADER_SVGSVGNODE_HXX
96 
97 // eof
98