Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
21 : #define INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
22 :
23 : #include <svgio/svgreader/svgnode.hxx>
24 : #include <svgio/svgreader/svgstyleattributes.hxx>
25 :
26 : //////////////////////////////////////////////////////////////////////////////
27 :
28 : namespace svgio
29 : {
30 : namespace svgreader
31 : {
32 : class SvgMarkerNode : public SvgNode
33 : {
34 : public:
35 : enum MarkerUnits
36 : {
37 : strokeWidth,
38 : userSpaceOnUse
39 : };
40 :
41 : private:
42 : /// buffered decomposition
43 : drawinglayer::primitive2d::Primitive2DSequence aPrimitives;
44 :
45 : /// use styles
46 : SvgStyleAttributes maSvgStyleAttributes;
47 :
48 : /// variable scan values, dependent of given XAttributeList
49 : basegfx::B2DRange* mpViewBox;
50 : SvgAspectRatio maSvgAspectRatio;
51 : SvgNumber maRefX;
52 : SvgNumber maRefY;
53 : MarkerUnits maMarkerUnits;
54 : SvgNumber maMarkerWidth;
55 : SvgNumber maMarkerHeight;
56 : double mfAngle;
57 :
58 : /// bitfield
59 : bool mbOrientAuto : 1; // true == on, false == fAngle valid
60 :
61 : public:
62 : SvgMarkerNode(
63 : SvgDocument& rDocument,
64 : SvgNode* pParent);
65 : virtual ~SvgMarkerNode();
66 :
67 : virtual const SvgStyleAttributes* getSvgStyleAttributes() const;
68 : virtual void parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent);
69 :
70 : /// get marker primitives buffered, uses decomposeSvgNode internally
71 : const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const;
72 :
73 : /// InfoProvider support for % values
74 : virtual const basegfx::B2DRange* getCurrentViewPort() const;
75 :
76 : /// viewBox content
77 0 : const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
78 0 : void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
79 :
80 : /// SvgAspectRatio content
81 0 : const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
82 0 : void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
83 :
84 : /// RefX content, set if found in current context
85 0 : const SvgNumber& getRefX() const { return maRefX; }
86 0 : void setRefX(const SvgNumber& rRefX = SvgNumber()) { maRefX = rRefX; }
87 :
88 : /// RefY content, set if found in current context
89 0 : const SvgNumber& getRefY() const { return maRefY; }
90 0 : void setRefY(const SvgNumber& rRefY = SvgNumber()) { maRefY = rRefY; }
91 :
92 : /// MarkerUnits content
93 0 : MarkerUnits getMarkerUnits() const { return maMarkerUnits; }
94 0 : void setMarkerUnits(const MarkerUnits aMarkerUnits) { maMarkerUnits = aMarkerUnits; }
95 :
96 : /// MarkerWidth content, set if found in current context
97 0 : const SvgNumber& getMarkerWidth() const { return maMarkerWidth; }
98 0 : void setMarkerWidth(const SvgNumber& rMarkerWidth = SvgNumber()) { maMarkerWidth = rMarkerWidth; }
99 :
100 : /// MarkerHeight content, set if found in current context
101 0 : const SvgNumber& getMarkerHeight() const { return maMarkerHeight; }
102 0 : void setMarkerHeight(const SvgNumber& rMarkerHeight = SvgNumber()) { maMarkerHeight = rMarkerHeight; }
103 :
104 : /// Angle content, set if found in current context
105 0 : double getAngle() const { return mfAngle; }
106 0 : void setAngle(double fAngle = 0.0) { mfAngle = fAngle; mbOrientAuto = false; }
107 :
108 : /// OrientAuto content, set if found in current context
109 0 : bool getOrientAuto() const { return mbOrientAuto; }
110 0 : void setOrientAuto(bool bOrientAuto = true) { mbOrientAuto = bOrientAuto; }
111 :
112 : };
113 : } // end of namespace svgreader
114 : } // end of namespace svgio
115 :
116 : //////////////////////////////////////////////////////////////////////////////
117 :
118 : #endif //INCLUDED_SVGIO_SVGREADER_SVGMARKERNODE_HXX
119 :
120 : // eof
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|