diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-04-20 18:16:50 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-04-27 13:20:02 +0200 |
commit | cf19ed587de53a3d4c737c01d9bb1ad570843a38 (patch) | |
tree | e204ef97c7933dd121791746c7f3a5426832d40b /oox/source | |
parent | d0e60c6f815de9b066c0697aabec87a776952f51 (diff) |
tdf#109169 export Type encoded shading to OOXML
A shape might have the shading information not in commands in the
enhanced-path, but generated in ctor of EnhancedCustomShape2d from the
Type value of the shape. This shading information is a 32 bit value
with first the number of the shadings and then the shadings. A shading
is encoded with 1,2,3,4,5,6,7 for lighten 10 to 70 and 8,9,a,b,c,d,e,f
for darken -80 to -10.
To get this information from EnhanceCustomShape2d I have made its
method GetLuminanceChange() public.
Because OOXML only has darken, darkenLess, lighten and lightenLess our
values are mapped:
-10, -20, -30 to darkenLess
-40, -50, -60, -70, -80 to darken
10, 20, 30 to lightenLess
40, 50, 60, 70 to lighten
The bupreport mentions only 'Octagon Bevel' and 'Diamond Bevel'. But
the patch fixes missing shading for shapes of Types 'ActionButton*'
as well. Such shapes come in from MS binary import.
Change-Id: I03f19496b915f3ced6346222e8806832b4ee2827
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133220
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133366
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/drawingml.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c2bdf39042a4..2a11fa507959 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3898,6 +3898,7 @@ bool DrawingML::WriteCustomGeometry( sal_Int32 nPairIndex = 0; // index over "Coordinates" sal_Int32 nPathSizeIndex = 0; // index over "SubViewSize" sal_Int32 nSubpathStartIndex(0); // index over "Segments" + sal_Int32 nSubPathIndex(0); // serial number of current subpath do { bool bOK(true); // catch faulty paths were commands do not correspond to points @@ -3920,6 +3921,19 @@ bool DrawingML::WriteCustomGeometry( else if (HasCommandInSubPath(LIGHTENLESS, nSubpathStartIndex, nNextNcommandIndex - 1, aSegments)) sFill = "lightenLess"; + else + { + // shading info might be in object type, e.g. "Octagon Bevel". + sal_Int32 nLuminanceChange(aCustomShape2d.GetLuminanceChange(nSubPathIndex)); + if (nLuminanceChange <= -40) + sFill = "darken"; + else if (nLuminanceChange <= -10) + sFill = "darkenLess"; + else if (nLuminanceChange >= 40) + sFill = "lighten"; + else if (nLuminanceChange >= 10) + sFill = "lightenLess"; + } // NOSTROKE std::optional<OString> sStroke; if (HasCommandInSubPath(NOSTROKE, nSubpathStartIndex, nNextNcommandIndex - 1, aSegments)) @@ -3964,6 +3978,7 @@ bool DrawingML::WriteCustomGeometry( // step forward to next subpath nSubpathStartIndex = nNextNcommandIndex + 1; nPathSizeIndex++; + nSubPathIndex++; } while (nSubpathStartIndex < aSegments.getLength()); mpFS->endElementNS(XML_a, XML_pathLst); |