diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-10-09 17:51:50 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-10-09 18:03:49 +0200 |
commit | aadda5d17f6e422da143ea774f759bfc5f629c5b (patch) | |
tree | 753fcbc7c0da18a7f4f2b2152db79a1c84d4f688 /xmloff | |
parent | a8f053697c6c6cfa07ce200165df8a1c9968a9de (diff) |
xmloff: fix ODF import of gradient draw:angle attribute a bit
ODF 1.2 part 3, 18.3.1 angle, says "An angle, as defined in §4.1 of
[SVG]" and "If no unit identifier is specified, the value is assumed to
be in degrees."
Unfortunately OOo could only read and write 10th of degree here.
See also https://issues.oasis-open.org/browse/OFFICE-3774
As the first step towards fixing that, implement the import for
draw:angle values with an angle unit identifier, but leave the import
as-is if the angle identifier is missing.
Change-Id: Ib88d417c03998ebcfc569b01492f0e1f851bbc85
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/style/TransGradientStyle.cxx | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 0ef830b3616c..0ad8c74c9044 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -178,9 +178,9 @@ bool XMLGradientStyleImport::importXML( break; case XML_TOK_GRADIENT_ANGLE: { - sal_Int32 nValue; - ::sax::Converter::convertNumber( nValue, rStrValue, 0, 3600 ); - aGradient.Angle = sal_Int16( nValue ); + bool const bSuccess = + ::sax::Converter::convertAngle(aGradient.Angle, rStrValue); + SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle"); } break; case XML_TOK_GRADIENT_BORDER: @@ -288,7 +288,7 @@ bool XMLGradientStyleExport::exportXML( // Angle if( aGradient.Style != awt::GradientStyle_RADIAL ) { - ::sax::Converter::convertNumber(aOut, sal_Int32(aGradient.Angle)); + ::sax::Converter::convertAngle(aOut, aGradient.Angle); aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue ); } diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx index 85c66ec3eafb..7b1ca1515193 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -178,9 +178,9 @@ bool XMLTransGradientStyleImport::importXML( break; case XML_TOK_GRADIENT_ANGLE: { - sal_Int32 nValue; - ::sax::Converter::convertNumber( nValue, rStrValue, 0, 3600 ); - aGradient.Angle = sal_Int16( nValue ); + bool const bSuccess = + ::sax::Converter::convertAngle(aGradient.Angle, rStrValue); + SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle"); } break; case XML_TOK_GRADIENT_BORDER: @@ -285,8 +285,7 @@ bool XMLTransGradientStyleExport::exportXML( // Angle if( aGradient.Style != awt::GradientStyle_RADIAL ) { - ::sax::Converter::convertNumber( - aOut, sal_Int32(aGradient.Angle)); + ::sax::Converter::convertAngle(aOut, aGradient.Angle); aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue ); } |