1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SVGPATTERNNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGPATTERNNODE_HXX
23 #include "svgnode.hxx"
24 #include "svgstyleattributes.hxx"
31 class SvgPatternNode
: public SvgNode
34 /// buffered decomposition
35 drawinglayer::primitive2d::Primitive2DContainer aPrimitives
;
38 SvgStyleAttributes maSvgStyleAttributes
;
40 /// variable scan values, dependent of given XAttributeList
41 std::unique_ptr
<basegfx::B2DRange
>
43 SvgAspectRatio maSvgAspectRatio
;
48 std::unique_ptr
<SvgUnits
>
50 std::unique_ptr
<SvgUnits
>
51 mpPatternContentUnits
;
52 std::unique_ptr
<basegfx::B2DHomMatrix
>
55 /// link to another pattern used as style. If maXLink
56 /// is set, the node can be fetched on demand by using
57 // tryToFindLink (buffered)
58 mutable bool mbResolvingLink
; // protect against infinite link recursion
60 const SvgPatternNode
* mpXLink
;
67 SvgDocument
& rDocument
,
69 virtual ~SvgPatternNode() override
;
71 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
72 virtual void parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
) override
;
75 void getValuesRelative(double& rfX
, double& rfY
, double& rfW
, double& rfH
, const basegfx::B2DRange
& rGeoRange
, SvgNode
const & rUser
) const;
77 /// get pattern primitives buffered, uses decomposeSvgNode internally
78 const drawinglayer::primitive2d::Primitive2DContainer
& getPatternPrimitives() const;
80 /// InfoProvider support for % values
81 virtual const basegfx::B2DRange
getCurrentViewPort() const override
;
84 const basegfx::B2DRange
* getViewBox() const;
85 void setViewBox(const basegfx::B2DRange
* pViewBox
) { mpViewBox
.reset(); if(pViewBox
) mpViewBox
.reset(new basegfx::B2DRange(*pViewBox
)); }
87 /// SvgAspectRatio content
88 const SvgAspectRatio
& getSvgAspectRatio() const;
90 /// X content, set if found in current context
91 const SvgNumber
& getX() const;
93 /// Y content, set if found in current context
94 const SvgNumber
& getY() const;
96 /// Width content, set if found in current context
97 const SvgNumber
& getWidth() const;
99 /// Height content, set if found in current context
100 const SvgNumber
& getHeight() const;
102 /// PatternUnits content
103 const SvgUnits
* getPatternUnits() const;
104 void setPatternUnits(const SvgUnits aPatternUnits
) { mpPatternUnits
.reset( new SvgUnits(aPatternUnits
) ); }
106 /// PatternContentUnits content
107 const SvgUnits
* getPatternContentUnits() const;
108 void setPatternContentUnits(const SvgUnits aPatternContentUnits
) { mpPatternContentUnits
.reset( new SvgUnits(aPatternContentUnits
) ); }
110 /// PatternTransform content
111 const basegfx::B2DHomMatrix
* getPatternTransform() const;
112 void setPatternTransform(const basegfx::B2DHomMatrix
* pMatrix
) { mpaPatternTransform
.reset(); if(pMatrix
) mpaPatternTransform
.reset(new basegfx::B2DHomMatrix(*pMatrix
)); }
115 } // end of namespace svgreader
116 } // end of namespace svgio
118 #endif // INCLUDED_SVGIO_INC_SVGPATTERNNODE_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */