LibreOffice Module svgio (master) 1
svgpatternnode.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"
25#include <memory>
26
27namespace svgio::svgreader
28 {
29 class SvgPatternNode final : public SvgNode
30 {
31 private:
34
37
39 std::unique_ptr<basegfx::B2DRange>
46 std::optional<SvgUnits>
48 std::optional<SvgUnits>
50 std::optional<basegfx::B2DHomMatrix>
52
55 // tryToFindLink (buffered)
56 mutable bool mbResolvingLink; // protect against infinite link recursion
57 OUString maXLink;
59
61 void tryToFindLink();
62
63 public:
65 SvgDocument& rDocument,
66 SvgNode* pParent);
67 virtual ~SvgPatternNode() override;
68
69 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
70 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
71
73 void getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode const & rUser) const;
74
77
79 virtual basegfx::B2DRange getCurrentViewPort() const override;
80
82 const basegfx::B2DRange* getViewBox() const;
83 void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset(new basegfx::B2DRange(*pViewBox)); }
84
86 const SvgAspectRatio& getSvgAspectRatio() const;
87
89 const SvgNumber& getX() const;
90
92 const SvgNumber& getY() const;
93
95 const SvgNumber& getWidth() const;
96
98 const SvgNumber& getHeight() const;
99
101 const SvgUnits* getPatternUnits() const;
102 void setPatternUnits(const SvgUnits aPatternUnits) { moPatternUnits = aPatternUnits; }
103
105 const SvgUnits* getPatternContentUnits() const;
106 void setPatternContentUnits(const SvgUnits aPatternContentUnits) { moPatternContentUnits = aPatternContentUnits; }
107
109 std::optional<basegfx::B2DHomMatrix> getPatternTransform() const;
110 void setPatternTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaPatternTransform = pMatrix; }
111
112 };
113
114} // end of namespace svgio::svgreader
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void tryToFindLink()
link on demand
const SvgUnits * getPatternContentUnits() const
PatternContentUnits content.
virtual basegfx::B2DRange getCurrentViewPort() const override
InfoProvider support for % values.
const SvgAspectRatio & getSvgAspectRatio() const
SvgAspectRatio content.
std::unique_ptr< basegfx::B2DRange > mpViewBox
variable scan values, dependent of given XAttributeList
const SvgUnits * getPatternUnits() const
PatternUnits content.
std::optional< basegfx::B2DHomMatrix > getPatternTransform() const
PatternTransform content.
void setViewBox(const basegfx::B2DRange *pViewBox)
std::optional< basegfx::B2DHomMatrix > mpaPatternTransform
const basegfx::B2DRange * getViewBox() const
viewBox content
SvgPatternNode(SvgDocument &rDocument, SvgNode *pParent)
SvgStyleAttributes maSvgStyleAttributes
use styles
std::optional< SvgUnits > moPatternContentUnits
virtual const SvgStyleAttributes * getSvgStyleAttributes() const override
const SvgNumber & getY() const
Y content, set if found in current context.
const SvgNumber & getHeight() const
Height content, set if found in current context.
void setPatternTransform(const std::optional< basegfx::B2DHomMatrix > &pMatrix)
drawinglayer::primitive2d::Primitive2DContainer aPrimitives
buffered decomposition
const SvgPatternNode * mpXLink
const SvgNumber & getWidth() const
Width content, set if found in current context.
void getValuesRelative(double &rfX, double &rfY, double &rfW, double &rfH, const basegfx::B2DRange &rGeoRange, SvgNode const &rUser) const
global helpers
void setPatternContentUnits(const SvgUnits aPatternContentUnits)
std::optional< SvgUnits > moPatternUnits
const SvgNumber & getX() const
X content, set if found in current context.
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
const drawinglayer::primitive2d::Primitive2DContainer & getPatternPrimitives() const
get pattern primitives buffered, uses decomposeSvgNode internally
void setPatternUnits(const SvgUnits aPatternUnits)
bool mbResolvingLink
link to another pattern used as style.