summaryrefslogtreecommitdiff
path: root/xmloff/source/style/GradientStyle.cxx
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-06-03 14:56:29 +0200
committerRegina Henschel <rb.henschel@t-online.de>2023-06-05 17:34:57 +0200
commit6c49886ab46c53398d74610b264e5edb0332a059 (patch)
tree4be7b6fcc85f2ca9388ed0a470d035a7cb7a3c7d /xmloff/source/style/GradientStyle.cxx
parent6014fd047a62e1a002cc27334e39e1d2e54e342f (diff)
tdf#155549 MCGR: Recreate 'axial' from symmetric 'linear'
When exporting a shape with an axial gradient fill to OOXML, it is converted to a linear gradient with multiple color stops. Versions before MCGR had recreated it as axial gradient on import from OOXML. But now LO is able to handle multiple color stops and so the linear gradient from OOXML is imported as linear gradient in LO. When such file is then written as ODF, the multiple color stops are in elements in extended namespace and versions before MCGR do not understand them. They show only the first and last color (which are equal) and the gradient is lost. With this patch LO converts the linear gradient back to an axial gradient on export to ODF. The exported axial gradient is rendered in a version with MCGR same as the linear gradient when opening the OOXML file. The difference is, that versions without MCGR now render an axial gradient with two colors. Change-Id: I2b416b4cdca75d8327107a4f259d63c2e6e97ac3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152574 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'xmloff/source/style/GradientStyle.cxx')
-rw-r--r--xmloff/source/style/GradientStyle.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
index 7598074fc409..d80b3f866482 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -228,6 +228,11 @@ void XMLGradientStyleExport::exportXML(
basegfx::BGradient aGradient(rValue);
+ // Export of axial gradient to OOXML produces a symmetrical linear multi-color gradient. Import
+ // does not regenerate it as 'axial' because that is not needed for MCGR. For export to ODF we
+ // try to regenerate 'axial' for to get a better compatibility with LO versions before MCGR.
+ aGradient.tryToConvertToAxial();
+
// MCGR: For better compatibility with LO versions before MCGR, try
// to re-create a 'border' value based on the existing gradient stops.
// With MCGR we do not need 'border' anymore in quite some cases since