diff options
Diffstat (limited to 'svgio/source/svgreader/svgstyleattributes.cxx')
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 3e454e4babc7..691a1f8d2a41 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1145,16 +1145,11 @@ namespace svgio aSource = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } - if(!getClipPathXLink().isEmpty()) + const SvgClipPathNode* mpClip = accessClipPathXLink(); + if(mpClip) { - // try to access linked ClipPath - const SvgClipPathNode* mpClip = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink())); - - if(mpClip) - { - // #i124852# transform may be needed when userSpaceOnUse - mpClip->apply(aSource, pTransform); - } + // #i124852# transform may be needed when userSpaceOnUse + mpClip->apply(aSource, pTransform); } if(!aSource.empty()) // test again, applied clipPath may have lead to empty geometry @@ -1215,6 +1210,7 @@ namespace svgio maTitle(), maDesc(), maClipPathXLink(), + mpClipPathXLink(nullptr), maMaskXLink(), maMarkerStartXLink(), mpMarkerStartXLink(nullptr), @@ -2659,6 +2655,38 @@ namespace svgio return nullptr; } + OUString SvgStyleAttributes::getClipPathXLink() const + { + if(!maClipPathXLink.isEmpty()) + { + return maClipPathXLink; + } + + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + + if(pSvgStyleAttributes && !pSvgStyleAttributes->maClipPathXLink.isEmpty()) + { + return pSvgStyleAttributes->getClipPathXLink(); + } + + return OUString(); + } + + const SvgClipPathNode* SvgStyleAttributes::accessClipPathXLink() const + { + if(!mpClipPathXLink) + { + const OUString aClipPath(getClipPathXLink()); + + if(!aClipPath.isEmpty()) + { + const_cast< SvgStyleAttributes* >(this)->mpClipPathXLink = dynamic_cast< const SvgClipPathNode* >(mrOwner.getDocument().findSvgNodeById(getClipPathXLink())); + } + } + + return mpClipPathXLink; + } + OUString SvgStyleAttributes::getMarkerStartXLink() const { if(!maMarkerStartXLink.isEmpty()) |