calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / svgio / inc / svggradientnode.hxx
blob605ac6f4e46c44f6d6d38c92378c84b01d14c76f
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 #pragma once
22 #include "svgnode.hxx"
23 #include "svgstyleattributes.hxx"
24 #include "svgtools.hxx"
25 #include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
27 namespace svgio::svgreader
29 class SvgGradientNode final : public SvgNode
31 private:
32 /// use styles
33 SvgStyleAttributes maSvgStyleAttributes;
35 /// linear gradient values
36 SvgNumber maX1;
37 SvgNumber maY1;
38 SvgNumber maX2;
39 SvgNumber maY2;
41 /// radial gradient values
42 SvgNumber maCx;
43 SvgNumber maCy;
44 SvgNumber maR;
45 SvgNumber maFx;
46 SvgNumber maFy;
48 /// variable scan values, dependent of given XAttributeList
49 SvgUnits maGradientUnits;
50 drawinglayer::primitive2d::SpreadMethod maSpreadMethod;
51 std::optional<basegfx::B2DHomMatrix> mpaGradientTransform;
53 /// link to another gradient used as style. If maXLink
54 /// is set, the node can be fetched on demand by using
55 // tryToFindLink (buffered)
56 mutable bool mbResolvingLink; // protect against infinite link recursion
57 OUString maXLink;
58 const SvgGradientNode* mpXLink;
60 /// link on demand
61 void tryToFindLink();
63 public:
64 SvgGradientNode(
65 SVGToken aType,
66 SvgDocument& rDocument,
67 SvgNode* pParent);
68 virtual ~SvgGradientNode() override;
70 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
71 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
73 /// collect gradient stop entries
74 void collectGradientEntries(drawinglayer::primitive2d::SvgGradientEntryVector& aVector) const;
76 /// x1 content
77 SvgNumber getX1() const;
79 /// y1 content
80 SvgNumber getY1() const;
82 /// x2 content
83 SvgNumber getX2() const;
85 /// y2 content
86 SvgNumber getY2() const;
88 /// Cx content
89 SvgNumber getCx() const;
91 /// Cy content
92 SvgNumber getCy() const;
94 /// R content
95 SvgNumber getR() const;
97 /// Fx content
98 const SvgNumber* getFx() const;
100 /// Fy content
101 const SvgNumber* getFy() const;
103 /// gradientUnits content
104 SvgUnits getGradientUnits() const { return maGradientUnits; }
105 void setGradientUnits(const SvgUnits aGradientUnits) { maGradientUnits = aGradientUnits; }
107 /// SpreadMethod content
108 drawinglayer::primitive2d::SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
109 void setSpreadMethod(const drawinglayer::primitive2d::SpreadMethod aSpreadMethod) { maSpreadMethod = aSpreadMethod; }
111 /// transform content, set if found in current context
112 std::optional<basegfx::B2DHomMatrix> getGradientTransform() const;
113 void setGradientTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaGradientTransform = pMatrix; }
116 } // end of namespace svgio::svgreader
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */