svx/source/sdr/primitive2d/sdrattributecreator.cxx | 11 ++++------- svx/source/xoutdev/xattr.cxx | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-)
New commits: commit 59abf300e342556ad9cdcd5fd57b9d887776c441 Author: Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de> AuthorDate: Fri Jun 30 11:07:07 2023 +0200 Commit: Armin Le Grand <armin.le.gr...@me.com> CommitDate: Fri Jun 30 17:47:06 2023 +0200 MCGR: tdf#155913 Non-supported attributes for TransparenceGradient In ODF spec there is no - MID_GRADIENT_STARTINTENSITY - MID_GRADIENT_ENDINTENSITY - MID_GRADIENT_STEPCOUNT so these should not be used in the core data, too. The last one leads to this error. I experimentally added to hanle these 'harder' in the UNO API implementation, too, to reflect that these are not supported and produce UNO API access errors. This is not urgently necessary, but let's see if that triggers problems. That these attributes were initially supported is due to the Item hosting those values for transparency gradient is directly derived from gradient and the implementations usually use the fallback to call the parent implementation(s). Change-Id: I982c4047d82bfe306dbcef9d1b64b8d212bf8d59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153799 Tested-by: Jenkins Reviewed-by: Armin Le Grand <armin.le.gr...@me.com> diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index aad8ba4576e4..2b9f9b767763 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -619,6 +619,8 @@ namespace drawinglayer::primitive2d if (rGradient.GetStartIntens() != 100 || rGradient.GetEndIntens() != 100) { + // tdf#155913 Start/EndIntens is not used for transparency gradient, + // so might even get asserted (?) // this may also be set for transparence, so need to take care of it aColorStops.blendToIntensity( rGradient.GetStartIntens() * 0.01, @@ -626,19 +628,14 @@ namespace drawinglayer::primitive2d basegfx::BColor()); // COL_BLACK } + // tdf#155913 GradientStepCount is not used for transparency gradient return attribute::FillGradientAttribute( rGradient.GetGradientStyle(), static_cast<double>(rGradient.GetBorder()) * 0.01, static_cast<double>(rGradient.GetXOffset()) * 0.01, static_cast<double>(rGradient.GetYOffset()) * 0.01, toRadians(rGradient.GetAngle()), - aColorStops, - // oops - the gradientStepCount was missing here. If we want to use - // a combination of gradient & transparencyGradient to represent - // imported gradients of formats which do originally support transparency - // in gradients, then the gradient has to be exactly defined the same, - // including the (evtl. used) gradientStepCount - rSet.Get(XATTR_GRADIENTSTEPCOUNT).GetValue()); + aColorStops); } } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 3cb12c467b74..c7299b6d1b92 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2526,11 +2526,20 @@ XFillFloatTransparenceItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pP bool XFillFloatTransparenceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const { + if (MID_GRADIENT_STARTINTENSITY == nMemberId + || MID_GRADIENT_ENDINTENSITY == nMemberId + || MID_GRADIENT_STEPCOUNT == nMemberId) + { + // tdf#155913 handle attributes not suppoted by transparency gradient as error + return false; + } + if (!IsEnabled() && nMemberId == MID_NAME) { // make sure that we return empty string in case of query for // "FillTransparenceGradientName" if the item is disabled rVal <<= OUString(); + return true; } return XFillGradientItem::QueryValue( rVal, nMemberId ); @@ -2538,6 +2547,14 @@ bool XFillFloatTransparenceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMem bool XFillFloatTransparenceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) { + if (MID_GRADIENT_STARTINTENSITY == nMemberId + || MID_GRADIENT_ENDINTENSITY == nMemberId + || MID_GRADIENT_STEPCOUNT == nMemberId) + { + // tdf#155913 handle attributes not suppoted by transparency gradient as error + return false; + } + return XFillGradientItem::PutValue( rVal, nMemberId ); }