[Libreoffice-commits] core.git: sd/source

Zhe Wang wangzcdl at apache.org
Thu May 23 08:28:44 PDT 2013


 sd/source/ui/animations/CustomAnimationPane.cxx |   72 ++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 6 deletions(-)

New commits:
commit f975e0050110c7f713162d13b65787bbb6627baa
Author: Zhe Wang <wangzcdl at apache.org>
Date:   Wed Jun 20 05:51:21 2012 +0000

    Resolves: #i119988# crash when modify the animation effect's...
    
    Text Animation properties to "As one object" and check "Animate attached shape"
    option
    
    (cherry picked from commit 897637ec83365f6e78c766fa3354de5d92aedfeb)
    
    Change-Id: Ifbe4f6dbbaebde7afc2d800652dca731ba1c039f

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index f26cb75..eee8e84 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -1720,6 +1720,69 @@ void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLProper
                 bChanged = true;
             }
 
+            //#i119988#
+            /************************************************************************/
+            /*
+            Note, the setAnimateForm means set the animation from TextGroup to Object's Shape
+            And on the UI in means "Animate attached shape" in "Effect Option" dialog
+            The setTextGrouping means set animation to Object's Text,
+            the nTextGrouping is Text Animation Type
+            nTextGrouping = -1 is "As one Object", means no text animation.
+
+            The previous call order first do the setTextGrouping and then do the setAnimateForm,
+            that will cause such defect: in the setTextGrouping, the effect has been removed,
+            but in setAnimateForm still need this effect, then a NULL pointer of that effect will
+            be gotten, and cause crash.
+
+            []bHasAnimateForm means the UI has changed, bAnimateForm is it value
+
+            So if create a new textgroup animation, the following animation will never be run!
+            Since the ¡°Animate attached shape¡± is default checked.
+            And the bHasAnimateForm default is false, and if user uncheck it the value bAnimateForm will be false,
+            it same as the TextGroup¡¯s default value, also could not be run setAnimateForm.
+            if( bHasAnimateForm )
+            {
+            if( pTextGroup->getAnimateForm() != bAnimateForm )
+            {
+            pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
+            bChanged = true;
+            }
+            }
+
+            In setTextGrouping, there are three case:
+            1.  Create new text effects for empty TextGroup
+            2.  Remove all text effects of TextGroup (nTextGrouping == -1)
+            3.  Change all the text effects¡¯ start type
+
+            So here is the right logic:
+            If set the animation from text to shape and remove text animation,
+            should do setAnimateForm first, then do setTextGrouping.
+            Other case,do setTextGrouping first, then do setAnimateForm.
+
+            */
+            /************************************************************************/
+
+            bool    bDoSetAnimateFormFirst = false;
+            bool    bNeedDoSetAnimateForm = false;
+
+            if( bHasAnimateForm )
+            {
+                if( pTextGroup->getAnimateForm() != bAnimateForm )
+                {
+                    if( (pTextGroup->getTextGrouping() >= 0) && (nTextGrouping == -1 ) )
+                    {
+                        bDoSetAnimateFormFirst = true;
+                    }
+                    bNeedDoSetAnimateForm = true;
+                }
+            }
+
+            if (bDoSetAnimateFormFirst)
+            {
+                pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
+                bChanged = true;
+            }
+
             if( bHasTextGrouping )
             {
                 if( (pTextGroup->getTextGrouping() != nTextGrouping) )
@@ -1729,13 +1792,10 @@ void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLProper
                 }
             }
 
-            if( bHasAnimateForm )
+            if (!bDoSetAnimateFormFirst&&bNeedDoSetAnimateForm)
             {
-                if( pTextGroup->getAnimateForm() != bAnimateForm )
-                {
-                    pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
-                    bChanged = true;
-                }
+                pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
+                bChanged = true;
             }
 
             if( bHasTextGroupingAuto )


More information about the Libreoffice-commits mailing list