summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-10-08 16:36:47 +0000
committerArmin Le Grand <alg@apache.org>2014-10-08 16:36:47 +0000
commit2b179313ac95f4ae9dc2cf8f6b6d577ea893c7a8 (patch)
treecf04a44b0bd00f0debe8189862655ad02122687c
parentf077f99da3cb2903fa903dcf30e6cfd714fd009c (diff)
i125332 made css style stuff aware that it is case independent
Notes
Notes: merged as: 78775257a338bb348d9bd55f32ab77ba399abca9
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx8
-rw-r--r--svgio/inc/svgio/svgreader/svgtoken.hxx2
-rw-r--r--svgio/inc/svgio/svgreader/svgtools.hxx16
-rw-r--r--svgio/source/svgreader/svgcirclenode.cxx2
-rw-r--r--svgio/source/svgreader/svgclippathnode.cxx2
-rw-r--r--svgio/source/svgreader/svgdocumenthandler.cxx4
-rw-r--r--svgio/source/svgreader/svgellipsenode.cxx2
-rw-r--r--svgio/source/svgreader/svggnode.cxx2
-rw-r--r--svgio/source/svgreader/svggradientnode.cxx2
-rw-r--r--svgio/source/svgreader/svggradientstopnode.cxx2
-rw-r--r--svgio/source/svgreader/svgimagenode.cxx2
-rw-r--r--svgio/source/svgreader/svglinenode.cxx2
-rw-r--r--svgio/source/svgreader/svgmarkernode.cxx2
-rw-r--r--svgio/source/svgreader/svgmasknode.cxx2
-rw-r--r--svgio/source/svgreader/svgnode.cxx4
-rw-r--r--svgio/source/svgreader/svgpathnode.cxx2
-rw-r--r--svgio/source/svgreader/svgpatternnode.cxx2
-rw-r--r--svgio/source/svgreader/svgpolynode.cxx2
-rw-r--r--svgio/source/svgreader/svgrectnode.cxx2
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx95
-rw-r--r--svgio/source/svgreader/svgstylenode.cxx2
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx2
-rw-r--r--svgio/source/svgreader/svgsymbolnode.cxx2
-rw-r--r--svgio/source/svgreader/svgtextnode.cxx2
-rw-r--r--svgio/source/svgreader/svgtextpathnode.cxx2
-rw-r--r--svgio/source/svgreader/svgtoken.cxx29
-rw-r--r--svgio/source/svgreader/svgtools.cxx30
-rw-r--r--svgio/source/svgreader/svgtrefnode.cxx2
-rw-r--r--svgio/source/svgreader/svgtspannode.cxx2
-rw-r--r--svgio/source/svgreader/svgusenode.cxx2
30 files changed, 151 insertions, 81 deletions
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 36e60ac1acda..3911e6b49945 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -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);
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx b/svgio/inc/svgio/svgreader/svgtoken.hxx
index 19c5653c0efe..a20ae26325ed 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -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();
diff --git a/svgio/inc/svgio/svgreader/svgtools.hxx b/svgio/inc/svgio/svgreader/svgtools.hxx
index c7b0dca976f5..a138d833e4c5 100644
--- a/svgio/inc/svgio/svgreader/svgtools.hxx
+++ b/svgio/inc/svgio/svgreader/svgtools.hxx
@@ -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);
diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx
index 714d10b2845d..8fbaf2059205 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.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/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index 82003ed2c039..6fef47a538d6 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx
index f28921dccd4b..3e7e5ca379ac 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -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);
diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx
index afe650c74d10..cb3bb0906081 100644
--- a/svgio/source/svgreader/svgellipsenode.cxx
+++ b/svgio/source/svgreader/svgellipsenode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx
index 97ace93f4832..b33f2c03583b 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx
index 48c5ea27e19f..7623c7a6e009 100644
--- a/svgio/source/svgreader/svggradientnode.cxx
+++ b/svgio/source/svgreader/svggradientnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svggradientstopnode.cxx b/svgio/source/svgreader/svggradientstopnode.cxx
index 51cc5cf9d21e..f309fc58e239 100644
--- a/svgio/source/svgreader/svggradientstopnode.cxx
+++ b/svgio/source/svgreader/svggradientstopnode.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/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index a96e60bba7be..4014766e067b 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx
index ac6577c0a087..d67dab82224f 100644
--- a/svgio/source/svgreader/svglinenode.cxx
+++ b/svgio/source/svgreader/svglinenode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx
index 134898ed2ce8..b9b218c5850b 100644
--- a/svgio/source/svgreader/svgmarkernode.cxx
+++ b/svgio/source/svgreader/svgmarkernode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx
index 231e4ed856f3..99fe962a2e54 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index a631312ad406..5f4afdfb6abf 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -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));
}
diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx
index 2dd5088a7c60..3466153ab38f 100644
--- a/svgio/source/svgreader/svgpathnode.cxx
+++ b/svgio/source/svgreader/svgpathnode.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/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index 4610649f3e4d..a633b8b3b16e 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx
index a738f8015886..bf9f6d574dcb 100644
--- a/svgio/source/svgreader/svgpolynode.cxx
+++ b/svgio/source/svgreader/svgpolynode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx
index ae096d155551..7b4c2b4cdff0 100644
--- a/svgio/source/svgreader/svgrectnode.cxx
+++ b/svgio/source/svgreader/svgrectnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index b0bf2b048f1d..0fa54d175150 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -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);
}
diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx
index 48482d1140f4..d9317fc77a6e 100644
--- a/svgio/source/svgreader/svgstylenode.cxx
+++ b/svgio/source/svgreader/svgstylenode.cxx
@@ -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());
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index 0a160696a274..7bc5de104fef 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgsymbolnode.cxx b/svgio/source/svgreader/svgsymbolnode.cxx
index e799b2e29f66..773b5cfdb9ac 100644
--- a/svgio/source/svgreader/svgsymbolnode.cxx
+++ b/svgio/source/svgreader/svgsymbolnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx
index e40a0afc0c4e..c76754de171a 100644
--- a/svgio/source/svgreader/svgtextnode.cxx
+++ b/svgio/source/svgreader/svgtextnode.cxx
@@ -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);
diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx
index 7c0d874fdb74..fcc4cb3bcdd0 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -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)
diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx
index 20e8bd24ead9..15eb5dc66102 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -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
diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx
index ed35eed9db02..ee0da7ff635a 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -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:
{
diff --git a/svgio/source/svgreader/svgtrefnode.cxx b/svgio/source/svgreader/svgtrefnode.cxx
index c6f0746535f0..f15ead816ba6 100644
--- a/svgio/source/svgreader/svgtrefnode.cxx
+++ b/svgio/source/svgreader/svgtrefnode.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/svgtspannode.cxx b/svgio/source/svgreader/svgtspannode.cxx
index 3f280df06443..920e94796bd6 100644
--- a/svgio/source/svgreader/svgtspannode.cxx
+++ b/svgio/source/svgreader/svgtspannode.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);
// read text position attributes
maSvgTextPositions.parseTextPositionAttributes(rTokenName, aSVGToken, aContent);
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index 123dffdfc1a8..9c586ecc7cc4 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -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)