summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgsvgnode.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svgio/source/svgreader/svgsvgnode.cxx')
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx110
1 files changed, 55 insertions, 55 deletions
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index 0d42099eff3b..72775f16b9a4 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -50,58 +50,58 @@ namespace svgio
// #i125258#
void SvgSvgNode::initializeStyleAttributes()
{
- if(!mbStyleAttributesInitialized)
+ if(mbStyleAttributesInitialized)
+ return;
+
+ // #i125258# determine if initial values need to be initialized with hard values
+ // for the case that this is the outmost SVG statement and it has no parent
+ // stale (CssStyle for svg may be defined)
+ bool bSetInitialValues(true);
+
+ if(getParent())
{
- // #i125258# determine if initial values need to be initialized with hard values
- // for the case that this is the outmost SVG statement and it has no parent
- // stale (CssStyle for svg may be defined)
- bool bSetInitialValues(true);
+ // #i125258# no initial values when it's a SVG element embedded in SVG
+ bSetInitialValues = false;
+ }
- if(getParent())
- {
- // #i125258# no initial values when it's a SVG element embedded in SVG
- bSetInitialValues = false;
- }
+ if(bSetInitialValues)
+ {
+ const SvgStyleAttributes* pStyles = getSvgStyleAttributes();
- if(bSetInitialValues)
+ if(pStyles && pStyles->getParentStyle())
{
- const SvgStyleAttributes* pStyles = getSvgStyleAttributes();
+ // SVG has a parent style (probably CssStyle), check if fill is set there anywhere
+ // already. If yes, do not set the default fill (black)
+ bool bFillSet(false);
+ const SvgStyleAttributes* pParentStyle = pStyles->getParentStyle();
- if(pStyles && pStyles->getParentStyle())
+ while(pParentStyle && !bFillSet)
{
- // SVG has a parent style (probably CssStyle), check if fill is set there anywhere
- // already. If yes, do not set the default fill (black)
- bool bFillSet(false);
- const SvgStyleAttributes* pParentStyle = pStyles->getParentStyle();
-
- while(pParentStyle && !bFillSet)
- {
- bFillSet = pParentStyle->isFillSet();
- pParentStyle = pParentStyle->getParentStyle();
- }
-
- if(bFillSet)
- {
- // #125258# no initial values when SVG has a parent style at which a fill
- // is already set
- bSetInitialValues = false;
- }
+ bFillSet = pParentStyle->isFillSet();
+ pParentStyle = pParentStyle->getParentStyle();
}
- }
- if(bSetInitialValues)
- {
- // #i125258# only set if not yet initialized (SvgSvgNode::parseAttribute is already done,
- // just setting may revert an already set valid value)
- if(!maSvgStyleAttributes.isFillSet())
+ if(bFillSet)
{
- // #i125258# initial fill is black (see SVG1.1 spec)
- maSvgStyleAttributes.setFill(SvgPaint(basegfx::BColor(0.0, 0.0, 0.0), true, true));
+ // #125258# no initial values when SVG has a parent style at which a fill
+ // is already set
+ bSetInitialValues = false;
}
}
+ }
- mbStyleAttributesInitialized = true;
+ if(bSetInitialValues)
+ {
+ // #i125258# only set if not yet initialized (SvgSvgNode::parseAttribute is already done,
+ // just setting may revert an already set valid value)
+ if(!maSvgStyleAttributes.isFillSet())
+ {
+ // #i125258# initial fill is black (see SVG1.1 spec)
+ maSvgStyleAttributes.setFill(SvgPaint(basegfx::BColor(0.0, 0.0, 0.0), true, true));
+ }
}
+
+ mbStyleAttributesInitialized = true;
}
SvgSvgNode::~SvgSvgNode()
@@ -709,22 +709,22 @@ namespace svgio
}
}
- if(aSequence.empty() && !getParent() && getViewBox())
- {
- // tdf#118232 No geometry, Outermost SVG element and we have a ViewBox.
- // Create a HiddenGeometry Primitive containing an expanded
- // hairline geometry to have the size contained
- const drawinglayer::primitive2d::Primitive2DReference xLine(
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
- basegfx::utils::createPolygonFromRect(
- *getViewBox()),
- basegfx::BColor(0.0, 0.0, 0.0)));
- const drawinglayer::primitive2d::Primitive2DReference xHidden(
- new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(
- drawinglayer::primitive2d::Primitive2DContainer { xLine }));
-
- rTarget.push_back(xHidden);
- }
+ if(!(aSequence.empty() && !getParent() && getViewBox()))
+ return;
+
+ // tdf#118232 No geometry, Outermost SVG element and we have a ViewBox.
+ // Create a HiddenGeometry Primitive containing an expanded
+ // hairline geometry to have the size contained
+ const drawinglayer::primitive2d::Primitive2DReference xLine(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ basegfx::utils::createPolygonFromRect(
+ *getViewBox()),
+ basegfx::BColor(0.0, 0.0, 0.0)));
+ const drawinglayer::primitive2d::Primitive2DReference xHidden(
+ new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(
+ drawinglayer::primitive2d::Primitive2DContainer { xLine }));
+
+ rTarget.push_back(xHidden);
}
const basegfx::B2DRange SvgSvgNode::getCurrentViewPort() const