summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgstylenode.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-07-25 15:38:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-07-26 14:51:33 +0100
commit0347e5c77d281e4a25f79660aafb625691c4f883 (patch)
tree1878ccaa3f4fb7dcf878566ccc672912d11863dc /svgio/source/svgreader/svgstylenode.cxx
parente5dd2e8826433566e223d0572ed73f21d0b992f1 (diff)
Related: #i125293# Further corrections for CssStyle handling in SVG importer
(cherry picked from commit f00d6d2ea3e73e687edb1da4c32c0960eaf5010b) Conflicts: svgio/source/svgreader/svgnode.cxx svgio/source/svgreader/svgstyleattributes.cxx svgio/source/svgreader/svgstylenode.cxx svgio/source/svgreader/svgsvgnode.cxx Change-Id: I335b292fcdf1ebac925c9fd76ad624efb923447d
Diffstat (limited to 'svgio/source/svgreader/svgstylenode.cxx')
-rw-r--r--svgio/source/svgreader/svgstylenode.cxx53
1 files changed, 43 insertions, 10 deletions
diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx
index 99f7ff53e9ce..b17c52853db1 100644
--- a/svgio/source/svgreader/svgstylenode.cxx
+++ b/svgio/source/svgreader/svgstylenode.cxx
@@ -92,17 +92,42 @@ namespace svgio
while(nPos < nLen)
{
+ // read the full style node names (may be multiple) and put to aStyleName
const sal_Int32 nInitPos(nPos);
- skip_char(aContent, ' ', '#', nPos, nLen);
- copyToLimiter(aContent, '{', nPos, aTokenValue, nLen);
- const OUString aStyleName = aTokenValue.makeStringAndClear().trim();
+ skip_char(aContent, sal_Unicode(' '), nPos, nLen);
+ copyToLimiter(aContent, sal_Unicode('{'), nPos, aTokenValue, nLen);
+ skip_char(aContent, sal_Unicode(' '), sal_Unicode('{'), nPos, nLen);
- if(!aStyleName.isEmpty() && nPos < nLen)
+ const rtl::OUString aStyleName(aTokenValue.makeStringAndClear().trim());
+ const sal_Int32 nLen2(aStyleName.getLength());
+ std::vector< rtl::OUString > aStyleNames;
+
+ if(nLen2)
{
- skip_char(aContent, ' ', '{', nPos, nLen);
- copyToLimiter(aContent, '}', nPos, aTokenValue, nLen);
- skip_char(aContent, ' ', '}', nPos, nLen);
- const OUString aStyleContent = aTokenValue.makeStringAndClear().trim();
+ // extract names
+ sal_Int32 nPos2(0);
+ rtl::OUStringBuffer aSingleName;
+
+ while(nPos2 < nLen2)
+ {
+ skip_char(aStyleName, sal_Unicode('#'), nPos2, nLen2);
+ copyToLimiter(aStyleName, sal_Unicode(' '), nPos2, aSingleName, nLen2);
+ skip_char(aStyleName, sal_Unicode(' '), nPos2, nLen2);
+
+ const rtl::OUString aOUSingleName(aSingleName.makeStringAndClear().trim());
+
+ if(aOUSingleName.getLength())
+ {
+ aStyleNames.push_back(aOUSingleName);
+ }
+ }
+ }
+
+ if(aStyleNames.size() && 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.isEmpty())
{
@@ -113,8 +138,16 @@ namespace svgio
// fill with content
pNewStyle->readStyle(aStyleContent);
- // register new style at document
- const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aStyleName, *pNewStyle);
+ // concatenate combined style name
+ rtl::OUString aConcatenatedStyleName;
+
+ for(sal_uInt32 a(0); a < aStyleNames.size(); a++)
+ {
+ aConcatenatedStyleName += aStyleNames[a];
+ }
+
+ // register new style at document for (evtl. concatenated) stylename
+ const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aConcatenatedStyleName, *pNewStyle);
}
}