LibreOffice Module svgio (master) 1
svggradientstopnode.cxx
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
21
22namespace svgio::svgreader
23{
25 SvgDocument& rDocument,
26 SvgNode* pParent)
27 : SvgNode(SVGToken::Stop, rDocument, pParent),
28 maSvgStyleAttributes(*this)
29 {
30 }
31
33 {
34 }
35
37 {
39 }
40
41 void SvgGradientStopNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
42 {
43 // call parent
44 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent);
45
46 // read style attributes
47 maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
48
49 // parse own
50 switch(aSVGToken)
51 {
52 case SVGToken::Style:
53 {
54 readLocalCssStyle(aContent);
55 break;
56 }
58 {
59 SvgNumber aNum;
60
61 if(readSingleNumber(aContent, aNum))
62 {
63 if(aNum.isPositive())
64 {
65 maOffset = aNum;
66 }
67 }
68 break;
69 }
70 default:
71 {
72 break;
73 }
74 }
75 }
76
77} // end of namespace svgio::svgreader
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const SvgStyleAttributes * getSvgStyleAttributes() const override
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent) override
SvgGradientStopNode(SvgDocument &rDocument, SvgNode *pParent)
SvgStyleAttributes maSvgStyleAttributes
use styles
const SvgStyleAttributes * checkForCssStyle(const SvgStyleAttributes &rOriginal) const
helper to evtl. link to css style
Definition: svgnode.cxx:335
virtual void parseAttribute(const OUString &rTokenName, SVGToken aSVGToken, const OUString &aContent)
Definition: svgnode.cxx:534
void readLocalCssStyle(std::u16string_view aContent)
scan helper to read and interpret a local CssStyle to mpLocalCssStyle
Definition: svgnode.cxx:412
void parseStyleAttribute(SVGToken aSVGToken, const OUString &rContent)
local attribute scanner
aCursorMoveIdle Stop()
bool readSingleNumber(std::u16string_view rCandidate, SvgNumber &aNum)
Definition: svgtools.cxx:1076