diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/style/TransGradientStyle.cxx | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 97721db74ea3..3a8a5bedc444 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/awt/Gradient.hpp> #include <sax/tools/converter.hxx> +#include <comphelper/documentconstants.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmluconv.hxx> @@ -160,8 +161,14 @@ void XMLGradientStyleImport::importXML( break; case XML_TOK_GRADIENT_ANGLE: { + auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); bool const bSuccess = - ::sax::Converter::convertAngle(aGradient.Angle, rStrValue); + ::sax::Converter::convertAngle(aGradient.Angle, rStrValue, + // tdf#89475 try to detect borked OOo angles + (cmp12 < 0) || (cmp12 == 0 + && (rImport.isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_7x) + // also for AOO 4.x, assume there won't ever be a 4.2 + || rImport.getGeneratorVersion() == SvXMLImport::AOO_4x))); SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle"); } break; @@ -260,7 +267,7 @@ void XMLGradientStyleExport::exportXML( // Angle if( aGradient.Style != awt::GradientStyle_RADIAL ) { - ::sax::Converter::convertAngle(aOut, aGradient.Angle); + ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion()); 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 0dce37fcae3e..536ba39d26b3 100644 --- a/xmloff/source/style/TransGradientStyle.cxx +++ b/xmloff/source/style/TransGradientStyle.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/awt/Gradient.hpp> #include <sax/tools/converter.hxx> +#include <comphelper/documentconstants.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmluconv.hxx> @@ -171,8 +172,14 @@ void XMLTransGradientStyleImport::importXML( break; case XML_TOK_GRADIENT_ANGLE: { + auto const cmp12(rImport.GetODFVersion().compareTo(ODFVER_012_TEXT)); bool const bSuccess = - ::sax::Converter::convertAngle(aGradient.Angle, rStrValue); + ::sax::Converter::convertAngle(aGradient.Angle, rStrValue, + // tdf#89475 try to detect borked OOo angles + (cmp12 < 0) || (cmp12 == 0 + && (rImport.isGeneratorVersionOlderThan(SvXMLImport::AOO_4x, SvXMLImport::LO_7x) + // also for AOO 4.x, assume there won't ever be a 4.2 + || rImport.getGeneratorVersion() == SvXMLImport::AOO_4x))); SAL_INFO_IF(!bSuccess, "xmloff.style", "failed to import draw:angle"); } break; @@ -265,7 +272,7 @@ void XMLTransGradientStyleExport::exportXML( // Angle if( aGradient.Style != awt::GradientStyle_RADIAL ) { - ::sax::Converter::convertAngle(aOut, aGradient.Angle); + ::sax::Converter::convertAngle(aOut, aGradient.Angle, rExport.getSaneDefaultVersion()); aStrValue = aOut.makeStringAndClear(); rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GRADIENT_ANGLE, aStrValue ); } |