LibreOffice Module svgio (master) 1
svggradientnode.hxx
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
20#pragma once
21
22#include "svgnode.hxx"
24#include "svgtools.hxx"
26
27namespace svgio::svgreader
28 {
29 class SvgGradientNode final : public SvgNode
30 {
31 private:
34
40
47
51 std::optional<basegfx::B2DHomMatrix> mpaGradientTransform;
52
55 // tryToFindLink (buffered)
56 mutable bool mbResolvingLink; // protect against infinite link recursion
57 OUString maXLink;
59
61 void tryToFindLink();
62
63 public:
65 SVGToken aType,
66 SvgDocument& rDocument,
67 SvgNode* pParent);
68 virtual ~SvgGradientNode() override;
69
70 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
71 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
72
75
77 SvgNumber getX1() const;
78
80 SvgNumber getY1() const;
81
83 SvgNumber getX2() const;
84
86 SvgNumber getY2() const;
87
89 SvgNumber getCx() const;
90
92 SvgNumber getCy() const;
93
95 SvgNumber getR() const;
96
98 const SvgNumber* getFx() const;
99
101 const SvgNumber* getFy() const;
102
105 void setGradientUnits(const SvgUnits aGradientUnits) { maGradientUnits = aGradientUnits; }
106
109 void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod) { maSpreadMethod = aSpreadMethod; }
110
112 std::optional<basegfx::B2DHomMatrix> getGradientTransform() const;
113 void setGradientTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaGradientTransform = pMatrix; }
114 };
115
116} // end of namespace svgio::svgreader
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvgNumber getY2() const
y2 content
SvgNumber getX1() const
x1 content
SvgUnits getGradientUnits() const
gradientUnits content
SvgNumber maCx
radial gradient values
void setGradientTransform(const std::optional< basegfx::B2DHomMatrix > &pMatrix)
const SvgGradientNode * mpXLink
SvgGradientNode(SVGToken aType, SvgDocument &rDocument, SvgNode *pParent)
SvgNumber getCy() const
Cy content.
bool mbResolvingLink
link to another gradient used as style.
void collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector &aVector) const
collect gradient stop entries
const SvgNumber * getFy() const
Fy content.
std::optional< basegfx::B2DHomMatrix > mpaGradientTransform
SvgNumber getCx() const
Cx content.
SvgStyleAttributes maSvgStyleAttributes
use styles
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
SvgNumber getX2() const
x2 content
drawinglayer::primitive2d::SpreadMethod getSpreadMethod() const
SpreadMethod content.
SvgNumber getY1() const
y1 content
virtual const SvgStyleAttributes * getSvgStyleAttributes() const override
std::optional< basegfx::B2DHomMatrix > getGradientTransform() const
transform content, set if found in current context
const SvgNumber * getFx() const
Fx content.
void setGradientUnits(const SvgUnits aGradientUnits)
SvgUnits maGradientUnits
variable scan values, dependent of given XAttributeList
SvgNumber maX1
linear gradient values
drawinglayer::primitive2d::SpreadMethod maSpreadMethod
SvgNumber getR() const
R content.
void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod)
::std::vector< SvgGradientEntry > SvgGradientEntryVector