diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-10-09 17:51:50 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-10-17 23:23:23 +0200 |
commit | 26dcd66646800bd343e2e49a6a45c5ed91d3bdec (patch) | |
tree | 69e44bc5f8d8ced35a3b4163f18b1e36f1e76991 /xmloff | |
parent | 92e24ae6f1a53370534e1b61514d519533f0fb4b (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
(cherry picked from commit aadda5d17f6e422da143ea774f759bfc5f629c5b)
Reviewed-on: https://gerrit.libreoffice.org/19283
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 76a4665a09542fb67dd99c9a607c162e0b678ead)
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 ); } |