summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-06-15 22:18:34 +0200
committerRegina Henschel <rb.henschel@t-online.de>2023-06-16 10:35:23 +0200
commit2b1b2a758cc4666c6cf6b147722223281dfe1f30 (patch)
treed3644e84cf4aa4fb14e7541e3cf5da7d801c6291 /oox/source
parentc66afb209de6132deac8fee9425a351391edc89e (diff)
tdf#155852 same method for StepCount in OOXML as in rendering
Rendering of stepped gradients uses a method that doesn't take the color from a cut point, but before or after respectively. For example, for StepCount 4, the colors at relative positions 0, 1/3, 2/3 and 1 are used. So sections are 'start color', '1/3 color', '2/3 color' and 'end color'. The output to OOXML now uses the same method. That way rendering in a produced pptx-file is the same as in the original odp-file. Since OOXML has nothing similar to StepCount, it is an export only problem. A second problem comes from the cuddle with StepCount in Gradient struct in API and FillStepCount in shape property set. The draw:gradient-stop-count attribute in ODF belongs to the graphic style of the shape. The gradient definition itself in the <draw:gradient> element has nothing about step count. When a file is opened, it can be that the StepCount component in the Gradient struct still has the default value 0, but the FillStepCount property has the correct value of the shape. The Gradient struct in the API should not have a component StepCount to be compatible with ODF. But the API is published and changing that struct is far-reaching in the code. So the fix here is not a general solution but solves the problem for export to OOXML by reading the FillStepCount property while exporting. Change-Id: Ie1cafe6bdda7c4d74b05f279f0d8212ff67ecc92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153154 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/export/drawingml.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index dca260895af8..1cef93c8732d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -663,6 +663,16 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
fTransparency = nTransparency * 0.01;
}
+ // tdf#155852 The gradient might wrongly have StepCount==0, as the draw:gradient-step-count
+ // attribute in ODF does not belong to the gradient definition but is an attribute in
+ // the graphic style of the shape.
+ if (GetProperty(rXPropSet, "FillGradientStepCount"))
+ {
+ sal_Int16 nStepCount = 0;
+ mAny >>= nStepCount;
+ aGradient.SetSteps(nStepCount);
+ }
+
WriteGradientFill(&aGradient, 0, pTransparenceGradient, fTransparency);
mpFS->endElementNS(XML_a, XML_gradFill);