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_SVGSVGNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGSVGNODE_HXX
23 #include "svgstyleattributes.hxx"
26 namespace svgio::svgreader
28 class SvgSvgNode final
: public SvgNode
32 SvgStyleAttributes maSvgStyleAttributes
;
34 /// variable scan values, dependent of given XAttributeList
35 std::unique_ptr
<basegfx::B2DRange
>
37 SvgAspectRatio maSvgAspectRatio
;
44 /// #i125258# bitfield
45 bool mbStyleAttributesInitialized
: 1;
47 // #i125258# on-demand init hard attributes when this is the outmost svg element
48 // and more (see implementation)
49 void initializeStyleAttributes();
53 SvgDocument
& rDocument
,
55 virtual ~SvgSvgNode() override
;
57 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
58 virtual void parseAttribute(const OUString
& rTokenName
, SVGToken aSVGToken
, const OUString
& aContent
) override
;
59 virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer
& rTarget
, bool bReferenced
) const override
;
61 /// Seeks width and height of viewport, which is current before the new viewport is set.
62 // needed for percentage unit in x, y, width or height
63 void seekReferenceWidth(double& fWidth
, bool& bHasFound
) const;
64 void seekReferenceHeight(double& fHeight
, bool& bHasFound
) const;
66 /// InfoProvider support for % values in children
67 // The returned 'CurrentViewPort' is the viewport as it is set by this svg element
68 // and as it is needed to resolve relative values in children
69 // The method does not check for invalid width and height
70 virtual basegfx::B2DRange
getCurrentViewPort() const override
;
73 const basegfx::B2DRange
* getViewBox() const { return mpViewBox
.get(); }
74 void setViewBox(const basegfx::B2DRange
* pViewBox
) { mpViewBox
.reset(); if(pViewBox
) mpViewBox
.reset( new basegfx::B2DRange(*pViewBox
) ); }
76 /// SvgAspectRatio content
77 const SvgAspectRatio
& getSvgAspectRatio() const { return maSvgAspectRatio
; }
80 const SvgNumber
& getX() const { return maX
; }
83 const SvgNumber
& getY() const { return maY
; }
86 const SvgNumber
& getWidth() const { return maWidth
; }
89 const SvgNumber
& getHeight() const { return maHeight
; }
92 } // end of namespace svgio::svgreader
94 #endif // INCLUDED_SVGIO_INC_SVGSVGNODE_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */