diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2015-02-03 21:20:20 +0100 |
---|---|---|
committer | Katarina Behrens <bubli@bubli.org> | 2015-02-06 09:17:49 +0000 |
commit | d0cfd49dc530574cbbc0a95c173de8936bc9c8ca (patch) | |
tree | 21985d6fea161338077dae76bcbec093a7c4a974 /svgio | |
parent | Report errors from clRelease*() APIs (diff) | |
download | core-d0cfd49dc530574cbbc0a95c173de8936bc9c8ca.tar.gz core-d0cfd49dc530574cbbc0a95c173de8936bc9c8ca.zip |
tdf#87309: SVG - use black as default currentColor if no color was specified
improves import of attachment https://bugs.documentfoundation.org/attachment.cgi?id=110836 from issue 62284
Change-Id: Icb056774746ce270138a54e9dfe9ca6987a64769
Reviewed-on: https://gerrit.libreoffice.org/14242
Reviewed-by: Katarina Behrens <bubli@bubli.org>
Tested-by: Katarina Behrens <bubli@bubli.org>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgio/svgreader/svgstyleattributes.hxx | 3 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 17 |
2 files changed, 16 insertions, 4 deletions
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx index 693772b31501..ac3fbf8cad3a 100644 --- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx +++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx @@ -406,6 +406,9 @@ namespace svgio const basegfx::BColor* getColor() const; void setColor(const SvgPaint& rColor) { maColor = rColor; } + /// Resolve current color (defaults to black if no color is specified) + const basegfx::BColor* getCurrentColor() const; + /// Opacity content SvgNumber getOpacity() const { return maOpacity; } void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; } diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 182448f827e5..fa71c63213cc 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1888,19 +1888,28 @@ namespace svgio return false; } + const basegfx::BColor* SvgStyleAttributes::getCurrentColor() const + { + static basegfx::BColor aBlack(0.0, 0.0, 0.0); + const basegfx::BColor *aColor = getColor(); + if( aColor ) + return aColor; + else + return &aBlack; + } + const basegfx::BColor* SvgStyleAttributes::getFill() const { if(mbIsClipPathContent) { static basegfx::BColor aBlack(0.0, 0.0, 0.0); - return &aBlack; } else if(maFill.isSet()) { if(maFill.isCurrent()) { - return getColor(); + return getCurrentColor(); } else if(maFill.isOn()) { @@ -1930,7 +1939,7 @@ namespace svgio { if(maStroke.isCurrent()) { - return getColor(); + return getCurrentColor(); } else if(maStroke.isOn()) { @@ -1954,7 +1963,7 @@ namespace svgio { if(maStopColor.isCurrent()) { - return *getColor(); + return *getCurrentColor(); } else { |