sd/source/ui/animations/CustomAnimationPane.cxx  |   54 +++++++++++------------
 sd/source/ui/animations/CustomAnimationPane.hxx  |    4 -
 sd/uiconfig/simpress/ui/customanimationspanel.ui |    4 -
 3 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 662406b44d16c713c3d42585b57caf46689980f0
Author: Rishabh <kris.kr...@gmail.com>
Date:   Wed Feb 10 03:06:26 2016 +0530

    tdf#87813: Bugfix for the animations sidebar tab
    
    Fixes the following bugs:
    1) When nothing is selected, clicking on a entry in the animation list 
doesnt activate category and effect drop down menus.
    2) When pressing the add button, it should select Entrance->Appear not 
Emphasis->Change Fill Color and no automatic preview should not be executed.
    3) When changing the Category, the first entry in the Effect list is 
selected, which would confuse users to believe that it is now added to the 
object.
    
    Change-Id: Idefe07aae039d6c4b1bc9f18397ede98605b2dd0
    Reviewed-on: https://gerrit.libreoffice.org/22248
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>

diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx 
b/sd/source/ui/animations/CustomAnimationPane.cxx
index 0349e85..e2e34cf 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -491,8 +491,6 @@ void CustomAnimationPane::updateControls()
     mpFTSpeed->Enable( mxView.is() );
     mpCBSpeed->Enable( mxView.is() );
     mpCustomAnimationList->Enable( mxView.is() );
-    mpPBMoveUp->Enable( mxView.is() );
-    mpPBMoveDown->Enable( mxView.is() );
     mpPBPlay->Enable( mxView.is() );
     mpCBAutoPreview->Enable( mxView.is() );
 
@@ -518,7 +516,9 @@ void CustomAnimationPane::updateControls()
 
     mpPBAddEffect->Enable( maViewSelection.hasValue() );
     mpPBRemoveEffect->Enable(nSelectionCount);
-    if(maViewSelection.hasValue() && (nSelectionCount == 1))
+    bool bIsSelected = (nSelectionCount == 1);
+
+    if(bIsSelected)
     {
         mpFTAnimation->Enable();
         mpLBAnimation->Enable();
@@ -531,8 +531,8 @@ void CustomAnimationPane::updateControls()
         mpLBAnimation->Clear();
     }
 
-    mpLBCategory->Enable(maViewSelection.hasValue() && (nSelectionCount == 1));
-    mpFTCategory->Enable(maViewSelection.hasValue() && (nSelectionCount == 1));
+    mpLBCategory->Enable(bIsSelected);
+    mpFTCategory->Enable(bIsSelected);
 
     mpFTStart->Enable(nSelectionCount > 0);
     mpLBStart->Enable(nSelectionCount > 0);
@@ -543,7 +543,7 @@ void CustomAnimationPane::updateControls()
 
     mnPropertyType = nPropertyTypeNone;
 
-    if( nSelectionCount == 1 )
+    if(bIsSelected)
     {
         CustomAnimationEffectPtr pEffect = maListSelection.front();
 
@@ -606,10 +606,10 @@ void CustomAnimationPane::updateControls()
         sal_uInt32 nCategoryPos = LISTBOX_ENTRY_NOTFOUND;
         switch(pEffect->getPresetClass())
         {
-            case EffectPresetClass::MOTIONPATH: nCategoryPos = 0; break;
+            case EffectPresetClass::ENTRANCE: nCategoryPos = 0; break;
             case EffectPresetClass::EMPHASIS: nCategoryPos = 1; break;
-            case EffectPresetClass::ENTRANCE: nCategoryPos = 2; break;
-            case EffectPresetClass::EXIT: nCategoryPos = 3; break;
+            case EffectPresetClass::EXIT: nCategoryPos = 2; break;
+            case EffectPresetClass::MOTIONPATH: nCategoryPos = 3; break;
             default:
                 break;
         }
@@ -750,8 +750,8 @@ void CustomAnimationPane::updateControls()
         }
     }
 
-    mpPBMoveUp->Enable(bEnableUp);
-    mpPBMoveDown->Enable(bEnableDown);
+    mpPBMoveUp->Enable(mxView.is() &&  bEnableUp);
+    mpPBMoveDown->Enable(mxView.is() && bEnableDown);
 
     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     mpCBAutoPreview->Check( pOptions->IsPreviewChangedEffects() );
@@ -894,7 +894,7 @@ void CustomAnimationPane::onContextMenu( sal_uInt16 
nSelectedPopupEntry )
         onRemove();
         break;
     case CM_CREATE:
-        if( maViewSelection.hasValue() ) onChange();
+        if( maViewSelection.hasValue() ) onAdd();
         break;
     }
 
@@ -1771,7 +1771,7 @@ void CustomAnimationPane::animationChange()
 
 }
 
-void CustomAnimationPane::onChange()
+void CustomAnimationPane::onAdd()
 {
     bool bHasText = true;
 
@@ -1829,7 +1829,7 @@ void CustomAnimationPane::onChange()
     }
     else
     {
-        OSL_FAIL("sd::CustomAnimationPane::onChange(), unknown view 
selection!" );
+        OSL_FAIL("sd::CustomAnimationPane::onAdd(), unknown view selection!" );
         return;
     }
 
@@ -1838,8 +1838,13 @@ void CustomAnimationPane::onChange()
     mpLBCategory->Enable();
     mpFTAnimation->Enable();
     mpLBAnimation->Enable();
-    mpLBCategory->SelectEntryPos(1);
-    fillAnimationLB();
+    mpLBCategory->SelectEntryPos(0);
+
+    sal_uInt32 nFirstEffect = fillAnimationLB();
+    if(nFirstEffect == LISTBOX_ENTRY_NOTFOUND)
+        return;
+
+    mpLBAnimation->SelectEntryPos(nFirstEffect);
     void* pEntryData = mpLBAnimation->GetSelectEntryData();
     if( pEntryData )
         pDescriptor = *static_cast< CustomAnimationPresetPtr* >( pEntryData );
@@ -2077,17 +2082,17 @@ IMPL_LINK_NOARG_TYPED(CustomAnimationPane, 
UpdateAnimationLB, ListBox&, void)
     fillAnimationLB();
 }
 
-void CustomAnimationPane::fillAnimationLB()
+sal_uInt32 CustomAnimationPane::fillAnimationLB()
 {
     PresetCategoryList rCategoryList;
     sal_uInt16 nPosition = mpLBCategory->GetSelectEntryPos();
     const CustomAnimationPresets& rPresets (getPresets());
     switch(nPosition)
     {
-        case 0:rCategoryList = rPresets.getMotionPathsPresets();break;
+        case 0:rCategoryList = rPresets.getEntrancePresets();break;
         case 1:rCategoryList = rPresets.getEmphasisPresets();break;
-        case 2:rCategoryList = rPresets.getEntrancePresets();break;
-        case 3:rCategoryList = rPresets.getExitPresets();break;
+        case 2:rCategoryList = rPresets.getExitPresets();break;
+        case 3:rCategoryList = rPresets.getMotionPathsPresets();break;
         case 4:rCategoryList = rPresets.getMiscPresets();break;
     }
 
@@ -2131,7 +2136,7 @@ void CustomAnimationPane::fillAnimationLB()
             }
         }
     }
-    mpLBAnimation->SelectEntryPos(nFirstEffect);
+    return nFirstEffect;
 }
 
 
@@ -2148,10 +2153,7 @@ IMPL_LINK_TYPED( CustomAnimationPane, 
implControlListBoxHdl, ListBox&, rListBox,
 void CustomAnimationPane::implControlHdl(Control* pControl )
 {
     if( pControl == mpPBAddEffect )
-    {
-        onChange();
-        onPreview(true);
-    }
+        onAdd();
     else if( pControl == mpPBRemoveEffect )
         onRemove();
     else if( pControl == mpLBStart )
@@ -2171,8 +2173,6 @@ void CustomAnimationPane::implControlHdl(Control* 
pControl )
         SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
         pOptions->SetPreviewChangedEffects( mpCBAutoPreview->IsChecked() );
     }
-
-    updateControls();
 }
 
 IMPL_LINK_NOARG_TYPED(CustomAnimationPane, lateInitCallback, Timer *, void)
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx 
b/sd/source/ui/animations/CustomAnimationPane.hxx
index 8eda015..c124c15 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -70,7 +70,7 @@ public:
     // callbacks
     void onSelectionChanged();
     void onChangeCurrentPage();
-    void onChange();
+    void onAdd();
     void animationChange();
     void onRemove();
     void onChangeStart();
@@ -116,7 +116,7 @@ private:
     static css::uno::Any getProperty1Value( sal_Int32 nType, 
CustomAnimationEffectPtr pEffect );
     bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, 
const css::uno::Any& rValue );
     void UpdateLook();
-    void fillAnimationLB();
+    sal_uInt32 fillAnimationLB();
 
     DECL_LINK_TYPED( implControlListBoxHdl, ListBox&, void );
     DECL_LINK_TYPED( implClickHdl, Button*, void );
diff --git a/sd/uiconfig/simpress/ui/customanimationspanel.ui 
b/sd/uiconfig/simpress/ui/customanimationspanel.ui
index 0759195..13dbb59 100644
--- a/sd/uiconfig/simpress/ui/customanimationspanel.ui
+++ b/sd/uiconfig/simpress/ui/customanimationspanel.ui
@@ -171,10 +171,10 @@
                 <property name="can_focus">False</property>
                 <property name="popup_fixed_width">False</property>
                 <items>
-                  <item translatable="yes">Motion Paths</item>
-                  <item translatable="yes">Emphasis</item>
                   <item translatable="yes">Entrance</item>
+                  <item translatable="yes">Emphasis</item>
                   <item translatable="yes">Exit</item>
+                  <item translatable="yes">Motion Paths</item>
                   <item translatable="yes">Misc Effects</item>
                 </items>
               </object>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to