tdf#96364 SVG: Parse 'color' and 'style' before the rest of attributes
'fill', 'stroke' and 'stop-color' might depend on them Change-Id: I8b709dafe0ad0423a87911af7f2c83fa81e61cbd Reviewed-on: https://gerrit.libreoffice.org/20653 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
This commit is contained in:
parent
0cae9c32ce
commit
5821c8949e
@ -337,11 +337,25 @@ struct AnnotatingVisitor
|
|||||||
const sal_Int32 nNumAttrs( xAttributes->getLength() );
|
const sal_Int32 nNumAttrs( xAttributes->getLength() );
|
||||||
maGradientStopVector.push_back(GradientStop());
|
maGradientStopVector.push_back(GradientStop());
|
||||||
maGradientVector.back().maStops.push_back(maGradientStopVector.size()-1);
|
maGradientVector.back().maStops.push_back(maGradientStopVector.size()-1);
|
||||||
for( sal_Int32 i=0; i<nNumAttrs; ++i )
|
|
||||||
{
|
// first parse 'color' as 'stop-color' might depend on it
|
||||||
|
// if 'stop-color''s value is "currentColor" and parsed previously
|
||||||
|
uno::Reference<xml::dom::XNode> xNodeColor(xAttributes->getNamedItem("color"));
|
||||||
|
if(xNodeColor.is())
|
||||||
parseGradientStop( maGradientStopVector.back(),
|
parseGradientStop( maGradientStopVector.back(),
|
||||||
maGradientStopVector.size()-1,
|
maGradientStopVector.size()-1,
|
||||||
getTokenId(xAttributes->item(i)->getNodeName()),
|
XML_STOP_COLOR,
|
||||||
|
xNodeColor->getNodeValue() );
|
||||||
|
|
||||||
|
//now, parse the rest of attributes
|
||||||
|
for( sal_Int32 i=0; i<nNumAttrs; ++i )
|
||||||
|
{
|
||||||
|
const sal_Int32 nTokenId(
|
||||||
|
getTokenId(xAttributes->item(i)->getNodeName()));
|
||||||
|
if ( nTokenId != XML_COLOR )
|
||||||
|
parseGradientStop( maGradientStopVector.back(),
|
||||||
|
maGradientStopVector.size()-1,
|
||||||
|
nTokenId,
|
||||||
xAttributes->item(i)->getNodeValue() );
|
xAttributes->item(i)->getNodeValue() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -353,30 +367,35 @@ struct AnnotatingVisitor
|
|||||||
maCurrState.maTransform.identity();
|
maCurrState.maTransform.identity();
|
||||||
maCurrState.maViewBox.reset();
|
maCurrState.maViewBox.reset();
|
||||||
|
|
||||||
// scan for style info
|
// first parse 'color' and 'style' as 'fill' and 'stroke' might depend on them
|
||||||
|
// if their values are "currentColor" and parsed previously
|
||||||
|
uno::Reference<xml::dom::XNode> xNodeColor(xAttributes->getNamedItem("color"));
|
||||||
|
if(xNodeColor.is())
|
||||||
|
parseAttribute(XML_COLOR, xNodeColor->getNodeValue());
|
||||||
|
|
||||||
|
uno::Reference<xml::dom::XNode> xNodeStyle(xAttributes->getNamedItem("style"));
|
||||||
|
if(xNodeStyle.is())
|
||||||
|
parseStyle(xNodeStyle->getNodeValue());
|
||||||
|
|
||||||
const sal_Int32 nNumAttrs( xAttributes->getLength() );
|
const sal_Int32 nNumAttrs( xAttributes->getLength() );
|
||||||
OUString sAttributeValue;
|
OUString sAttributeValue;
|
||||||
|
|
||||||
|
//now, parse the rest of attributes
|
||||||
for( sal_Int32 i=0; i<nNumAttrs; ++i )
|
for( sal_Int32 i=0; i<nNumAttrs; ++i )
|
||||||
{
|
{
|
||||||
sAttributeValue = xAttributes->item(i)->getNodeValue();
|
sAttributeValue = xAttributes->item(i)->getNodeValue();
|
||||||
const sal_Int32 nTokenId(
|
const sal_Int32 nTokenId(
|
||||||
getTokenId(xAttributes->item(i)->getNodeName()));
|
getTokenId(xAttributes->item(i)->getNodeName()));
|
||||||
if( XML_STYLE == nTokenId )
|
|
||||||
parseStyle(sAttributeValue);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( XML_ID == nTokenId )
|
if( XML_ID == nTokenId )
|
||||||
{
|
{
|
||||||
maElementVector.push_back(xElem);
|
maElementVector.push_back(xElem);
|
||||||
maElementIdMap.insert(std::make_pair(sAttributeValue,
|
maElementIdMap.insert(std::make_pair(sAttributeValue,
|
||||||
maElementVector.size() - 1));
|
maElementVector.size() - 1));
|
||||||
}
|
}
|
||||||
else
|
else if ( nTokenId != XML_COLOR || nTokenId != XML_STYLE )
|
||||||
parseAttribute(nTokenId,
|
parseAttribute(nTokenId,
|
||||||
sAttributeValue);
|
sAttributeValue);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// all attributes parsed, can calc total CTM now
|
// all attributes parsed, can calc total CTM now
|
||||||
basegfx::B2DHomMatrix aLocalTransform;
|
basegfx::B2DHomMatrix aLocalTransform;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user