summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-01-10 13:59:16 +0000
committerArmin Le Grand <alg@apache.org>2012-01-10 13:59:16 +0000
commitca69b789a3e7b693b9d1d3ee5f3235a0be59834a (patch)
tree30ec6873aa87cba9f5bbcc4384277eb2a4bcc177 /svgio/source/svgreader
parentd1b5144a3df73572ec5a613db03358429cb04d22 (diff)
#118737# Support multiple styles in a css/style statement, use the right identifiers for polygon and polynode
Diffstat (limited to 'svgio/source/svgreader')
-rw-r--r--svgio/source/svgreader/svgpolynode.cxx5
-rw-r--r--svgio/source/svgreader/svgstylenode.cxx43
2 files changed, 30 insertions, 18 deletions
diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx
index efe1f74ae080..8cf572c3c7e8 100644
--- a/svgio/source/svgreader/svgpolynode.cxx
+++ b/svgio/source/svgreader/svgpolynode.cxx
@@ -52,8 +52,9 @@ namespace svgio
const SvgStyleAttributes* SvgPolyNode::getSvgStyleAttributes() const
{
- static rtl::OUString aClassStr(rtl::OUString::createFromAscii("poly"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
+ static rtl::OUString aClassStrA(rtl::OUString::createFromAscii("polygon"));
+ static rtl::OUString aClassStrB(rtl::OUString::createFromAscii("polyline"));
+ maSvgStyleAttributes.checkForCssStyle(mbIsPolyline? aClassStrB : aClassStrA);
return &maSvgStyleAttributes;
}
diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx
index 5b0bbc092ff6..e72c3becbf95 100644
--- a/svgio/source/svgreader/svgstylenode.cxx
+++ b/svgio/source/svgreader/svgstylenode.cxx
@@ -86,27 +86,38 @@ namespace svgio
sal_Int32 nPos(0);
rtl::OUStringBuffer aTokenValue;
- skip_char(aContent, sal_Unicode(' '), sal_Unicode('#'), nPos, nLen);
- copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
- const rtl::OUString aStyleName = aTokenValue.makeStringAndClear().trim();
-
- if(aStyleName.getLength())
+ while(nPos < nLen)
{
- skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
- copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen);
- const rtl::OUString aStyleContent = aTokenValue.makeStringAndClear().trim();
+ const sal_Int32 nInitPos(nPos);
+ skip_char(aContent, sal_Unicode(' '), sal_Unicode('#'), nPos, nLen);
+ copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
+ const rtl::OUString aStyleName = aTokenValue.makeStringAndClear().trim();
- if(aStyleContent.getLength())
+ if(aStyleName.getLength() && nPos < nLen)
{
- // create new style
- SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
- maSvgStyleAttributes.push_back(pNewStyle);
+ skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
+ copyToLimiter(aContent, sal_Unicode('}'), nPos, aTokenValue, nLen);
+ skip_char(aContent, sal_Unicode(' '), sal_Unicode('}'), nPos, nLen);
+ const rtl::OUString aStyleContent = aTokenValue.makeStringAndClear().trim();
+
+ if(aStyleContent.getLength())
+ {
+ // create new style
+ SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);
+ maSvgStyleAttributes.push_back(pNewStyle);
- // fill with content
- pNewStyle->readStyle(aStyleContent);
+ // fill with content
+ pNewStyle->readStyle(aStyleContent);
- // register new style at document
- const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aStyleName, *pNewStyle);
+ // register new style at document
+ const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aStyleName, *pNewStyle);
+ }
+ }
+
+ if(nInitPos == nPos)
+ {
+ OSL_ENSURE(false, "Could not interpret on current position (!)");
+ nPos++;
}
}
}