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 <svgio/svgreader/svgmarkernode.hxx>
22 //////////////////////////////////////////////////////////////////////////////
28 SvgMarkerNode::SvgMarkerNode(
29 SvgDocument
& rDocument
,
31 : SvgNode(SVGTokenMarker
, rDocument
, pParent
),
33 maSvgStyleAttributes(*this),
38 maMarkerUnits(strokeWidth
),
46 SvgMarkerNode::~SvgMarkerNode()
48 if(mpViewBox
) delete mpViewBox
;
51 const SvgStyleAttributes
* SvgMarkerNode::getSvgStyleAttributes() const
53 static rtl::OUString
aClassStr(rtl::OUString::createFromAscii("marker"));
54 maSvgStyleAttributes
.checkForCssStyle(aClassStr
);
56 return &maSvgStyleAttributes
;
59 void SvgMarkerNode::parseAttribute(const rtl::OUString
& rTokenName
, SVGToken aSVGToken
, const rtl::OUString
& aContent
)
62 SvgNode::parseAttribute(rTokenName
, aSVGToken
, aContent
);
64 // read style attributes
65 maSvgStyleAttributes
.parseStyleAttribute(rTokenName
, aSVGToken
, aContent
);
72 maSvgStyleAttributes
.readStyle(aContent
);
77 const basegfx::B2DRange
aRange(readViewBox(aContent
, *this));
85 case SVGTokenPreserveAspectRatio
:
87 setSvgAspectRatio(readSvgAspectRatio(aContent
));
94 if(readSingleNumber(aContent
, aNum
))
104 if(readSingleNumber(aContent
, aNum
))
110 case SVGTokenMarkerUnits
:
112 if(aContent
.getLength())
114 static rtl::OUString
aStrStrokeWidth(rtl::OUString::createFromAscii("strokeWidth"));
116 if(aContent
.match(aStrStrokeWidth
, 0))
118 setMarkerUnits(strokeWidth
);
120 else if(aContent
.match(commonStrings::aStrUserSpaceOnUse
, 0))
122 setMarkerUnits(userSpaceOnUse
);
127 case SVGTokenMarkerWidth
:
131 if(readSingleNumber(aContent
, aNum
))
133 if(aNum
.isPositive())
135 setMarkerWidth(aNum
);
140 case SVGTokenMarkerHeight
:
144 if(readSingleNumber(aContent
, aNum
))
146 if(aNum
.isPositive())
148 setMarkerHeight(aNum
);
155 const sal_Int32
nLen(aContent
.getLength());
159 static rtl::OUString
aStrAuto(rtl::OUString::createFromAscii("auto"));
161 if(aContent
.match(aStrAuto
, 0))
170 if(readAngle(aContent
, nPos
, fAngle
, nLen
))
185 const drawinglayer::primitive2d::Primitive2DSequence
& SvgMarkerNode::getMarkerPrimitives() const
187 if(!aPrimitives
.hasElements())
189 decomposeSvgNode(const_cast< SvgMarkerNode
* >(this)->aPrimitives
, true);
195 const basegfx::B2DRange
* SvgMarkerNode::getCurrentViewPort() const
203 return SvgNode::getCurrentViewPort();
207 } // end of namespace svgreader
208 } // end of namespace svgio
210 //////////////////////////////////////////////////////////////////////////////
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */