bump product version to 7.2.5.1
[LibreOffice.git] / svgio / inc / svgmarkernode.hxx
blobdc9f13d81f7a4112e195daaa35072d7385565f9f
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 : public SvgNode
30 public:
31 enum class MarkerUnits
33 strokeWidth,
34 userSpaceOnUse
37 private:
38 /// buffered decomposition
39 drawinglayer::primitive2d::Primitive2DContainer aPrimitives;
41 /// use styles
42 SvgStyleAttributes maSvgStyleAttributes;
44 /// variable scan values, dependent of given XAttributeList
45 std::unique_ptr<basegfx::B2DRange>
46 mpViewBox;
47 SvgAspectRatio maSvgAspectRatio;
48 SvgNumber maRefX;
49 SvgNumber maRefY;
50 MarkerUnits maMarkerUnits;
51 SvgNumber maMarkerWidth;
52 SvgNumber maMarkerHeight;
53 double mfAngle;
55 bool mbOrientAuto : 1; // true == on, false == fAngle valid
57 public:
58 SvgMarkerNode(
59 SvgDocument& rDocument,
60 SvgNode* pParent);
61 virtual ~SvgMarkerNode() override;
63 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
64 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
66 /// get marker primitives buffered, uses decomposeSvgNode internally
67 const drawinglayer::primitive2d::Primitive2DContainer& getMarkerPrimitives() const;
69 /// InfoProvider support for % values
70 virtual basegfx::B2DRange getCurrentViewPort() const override;
72 /// viewBox content
73 const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
74 void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
76 /// SvgAspectRatio content
77 const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; }
79 /// RefX content, set if found in current context
80 const SvgNumber& getRefX() const { return maRefX; }
82 /// RefY content, set if found in current context
83 const SvgNumber& getRefY() const { return maRefY; }
85 /// MarkerUnits content
86 MarkerUnits getMarkerUnits() const { return maMarkerUnits; }
87 void setMarkerUnits(const MarkerUnits aMarkerUnits) { maMarkerUnits = aMarkerUnits; }
89 /// MarkerWidth content, set if found in current context
90 const SvgNumber& getMarkerWidth() const { return maMarkerWidth; }
92 /// MarkerHeight content, set if found in current context
93 const SvgNumber& getMarkerHeight() const { return maMarkerHeight; }
95 /// Angle content, set if found in current context
96 double getAngle() const { return mfAngle; }
97 void setAngle(double fAngle) { mfAngle = fAngle; mbOrientAuto = false; }
99 /// OrientAuto content, set if found in current context
100 bool getOrientAuto() const { return mbOrientAuto; }
104 } // end of namespace svgio::svgreader
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */