svgio/inc/svgio/svgreader/svgdocumenthandler.hxx | 2 + svgio/inc/svgio/svgreader/svgtoken.hxx | 2 + svgio/source/svgreader/svgdocumenthandler.cxx | 27 ++++++++++++++++++++++- svgio/source/svgreader/svgtoken.cxx | 3 ++ 4 files changed, 33 insertions(+), 1 deletion(-)
New commits: commit 5bd241b99b76ae7f4b3c1d4f2bcbaf7c487bb339 Author: Joren De Cuyper <jore...@libreoffice.org> Date: Tue Jul 15 00:02:44 2014 +0200 fdo#50114 ingore flowRoot element during svg import This element is not specified in any released svg specification. It might be mentioned in svg1.2 but since this is not yet released/ or will even not be released ever -> ignore it. Change-Id: Iaf5a392893070fda9e7a420bc951c8565bcfb37f Reviewed-on: https://gerrit.libreoffice.org/10312 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx index 7269e3f..8656689 100644 --- a/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx +++ b/svgio/inc/svgio/svgreader/svgdocumenthandler.hxx @@ -41,6 +41,8 @@ namespace svgio // text collector string stack for css styles std::vector< OUString > maCssContents; + bool bSkip; + public: SvgDocHdl(const OUString& rAbsolutePath); virtual ~SvgDocHdl(); diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx b/svgio/inc/svgio/svgreader/svgtoken.hxx index fa6986e..4596fb2 100644 --- a/svgio/inc/svgio/svgreader/svgtoken.hxx +++ b/svgio/inc/svgio/svgreader/svgtoken.hxx @@ -178,6 +178,8 @@ namespace svgio SVGTokenText, SVGTokenBaselineShift, + SVGTokenFlowRoot, + SVGTokenLast }; diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index 25772aa..3817612 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -137,7 +137,8 @@ namespace svgio SvgDocHdl::SvgDocHdl(const OUString& aAbsolutePath) : maDocument(aAbsolutePath), mpTarget(0), - maCssContents() + maCssContents(), + bSkip(false) { } @@ -167,8 +168,11 @@ namespace svgio void SvgDocHdl::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs ) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (bSkip) + return; if(!aName.isEmpty()) { + const SVGToken aSVGToken(StrToSVGToken(aName)); switch(aSVGToken) @@ -364,6 +368,13 @@ namespace svgio break; } + // ignore FlowRoot and child nodes + case SVGTokenFlowRoot: + { + bSkip = true; + break; + } + default: { /// invalid token, ignore @@ -388,6 +399,13 @@ namespace svgio SvgStyleNode* pCssStyle(SVGTokenStyle == aSVGToken ? static_cast< SvgStyleNode* >(mpTarget) : 0); SvgTitleDescNode* pSvgTitleDescNode(SVGTokenTitle == aSVGToken || SVGTokenDesc == aSVGToken ? static_cast< SvgTitleDescNode* >(mpTarget) : 0); + // if we are in skipping mode and we reach the flowRoot end tag: stop skipping mode + if(bSkip && aSVGToken == SVGTokenFlowRoot) + bSkip = false; + // we are in skipping mode: do nothing until we found the flowRoot end tag + else if(bSkip) + return; + switch(aSVGToken) { /// valid tokens for which a new one was created @@ -457,6 +475,13 @@ namespace svgio } break; } + + case SVGTokenFlowRoot: + { + bSkip = false; + break; + } + default: { /// invalid token, ignore diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index 337a26d..db494b1 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -160,6 +160,8 @@ namespace svgio static OUString aSVGStrText("text"); static OUString aSVGStrBaselineShift("baseline-shift"); + static OUString aSVGStrFlowRoot("flowRoot"); + SVGToken StrToSVGToken(const OUString& rStr) { typedef boost::unordered_map< OUString, SVGToken, OUStringHash,::std::equal_to< OUString > > SVGTokenMapper; @@ -302,6 +304,7 @@ namespace svgio aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrText, SVGTokenText)); aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrBaselineShift, SVGTokenBaselineShift)); + aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrFlowRoot, SVGTokenFlowRoot)); } const SVGTokenMapper::const_iterator aResult(aSVGTokenMapperList.find(rStr.startsWith("svg:") ? rStr.copy(4) : rStr));
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits