nss: upgrade to release 3.73
[LibreOffice.git] / svgio / inc / svggradientnode.hxx
blobb5e41e984de258cf0e14f102d6633dbc1e975ce5
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 #ifndef INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
23 #include "svgnode.hxx"
24 #include "svgstyleattributes.hxx"
25 #include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
26 #include <memory>
28 namespace svgio::svgreader
30 class SvgGradientNode : public SvgNode
32 private:
33 /// use styles
34 SvgStyleAttributes maSvgStyleAttributes;
36 /// linear gradient values
37 SvgNumber maX1;
38 SvgNumber maY1;
39 SvgNumber maX2;
40 SvgNumber maY2;
42 /// radial gradient values
43 SvgNumber maCx;
44 SvgNumber maCy;
45 SvgNumber maR;
46 SvgNumber maFx;
47 SvgNumber maFy;
49 /// variable scan values, dependent of given XAttributeList
50 SvgUnits maGradientUnits;
51 drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
52 std::unique_ptr<basegfx::B2DHomMatrix> mpaGradientTransform;
54 /// link to another gradient used as style. If maXLink
55 /// is set, the node can be fetched on demand by using
56 // tryToFindLink (buffered)
57 mutable bool mbResolvingLink; // protect against infinite link recursion
58 OUString maXLink;
59 const SvgGradientNode* mpXLink;
61 /// link on demand
62 void tryToFindLink();
64 public:
65 SvgGradientNode(
66 SVGToken aType,
67 SvgDocument& rDocument,
68 SvgNode* pParent);
69 virtual ~SvgGradientNode() override;
71 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
72 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
74 /// collect gradient stop entries
75 void collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector& aVector) const;
77 /// x1 content
78 SvgNumber getX1() const;
80 /// y1 content
81 SvgNumber getY1() const;
83 /// x2 content
84 SvgNumber getX2() const;
86 /// y2 content
87 SvgNumber getY2() const;
89 /// Cx content
90 SvgNumber getCx() const;
92 /// Cy content
93 SvgNumber getCy() const;
95 /// R content
96 SvgNumber getR() const;
98 /// Fx content
99 const SvgNumber* getFx() const;
101 /// Fy content
102 const SvgNumber* getFy() const;
104 /// gradientUnits content
105 SvgUnits getGradientUnits() const { return maGradientUnits; }
106 void setGradientUnits(const SvgUnits aGradientUnits) { maGradientUnits = aGradientUnits; }
108 /// SpreadMethod content
109 drawinglayer::primitive2d::SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
110 void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod) { maSpreadMethod = aSpreadMethod; }
112 /// transform content, set if found in current context
113 const basegfx::B2DHomMatrix* getGradientTransform() const;
114 void setGradientTransform(const basegfx::B2DHomMatrix* pMatrix);
117 } // end of namespace svgio::svgreader
119 #endif // INCLUDED_SVGIO_INC_SVGGRADIENTNODE_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */