summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-15 09:45:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-15 09:45:57 +0200
commit60542769488cbf31339e86dc2688a064c6e07917 (patch)
tree520a231143469c84b6f8cd49e4f13ec80f23412c /sd
parent12b2803f196b897ffb901b0eebe271c5ee43d03e (diff)
convert EValue to scoped enum
and drop unused enumerators Change-Id: I22629ee4a514053030d7120ee8a8fb8145163fad
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/CustomAnimationEffect.hxx2
-rw-r--r--sd/source/core/CustomAnimationEffect.cxx79
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx36
3 files changed, 27 insertions, 90 deletions
diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx
index deda3a427623..187437f90b7d 100644
--- a/sd/inc/CustomAnimationEffect.hxx
+++ b/sd/inc/CustomAnimationEffect.hxx
@@ -38,7 +38,7 @@ class SdrPathObj;
namespace sd {
-enum EValue { VALUE_FROM, VALUE_TO, VALUE_BY, VALUE_FIRST, VALUE_LAST };
+enum class EValue { To, By };
class CustomAnimationEffect;
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 886700a47398..230900ac81a4 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1151,17 +1151,8 @@ Any CustomAnimationEffect::getProperty( sal_Int32 nNodeType, const OUString& rAt
{
switch( eValue )
{
- case VALUE_FROM: aProperty = xAnimate->getFrom(); break;
- case VALUE_TO: aProperty = xAnimate->getTo(); break;
- case VALUE_BY: aProperty = xAnimate->getBy(); break;
- case VALUE_FIRST:
- case VALUE_LAST:
- {
- Sequence<Any> aValues( xAnimate->getValues() );
- if( aValues.hasElements() )
- aProperty = aValues[ eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1 ];
- }
- break;
+ case EValue::To: aProperty = xAnimate->getTo(); break;
+ case EValue::By: aProperty = xAnimate->getBy(); break;
}
}
}
@@ -1200,43 +1191,20 @@ bool CustomAnimationEffect::setProperty( sal_Int32 nNodeType, const OUString& rA
{
switch( eValue )
{
- case VALUE_FROM:
- if( xAnimate->getFrom() != rValue )
- {
- xAnimate->setFrom( rValue );
- bChanged = true;
- }
- break;
- case VALUE_TO:
+ case EValue::To:
if( xAnimate->getTo() != rValue )
{
xAnimate->setTo( rValue );
bChanged = true;
}
break;
- case VALUE_BY:
+ case EValue::By:
if( xAnimate->getTo() != rValue )
{
xAnimate->setBy( rValue );
bChanged = true;
}
break;
- case VALUE_FIRST:
- case VALUE_LAST:
- {
- Sequence<Any> aValues( xAnimate->getValues() );
- if( !aValues.hasElements() )
- aValues.realloc(1);
-
- sal_Int32 nIndex = eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1;
-
- if( aValues[ nIndex ] != rValue )
- {
- aValues[ nIndex ] = rValue;
- xAnimate->setValues( aValues );
- bChanged = true;
- }
- }
}
}
}
@@ -1378,17 +1346,8 @@ Any CustomAnimationEffect::getTransformationProperty( sal_Int32 nTransformType,
{
switch( eValue )
{
- case VALUE_FROM: aProperty = xTransform->getFrom(); break;
- case VALUE_TO: aProperty = xTransform->getTo(); break;
- case VALUE_BY: aProperty = xTransform->getBy(); break;
- case VALUE_FIRST:
- case VALUE_LAST:
- {
- Sequence<Any> aValues( xTransform->getValues() );
- if( aValues.hasElements() )
- aProperty = aValues[ eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1 ];
- }
- break;
+ case EValue::To: aProperty = xTransform->getTo(); break;
+ case EValue::By: aProperty = xTransform->getBy(); break;
}
}
}
@@ -1424,42 +1383,20 @@ bool CustomAnimationEffect::setTransformationProperty( sal_Int32 nTransformType,
{
switch( eValue )
{
- case VALUE_FROM:
- if( xTransform->getFrom() != rValue )
- {
- xTransform->setFrom( rValue );
- bChanged = true;
- }
- break;
- case VALUE_TO:
+ case EValue::To:
if( xTransform->getTo() != rValue )
{
xTransform->setTo( rValue );
bChanged = true;
}
break;
- case VALUE_BY:
+ case EValue::By:
if( xTransform->getBy() != rValue )
{
xTransform->setBy( rValue );
bChanged = true;
}
break;
- case VALUE_FIRST:
- case VALUE_LAST:
- {
- Sequence<Any> aValues( xTransform->getValues() );
- if( !aValues.hasElements() )
- aValues.realloc(1);
-
- sal_Int32 nIndex = eValue == VALUE_FIRST ? 0 : aValues.getLength() - 1;
- if( aValues[nIndex] != rValue )
- {
- aValues[nIndex] = rValue;
- xTransform->setValues( aValues );
- bChanged = true;
- }
- }
}
}
}
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 093b0dff7daa..1803799e3569 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -1001,32 +1001,32 @@ Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, const CustomAnimati
}
case nPropertyTypeFont:
- return pEffect->getProperty( AnimationNodeType::SET, "CharFontName" , VALUE_TO );
+ return pEffect->getProperty( AnimationNodeType::SET, "CharFontName" , EValue::To );
case nPropertyTypeCharHeight:
{
const OUString aAttributeName( "CharHeight" );
- Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO ) );
+ Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, EValue::To ) );
if( !aValue.hasValue() )
- aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO );
+ aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To );
return aValue;
}
case nPropertyTypeRotate:
- return pEffect->getTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY);
+ return pEffect->getTransformationProperty( AnimationTransformType::ROTATE, EValue::By);
case nPropertyTypeTransparency:
- return pEffect->getProperty( AnimationNodeType::SET, "Opacity" , VALUE_TO );
+ return pEffect->getProperty( AnimationNodeType::SET, "Opacity" , EValue::To );
case nPropertyTypeScale:
- return pEffect->getTransformationProperty( AnimationTransformType::SCALE, VALUE_BY );
+ return pEffect->getTransformationProperty( AnimationTransformType::SCALE, EValue::By );
case nPropertyTypeCharDecoration:
{
Sequence< Any > aValues(3);
- aValues[0] = pEffect->getProperty( AnimationNodeType::SET, "CharWeight" , VALUE_TO );
- aValues[1] = pEffect->getProperty( AnimationNodeType::SET, "CharPosture" , VALUE_TO );
- aValues[2] = pEffect->getProperty( AnimationNodeType::SET, "CharUnderline" , VALUE_TO );
+ aValues[0] = pEffect->getProperty( AnimationNodeType::SET, "CharWeight" , EValue::To );
+ aValues[1] = pEffect->getProperty( AnimationNodeType::SET, "CharPosture" , EValue::To );
+ aValues[2] = pEffect->getProperty( AnimationNodeType::SET, "CharUnderline" , EValue::To );
return makeAny( aValues );
}
}
@@ -1072,36 +1072,36 @@ bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, const CustomAnimat
break;
case nPropertyTypeFont:
- bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharFontName" , VALUE_TO, rValue );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharFontName" , EValue::To, rValue );
break;
case nPropertyTypeCharHeight:
{
const OUString aAttributeName( "CharHeight" );
- bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO, rValue );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, EValue::To, rValue );
if( !bEffectChanged )
- bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO, rValue );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To, rValue );
}
break;
case nPropertyTypeRotate:
- bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY , rValue );
+ bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE, EValue::By , rValue );
break;
case nPropertyTypeTransparency:
- bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "Opacity" , VALUE_TO, rValue );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "Opacity" , EValue::To, rValue );
break;
case nPropertyTypeScale:
- bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE, VALUE_BY, rValue );
+ bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE, EValue::By, rValue );
break;
case nPropertyTypeCharDecoration:
{
Sequence< Any > aValues(3);
rValue >>= aValues;
- bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharWeight" , VALUE_TO, aValues[0] );
- bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharPosture" , VALUE_TO, aValues[1] );
- bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharUnderline" , VALUE_TO, aValues[2] );
+ bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharWeight" , EValue::To, aValues[0] );
+ bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharPosture" , EValue::To, aValues[1] );
+ bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharUnderline" , EValue::To, aValues[2] );
}
break;