svgsvgnode.cxx (86e1cf34) | svgsvgnode.cxx (4374d266) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 : SvgNode(SVGTokenSvg, rDocument, pParent), 45 maSvgStyleAttributes(*this), 46 mpViewBox(0), 47 maSvgAspectRatio(), 48 maX(), 49 maY(), 50 maWidth(), 51 maHeight(), | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 : SvgNode(SVGTokenSvg, rDocument, pParent), 45 maSvgStyleAttributes(*this), 46 mpViewBox(0), 47 maSvgAspectRatio(), 48 maX(), 49 maY(), 50 maWidth(), 51 maHeight(), |
52 maVersion() | 52 maVersion(), 53 mbStyleAttributesInitialized(false) // #125258# |
53 { | 54 { |
54 if(!getParent()) | 55 } 56 57 // #125258# 58 void SvgSvgNode::initializeStyleAttributes() 59 { 60 if(!mbStyleAttributesInitialized) |
55 { | 61 { |
56 // initial fill is black 57 maSvgStyleAttributes.setFill(SvgPaint(basegfx::BColor(0.0, 0.0, 0.0), true, true)); | 62 // #125258# determine if initial values need to be initialized with hard values 63 // for the case that this is the outmost SVG statement and it has no parent 64 // stale (CssStyle for svg may be defined) 65 bool bSetInitialValues(true); 66 67 if(getParent()) 68 { 69 // #125258# no initial values when it's a SVG element embedded in SVG 70 bSetInitialValues = false; 71 } 72 73 if(bSetInitialValues) 74 { 75 const SvgStyleAttributes* pStyles = getSvgStyleAttributes(); 76 77 if(pStyles && pStyles->getParentStyle()) 78 { 79 // #125258# no initial values when SVG has a parent style (probably CssStyle) 80 bSetInitialValues = false; 81 } 82 } 83 84 if(bSetInitialValues) 85 { 86 // #125258# only set if not yet initialized (SvgSvgNode::parseAttribute is already done, 87 // just setting may revert an already set valid value) 88 if(!maSvgStyleAttributes.isFillSet()) 89 { 90 // #125258# initial fill is black (see SVG1.1 spec) 91 maSvgStyleAttributes.setFill(SvgPaint(basegfx::BColor(0.0, 0.0, 0.0), true, true)); 92 } 93 } 94 95 mbStyleAttributesInitialized = true; |
58 } 59 } 60 61 SvgSvgNode::~SvgSvgNode() 62 { 63 if(mpViewBox) delete mpViewBox; 64 } 65 66 const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const 67 { | 96 } 97 } 98 99 SvgSvgNode::~SvgSvgNode() 100 { 101 if(mpViewBox) delete mpViewBox; 102 } 103 104 const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const 105 { |
68 return &maSvgStyleAttributes; | 106 // #125258# svg node can vahe CssStyles, too, so check for it here 107 static rtl::OUString aClassStr(rtl::OUString::createFromAscii("svg")); 108 109 return checkForCssStyle(aClassStr, maSvgStyleAttributes); |
69 } 70 71 void SvgSvgNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent) 72 { 73 // call parent 74 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); 75 76 // read style attributes --- 169 unchanged lines hidden (view full) --- 246 } 247 } 248 249// ToDo: Consider attribute overflow in method decomposeSvgNode 250 void SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const 251 { 252 drawinglayer::primitive2d::Primitive2DSequence aSequence; 253 | 110 } 111 112 void SvgSvgNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent) 113 { 114 // call parent 115 SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); 116 117 // read style attributes --- 169 unchanged lines hidden (view full) --- 287 } 288 } 289 290// ToDo: Consider attribute overflow in method decomposeSvgNode 291 void SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const 292 { 293 drawinglayer::primitive2d::Primitive2DSequence aSequence; 294 |
295 // #125258# check now if we need to init some style settings locally. Do not do this 296 // in the constructor, there is not yet informatikon e.g. about existing CssStyles. 297 // Here all nodes are read and interpreted 298 const_cast< SvgSvgNode* >(this)->initializeStyleAttributes(); 299 |
|
254 // decompose childs 255 SvgNode::decomposeSvgNode(aSequence, bReferenced); 256 257 if(aSequence.hasElements()) 258 { 259 if(getParent()) 260 { 261 // #122594# if width/height is not given, it's 100% (see 5.1.2 The 'svg' element in SVG1.1 spec). --- 454 unchanged lines hidden --- | 300 // decompose childs 301 SvgNode::decomposeSvgNode(aSequence, bReferenced); 302 303 if(aSequence.hasElements()) 304 { 305 if(getParent()) 306 { 307 // #122594# if width/height is not given, it's 100% (see 5.1.2 The 'svg' element in SVG1.1 spec). --- 454 unchanged lines hidden --- |