LibreOffice Module svgio (master) 1
svgsvgnode.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
23#include <memory>
24
25namespace svgio::svgreader
26 {
27 class SvgSvgNode final : public SvgNode
28 {
29 private:
32
34 std::unique_ptr<basegfx::B2DRange>
42
45
46 // #i125258# on-demand init hard attributes when this is the outmost svg element
47 // and more (see implementation)
49
50 public:
52 SvgDocument& rDocument,
53 SvgNode* pParent);
54 virtual ~SvgSvgNode() override;
55
56 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
57 virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
58 virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
59
61 // needed for percentage unit in x, y, width or height
62 void seekReferenceWidth(double& fWidth, bool& bHasFound) const;
63 void seekReferenceHeight(double& fHeight, bool& bHasFound) const;
64
66 // The returned 'CurrentViewPort' is the viewport as it is set by this svg element
67 // and as it is needed to resolve relative values in children
68 // The method does not check for invalid width and height
69 virtual basegfx::B2DRange getCurrentViewPort() const override;
70
72 const basegfx::B2DRange* getViewBox() const { return mpViewBox.get(); }
73 void setViewBox(const basegfx::B2DRange* pViewBox) { mpViewBox.reset(); if(pViewBox) mpViewBox.reset( new basegfx::B2DRange(*pViewBox) ); }
74
77
79 const SvgNumber& getX() const { return maX; }
80
82 const SvgNumber& getY() const { return maY; }
83
85 const SvgNumber& getWidth() const { return maWidth; }
86
88 const SvgNumber& getHeight() const { return maHeight; }
89 };
90
91} // end of namespace svgio::svgreader
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SvgAspectRatio & getSvgAspectRatio() const
SvgAspectRatio content.
Definition: svgsvgnode.hxx:76
void setViewBox(const basegfx::B2DRange *pViewBox)
Definition: svgsvgnode.hxx:73
virtual ~SvgSvgNode() override
Definition: svgsvgnode.cxx:100
std::unique_ptr< basegfx::B2DRange > mpViewBox
variable scan values, dependent of given XAttributeList
Definition: svgsvgnode.hxx:35
SvgStyleAttributes maSvgStyleAttributes
use styles
Definition: svgsvgnode.hxx:31
virtual const SvgStyleAttributes * getSvgStyleAttributes() const override
Definition: svgsvgnode.cxx:104
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer &rTarget, bool bReferenced) const override
Definition: svgsvgnode.cxx:289
SvgSvgNode(SvgDocument &rDocument, SvgNode *pParent)
Definition: svgsvgnode.cxx:34
SvgAspectRatio maSvgAspectRatio
Definition: svgsvgnode.hxx:36
const SvgNumber & getWidth() const
width content
Definition: svgsvgnode.hxx:85
void seekReferenceWidth(double &fWidth, bool &bHasFound) const
Seeks width and height of viewport, which is current before the new viewport is set.
Definition: svgsvgnode.cxx:204
const SvgNumber & getX() const
x content
Definition: svgsvgnode.hxx:79
virtual basegfx::B2DRange getCurrentViewPort() const override
InfoProvider support for % values in children.
Definition: svgsvgnode.cxx:721
const SvgNumber & getY() const
y content
Definition: svgsvgnode.hxx:82
void seekReferenceHeight(double &fHeight, bool &bHasFound) const
Definition: svgsvgnode.cxx:246
const basegfx::B2DRange * getViewBox() const
viewBox content
Definition: svgsvgnode.hxx:72
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
Definition: svgsvgnode.cxx:110
const SvgNumber & getHeight() const
height content
Definition: svgsvgnode.hxx:88
bool mbStyleAttributesInitialized
#i125258# bitfield
Definition: svgsvgnode.hxx:44