summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2023-03-15 19:25:03 +0300
committerSarper Akdemir <sarper.akdemir@collabora.com>2023-05-12 12:27:35 +0200
commit1b9fa684374d056b04b6b8019bd0be2b603b3d95 (patch)
treef90678056e1b5d3be8a67ba0c9fa335066a64fd8 /oox
parent57c7a776df80931c505bd39c7539ddb0f6270c2c (diff)
tdf#150020 pptx import: handle algn for outerShdw
Introduces RectangleAlignmentItem that holds a value of the enum model::RectangleAlignment. Introduces SDRATTR_SHADOWALIGNMENT that holds alignment for a shadow. Implements import of algn for outerShdw. Makes the alignment considered while the shadow is being scaled. Also adds a unit test that covers this. Change-Id: I8f4eaed5f0d9428a7f405c65f19237f9e70ca151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148934 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151643 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/effectproperties.cxx5
-rw-r--r--oox/source/drawingml/effectproperties.hxx5
-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 579f4e1ab0ac..8424e3436c1a 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -14,6 +14,7 @@
#include <basegfx/numeric/ftools.hxx>
#include <comphelper/propertyvalue.hxx>
+#include <docmodel/theme/FormatScheme.hxx>
#include <algorithm>
@@ -38,6 +39,7 @@ void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourcePro
assignIfUsed( moShadowSy, rSourceProps.moShadowSy );
moShadowColor.assignIfUsed( rSourceProps.moShadowColor );
assignIfUsed( moShadowBlur, rSourceProps.moShadowBlur );
+ assignIfUsed( moShadowAlignment, rSourceProps.moShadowAlignment );
}
@@ -105,6 +107,9 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper ) );
rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency());
rPropMap.setProperty( PROP_ShadowBlur, convertEmuToHmm(nAttrBlur));
+ rPropMap.setProperty(
+ PROP_ShadowAlignment,
+ static_cast<sal_Int32>(maShadow.moShadowAlignment.value_or(model::RectangleAlignment::Bottom)));
}
}
diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx
index 54c7068ef5c6..992e2bddf3ef 100644
--- a/oox/source/drawingml/effectproperties.hxx
+++ b/oox/source/drawingml/effectproperties.hxx
@@ -17,6 +17,10 @@
#include <vector>
#include <map>
+namespace model {
+enum class RectangleAlignment;
+}
+
namespace oox::drawingml {
struct EffectGlowProperties
@@ -43,6 +47,7 @@ struct EffectShadowProperties
std::optional< sal_Int64 > moShadowSy;
Color moShadowColor;
std::optional< sal_Int64 > moShadowBlur; // size of blur effect
+ std::optional< model::RectangleAlignment > moShadowAlignment;
/** 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 c8c5096829ff..017d45e4d5ee 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -87,6 +87,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
mrEffectProperties.maShadow.moShadowSx = rAttribs.getInteger( XML_sx, 0 );
mrEffectProperties.maShadow.moShadowSy = rAttribs.getInteger( XML_sy, 0 );
mrEffectProperties.maShadow.moShadowBlur = rAttribs.getInteger( XML_blurRad, 0 );
+ mrEffectProperties.maShadow.moShadowAlignment = convertToRectangleAlignment( rAttribs.getToken(XML_algn, XML_b) );
model::ColorDefinition* pColor = nullptr;
if (mpEffectStyle)
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index fd2c3a0c6497..0b6e5437b883 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -471,6 +471,7 @@ Segments
SelectedItems
SelectedPage
Shadow
+ShadowAlignment
ShadowColor
ShadowFormat
ShadowSizeX