Author: alg Date: Wed Oct 8 16:36:47 2014 New Revision: 1630170 URL: http://svn.apache.org/r1630170 Log: i125332 made css style stuff aware that it is case independent
Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtoken.hxx openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx openoffice/trunk/main/svgio/source/svgreader/svgclippathnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgdocumenthandler.cxx openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx openoffice/trunk/main/svgio/source/svgreader/svggnode.cxx openoffice/trunk/main/svgio/source/svgreader/svggradientnode.cxx openoffice/trunk/main/svgio/source/svgreader/svggradientstopnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx openoffice/trunk/main/svgio/source/svgreader/svgmasknode.cxx openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx openoffice/trunk/main/svgio/source/svgreader/svgstylenode.cxx openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgsymbolnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgtextnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgtextpathnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgtoken.cxx openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx openoffice/trunk/main/svgio/source/svgreader/svgtrefnode.cxx openoffice/trunk/main/svgio/source/svgreader/svgtspannode.cxx openoffice/trunk/main/svgio/source/svgreader/svgusenode.cxx Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx (original) +++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgstyleattributes.hxx Wed Oct 8 16:36:47 2014 @@ -259,7 +259,11 @@ namespace svgio public: /// local attribute scanner - void parseStyleAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent); + void parseStyleAttribute( + const rtl::OUString& rTokenName, + SVGToken aSVGToken, + const rtl::OUString& aContent, + bool bCaseIndependent); /// helper which does the necessary with a given path void add_text( @@ -279,7 +283,7 @@ namespace svgio const SvgStyleAttributes* getCssStyleParent() const { return mpCssStyleParent; } /// scan helpers - void readStyle(const rtl::OUString& rCandidate); + void readCssStyle(const rtl::OUString& rCandidate); const SvgStyleAttributes* getParentStyle() const; SvgStyleAttributes(SvgNode& rOwner); Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtoken.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtoken.hxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtoken.hxx (original) +++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtoken.hxx Wed Oct 8 16:36:47 2014 @@ -186,7 +186,7 @@ namespace svgio SVGTokenLast }; - SVGToken StrToSVGToken(const rtl::OUString& rStr); + SVGToken StrToSVGToken(const rtl::OUString& rStr, bool bCaseIndependent); const rtl::OUString& getStrTitle(); const rtl::OUString& getStrDesc(); Modified: openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx (original) +++ openoffice/trunk/main/svgio/inc/svgio/svgreader/svgtools.hxx Wed Oct 8 16:36:47 2014 @@ -203,13 +203,23 @@ namespace svgio bool readNumberAndUnit(const rtl::OUString& rCandidate, sal_Int32& nPos, SvgNumber& aNum, const sal_Int32 nLen); bool readAngle(const rtl::OUString& rCandidate, sal_Int32& nPos, double& fAngle, const sal_Int32 nLen); sal_Int32 read_hex(const sal_Unicode& rChar); - bool match_colorKeyword(basegfx::BColor& rColor, const rtl::OUString& rName); - bool read_color(const rtl::OUString& rCandidate, basegfx::BColor& rColor); + bool match_colorKeyword( + basegfx::BColor& rColor, + const rtl::OUString& rName, + bool bCaseIndependent); + bool read_color( + const rtl::OUString& rCandidate, + basegfx::BColor& rColor, + bool bCaseIndependent); basegfx::B2DRange readViewBox(const rtl::OUString& rCandidate, InfoProvider& rInfoProvider); basegfx::B2DHomMatrix readTransform(const rtl::OUString& rCandidate, InfoProvider& rInfoProvider); bool readSingleNumber(const rtl::OUString& rCandidate, SvgNumber& aNum); bool readLocalUrl(const rtl::OUString& rCandidate, rtl::OUString& rURL); - bool readSvgPaint(const rtl::OUString& rCandidate, SvgPaint& rSvgPaint, rtl::OUString& rURL); + bool readSvgPaint( + const rtl::OUString& rCandidate, + SvgPaint& rSvgPaint, + rtl::OUString& rURL, + bool bCaseIndependent); bool readSvgNumberVector(const rtl::OUString& rCandidate, SvgNumberVector& rSvgNumberVector); ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& rInput, const InfoProvider& rInfoProvider, NumberType aNumberType = length); Modified: openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgcirclenode.cxx Wed Oct 8 16:36:47 2014 @@ -62,7 +62,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgclippathnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgclippathnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgclippathnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgclippathnode.cxx Wed Oct 8 16:36:47 2014 @@ -63,7 +63,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgdocumenthandler.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgdocumenthandler.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgdocumenthandler.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgdocumenthandler.cxx Wed Oct 8 16:36:47 2014 @@ -179,7 +179,7 @@ namespace svgio { if(aName.getLength()) { - const SVGToken aSVGToken(StrToSVGToken(aName)); + const SVGToken aSVGToken(StrToSVGToken(aName, false)); switch(aSVGToken) { @@ -393,7 +393,7 @@ namespace svgio { if(aName.getLength()) { - const SVGToken aSVGToken(StrToSVGToken(aName)); + const SVGToken aSVGToken(StrToSVGToken(aName, false)); SvgNode* pWhitespaceCheck(SVGTokenText == aSVGToken ? mpTarget : 0); SvgStyleNode* pCssStyle(SVGTokenStyle == aSVGToken ? static_cast< SvgStyleNode* >(mpTarget) : 0); SvgTitleDescNode* pSvgTitleDescNode(SVGTokenTitle == aSVGToken || SVGTokenDesc == aSVGToken ? static_cast< SvgTitleDescNode* >(mpTarget) : 0); Modified: openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgellipsenode.cxx Wed Oct 8 16:36:47 2014 @@ -63,7 +63,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svggnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svggnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svggnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svggnode.cxx Wed Oct 8 16:36:47 2014 @@ -70,7 +70,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svggradientnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svggradientnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svggradientnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svggradientnode.cxx Wed Oct 8 16:36:47 2014 @@ -86,7 +86,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svggradientstopnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svggradientstopnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svggradientstopnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svggradientstopnode.cxx Wed Oct 8 16:36:47 2014 @@ -56,7 +56,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgimagenode.cxx Wed Oct 8 16:36:47 2014 @@ -80,7 +80,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svglinenode.cxx Wed Oct 8 16:36:47 2014 @@ -63,7 +63,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgmarkernode.cxx Wed Oct 8 16:36:47 2014 @@ -66,7 +66,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgmasknode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgmasknode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgmasknode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgmasknode.cxx Wed Oct 8 16:36:47 2014 @@ -69,7 +69,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgnode.cxx Wed Oct 8 16:36:47 2014 @@ -331,7 +331,7 @@ namespace svgio if(mpLocalCssStyle) { // parse and set values to it - mpLocalCssStyle->readStyle(aContent); + mpLocalCssStyle->readCssStyle(aContent); } else { @@ -349,7 +349,7 @@ namespace svgio for(sal_uInt32 a(0); a < nAttributes; a++) { const ::rtl::OUString aTokenName(xAttribs->getNameByIndex(a)); - const SVGToken aSVGToken(StrToSVGToken(aTokenName)); + const SVGToken aSVGToken(StrToSVGToken(aTokenName, false)); parseAttribute(aTokenName, aSVGToken, xAttribs->getValueByIndex(a)); } Modified: openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgpathnode.cxx Wed Oct 8 16:36:47 2014 @@ -61,7 +61,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgpatternnode.cxx Wed Oct 8 16:36:47 2014 @@ -80,7 +80,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgpolynode.cxx Wed Oct 8 16:36:47 2014 @@ -65,7 +65,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgrectnode.cxx Wed Oct 8 16:36:47 2014 @@ -65,7 +65,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgstyleattributes.cxx Wed Oct 8 16:36:47 2014 @@ -180,61 +180,70 @@ namespace svgio return nRetval; } - void SvgStyleAttributes::readStyle(const rtl::OUString& rCandidate) + void SvgStyleAttributes::readCssStyle(const rtl::OUString& rCandidate) { const sal_Int32 nLen(rCandidate.getLength()); sal_Int32 nPos(0); while(nPos < nLen) { - const sal_Int32 nInitPos(nPos); - skip_char(rCandidate, sal_Unicode(' '), nPos, nLen); + // get TokenName rtl::OUStringBuffer aTokenName; + skip_char(rCandidate, sal_Unicode(' '), nPos, nLen); copyString(rCandidate, nPos, aTokenName, nLen); - - if(aTokenName.getLength()) + + if(!aTokenName.getLength()) { - skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(':'), nPos, nLen); - rtl::OUStringBuffer aTokenValue; - copyToLimiter(rCandidate, sal_Unicode(';'), nPos, aTokenValue, nLen); - skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(';'), nPos, nLen); - const rtl::OUString aOUTokenName(aTokenName.makeStringAndClear()); - rtl::OUString aOUTokenValue(aTokenValue.makeStringAndClear()); + // if no TokenName advance one by force to avoid death loop, continue + OSL_ENSURE(false, "Could not interpret on current position, advancing one byte (!)"); + nPos++; + continue; + } - // check for '!important' CssStyle mark, currently not supported - // but neds to be extracted for correct parsing - static rtl::OUString aTokenImportant(RTL_CONSTASCII_USTRINGPARAM("!important")); - const sal_Int32 nIndexTokenImportant(aOUTokenValue.indexOf(aTokenImportant)); + // get TokenValue + rtl::OUStringBuffer aTokenValue; + skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(':'), nPos, nLen); + copyToLimiter(rCandidate, sal_Unicode(';'), nPos, aTokenValue, nLen); + skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(';'), nPos, nLen); - if(-1 != nIndexTokenImportant) - { - // if there currently just remove it and remove spaces to have the value only - rtl::OUString aNewOUTokenValue; + if(!aTokenValue.getLength()) + { + // no value - continue + continue; + } - if(nIndexTokenImportant > 0) - { - // copy content before token - aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant); - } + // generate OUStrings + const rtl::OUString aOUTokenName(aTokenName.makeStringAndClear()); + rtl::OUString aOUTokenValue(aTokenValue.makeStringAndClear()); - if(aOUTokenValue.getLength() > nIndexTokenImportant + aTokenImportant.getLength()) - { - // copy content after token - aNewOUTokenValue += aOUTokenValue.copy(nIndexTokenImportant + aTokenImportant.getLength()); - } + // check for '!important' CssStyle mark, currently not supported + // but needs to be extracted for correct parsing + static rtl::OUString aTokenImportant(RTL_CONSTASCII_USTRINGPARAM("!important")); + const sal_Int32 nIndexTokenImportant(aOUTokenValue.indexOf(aTokenImportant)); + + if(-1 != nIndexTokenImportant) + { + // if there currently just remove it and remove spaces to have the value only + rtl::OUString aNewOUTokenValue; - // remove spaces - aOUTokenValue = aNewOUTokenValue.trim(); + if(nIndexTokenImportant > 0) + { + // copy content before token + aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant); } - parseStyleAttribute(aOUTokenName, StrToSVGToken(aOUTokenName), aOUTokenValue); - } + if(aOUTokenValue.getLength() > nIndexTokenImportant + aTokenImportant.getLength()) + { + // copy content after token + aNewOUTokenValue += aOUTokenValue.copy(nIndexTokenImportant + aTokenImportant.getLength()); + } - if(nInitPos == nPos) - { - OSL_ENSURE(false, "Could not interpret on current position (!)"); - nPos++; + // remove spaces + aOUTokenValue = aNewOUTokenValue.trim(); } + + // valid token-value pair, parse it + parseStyleAttribute(aOUTokenName, StrToSVGToken(aOUTokenName, true), aOUTokenValue, true); } } @@ -1246,7 +1255,11 @@ namespace svgio { } - void SvgStyleAttributes::parseStyleAttribute(const rtl::OUString& /* rTokenName */, SVGToken aSVGToken, const rtl::OUString& aContent) + void SvgStyleAttributes::parseStyleAttribute( + const rtl::OUString& /* rTokenName */, + SVGToken aSVGToken, + const rtl::OUString& aContent, + bool bCaseIndependent) { switch(aSVGToken) { @@ -1255,7 +1268,7 @@ namespace svgio SvgPaint aSvgPaint; rtl::OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setFill(aSvgPaint); } @@ -1310,7 +1323,7 @@ namespace svgio SvgPaint aSvgPaint; rtl::OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setStroke(aSvgPaint); } @@ -1457,7 +1470,7 @@ namespace svgio SvgPaint aSvgPaint; rtl::OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setStopColor(aSvgPaint); } @@ -1778,7 +1791,7 @@ namespace svgio SvgPaint aSvgPaint; rtl::OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setColor(aSvgPaint); } Modified: openoffice/trunk/main/svgio/source/svgreader/svgstylenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgstylenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgstylenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgstylenode.cxx Wed Oct 8 16:36:47 2014 @@ -163,7 +163,7 @@ namespace svgio maSvgStyleAttributes.push_back(pNewStyle); // fill with content - pNewStyle->readStyle(aContent); + pNewStyle->readCssStyle(aContent); // comma-separated split (Css abbreviation for same style for multiple selectors) const sal_Int32 nLen(aSelectors.getLength()); Modified: openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgsvgnode.cxx Wed Oct 8 16:36:47 2014 @@ -130,7 +130,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgsymbolnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgsymbolnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgsymbolnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgsymbolnode.cxx Wed Oct 8 16:36:47 2014 @@ -58,7 +58,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgtextnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtextnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtextnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtextnode.cxx Wed Oct 8 16:36:47 2014 @@ -65,7 +65,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // read text position attributes maSvgTextPositions.parseTextPositionAttributes(rTokenName, aSVGToken, aContent); Modified: openoffice/trunk/main/svgio/source/svgreader/svgtextpathnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtextpathnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtextpathnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtextpathnode.cxx Wed Oct 8 16:36:47 2014 @@ -299,7 +299,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgtoken.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtoken.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtoken.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtoken.cxx Wed Oct 8 16:36:47 2014 @@ -167,7 +167,7 @@ namespace svgio static rtl::OUString aSVGStrText(rtl::OUString::createFromAscii("text")); static rtl::OUString aSVGStrBaselineShift(rtl::OUString::createFromAscii("baseline-shift")); - SVGToken StrToSVGToken(const rtl::OUString& rStr) + SVGToken StrToSVGToken(const rtl::OUString& rStr, bool bCaseIndependent) { typedef std::hash_map< rtl::OUString, SVGToken, rtl::OUStringHash > SVGTokenMapper; typedef std::pair< rtl::OUString, SVGToken > SVGTokenValueType; @@ -315,6 +315,33 @@ namespace svgio if(aResult == aSVGTokenMapperList.end()) { + if(bCaseIndependent) + { + static SVGTokenMapper aCaseLindependentSVGTokenMapperList; + + if(aCaseLindependentSVGTokenMapperList.empty()) + { + for(SVGTokenMapper::const_iterator aCurrent(aSVGTokenMapperList.begin()); aCurrent != aSVGTokenMapperList.end(); aCurrent++) + { + aCaseLindependentSVGTokenMapperList.insert( + SVGTokenValueType( + aCurrent->first.toAsciiLowerCase(), + aCurrent->second)); + } + } + + const SVGTokenMapper::const_iterator aResult2(aCaseLindependentSVGTokenMapperList.find(rStr.toAsciiLowerCase())); + + if(aResult2 == aCaseLindependentSVGTokenMapperList.end()) + { + return SVGTokenUnknown; + } + else + { + return aResult2->second; + } + } + return SVGTokenUnknown; } else Modified: openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtools.cxx Wed Oct 8 16:36:47 2014 @@ -646,7 +646,10 @@ namespace svgio } } - bool match_colorKeyword(basegfx::BColor& rColor, const rtl::OUString& rName) + bool match_colorKeyword( + basegfx::BColor& rColor, + const rtl::OUString& rName, + bool bCaseIndependent) { typedef std::hash_map< rtl::OUString, Color, rtl::OUStringHash > ColorTokenMapper; typedef std::pair< rtl::OUString, Color > ColorTokenValueType; @@ -803,7 +806,13 @@ namespace svgio aColorTokenMapperList.insert(ColorTokenValueType(rtl::OUString::createFromAscii("yellowgreen"), Color(154, 205, 50))); } - const ColorTokenMapper::const_iterator aResult(aColorTokenMapperList.find(rName)); + ColorTokenMapper::const_iterator aResult(aColorTokenMapperList.find(rName)); + + if(bCaseIndependent && aResult == aColorTokenMapperList.end()) + { + // also try case independent match (e.g. for Css styles) + aResult = aColorTokenMapperList.find(rName.toAsciiLowerCase()); + } if(aResult == aColorTokenMapperList.end()) { @@ -816,7 +825,10 @@ namespace svgio } } - bool read_color(const rtl::OUString& rCandidate, basegfx::BColor& rColor) + bool read_color( + const rtl::OUString& rCandidate, + basegfx::BColor& rColor, + bool bCaseIndependent) { const sal_Int32 nLen(rCandidate.getLength()); @@ -924,7 +936,7 @@ namespace svgio else { // color keyword - if(match_colorKeyword(rColor, rCandidate)) + if(match_colorKeyword(rColor, rCandidate, bCaseIndependent)) { return true; } @@ -1209,7 +1221,11 @@ namespace svgio return false; } - bool readSvgPaint(const rtl::OUString& rCandidate, SvgPaint& rSvgPaint, rtl::OUString& rURL) + bool readSvgPaint( + const rtl::OUString& rCandidate, + SvgPaint& rSvgPaint, + rtl::OUString& rURL, + bool bCaseIndependent) { const sal_Int32 nLen(rCandidate.getLength()); @@ -1217,7 +1233,7 @@ namespace svgio { basegfx::BColor aColor; - if(read_color(rCandidate, aColor)) + if(read_color(rCandidate, aColor, bCaseIndependent)) { rSvgPaint = SvgPaint(aColor, true, true); return true; @@ -1292,7 +1308,7 @@ namespace svgio if(aTokenName.getLength()) { - switch(StrToSVGToken(aTokenName.makeStringAndClear())) + switch(StrToSVGToken(aTokenName.makeStringAndClear(), false)) { case SVGTokenDefer: { Modified: openoffice/trunk/main/svgio/source/svgreader/svgtrefnode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtrefnode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtrefnode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtrefnode.cxx Wed Oct 8 16:36:47 2014 @@ -55,7 +55,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken) Modified: openoffice/trunk/main/svgio/source/svgreader/svgtspannode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgtspannode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgtspannode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgtspannode.cxx Wed Oct 8 16:36:47 2014 @@ -57,7 +57,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // read text position attributes maSvgTextPositions.parseTextPositionAttributes(rTokenName, aSVGToken, aContent); Modified: openoffice/trunk/main/svgio/source/svgreader/svgusenode.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svgio/source/svgreader/svgusenode.cxx?rev=1630170&r1=1630169&r2=1630170&view=diff ============================================================================== --- openoffice/trunk/main/svgio/source/svgreader/svgusenode.cxx (original) +++ openoffice/trunk/main/svgio/source/svgreader/svgusenode.cxx Wed Oct 8 16:36:47 2014 @@ -64,7 +64,7 @@ namespace svgio SvgNode::parseAttribute(rTokenName, aSVGToken, aContent); // read style attributes - maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent); + maSvgStyleAttributes.parseStyleAttribute(rTokenName, aSVGToken, aContent, false); // parse own switch(aSVGToken)