LibreOffice Module svgio (master) 1
svgfeoffsetnode.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include <svgfeoffsetnode.hxx>
22#include <o3tl/string_view.hxx>
23
24namespace svgio::svgreader
25{
27 : SvgFilterNode(SVGToken::FeOffset, rDocument, pParent)
28 , maDx(SvgNumber(0.0))
29 , maDy(SvgNumber(0.0))
30{
31}
32
34
35void SvgFeOffsetNode::parseAttribute(const OUString& /*rTokenName*/, SVGToken aSVGToken,
36 const OUString& aContent)
37{
38 // parse own
39 switch (aSVGToken)
40 {
41 case SVGToken::Dx:
42 {
43 SvgNumber aNum;
44
45 if (readSingleNumber(aContent, aNum))
46 {
47 if (aNum.isPositive())
48 {
49 maDx = aNum;
50 }
51 }
52 break;
53 }
54 case SVGToken::Dy:
55 {
56 SvgNumber aNum;
57
58 if (readSingleNumber(aContent, aNum))
59 {
60 if (aNum.isPositive())
61 {
62 maDy = aNum;
63 }
64 }
65 break;
66 }
67 default:
68 {
69 break;
70 }
71 }
72}
73
75{
76 basegfx::B2DHomMatrix aTransform;
77
78 if (maDx.isSet() || maDy.isSet())
79 {
82 }
83
86
88}
89
90} // end of namespace svgio::svgreader
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void translate(double fX, double fY)
void apply(drawinglayer::primitive2d::Primitive2DContainer &rTarget) const override
SvgFeOffsetNode(SvgDocument &rDocument, SvgNode *pParent)
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
double solve(const InfoProvider &rInfoProvider, NumberType aNumberType=NumberType::length) const
Definition: SvgNumber.cxx:69
FilterGroup & rTarget
bool readSingleNumber(std::u16string_view rCandidate, SvgNumber &aNum)
Definition: svgtools.cxx:1076