1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SVGIO_INC_SVGMARKERNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGMARKERNODE_HXX
23 #include "svgnode.hxx"
24 #include "svgstyleattributes.hxx"
27 namespace svgio::svgreader
29 class SvgMarkerNode
: public SvgNode
32 enum class MarkerUnits
39 /// buffered decomposition
40 drawinglayer::primitive2d::Primitive2DContainer aPrimitives
;
43 SvgStyleAttributes maSvgStyleAttributes
;
45 /// variable scan values, dependent of given XAttributeList
46 std::unique_ptr
<basegfx::B2DRange
>
48 SvgAspectRatio maSvgAspectRatio
;
51 MarkerUnits maMarkerUnits
;
52 SvgNumber maMarkerWidth
;
53 SvgNumber maMarkerHeight
;
56 bool mbOrientAuto
: 1; // true == on, false == fAngle valid
60 SvgDocument
& rDocument
,
62 virtual ~SvgMarkerNode() override
;
64 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
65 virtual void parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
) override
;
67 /// get marker primitives buffered, uses decomposeSvgNode internally
68 const drawinglayer::primitive2d::Primitive2DContainer
& getMarkerPrimitives() const;
70 /// InfoProvider support for % values
71 virtual basegfx::B2DRange
getCurrentViewPort() const override
;
74 const basegfx::B2DRange
* getViewBox() const { return mpViewBox
.get(); }
75 void setViewBox(const basegfx::B2DRange
* pViewBox
) { mpViewBox
.reset(); if(pViewBox
) mpViewBox
.reset( new basegfx::B2DRange(*pViewBox
) ); }
77 /// SvgAspectRatio content
78 const SvgAspectRatio
& getSvgAspectRatio() const { return maSvgAspectRatio
; }
80 /// RefX content, set if found in current context
81 const SvgNumber
& getRefX() const { return maRefX
; }
83 /// RefY content, set if found in current context
84 const SvgNumber
& getRefY() const { return maRefY
; }
86 /// MarkerUnits content
87 MarkerUnits
getMarkerUnits() const { return maMarkerUnits
; }
88 void setMarkerUnits(const MarkerUnits aMarkerUnits
) { maMarkerUnits
= aMarkerUnits
; }
90 /// MarkerWidth content, set if found in current context
91 const SvgNumber
& getMarkerWidth() const { return maMarkerWidth
; }
93 /// MarkerHeight content, set if found in current context
94 const SvgNumber
& getMarkerHeight() const { return maMarkerHeight
; }
96 /// Angle content, set if found in current context
97 double getAngle() const { return mfAngle
; }
98 void setAngle(double fAngle
) { mfAngle
= fAngle
; mbOrientAuto
= false; }
100 /// OrientAuto content, set if found in current context
101 bool getOrientAuto() const { return mbOrientAuto
; }
105 } // end of namespace svgio::svgreader
107 #endif // INCLUDED_SVGIO_INC_SVGMARKERNODE_HXX
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */