Update git submodules
[LibreOffice.git] / svgio / inc / svgmarkernode.hxx
blobb8fa7c000e684bab8457596e48d9ef4f0e2852e4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include "svgnode.hxx"
23 #include "svgstyleattributes.hxx"
24 #include <memory>
26 namespace svgio::svgreader
28 class SvgMarkerNode final : public SvgNode
30 public:
31 enum class MarkerUnits
33 strokeWidth,
34 userSpaceOnUse
37 enum class MarkerOrient
39 notset,
40 auto_start,
41 auto_start_reverse
44 private:
45 /// buffered decomposition
46 drawinglayer::primitive2d::Primitive2DContainer aPrimitives;
48 /// use styles
49 SvgStyleAttributes maSvgStyleAttributes;
51 /// variable scan values, dependent of given XAttributeList
52 std::unique_ptr<basegfx::B2DRange>
53 mpViewBox;
54 SvgAspectRatio maSvgAspectRatio;
55 SvgNumber maRefX;
56 SvgNumber maRefY;
57 MarkerUnits maMarkerUnits;
58 SvgNumber maMarkerWidth;
59 SvgNumber maMarkerHeight;
60 double mfAngle;
61 MarkerOrient maMarkerOrient;
63 public:
64 SvgMarkerNode(
65 SvgDocument& rDocument,
66 SvgNode* pParent);
67 virtual ~SvgMarkerNode() override;
69 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
70 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) override;
72 /// get marker primitives buffered, uses decomposeSvgNode internally
73 const drawinglayer::primitive2d::Primitive2DContainer& getMarkerPrimitives() const;
75 /// InfoProvider support for % values
76 virtual basegfx::B2DRange getCurrentViewPort() const override;
78 /// viewBox content
79 const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
80 void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
82 /// SvgAspectRatio content
83 const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
85 /// RefX content, set if found in current context
86 const SvgNumber& getRefX() const { return maRefX; }
88 /// RefY content, set if found in current context
89 const SvgNumber& getRefY() const { return maRefY; }
91 /// MarkerUnits content
92 MarkerUnits getMarkerUnits() const { return maMarkerUnits; }
93 void setMarkerUnits(const MarkerUnits aMarkerUnits) { maMarkerUnits = aMarkerUnits; }
95 /// MarkerWidth content, set if found in current context
96 const SvgNumber& getMarkerWidth() const { return maMarkerWidth; }
98 /// MarkerHeight content, set if found in current context
99 const SvgNumber& getMarkerHeight() const { return maMarkerHeight; }
101 /// Angle content, set if found in current context
102 double getAngle() const { return mfAngle; }
103 void setAngle(double fAngle) { mfAngle = fAngle;}
105 /// MarkerOrient content
106 MarkerOrient getMarkerOrient() const { return maMarkerOrient; }
107 void setMarkerOrient(const MarkerOrient aMarkerOrient) { maMarkerOrient = aMarkerOrient; }
111 } // end of namespace svgio::svgreader
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */