sd: respect what user has selected for new effects.

It was annoying that "Entry - Appear" animation was always added
despite user had selected another effect. Correct the design as:
- "Entry - Appear" is added for the first animation in the slide.
- Last selected effect is added.
- If the category is selected but the effect isn't, the first effect
  in the category is added.

Change-Id: I5e781feb0468bef4a5e46fd277554ddeadbcfbec
Reviewed-on: https://gerrit.libreoffice.org/67977
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
This commit is contained in:
Mark Hung
2019-02-19 18:25:22 +01:00
parent cacdb1ae9d
commit a1bf6fa6c4
@@ -1807,16 +1807,30 @@ void CustomAnimationPane::onAdd()
CustomAnimationPresetPtr pDescriptor;
mpFTCategory->Enable();
mpLBCategory->Enable();
mpFTAnimation->Enable();
mpLBAnimation->Enable();
mpLBCategory->SelectEntryPos(0);
sal_uInt32 nFirstEffect = fillAnimationLB( bHasText );
if(nFirstEffect == LISTBOX_ENTRY_NOTFOUND)
return;
bool bCategoryReset = false;
if (!mpLBCategory->IsEnabled() ||
mpLBCategory->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
{
mpLBCategory->Enable();
mpLBCategory->SelectEntryPos(0);
bCategoryReset = true;
}
if (bCategoryReset || !mpLBAnimation->IsEnabled() ||
mpLBAnimation->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
{
mpLBAnimation->Enable();
sal_uInt32 nFirstEffect = fillAnimationLB( bHasText );
if(nFirstEffect == LISTBOX_ENTRY_NOTFOUND)
return;
mpLBAnimation->SelectEntryPos(nFirstEffect);
}
mpLBAnimation->SelectEntryPos(nFirstEffect);
void* pEntryData = mpLBAnimation->GetSelectedEntryData();
if( pEntryData )
pDescriptor = *static_cast< CustomAnimationPresetPtr* >( pEntryData );