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"
31 class SvgMarkerNode
: public SvgNode
34 enum class MarkerUnits
41 /// buffered decomposition
42 drawinglayer::primitive2d::Primitive2DContainer aPrimitives
;
45 SvgStyleAttributes maSvgStyleAttributes
;
47 /// variable scan values, dependent of given XAttributeList
48 std::unique_ptr
<basegfx::B2DRange
>
50 SvgAspectRatio maSvgAspectRatio
;
53 MarkerUnits maMarkerUnits
;
54 SvgNumber maMarkerWidth
;
55 SvgNumber maMarkerHeight
;
58 bool mbOrientAuto
: 1; // true == on, false == fAngle valid
62 SvgDocument
& rDocument
,
64 virtual ~SvgMarkerNode() override
;
66 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
67 virtual void parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
) override
;
69 /// get marker primitives buffered, uses decomposeSvgNode internally
70 const drawinglayer::primitive2d::Primitive2DContainer
& getMarkerPrimitives() const;
72 /// InfoProvider support for % values
73 virtual const basegfx::B2DRange
getCurrentViewPort() const override
;
76 const basegfx::B2DRange
* getViewBox() const { return mpViewBox
.get(); }
77 void setViewBox(const basegfx::B2DRange
* pViewBox
) { mpViewBox
.reset(); if(pViewBox
) mpViewBox
.reset( new basegfx::B2DRange(*pViewBox
) ); }
79 /// SvgAspectRatio content
80 const SvgAspectRatio
& getSvgAspectRatio() const { return maSvgAspectRatio
; }
82 /// RefX content, set if found in current context
83 const SvgNumber
& getRefX() const { return maRefX
; }
85 /// RefY content, set if found in current context
86 const SvgNumber
& getRefY() const { return maRefY
; }
88 /// MarkerUnits content
89 MarkerUnits
getMarkerUnits() const { return maMarkerUnits
; }
90 void setMarkerUnits(const MarkerUnits aMarkerUnits
) { maMarkerUnits
= aMarkerUnits
; }
92 /// MarkerWidth content, set if found in current context
93 const SvgNumber
& getMarkerWidth() const { return maMarkerWidth
; }
95 /// MarkerHeight content, set if found in current context
96 const SvgNumber
& getMarkerHeight() const { return maMarkerHeight
; }
98 /// Angle content, set if found in current context
99 double getAngle() const { return mfAngle
; }
100 void setAngle(double fAngle
) { mfAngle
= fAngle
; mbOrientAuto
= false; }
102 /// OrientAuto content, set if found in current context
103 bool getOrientAuto() const { return mbOrientAuto
; }
106 } // end of namespace svgreader
107 } // end of namespace svgio
109 #endif // INCLUDED_SVGIO_INC_SVGMARKERNODE_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */