summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-04-12 11:18:42 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-04-25 13:38:18 +0200
commit6252959192c07973af698ce30fa67b1a29e4871e (patch)
tree5713580848f0608f7143b6dad041d50a342c752e /oox/source/drawingml
parentb09c377888e2e75859fff37fdf9408065eb522d6 (diff)
oox: add support for theme import and export of blip effects
This adds support for (most) blip effects import, export and the document model. Change-Id: Iec15f4de22c31268019fa1a60432e40ae8f03635 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150262 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/misccontexts.cxx42
1 files changed, 34 insertions, 8 deletions
diff --git a/oox/source/drawingml/misccontexts.cxx b/oox/source/drawingml/misccontexts.cxx
index bf3ec6e4fb03..26df16a17553 100644
--- a/oox/source/drawingml/misccontexts.cxx
+++ b/oox/source/drawingml/misccontexts.cxx
@@ -253,8 +253,9 @@ ColorChangeContext::ColorChangeContext( ContextHandler2Helper const & rParent,
mbUseAlpha = rAttribs.getBool( XML_useA, true );
if (mpBlipFill)
{
- mpBlipFill->meColorEffectType = model::ColorEffectType::ColorChange;
- mpBlipFill->mbUseAlpha = mbUseAlpha;
+ auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
+ rEffect.meType = model::BlipEffectType::ColorChange;
+ rEffect.mbUseAlpha = mbUseAlpha;
}
}
@@ -272,11 +273,17 @@ ContextHandlerRef ColorChangeContext::onCreateContext(
{
case A_TOKEN(clrFrom):
if (mpBlipFill)
- pColorDefinition = &mpBlipFill->maColorFrom;
+ {
+ auto& rEffect = mpBlipFill->maBlipEffects.back();
+ pColorDefinition = &rEffect.getColorFrom();
+ }
return new ColorContext(*this, mrBlipProps.maColorChangeFrom, pColorDefinition);
case A_TOKEN(clrTo):
if (mpBlipFill)
- pColorDefinition = &mpBlipFill->maColorTo;
+ {
+ auto& rEffect = mpBlipFill->maBlipEffects.back();
+ pColorDefinition = &rEffect.getColorTo();
+ }
return new ColorContext(*this, mrBlipProps.maColorChangeTo, pColorDefinition);
}
return nullptr;
@@ -325,12 +332,16 @@ ContextHandlerRef BlipContext::onCreateContext(
{
case A_TOKEN( biLevel ):
{
- mrBlipProps.moBiLevelThreshold = rAttribs.getInteger( XML_thresh );
+ sal_Int32 nTreshold = rAttribs.getInteger(XML_thresh, 0);
+
+ mrBlipProps.moBiLevelThreshold = nTreshold;
mrBlipProps.moColorEffect = getBaseToken(nElement);
+
if (mpBlipFill)
{
- mpBlipFill->meColorEffectType = model::ColorEffectType::BiLevel;
- mpBlipFill->mnBiLevelThreshold = rAttribs.getInteger(XML_thresh, 0);
+ auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
+ rEffect.meType = model::BlipEffectType::BiLevel;
+ rEffect.mnThreshold = nTreshold;
}
}
break;
@@ -340,7 +351,8 @@ ContextHandlerRef BlipContext::onCreateContext(
mrBlipProps.moColorEffect = getBaseToken( nElement );
if (mpBlipFill)
{
- mpBlipFill->meColorEffectType = model::ColorEffectType::Grayscale;
+ auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
+ rEffect.meType = model::BlipEffectType::Grayscale;
}
}
break;
@@ -360,11 +372,25 @@ ContextHandlerRef BlipContext::onCreateContext(
{
mrBlipProps.moBrightness = rAttribs.getInteger( XML_bright );
mrBlipProps.moContrast = rAttribs.getInteger( XML_contrast );
+
+ if (mpBlipFill)
+ {
+ auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
+ rEffect.meType = model::BlipEffectType::Luminance;
+ rEffect.mnBrightness = rAttribs.getInteger(XML_bright, 0);
+ rEffect.mnContrast = rAttribs.getInteger(XML_contrast, 0);
+ }
}
break;
case A_TOKEN( alphaModFix ):
{
mrBlipProps.moAlphaModFix = rAttribs.getInteger(XML_amt);
+ if (mpBlipFill)
+ {
+ auto& rEffect = mpBlipFill->maBlipEffects.emplace_back();
+ rEffect.meType = model::BlipEffectType::AlphaModulateFixed;
+ rEffect.mnAmount = rAttribs.getInteger(XML_amt, 100 * 1000);
+ }
}
break;
}