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_INC_SVGIO_SVGREADER_SVGMARKERNODE_HXX
21 : #define INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGMARKERNODE_HXX
22 :
23 : #include <svgio/svgreader/svgnode.hxx>
24 : #include <svgio/svgreader/svgstyleattributes.hxx>
25 :
26 : namespace svgio
27 : {
28 : namespace svgreader
29 : {
30 : class SvgMarkerNode : public SvgNode
31 : {
32 : public:
33 : enum MarkerUnits
34 : {
35 : strokeWidth,
36 : userSpaceOnUse
37 : };
38 :
39 : private:
40 : /// buffered decomposition
41 : drawinglayer::primitive2d::Primitive2DSequence aPrimitives;
42 :
43 : /// use styles
44 : SvgStyleAttributes maSvgStyleAttributes;
45 :
46 : /// variable scan values, dependent of given XAttributeList
47 : basegfx::B2DRange* mpViewBox;
48 : SvgAspectRatio maSvgAspectRatio;
49 : SvgNumber maRefX;
50 : SvgNumber maRefY;
51 : MarkerUnits maMarkerUnits;
52 : SvgNumber maMarkerWidth;
53 : SvgNumber maMarkerHeight;
54 : double mfAngle;
55 :
56 : /// bitfield
57 : bool mbOrientAuto : 1; // true == on, false == fAngle valid
58 :
59 : public:
60 : SvgMarkerNode(
61 : SvgDocument& rDocument,
62 : SvgNode* pParent);
63 : virtual ~SvgMarkerNode();
64 :
65 : virtual const SvgStyleAttributes* getSvgStyleAttributes() const SAL_OVERRIDE;
66 : virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) SAL_OVERRIDE;
67 :
68 : /// get marker primitives buffered, uses decomposeSvgNode internally
69 : const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const;
70 :
71 : /// InfoProvider support for % values
72 : virtual const basegfx::B2DRange getCurrentViewPort() const SAL_OVERRIDE;
73 :
74 : /// viewBox content
75 0 : const basegfx::B2DRange* getViewBox() const { return mpViewBox; }
76 0 : void setViewBox(const basegfx::B2DRange* pViewBox = 0) { if(mpViewBox) delete mpViewBox; mpViewBox = 0; if(pViewBox) mpViewBox = new basegfx::B2DRange(*pViewBox); }
77 :
78 : /// SvgAspectRatio content
79 0 : const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
80 0 : void setSvgAspectRatio(const SvgAspectRatio& rSvgAspectRatio = SvgAspectRatio()) { maSvgAspectRatio = rSvgAspectRatio; }
81 :
82 : /// RefX content, set if found in current context
83 0 : const SvgNumber& getRefX() const { return maRefX; }
84 0 : void setRefX(const SvgNumber& rRefX = SvgNumber()) { maRefX = rRefX; }
85 :
86 : /// RefY content, set if found in current context
87 0 : const SvgNumber& getRefY() const { return maRefY; }
88 0 : void setRefY(const SvgNumber& rRefY = SvgNumber()) { maRefY = rRefY; }
89 :
90 : /// MarkerUnits content
91 0 : MarkerUnits getMarkerUnits() const { return maMarkerUnits; }
92 0 : void setMarkerUnits(const MarkerUnits aMarkerUnits) { maMarkerUnits = aMarkerUnits; }
93 :
94 : /// MarkerWidth content, set if found in current context
95 0 : const SvgNumber& getMarkerWidth() const { return maMarkerWidth; }
96 0 : void setMarkerWidth(const SvgNumber& rMarkerWidth = SvgNumber()) { maMarkerWidth = rMarkerWidth; }
97 :
98 : /// MarkerHeight content, set if found in current context
99 0 : const SvgNumber& getMarkerHeight() const { return maMarkerHeight; }
100 0 : void setMarkerHeight(const SvgNumber& rMarkerHeight = SvgNumber()) { maMarkerHeight = rMarkerHeight; }
101 :
102 : /// Angle content, set if found in current context
103 0 : double getAngle() const { return mfAngle; }
104 0 : void setAngle(double fAngle = 0.0) { mfAngle = fAngle; mbOrientAuto = false; }
105 :
106 : /// OrientAuto content, set if found in current context
107 0 : bool getOrientAuto() const { return mbOrientAuto; }
108 0 : void setOrientAuto(bool bOrientAuto = true) { mbOrientAuto = bOrientAuto; }
109 :
110 : };
111 : } // end of namespace svgreader
112 : } // end of namespace svgio
113 :
114 : #endif // INCLUDED_SVGIO_INC_SVGIO_SVGREADER_SVGMARKERNODE_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|