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 #include <svgmarkernode.hxx>
26 SvgMarkerNode::SvgMarkerNode(
27 SvgDocument
& rDocument
,
29 : SvgNode(SVGTokenMarker
, rDocument
, pParent
),
31 maSvgStyleAttributes(*this),
35 maMarkerUnits(MarkerUnits::strokeWidth
),
43 SvgMarkerNode::~SvgMarkerNode()
47 const SvgStyleAttributes
* SvgMarkerNode::getSvgStyleAttributes() const
49 return checkForCssStyle("marker", maSvgStyleAttributes
);
52 void SvgMarkerNode::parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
)
55 SvgNode::parseAttribute(rTokenName
, aSVGToken
, aContent
);
57 // read style attributes
58 maSvgStyleAttributes
.parseStyleAttribute(aSVGToken
, aContent
, false);
65 readLocalCssStyle(aContent
);
70 const basegfx::B2DRange
aRange(readViewBox(aContent
, *this));
78 case SVGTokenPreserveAspectRatio
:
80 maSvgAspectRatio
= readSvgAspectRatio(aContent
);
87 if(readSingleNumber(aContent
, aNum
))
97 if(readSingleNumber(aContent
, aNum
))
103 case SVGTokenMarkerUnits
:
105 if(!aContent
.isEmpty())
107 if(aContent
.startsWith("strokeWidth"))
109 setMarkerUnits(MarkerUnits::strokeWidth
);
111 else if(aContent
.match(commonStrings::aStrUserSpaceOnUse
))
113 setMarkerUnits(MarkerUnits::userSpaceOnUse
);
118 case SVGTokenMarkerWidth
:
122 if(readSingleNumber(aContent
, aNum
))
124 if(aNum
.isPositive())
126 maMarkerWidth
= aNum
;
131 case SVGTokenMarkerHeight
:
135 if(readSingleNumber(aContent
, aNum
))
137 if(aNum
.isPositive())
139 maMarkerHeight
= aNum
;
146 const sal_Int32
nLen(aContent
.getLength());
150 if(aContent
.startsWith("auto"))
159 if(readAngle(aContent
, nPos
, fAngle
, nLen
))
174 const drawinglayer::primitive2d::Primitive2DContainer
& SvgMarkerNode::getMarkerPrimitives() const
176 if(aPrimitives
.empty() && Display_none
!= getDisplay())
178 decomposeSvgNode(const_cast< SvgMarkerNode
* >(this)->aPrimitives
, true);
184 const basegfx::B2DRange
SvgMarkerNode::getCurrentViewPort() const
188 return *(getViewBox());
192 return SvgNode::getCurrentViewPort();
196 } // end of namespace svgreader
197 } // end of namespace svgio
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */