From 68095e63a8ad8f6079b15e475179a14a64da36d3 Mon Sep 17 00:00:00 2001 From: A_GAN Date: Fri, 29 May 2020 02:10:49 +0200 Subject: OOXML support for shadow blur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new property for the blur radius and define an ID for it to support the import of OOX files. Add a test for importing the blur radius from PPTX file Change-Id: Iffaa33ff7159019ce9478cee558622bd61bcf60e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95090 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl --- oox/source/drawingml/effectproperties.cxx | 9 +++++++++ oox/source/drawingml/effectproperties.hxx | 1 + oox/source/drawingml/effectpropertiescontext.cxx | 1 + oox/source/token/properties.txt | 1 + 4 files changed, 12 insertions(+) (limited to 'oox') diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 4d0c7c334ab5..d6a1b9a749c6 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -34,6 +34,8 @@ void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourcePro moShadowSx.assignIfUsed( rSourceProps.moShadowSx ); moShadowSy.assignIfUsed( rSourceProps.moShadowSy ); moShadowColor.assignIfUsed( rSourceProps.moShadowColor ); + moShadowBlur.assignIfUsed( rSourceProps.moShadowBlur ); + } void EffectProperties::assignUsed( const EffectProperties& rSourceProps ) @@ -62,6 +64,7 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap, sal_Int32 nAttrDir = 0, nAttrDist = 0; sal_Int32 nAttrSizeX = 100000, nAttrSizeY = 100000; // If shadow size is %100=100000 (means equal to object's size), sx sy is not exists, // Default values of sx, sy should be 100000 in this case. + sal_Int32 nAttrBlur = 0; std::map< OUString, css::uno::Any >::const_iterator attribIt = it->maAttribs.find( "dir" ); if( attribIt != it->maAttribs.end() ) @@ -79,6 +82,10 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap, if( attribIt != it->maAttribs.end() ) attribIt->second >>= nAttrSizeY; + attribIt = it->maAttribs.find( "blurRad" ); + if( attribIt != it->maAttribs.end() ) + attribIt->second >>= nAttrBlur; + // Negative X or Y dist indicates left or up, respectively // Negative X or Y dist indicates left or up, respectively double nAngle = basegfx::deg2rad(static_cast(nAttrDir) / PER_DEGREE); @@ -93,6 +100,8 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap, rPropMap.setProperty( PROP_ShadowSizeY, nAttrSizeY); rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper ) ); rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency()); + rPropMap.setProperty( PROP_ShadowBlur, nAttrBlur); + } } } diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx index 2d2b20e2e8e5..a06ac5a05acc 100644 --- a/oox/source/drawingml/effectproperties.hxx +++ b/oox/source/drawingml/effectproperties.hxx @@ -43,6 +43,7 @@ struct EffectShadowProperties OptValue< sal_Int64 > moShadowSx; OptValue< sal_Int64 > moShadowSy; Color moShadowColor; + OptValue< sal_Int64 > moShadowBlur; // size of blur effect /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const EffectShadowProperties& rSourceProps ); diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index afd00d2dd097..f287c897d891 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -84,6 +84,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 ); mrEffectProperties.maShadow.moShadowSx = rAttribs.getInteger( XML_sx, 0 ); mrEffectProperties.maShadow.moShadowSy = rAttribs.getInteger( XML_sy, 0 ); + mrEffectProperties.maShadow.moShadowBlur = rAttribs.getInteger( XML_blurRad, 0 ); return new ColorContext(*this, mrEffectProperties.m_Effects[nPos]->moColor); } break; diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 078284f18e39..3c9ba162f563 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -454,6 +454,7 @@ ShadowFormat ShadowSizeX ShadowSizeY ShadowTransparence +ShadowBlur ShadowXDistance ShadowYDistance Show -- cgit