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 return checkForCssStyle(aClassStr
, maSvgStyleAttributes
);
57 void SvgMarkerNode::parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
)
60 SvgNode::parseAttribute(rTokenName
, aSVGToken
, aContent
);
62 // read style attributes
63 maSvgStyleAttributes
.parseStyleAttribute(rTokenName
, aSVGToken
, aContent
);
70 maSvgStyleAttributes
.readStyle(aContent
);
75 const basegfx::B2DRange
aRange(readViewBox(aContent
, *this));
83 case SVGTokenPreserveAspectRatio
:
85 setSvgAspectRatio(readSvgAspectRatio(aContent
));
92 if(readSingleNumber(aContent
, aNum
))
102 if(readSingleNumber(aContent
, aNum
))
108 case SVGTokenMarkerUnits
:
110 if(aContent
.getLength())
112 static OUString
aStrStrokeWidth(OUString::createFromAscii("strokeWidth"));
114 if(aContent
.match(aStrStrokeWidth
, 0))
116 setMarkerUnits(strokeWidth
);
118 else if(aContent
.match(commonStrings::aStrUserSpaceOnUse
, 0))
120 setMarkerUnits(userSpaceOnUse
);
125 case SVGTokenMarkerWidth
:
129 if(readSingleNumber(aContent
, aNum
))
131 if(aNum
.isPositive())
133 setMarkerWidth(aNum
);
138 case SVGTokenMarkerHeight
:
142 if(readSingleNumber(aContent
, aNum
))
144 if(aNum
.isPositive())
146 setMarkerHeight(aNum
);
153 const sal_Int32
nLen(aContent
.getLength());
157 static OUString
aStrAuto(OUString::createFromAscii("auto"));
159 if(aContent
.match(aStrAuto
, 0))
168 if(readAngle(aContent
, nPos
, fAngle
, nLen
))
183 const drawinglayer::primitive2d::Primitive2DSequence
& SvgMarkerNode::getMarkerPrimitives() const
185 if(!aPrimitives
.hasElements())
187 decomposeSvgNode(const_cast< SvgMarkerNode
* >(this)->aPrimitives
, true);
193 const basegfx::B2DRange
* SvgMarkerNode::getCurrentViewPort() const
201 return SvgNode::getCurrentViewPort();
205 } // end of namespace svgreader
206 } // end of namespace svgio
208 //////////////////////////////////////////////////////////////////////////////
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */