summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2020-07-21 15:46:51 +0200
committerRegina Henschel <rb.henschel@t-online.de>2020-07-22 11:54:04 +0200
commit51e5afb0042bc6a10f0cd02af5733079b42fa0f7 (patch)
tree4a115d674aaebf043eb95f762cfe26cdde6e33f1 /oox
parent14bdbc36f0cf3913f6de10c746044b6aadf37095 (diff)
tdf#134969 Add solid transparence in color gradient
Converts a 'FillTransparence' percent value to a Gray color and stores it in a TransparenceGradient, so that it can be used by WriteGradientFill(). Use of third parameter rXPropSet is not possible, because it would overwrite a true transparency gradient. Causion, the property 'FillTransparenceGradient' might exist in an XPropSet of a shape with some default values. To detect, whether a gradient is actually used, you have to examine the property 'FillTransparenceGradientName'. Change-Id: Icbef599f02ebae2fcb5825fe64f546295eb78510 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99145 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 517d9801bba6..155c33796f70 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -540,10 +540,27 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
else
{
mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0");
- if( GetProperty(rXPropSet, "FillTransparenceGradient") )
- aTransparenceGradient = *o3tl::doAccess<awt::Gradient>(mAny);
+ OUString sFillTransparenceGradientName;
+ if (GetProperty(rXPropSet, "FillTransparenceGradientName")
+ && (mAny >>= sFillTransparenceGradientName)
+ && !sFillTransparenceGradientName.isEmpty())
+ {
+ if (GetProperty(rXPropSet, "FillTransparenceGradient"))
+ aTransparenceGradient = *o3tl::doAccess<awt::Gradient>(mAny);
+ }
+ else if (GetProperty(rXPropSet, "FillTransparence"))
+ {
+ // currently only StartColor and EndColor are evaluated in WriteGradientFill()
+ sal_Int32 nTransparency = 0;
+ mAny >>= nTransparency;
+ // convert percent to gray color
+ nTransparency = nTransparency * 255/100;
+ const sal_Int32 aGrayColor = static_cast<sal_Int32>( nTransparency | nTransparency << 8 | nTransparency << 16 );
+ aTransparenceGradient.StartColor = aGrayColor;
+ aTransparenceGradient.EndColor = aGrayColor;
+ }
WriteGradientFill(aGradient, aTransparenceGradient);
- mpFS->endElementNS( XML_a, XML_gradFill );
+ mpFS->endElementNS(XML_a, XML_gradFill);
}
}