diff --git a/sd/inc/CustomAnimationEffect.hxx b/sd/inc/CustomAnimationEffect.hxx index b886877..295426a 100644 --- a/sd/inc/CustomAnimationEffect.hxx +++ b/sd/inc/CustomAnimationEffect.hxx @@ -268,12 +268,14 @@ private: EffectSequence maEffects; ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > maTarget; + enum { PARA_LEVELS = 5 }; + sal_Int32 mnTextGrouping; sal_Bool mbAnimateForm; sal_Bool mbTextReverse; double mfGroupingAuto; sal_Int32 mnLastPara; - sal_Int8 mnDepthFlags[5]; + sal_Int8 mnDepthFlags[PARA_LEVELS]; sal_Int32 mnGroupId; }; diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index c6ceae3..5408e64 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -2470,8 +2470,10 @@ void CustomAnimationTextGroup::reset() mfGroupingAuto = -1.0; mnLastPara = -1; // used to check for TextReverse - int i = 5; - while( i-- ) mnDepthFlags[i] = 0; + for (int i = 0; i < PARA_LEVELS; ++i) + { + mnDepthFlags[i] = 0; + } maEffects.clear(); } @@ -2496,8 +2498,8 @@ void CustomAnimationTextGroup::addEffect( CustomAnimationEffectPtr& pEffect ) const sal_Int32 nParaDepth = pEffect->getParaDepth(); - // only look at the first 5 levels - if( nParaDepth < 5 ) + // only look at the first PARA_LEVELS levels + if( nParaDepth < PARA_LEVELS ) { // our first paragraph with this level? if( mnDepthFlags[nParaDepth] == 0 ) @@ -2513,9 +2515,10 @@ void CustomAnimationTextGroup::addEffect( CustomAnimationEffectPtr& pEffect ) if( pEffect->getNodeType() == EffectNodeType::AFTER_PREVIOUS ) mfGroupingAuto = pEffect->getBegin(); - mnTextGrouping = 0; - while( (mnTextGrouping < 5) && (mnDepthFlags[mnTextGrouping] > 0) ) - mnTextGrouping++; + mnTextGrouping = PARA_LEVELS; + while( (mnTextGrouping > 0) + && (mnDepthFlags[mnTextGrouping - 1] <= 0) ) + --mnTextGrouping; } } else