summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgstyleattributes.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svgio/source/svgreader/svgstyleattributes.cxx')
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx38
1 files changed, 32 insertions, 6 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 4d9448a5491f..b48431d3311d 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -183,12 +183,38 @@ namespace svgio
if(!aTokenName.isEmpty())
{
- skip_char(rCandidate, ' ', ':', nPos, nLen);
- OUStringBuffer aTokenValue;
- copyToLimiter(rCandidate, ';', nPos, aTokenValue, nLen);
- skip_char(rCandidate, ' ', ';', nPos, nLen);
- const OUString aOUTokenName(aTokenName.makeStringAndClear());
- const OUString aOUTokenValue(aTokenValue.makeStringAndClear());
+ 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());
+
+ // 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));
+
+ if(-1 != nIndexTokenImportant)
+ {
+ // if there currently just remove it and remove spaces to have the value only
+ rtl::OUString aNewOUTokenValue;
+
+ if(nIndexTokenImportant > 0)
+ {
+ // copy content before token
+ aNewOUTokenValue += aOUTokenValue.copy(0, nIndexTokenImportant);
+ }
+
+ if(aOUTokenValue.getLength() > nIndexTokenImportant + aTokenImportant.getLength())
+ {
+ // copy content after token
+ aNewOUTokenValue += aOUTokenValue.copy(nIndexTokenImportant + aTokenImportant.getLength());
+ }
+
+ // remove spaces
+ aOUTokenValue = aNewOUTokenValue.trim();
+ }
parseStyleAttribute(aOUTokenName, StrToSVGToken(aOUTokenName), aOUTokenValue);
}