summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorA_GAN <ganzouri97@gmail.com>2020-05-29 02:10:49 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-06-02 23:29:30 +0200
commit68095e63a8ad8f6079b15e475179a14a64da36d3 (patch)
treec8588137798ff2067919989cd9fb7f0c1f6167ac /oox
parent31ec2c252425f8a30b25177b4f67dde0a21771fc (diff)
OOXML support for shadow blur
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 <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/effectproperties.cxx9
-rw-r--r--oox/source/drawingml/effectproperties.hxx1
-rw-r--r--oox/source/drawingml/effectpropertiescontext.cxx1
-rw-r--r--oox/source/token/properties.txt1
4 files changed, 12 insertions, 0 deletions
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<double>(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