svgio/inc/svgio/svgreader/svgstyleattributes.hxx | 5 - svgio/inc/svgio/svgreader/svgtoken.hxx | 2 svgio/inc/svgio/svgreader/svgtools.hxx | 6 - svgio/source/svgreader/svgcirclenode.cxx | 2 svgio/source/svgreader/svgclippathnode.cxx | 2 svgio/source/svgreader/svgdocumenthandler.cxx | 5 - svgio/source/svgreader/svgellipsenode.cxx | 2 svgio/source/svgreader/svggnode.cxx | 2 svgio/source/svgreader/svggradientnode.cxx | 2 svgio/source/svgreader/svggradientstopnode.cxx | 2 svgio/source/svgreader/svgimagenode.cxx | 2 svgio/source/svgreader/svglinenode.cxx | 2 svgio/source/svgreader/svgmarkernode.cxx | 2 svgio/source/svgreader/svgmasknode.cxx | 2 svgio/source/svgreader/svgnode.cxx | 4 svgio/source/svgreader/svgpathnode.cxx | 2 svgio/source/svgreader/svgpatternnode.cxx | 2 svgio/source/svgreader/svgpolynode.cxx | 2 svgio/source/svgreader/svgrectnode.cxx | 2 svgio/source/svgreader/svgstyleattributes.cxx | 95 +++++++++++++---------- svgio/source/svgreader/svgstylenode.cxx | 2 svgio/source/svgreader/svgsvgnode.cxx | 2 svgio/source/svgreader/svgsymbolnode.cxx | 2 svgio/source/svgreader/svgtextnode.cxx | 2 svgio/source/svgreader/svgtextpathnode.cxx | 2 svgio/source/svgreader/svgtoken.cxx | 29 ++++++- svgio/source/svgreader/svgtools.cxx | 20 +++- svgio/source/svgreader/svgtrefnode.cxx | 2 svgio/source/svgreader/svgtspannode.cxx | 2 svgio/source/svgreader/svgusenode.cxx | 2 sw/uiconfig/swriter/toolbar/textobjectbar.xml | 2 31 files changed, 129 insertions(+), 83 deletions(-)
New commits: commit bb29c5723a6053476b6f398c8550b2a839aa07fc Author: Jan Holesovsky <[email protected]> Date: Wed Oct 8 21:32:48 2014 +0200 fdo#81475: Show the Background color too. Unfortunately it means something a bit different than the highlighting, and it is hard to achieve it by other means... Change-Id: I6aced1e33ba8a9cfd73e092a90e9f45e50f5bb20 diff --git a/sw/uiconfig/swriter/toolbar/textobjectbar.xml b/sw/uiconfig/swriter/toolbar/textobjectbar.xml index 1caaf45..acf3752 100644 --- a/sw/uiconfig/swriter/toolbar/textobjectbar.xml +++ b/sw/uiconfig/swriter/toolbar/textobjectbar.xml @@ -37,7 +37,7 @@ <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:FontColor"/> <toolbar:toolbaritem xlink:href=".uno:BackColor"/> - <toolbar:toolbaritem xlink:href=".uno:BackgroundColor" toolbar:visible="false"/> + <toolbar:toolbaritem xlink:href=".uno:BackgroundColor"/> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:DefaultNumbering"/> <toolbar:toolbaritem xlink:href=".uno:DefaultBullet"/> commit 78775257a338bb348d9bd55f32ab77ba399abca9 Author: Armin Le Grand <[email protected]> Date: Wed Oct 8 16:36:47 2014 +0000 Resolves: #i125332# made css style stuff aware that it is case independent (cherry picked from commit 2b179313ac95f4ae9dc2cf8f6b6d577ea893c7a8) Conflicts: svgio/inc/svgio/svgreader/svgstyleattributes.hxx svgio/inc/svgio/svgreader/svgtoken.hxx svgio/inc/svgio/svgreader/svgtools.hxx svgio/source/svgreader/svgdocumenthandler.cxx svgio/source/svgreader/svgnode.cxx svgio/source/svgreader/svgstyleattributes.cxx svgio/source/svgreader/svgtoken.cxx svgio/source/svgreader/svgtools.cxx Change-Id: I8bac5a185feb0c7a54aa7bf816ab7aabd71a2e19 diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx index 345eb65..ab40e9d 100644 --- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx +++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx @@ -256,7 +256,8 @@ namespace svgio public: /// local attribute scanner - void parseStyleAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent); + void parseStyleAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& rContent, + bool bCaseIndependent); /// helper which does the necessary with a given path void add_text( @@ -276,7 +277,7 @@ namespace svgio const SvgStyleAttributes* getCssStyleParent() const { return mpCssStyleParent; } /// scan helpers - void readStyle(const OUString& rCandidate); + void readCssStyle(const OUString& rCandidate); const SvgStyleAttributes* getParentStyle() const; SvgStyleAttributes(SvgNode& rOwner); diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx b/svgio/inc/svgio/svgreader/svgtoken.hxx index 4596fb2..87d23b6 100644 --- a/svgio/inc/svgio/svgreader/svgtoken.hxx +++ b/svgio/inc/svgio/svgreader/svgtoken.hxx @@ -183,7 +183,7 @@ namespace svgio SVGTokenLast }; - SVGToken StrToSVGToken(const OUString& rStr); + SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent); const OUString& getStrTitle(); const OUString& getStrDesc(); diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx b/svgio/inc/svgio/svgreader/svgtools.hxx index df6cead..555a075 100644 --- a/svgio/inc/svgio/svgreader/svgtools.hxx +++ b/svgio/inc/svgio/svgreader/svgtools.hxx @@ -201,13 +201,13 @@ namespace svgio bool readNumberAndUnit(const OUString& rCandidate, sal_Int32& nPos, SvgNumber& aNum, const sal_Int32 nLen); bool readAngle(const 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 OUString& rName); - bool read_color(const OUString& rCandidate, basegfx::BColor& rColor); + bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName, bool bCaseIndependent); + bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, bool bCaseIndependent); basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider& rInfoProvider); basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, InfoProvider& rInfoProvider); bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum); bool readLocalUrl(const OUString& rCandidate, OUString& rURL); - bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL); + bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL, bool bCaseIndependent); bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& rSvgNumberVector); ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& rInput, const InfoProvider& rInfoProvider, NumberType aNumberType = length); diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx index db75fde..17031af 100644 --- a/svgio/source/svgreader/svgcirclenode.cxx +++ b/svgio/source/svgreader/svgcirclenode.cxx @@ -53,7 +53,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) diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx index 7b65f94..5e3bab1 100644 --- a/svgio/source/svgreader/svgclippathnode.cxx +++ b/svgio/source/svgreader/svgclippathnode.cxx @@ -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) diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index c3b2256..d052e46 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -172,8 +172,7 @@ namespace svgio return; if(!aName.isEmpty()) { - - const SVGToken aSVGToken(StrToSVGToken(aName)); + const SVGToken aSVGToken(StrToSVGToken(aName, false)); switch(aSVGToken) { @@ -394,7 +393,7 @@ namespace svgio { if(!aName.isEmpty()) { - 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); diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx index 03a5f6f..e23dfaa 100644 --- a/svgio/source/svgreader/svgellipsenode.cxx +++ b/svgio/source/svgreader/svgellipsenode.cxx @@ -54,7 +54,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) diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index 08786cb..306de2e 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -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) diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx index d31979b..3bc72e5 100644 --- a/svgio/source/svgreader/svggradientnode.cxx +++ b/svgio/source/svgreader/svggradientnode.cxx @@ -79,7 +79,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) diff --git a/svgio/source/svgreader/svggradientstopnode.cxx b/svgio/source/svgreader/svggradientstopnode.cxx index a1ce201..506fd13 100644 --- a/svgio/source/svgreader/svggradientstopnode.cxx +++ b/svgio/source/svgreader/svggradientstopnode.cxx @@ -49,7 +49,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) diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index cebd613..c81640f 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -71,7 +71,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) diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx index 5bba7d5..dd71ee1 100644 --- a/svgio/source/svgreader/svglinenode.cxx +++ b/svgio/source/svgreader/svglinenode.cxx @@ -54,7 +54,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) diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx index 5bad024..e9a3085 100644 --- a/svgio/source/svgreader/svgmarkernode.cxx +++ b/svgio/source/svgreader/svgmarkernode.cxx @@ -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); // parse own switch(aSVGToken) diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx index 736ce14..9e46709 100644 --- a/svgio/source/svgreader/svgmasknode.cxx +++ b/svgio/source/svgreader/svgmasknode.cxx @@ -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) diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 3e85aed..029fdf8 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -324,7 +324,7 @@ namespace svgio if(mpLocalCssStyle) { // parse and set values to it - mpLocalCssStyle->readStyle(aContent); + mpLocalCssStyle->readCssStyle(aContent); } else { @@ -342,7 +342,7 @@ namespace svgio for(sal_uInt32 a(0); a < nAttributes; a++) { const OUString aTokenName(xAttribs->getNameByIndex(a)); - const SVGToken aSVGToken(StrToSVGToken(aTokenName)); + const SVGToken aSVGToken(StrToSVGToken(aTokenName, false)); parseAttribute(aTokenName, aSVGToken, xAttribs->getValueByIndex(a)); } diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx index cf13a37..7b14b72 100644 --- a/svgio/source/svgreader/svgpathnode.cxx +++ b/svgio/source/svgreader/svgpathnode.cxx @@ -52,7 +52,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) diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx index a50892e..48e0bf0 100644 --- a/svgio/source/svgreader/svgpatternnode.cxx +++ b/svgio/source/svgreader/svgpatternnode.cxx @@ -71,7 +71,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) diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index 09da02d..5edd746 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -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) diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx index 2ee3949..fa3f1ddf 100644 --- a/svgio/source/svgreader/svgrectnode.cxx +++ b/svgio/source/svgreader/svgrectnode.cxx @@ -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) diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 82104ae..f2ba4b5 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -169,61 +169,70 @@ namespace svgio return nRetval; } - void SvgStyleAttributes::readStyle(const OUString& rCandidate) + void SvgStyleAttributes::readCssStyle(const OUString& rCandidate) { const sal_Int32 nLen(rCandidate.getLength()); sal_Int32 nPos(0); while(nPos < nLen) { - const sal_Int32 nInitPos(nPos); - skip_char(rCandidate, ' ', nPos, nLen); + // get TokenName OUStringBuffer aTokenName; + skip_char(rCandidate, sal_Unicode(' '), nPos, nLen); copyString(rCandidate, nPos, aTokenName, nLen); - if(!aTokenName.isEmpty()) + if (aTokenName.isEmpty()) { - skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(':'), nPos, nLen); - OUStringBuffer aTokenValue; - copyToLimiter(rCandidate, sal_Unicode(';'), nPos, aTokenValue, nLen); - skip_char(rCandidate, sal_Unicode(' '), sal_Unicode(';'), nPos, nLen); - const OUString aOUTokenName(aTokenName.makeStringAndClear()); - 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 - OUString aTokenImportant("!important"); - const sal_Int32 nIndexTokenImportant(aOUTokenValue.indexOf(aTokenImportant)); + // get TokenValue + 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 - OUString aNewOUTokenValue; + if (aTokenValue.isEmpty()) + { + // no value - continue + continue; + } - if(nIndexTokenImportant > 0) - { - // copy content before token - aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant); - } + // generate OUStrings + const OUString aOUTokenName(aTokenName.makeStringAndClear()); + 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 + OUString aTokenImportant("!important"); + const sal_Int32 nIndexTokenImportant(aOUTokenValue.indexOf(aTokenImportant)); - // remove spaces - aOUTokenValue = aNewOUTokenValue.trim(); + if(-1 != nIndexTokenImportant) + { + // if there currently just remove it and remove spaces to have the value only + OUString aNewOUTokenValue; + + 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); } } @@ -1235,7 +1244,11 @@ namespace svgio { } - void SvgStyleAttributes::parseStyleAttribute(const OUString& /*rTokenName*/, SVGToken aSVGToken, const OUString& aContent) + void SvgStyleAttributes::parseStyleAttribute( + const OUString& /* rTokenName */, + SVGToken aSVGToken, + const OUString& aContent, + bool bCaseIndependent) { switch(aSVGToken) { @@ -1244,7 +1257,7 @@ namespace svgio SvgPaint aSvgPaint; OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setFill(aSvgPaint); } @@ -1296,7 +1309,7 @@ namespace svgio SvgPaint aSvgPaint; OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setStroke(aSvgPaint); } @@ -1434,7 +1447,7 @@ namespace svgio SvgPaint aSvgPaint; OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setStopColor(aSvgPaint); } @@ -1707,7 +1720,7 @@ namespace svgio SvgPaint aSvgPaint; OUString aURL; - if(readSvgPaint(aContent, aSvgPaint, aURL)) + if(readSvgPaint(aContent, aSvgPaint, aURL, bCaseIndependent)) { setColor(aSvgPaint); } diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx index bca95c6..ab9fa02 100644 --- a/svgio/source/svgreader/svgstylenode.cxx +++ b/svgio/source/svgreader/svgstylenode.cxx @@ -154,7 +154,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()); diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index d6d2a83..dcc0bf9 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -121,7 +121,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) diff --git a/svgio/source/svgreader/svgsymbolnode.cxx b/svgio/source/svgreader/svgsymbolnode.cxx index c131059..78cbb4c 100644 --- a/svgio/source/svgreader/svgsymbolnode.cxx +++ b/svgio/source/svgreader/svgsymbolnode.cxx @@ -51,7 +51,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) diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx index 9ef3c7f..21c973c 100644 --- a/svgio/source/svgreader/svgtextnode.cxx +++ b/svgio/source/svgreader/svgtextnode.cxx @@ -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); // read text position attributes maSvgTextPositions.parseTextPositionAttributes(rTokenName, aSVGToken, aContent); diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index aba2624..a737426 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -273,7 +273,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) diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index db494b1..0e3793f 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -162,7 +162,7 @@ namespace svgio static OUString aSVGStrFlowRoot("flowRoot"); - SVGToken StrToSVGToken(const OUString& rStr) + SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent) { typedef boost::unordered_map< OUString, SVGToken, OUStringHash,::std::equal_to< OUString > > SVGTokenMapper; typedef std::pair< OUString, SVGToken > SVGTokenValueType; @@ -311,6 +311,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 diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 8c7ba0f..f3faa47 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -633,7 +633,7 @@ namespace svgio } } - bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName) + bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName, bool bCaseIndependent) { typedef boost::unordered_map< OUString, Color, OUStringHash, @@ -793,7 +793,13 @@ namespace svgio aColorTokenMapperList.insert(ColorTokenValueType(OUString("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()) { @@ -806,7 +812,7 @@ namespace svgio } } - bool read_color(const OUString& rCandidate, basegfx::BColor& rColor) + bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, bool bCaseIndependent) { const sal_Int32 nLen(rCandidate.getLength()); @@ -914,7 +920,7 @@ namespace svgio else { // color keyword - if(match_colorKeyword(rColor, rCandidate)) + if(match_colorKeyword(rColor, rCandidate, bCaseIndependent)) { return true; } @@ -1199,13 +1205,13 @@ namespace svgio return false; } - bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL) + bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL, bool bCaseIndependent) { if( !rCandidate.isEmpty() ) { basegfx::BColor aColor; - if(read_color(rCandidate, aColor)) + if(read_color(rCandidate, aColor, bCaseIndependent)) { rSvgPaint = SvgPaint(aColor, true, true); return true; @@ -1277,7 +1283,7 @@ namespace svgio if(!aTokenName.isEmpty()) { - switch(StrToSVGToken(aTokenName.makeStringAndClear())) + switch(StrToSVGToken(aTokenName.makeStringAndClear(), false)) { case SVGTokenDefer: { diff --git a/svgio/source/svgreader/svgtrefnode.cxx b/svgio/source/svgreader/svgtrefnode.cxx index 961e1a4..f698794 100644 --- a/svgio/source/svgreader/svgtrefnode.cxx +++ b/svgio/source/svgreader/svgtrefnode.cxx @@ -48,7 +48,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) diff --git a/svgio/source/svgreader/svgtspannode.cxx b/svgio/source/svgreader/svgtspannode.cxx index b837e72..ecbca4d 100644 --- a/svgio/source/svgreader/svgtspannode.cxx +++ b/svgio/source/svgreader/svgtspannode.cxx @@ -48,7 +48,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); diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx index c0220b7..42d5c31 100644 --- a/svgio/source/svgreader/svgusenode.cxx +++ b/svgio/source/svgreader/svgusenode.cxx @@ -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) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
