Teach symstore more duplicated DLLs
[LibreOffice.git] / svgio / source / svgreader / svgpolynode.cxx
blobadb37e69b7a2b22a18a03d34101a8975bb98ef23
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <svgpolynode.hxx>
21 #include <basegfx/polygon/b2dpolygon.hxx>
22 #include <basegfx/polygon/b2dpolypolygontools.hxx>
23 #include <basegfx/polygon/b2dpolygontools.hxx>
25 namespace svgio
27 namespace svgreader
29 SvgPolyNode::SvgPolyNode(
30 SvgDocument& rDocument,
31 SvgNode* pParent,
32 bool bIsPolyline)
33 : SvgNode(SVGTokenPolygon, rDocument, pParent),
34 maSvgStyleAttributes(*this),
35 mbIsPolyline(bIsPolyline)
39 SvgPolyNode::~SvgPolyNode()
43 const SvgStyleAttributes* SvgPolyNode::getSvgStyleAttributes() const
45 return checkForCssStyle(mbIsPolyline? OUString("polyline") : OUString("polygon"), maSvgStyleAttributes);
48 void SvgPolyNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
50 // call parent
51 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
53 // read style attributes
54 maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent, false);
56 // parse own
57 switch(aSVGToken)
59 case SVGTokenStyle:
61 readLocalCssStyle(aContent);
62 break;
64 case SVGTokenPoints:
66 basegfx::B2DPolygon aPath;
68 if(basegfx::utils::importFromSvgPoints(aPath, aContent))
70 if(aPath.count())
72 if(!mbIsPolyline)
74 aPath.setClosed(true);
77 setPolygon(&aPath);
80 break;
82 case SVGTokenTransform:
84 const basegfx::B2DHomMatrix aMatrix(readTransform(aContent, *this));
86 if(!aMatrix.isIdentity())
88 setTransform(&aMatrix);
90 break;
92 default:
94 break;
99 void SvgPolyNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const
101 const SvgStyleAttributes* pStyle = getSvgStyleAttributes();
103 if(pStyle && mpPolygon)
105 drawinglayer::primitive2d::Primitive2DContainer aNewTarget;
107 pStyle->add_path(basegfx::B2DPolyPolygon(*mpPolygon), aNewTarget, nullptr);
109 if(!aNewTarget.empty())
111 pStyle->add_postProcess(rTarget, aNewTarget, getTransform());
115 } // end of namespace svgreader
116 } // end of namespace svgio
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */