summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-10-08 16:36:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-10-08 20:58:42 +0100
commit78775257a338bb348d9bd55f32ab77ba399abca9 (patch)
tree2f53e362e16e8f50a9d31125f2a5a9e8583f898c /svgio
parentb77b1ba8f0ec18d37c0bfdd795a1a9726df01482 (diff)
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
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx5
-rw-r--r--svgio/inc/svgio/svgreader/svgtoken.hxx2
-rw-r--r--svgio/inc/svgio/svgreader/svgtools.hxx6
-rw-r--r--svgio/source/svgreader/svgcirclenode.cxx2
-rw-r--r--svgio/source/svgreader/svgclippathnode.cxx2
-rw-r--r--svgio/source/svgreader/svgdocumenthandler.cxx5
-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.cxx20
-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, 128 insertions, 82 deletions
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 345eb651810a..ab40e9de0f4b 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 4596fb2118d0..87d23b663b49 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 df6cead11730..555a075befa4 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 db75fde1a308..17031af2bf20 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 7b65f943fa24..5e3bab11356d 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 c3b22568aa87..d052e46334e3 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 03a5f6fa4360..e23dfaa62c01 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 08786cbb81f9..306de2e15a29 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 d31979bbaf9f..3bc72e5ef92a 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 a1ce201da260..506fd13ae4ff 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 cebd6137a4d2..c81640f5b2e7 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 5bba7d50acc8..dd71ee184f29 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 5bad024c48a6..e9a3085d072c 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 736ce1489036..9e467091a07f 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 3e85aedbe75d..029fdf88fc9d 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 cf13a37fe548..7b14b727d5cf 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 a50892e9ac77..48e0bf03d0d6 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 09da02daefba..5edd74696dee 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 2ee394968f7f..fa3f1ddff90c 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 82104ae99d47..f2ba4b5ecfa8 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 bca95c6cd423..ab9fa025ec25 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 d6d2a8379573..dcc0bf9ee823 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 c1310597ab60..78cbb4c75d2e 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 9ef3c7fc726e..21c973c5c0ec 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 aba2624bf7a4..a73742651b01 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 db494b12bfea..0e3793f7c7f4 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 8c7ba0f5f573..f3faa470a679 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 961e1a46dcd9..f698794e9e80 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 b837e72246be..ecbca4d441dd 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 c0220b70ae93..42d5c3111d25 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)