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.Grand@me.com>
(cherry picked from commit 59abf300e342556ad9cdcd5fd57b9d887776c441)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153834
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index aad8ba45..2b9f9b7 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 d3fd73f..09d7641 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -2474,11 +2474,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 );
@@ -2486,6 +2495,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 );
}