summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-06-03 14:56:29 +0200
committerAndras Timar <andras.timar@collabora.com>2023-06-07 08:28:02 +0200
commita48c2b3561bc27f45954b250d277ae2edf56c75d (patch)
tree53394f154d5c4348c15c9a8f9fda9810bcefe4b9 /include
parentfc53a8a2726b68c0e756ce54049a99f87872ca5e (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 'include')
-rw-r--r--include/basegfx/utils/bgradient.hxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/basegfx/utils/bgradient.hxx b/include/basegfx/utils/bgradient.hxx
index b7c2cf8c9e3f..fd8dcae7e2d2 100644
--- a/include/basegfx/utils/bgradient.hxx
+++ b/include/basegfx/utils/bgradient.hxx
@@ -273,6 +273,9 @@ public:
// try to detect if an empty/no-color-change area exists
// at the start and return offset to it. Returns 0.0 if not.
double detectPossibleOffsetAtStart() const;
+
+ // returns true if the color stops are symmetrical in color and offset, otherwise false.
+ bool isSymmetrical() const;
};
class BASEGFX_DLLPUBLIC BGradient final
@@ -338,6 +341,10 @@ public:
void tryToRecreateBorder(basegfx::BColorStops* pAssociatedTransparencyStops = nullptr);
void tryToApplyBorder();
void tryToApplyStartEndIntensity();
+
+ // If a linear gradient is symmetrical it is converted to an axial gradient.
+ // Does nothing in other cases and for other gradient types.
+ void tryToConvertToAxial();
};
}