summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-11-03 14:18:23 +0200
committerTor Lillqvist <tml@collabora.com>2015-11-05 21:32:55 +0000
commit95e13b89ecb70eb0a03a0c68f0f1e41d02acef22 (patch)
tree2f20d1ccd211f0466aeef862570b343cf263aefb /sd
parent0c39c456f47c14e2b7f86d1bc6857dc0e2ca6cb3 (diff)
tdf#36946: Organise transitions hierarchically
Introduce the concept of transition groups and sets. (Suggestions for other terminology welcome.) A collection of transitions that differ only in the direction the transition is applied, or similar minor fashion, are called a set, and they show up only once in the long list of transitions in the UI. Each set also has an icon. Sets are then collected into groups based on some overall common feature, like "subtle" or "3D". Groups do not yet show up in the UI, but are only present in the configuration registry. I made only a few silly icons as I am not an artist. Not intended to be a final design in any way for them. Change-Id: I148cb7f8dc2e3ecd70cae188908dd02053308239 Reviewed-on: https://gerrit.libreoffice.org/19797 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/TransitionPreset.hxx11
-rw-r--r--sd/source/core/TransitionPreset.cxx87
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.cxx216
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.hxx14
-rw-r--r--sd/source/ui/dlg/dlgass.cxx28
-rw-r--r--sd/source/ui/dlg/dlgctrls.cxx93
-rw-r--r--sd/source/ui/inc/dlgctrls.hxx5
-rw-r--r--sd/uiconfig/simpress/ui/assistentdialog.ui33
-rw-r--r--sd/uiconfig/simpress/ui/slidetransitionspanel.ui32
9 files changed, 383 insertions, 136 deletions
diff --git a/sd/inc/TransitionPreset.hxx b/sd/inc/TransitionPreset.hxx
index 95416a259af3..eb31d0c6f7a9 100644
--- a/sd/inc/TransitionPreset.hxx
+++ b/sd/inc/TransitionPreset.hxx
@@ -53,8 +53,11 @@ public:
bool getDirection() const { return mbDirection; }
sal_Int32 getFadeColor() const { return mnFadeColor; }
- const OUString& getUIName() const { return maUIName; }
const OUString& getPresetId() const { return maPresetId; }
+ const OUString& getGroupId() const { return maGroupId; }
+ const OUString& getSetId() const { return maSetId; }
+ const OUString& getSetLabel() const { return maSetLabel; }
+ const OUString& getVariantLabel() const { return maVariantLabel; }
private:
TransitionPreset( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
@@ -64,11 +67,13 @@ private:
bool mbDirection;
sal_Int32 mnFadeColor;
OUString maPresetId;
- OUString maUIName;
+ OUString maGroupId;
+ OUString maSetId;
+ OUString maSetLabel;
+ OUString maVariantLabel;
static bool importTransitionsFile( TransitionPresetList& rList,
css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceFactory,
- UStringMap& rTransitionNameMap,
const OUString& aFilename );
};
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index 6b63d2f12c22..2d55ee6ece40 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -32,6 +32,7 @@
#include <comphelper/getexpandeduri.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/pathoptions.hxx>
+#include <officecfg/Office/UI/Effects.hxx>
#include <tools/stream.hxx>
#include <rtl/uri.hxx>
@@ -89,9 +90,15 @@ TransitionPreset::TransitionPreset( const css::uno::Reference< css::animations::
bool TransitionPreset::importTransitionsFile( TransitionPresetList& rList,
Reference< XMultiServiceFactory >& xServiceFactory,
- UStringMap& rTransitionNameMap,
const OUString& aURL )
{
+ SAL_INFO("sd.transitions", "Importing " << aURL);
+
+ Reference< container::XNameAccess > xTransitionSets( officecfg::Office::UI::Effects::UserInterface::TransitionSets::get() );
+ Reference< container::XNameAccess > xTransitionGroups( officecfg::Office::UI::Effects::UserInterface::TransitionGroups::get() );
+ Reference< container::XNameAccess > xTransitionVariants( officecfg::Office::UI::Effects::UserInterface::TransitionVariants::get() );
+ Reference< container::XNameAccess > xTransitions( officecfg::Office::UI::Effects::UserInterface::Transitions::get() );
+
// import transition presets
Reference< XAnimationNode > xAnimationNode;
@@ -105,26 +112,75 @@ bool TransitionPreset::importTransitionsFile( TransitionPresetList& rList,
Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
if( xChildNode->getType() == AnimationNodeType::PAR )
{
- // create it
TransitionPresetPtr pPreset( new TransitionPreset( xChildNode ) );
- // name it
OUString aPresetId( pPreset->getPresetId() );
+
if( !aPresetId.isEmpty() )
{
- UStringMap::const_iterator aIter( rTransitionNameMap.find( aPresetId ) );
- if( aIter != rTransitionNameMap.end() )
- pPreset->maUIName = (*aIter).second;
-
- // add it
- rList.push_back( pPreset );
+ Reference< container::XNameAccess > xTransitionNode;
+
+ if (xTransitions->hasByName( aPresetId ) &&
+ (xTransitions->getByName( aPresetId ) >>= xTransitionNode) &&
+ xTransitionNode.is() )
+ {
+ OUString sSet;
+ OUString sVariant;
+
+ xTransitionNode->getByName( "Set" ) >>= sSet;
+ xTransitionNode->getByName( "Variant" ) >>= sVariant;
+
+ Reference< container::XNameAccess > xSetNode;
+
+ xTransitionSets->getByName( sSet ) >>= xSetNode;
+ if( xSetNode.is() )
+ {
+ pPreset->maSetId = sSet;
+ xSetNode->getByName( "Label" ) >>= sSet;
+ pPreset->maSetLabel = sSet;
+
+ OUString sGroup;
+
+ xSetNode->getByName( "Group" ) >>= sGroup;
+
+ Reference< container::XNameAccess > xGroupNode;
+ xTransitionGroups->getByName( sGroup ) >>= xGroupNode;
+
+ if( xGroupNode.is() )
+ {
+ pPreset->maGroupId = sGroup;
+ xGroupNode->getByName( "Label" ) >>= sGroup;
+ if( !sVariant.isEmpty() )
+ {
+ Reference< container::XNameAccess > xVariantNode;
+ xTransitionVariants->getByName( sVariant ) >>= xVariantNode;
+ if( xVariantNode.is() )
+ {
+ xVariantNode->getByName( "Label" ) >>= sVariant;
+ pPreset->maVariantLabel = sVariant;
+ }
+ }
+
+ pPreset->maSetLabel = sSet;
+ SAL_INFO("sd.transitions", aPresetId << ": " << sGroup << "/" << sSet << (sVariant.isEmpty() ? OUString("") : OUString("/" + sVariant)));
+
+ rList.push_back( pPreset );
+ }
+ else
+ SAL_WARN("sd.transitions", "group node " << sGroup << " not found");
+ }
+ else
+ SAL_WARN("sd.transitions", "set node " << sSet << " not found");
+ }
+ else
+ SAL_WARN("sd.transitions", "transition node " << aPresetId << " not found");
}
}
else
- {
- OSL_FAIL( "sd::TransitionPreset::importTransitionPresetList(), malformed xml configuration file, giving up!" );
- break;
- }
+ {
+ SAL_WARN("sd.transitions", " malformed xml configuration file " << aURL );
+ break;
+ }
}
} catch( Exception& ) {
return false;
@@ -154,10 +210,6 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
Reference< XMultiServiceFactory > xConfigProvider =
configuration::theDefaultProvider::get( xContext );
- UStringMap aTransitionNameMap;
- const OUString aTransitionPath("/org.openoffice.Office.UI.Effects/UserInterface/Transitions" );
- implImportLabels( xConfigProvider, aTransitionPath, aTransitionNameMap );
-
// read path to transition effects files from config
Any propValue = uno::makeAny(
beans::PropertyValue("nodepath", -1,
@@ -178,7 +230,6 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
bRet |= importTransitionsFile( rList,
xServiceFactory,
- aTransitionNameMap,
aURL );
}
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index e7022c07755f..fa7f3aebac63 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -60,7 +60,6 @@ using ::com::sun::star::uno::RuntimeException;
using ::sd::framework::FrameworkHelper;
-// ::sd::impl::TransitionEffect
namespace sd
{
namespace impl
@@ -265,55 +264,6 @@ void lcl_CreateUndoForPages(
pManager->LeaveListAction();
}
-sal_Int32 lcl_getTransitionEffectIndex(
- SdDrawDocument * pDoc,
- const ::sd::impl::TransitionEffect & rTransition )
-{
- // first entry: "<none>"
- sal_Int32 nResultIndex = LISTBOX_ENTRY_NOTFOUND;
-
- if( pDoc )
- {
- sal_Int32 nCurrentIndex = 0;
- const ::sd::TransitionPresetList & rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
- ::sd::TransitionPresetList::const_iterator aIt( rPresetList.begin());
- const ::sd::TransitionPresetList::const_iterator aEndIt( rPresetList.end());
- for( ; aIt != aEndIt; ++aIt, ++nCurrentIndex )
- {
- if( rTransition.operator==( *(*aIt) ))
- {
- nResultIndex = nCurrentIndex;
- break;
- }
- }
- }
-
- return nResultIndex;
-}
-
-::sd::TransitionPresetPtr lcl_getTransitionPresetByUIName(
- SdDrawDocument * pDoc,
- const OUString & rUIName )
-{
- ::sd::TransitionPresetPtr pResult;
- if( pDoc )
- {
- const ::sd::TransitionPresetList& rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
- ::sd::TransitionPresetList::const_iterator aIter( rPresetList.begin() );
- const ::sd::TransitionPresetList::const_iterator aEnd( rPresetList.end() );
- for( ; aIter != aEnd; ++aIter )
- {
- if( (*aIter)->getUIName().equals( rUIName ))
- {
- pResult = *aIter;
- break;
- }
- }
- }
-
- return pResult;
-}
-
struct lcl_EqualsSoundFileName : public ::std::unary_function< OUString, bool >
{
explicit lcl_EqualsSoundFileName( const OUString & rStr ) :
@@ -424,6 +374,8 @@ SlideTransitionPane::SlideTransitionPane(
maLateInitTimer()
{
get(mpLB_SLIDE_TRANSITIONS, "transitions_list");
+ get(mpFT_VARIANT, "variant_label");
+ get(mpLB_VARIANT, "variant_list");
get(mpFT_SPEED, "speed_label");
get(mpLB_SPEED, "speed_list");
get(mpFT_SOUND, "sound_label");
@@ -439,6 +391,8 @@ SlideTransitionPane::SlideTransitionPane(
mpLB_SLIDE_TRANSITIONS->set_width_request(mpLB_SLIDE_TRANSITIONS->approximate_char_width() * 16);
mpLB_SLIDE_TRANSITIONS->SetDropDownLineCount(4);
+ mpLB_VARIANT->SetDropDownLineCount(4);
+
if( pDoc )
mxModel.set( pDoc->getUnoModel(), uno::UNO_QUERY );
// TODO: get correct view
@@ -446,7 +400,8 @@ SlideTransitionPane::SlideTransitionPane(
mxView.set( mxModel->getCurrentController(), uno::UNO_QUERY );
// fill list box of slide transitions
- mpLB_SLIDE_TRANSITIONS->InsertEntry( SD_RESSTR( STR_SLIDETRANSITION_NONE ) );
+ mpLB_SLIDE_TRANSITIONS->InsertEntry( SD_RESSTR( STR_SLIDETRANSITION_NONE ), Image( BitmapEx( "sd/cmd/transition-none.png" ) ) );
+ m_aTransitionLBToSet.push_back( "" );
// set defaults
mpCB_AUTO_PREVIEW->Check(); // automatic preview on
@@ -460,6 +415,7 @@ SlideTransitionPane::SlideTransitionPane(
mpLB_SLIDE_TRANSITIONS->SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected ));
+ mpLB_VARIANT->SetSelectHdl( LINK( this, SlideTransitionPane, VariantListBoxSelected ));
mpLB_SPEED->SetSelectHdl( LINK( this, SlideTransitionPane, SpeedListBoxSelected ));
mpLB_SOUND->SetSelectHdl( LINK( this, SlideTransitionPane, SoundListBoxSelected ));
mpCB_LOOP_SOUND->SetClickHdl( LINK( this, SlideTransitionPane, LoopSoundBoxChecked ));
@@ -487,6 +443,8 @@ void SlideTransitionPane::dispose()
maLateInitTimer.Stop();
removeListener();
mpLB_SLIDE_TRANSITIONS.clear();
+ mpFT_VARIANT.clear();
+ mpLB_VARIANT.clear();
mpFT_SPEED.clear();
mpLB_SPEED.clear();
mpFT_SOUND.clear();
@@ -568,16 +526,16 @@ void SlideTransitionPane::updateControls()
impl::TransitionEffect aEffect( *pFirstPage );
// merge with other pages
- ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aIt(
+ ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aPageIt(
pSelectedPages->begin());
- ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aEndIt(
+ ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aPageEndIt(
pSelectedPages->end());
// start with second page (note aIt != aEndIt, because ! aSelectedPages.empty())
- for( ++aIt ;aIt != aEndIt; ++aIt )
+ for( ++aPageIt; aPageIt != aPageEndIt; ++aPageIt )
{
- if( *aIt )
- aEffect.compareWith( *(*aIt) );
+ if( *aPageIt )
+ aEffect.compareWith( *(*aPageIt) );
}
// detect current slide effect
@@ -591,16 +549,50 @@ void SlideTransitionPane::updateControls()
mpLB_SLIDE_TRANSITIONS->SelectEntryPos( 0 );
else
{
- sal_Int32 nEntry = lcl_getTransitionEffectIndex( mpDrawDoc, aEffect );
+ int nEntry = LISTBOX_ENTRY_NOTFOUND;
+ const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList();
+ sd::TransitionPresetPtr pFound;
+
+ for( auto aIt: rPresetList )
+ {
+ if( aEffect.operator==( *aIt ))
+ {
+ pFound = aIt;
+ // This function can be called before LateInit, with m_aSetToTransitionLBIndex
+ // not set up properly. In that case nEntry will stay as
+ // LISTBOX_ENTRY_NOTFOUND. But in that case we will be called soon again, I think.
+ if( m_aSetToTransitionLBIndex.find( aIt->getSetId() ) != m_aSetToTransitionLBIndex.end() )
+ nEntry = m_aSetToTransitionLBIndex[aIt->getSetId()];
+ break;
+ }
+ }
+
+ mpLB_VARIANT->Clear();
if( nEntry == LISTBOX_ENTRY_NOTFOUND )
+ {
mpLB_SLIDE_TRANSITIONS->SetNoSelection();
+ mpLB_VARIANT->Enable( false );
+ }
else
{
- // first entry in list is "none", so add 1 after translation
- if( m_aPresetIndexes.find( nEntry ) != m_aPresetIndexes.end())
- mpLB_SLIDE_TRANSITIONS->SelectEntryPos( m_aPresetIndexes[ nEntry ] + 1 );
+ // Fill in the variant listbox
+ for( auto aIt: rPresetList )
+ {
+ if( aIt->getSetId().equals( pFound->getSetId() ) )
+ {
+ if( !aIt->getVariantLabel().isEmpty() )
+ {
+ mpLB_VARIANT->InsertEntry( aIt->getVariantLabel() );
+ if( aEffect.operator==( *aIt ))
+ mpLB_VARIANT->SelectEntryPos( mpLB_VARIANT->GetEntryCount()-1 );
+ }
+ }
+ }
+ if( mpLB_VARIANT->GetEntryCount() == 0 )
+ mpLB_VARIANT->Enable( false );
else
- mpLB_SLIDE_TRANSITIONS->SetNoSelection();
+ mpLB_VARIANT->Enable();
+ mpLB_SLIDE_TRANSITIONS->SelectEntryPos( nEntry );
}
}
}
@@ -673,6 +665,7 @@ void SlideTransitionPane::updateControls()
void SlideTransitionPane::updateControlState()
{
mpLB_SLIDE_TRANSITIONS->Enable( mbHasSelection );
+ mpLB_VARIANT->Enable( mbHasSelection && mpLB_VARIANT->GetEntryCount() > 0 );
mpLB_SPEED->Enable( mbHasSelection );
mpLB_SOUND->Enable( mbHasSelection );
mpCB_LOOP_SOUND->Enable( mbHasSelection && (mpLB_SOUND->GetSelectEntryPos() > 2));
@@ -775,15 +768,28 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
if( mpLB_SLIDE_TRANSITIONS->IsEnabled() &&
mpLB_SLIDE_TRANSITIONS->GetSelectEntryCount() > 0 )
{
- TransitionPresetPtr pPreset = lcl_getTransitionPresetByUIName(
- mpDrawDoc, OUString( mpLB_SLIDE_TRANSITIONS->GetSelectEntry()));
+ const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList();
- if( pPreset.get())
+ int nVariant = 0;
+ bool bFound = false;
+ for( auto aIter: rPresetList )
{
- aResult = impl::TransitionEffect( *pPreset );
- aResult.setAllAmbiguous();
+ if( aIter->getSetId().equals(m_aTransitionLBToSet[mpLB_SLIDE_TRANSITIONS->GetSelectEntryPos()]) )
+ {
+ if( mpLB_VARIANT->GetSelectEntryPos() == nVariant)
+ {
+ aResult = impl::TransitionEffect( *aIter );
+ aResult.setAllAmbiguous();
+ bFound = true;
+ break;
+ }
+ else
+ {
+ nVariant++;
+ }
+ }
}
- else
+ if( !bFound )
{
aResult.mnType = 0;
}
@@ -1000,6 +1006,32 @@ IMPL_LINK_NOARG_TYPED(SlideTransitionPane, PlayButtonClicked, Button*, void)
IMPL_LINK_NOARG_TYPED(SlideTransitionPane, TransitionSelected, ListBox&, void)
{
+ mpLB_VARIANT->Clear();
+
+ if( mpLB_SLIDE_TRANSITIONS->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ return;
+
+ if( mpLB_SLIDE_TRANSITIONS->GetSelectEntryPos() > 0)
+ {
+ const sd::TransitionPresetList& rPresetList = sd::TransitionPreset::getTransitionPresetList();
+
+ for( auto aIt: rPresetList )
+ {
+ if( m_aSetToTransitionLBIndex[aIt->getSetId()] == mpLB_SLIDE_TRANSITIONS->GetSelectEntryPos() )
+ mpLB_VARIANT->InsertEntry( aIt->getVariantLabel() );
+ }
+ }
+
+ if( mpLB_VARIANT->GetEntryCount() == 0 )
+ {
+ mpLB_VARIANT->Enable( false );
+ }
+ else
+ {
+ mpLB_VARIANT->Enable();
+ mpLB_VARIANT->SelectEntryPos( 0 );
+ }
+
applyToSelectedPages();
}
@@ -1014,6 +1046,11 @@ IMPL_LINK_NOARG_TYPED(SlideTransitionPane, AdvanceTimeModified, Edit&, void)
applyToSelectedPages();
}
+IMPL_LINK_NOARG_TYPED(SlideTransitionPane, VariantListBoxSelected, ListBox&, void)
+{
+ applyToSelectedPages();
+}
+
IMPL_LINK_NOARG_TYPED(SlideTransitionPane, SpeedListBoxSelected, ListBox&, void)
{
applyToSelectedPages();
@@ -1048,21 +1085,42 @@ IMPL_LINK_NOARG_TYPED(SlideTransitionPane, AutoPreviewClicked, Button*, void)
IMPL_LINK_NOARG_TYPED(SlideTransitionPane, LateInitCallback, Timer *, void)
{
const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
- TransitionPresetList::const_iterator aIter( rPresetList.begin() );
- const TransitionPresetList::const_iterator aEnd( rPresetList.end() );
- sal_uInt16 nIndex = 0;
- ::std::size_t nUIIndex = 0;
- while( aIter != aEnd )
+
+ for( auto aIter: rPresetList )
{
- TransitionPresetPtr pPreset = (*aIter++);
- const OUString aUIName( pPreset->getUIName() );
- if( !aUIName.isEmpty() )
+ TransitionPresetPtr pPreset = aIter;
+ const OUString sLabel( pPreset->getSetLabel() );
+ if( !sLabel.isEmpty() )
{
- mpLB_SLIDE_TRANSITIONS->InsertEntry( aUIName );
- m_aPresetIndexes[ nIndex ] = (sal_uInt16)nUIIndex;
- ++nUIIndex;
+ if( m_aNumVariants.find( pPreset->getSetId() ) == m_aNumVariants.end() )
+ {
+ OUString sImageName("sd/cmd/transition-" + pPreset->getSetId() + ".png");
+
+ mpLB_SLIDE_TRANSITIONS->InsertEntry( sLabel, Image( BitmapEx( sImageName) ) );
+
+ m_aTransitionLBToSet.push_back( pPreset->getSetId() );
+
+ assert( m_aTransitionLBToSet.size() == static_cast<size_t>( mpLB_SLIDE_TRANSITIONS->GetEntryCount() ) );
+
+ m_aNumVariants[ pPreset->getSetId() ] = 1;
+ m_aSetToTransitionLBIndex[ aIter->getSetId() ] = mpLB_SLIDE_TRANSITIONS->GetEntryCount() - 1;
+ }
+ else
+ {
+ m_aNumVariants[ pPreset->getSetId() ]++;
+ }
}
- ++nIndex;
+ }
+
+ for( int i = 0; i < mpLB_SLIDE_TRANSITIONS->GetEntryCount(); ++i )
+ SAL_INFO("sd.transitions", i << ":" << mpLB_SLIDE_TRANSITIONS->GetEntry( i ) << " (" << m_aTransitionLBToSet[i] << ")");
+
+ for( auto aIter: rPresetList )
+ {
+ SAL_INFO("sd.transitions",
+ aIter->getPresetId() << ": " <<
+ m_aSetToTransitionLBIndex[ aIter->getSetId() ] <<
+ " (" << mpLB_SLIDE_TRANSITIONS->GetEntry( m_aSetToTransitionLBIndex[ aIter->getSetId() ] ) << ")" );
}
updateSoundList();
diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx
index 69e714d7be6d..814995ec9c2e 100644
--- a/sd/source/ui/animations/SlideTransitionPane.hxx
+++ b/sd/source/ui/animations/SlideTransitionPane.hxx
@@ -22,6 +22,7 @@
#include "EventMultiplexer.hxx"
#include "SlideSorterViewShell.hxx"
+#include "TransitionPreset.hxx"
#include <vcl/ctrl.hxx>
#include <vcl/lstbox.hxx>
@@ -92,6 +93,7 @@ private:
DECL_LINK_TYPED( TransitionSelected, ListBox&, void );
DECL_LINK_TYPED( AdvanceSlideRadioButtonToggled, RadioButton&, void );
DECL_LINK_TYPED( AdvanceTimeModified, Edit&, void );
+ DECL_LINK_TYPED( VariantListBoxSelected, ListBox&, void );
DECL_LINK_TYPED( SpeedListBoxSelected, ListBox&, void );
DECL_LINK_TYPED( SoundListBoxSelected, ListBox&, void );
DECL_LINK_TYPED( LoopSoundBoxChecked, Button*, void );
@@ -102,6 +104,8 @@ private:
SdDrawDocument * mpDrawDoc;
VclPtr<ListBox> mpLB_SLIDE_TRANSITIONS;
+ VclPtr<FixedText> mpFT_VARIANT;
+ VclPtr<ListBox> mpLB_VARIANT;
VclPtr<FixedText> mpFT_SPEED;
VclPtr<ListBox> mpLB_SPEED;
VclPtr<FixedText> mpFT_SOUND;
@@ -125,8 +129,14 @@ private:
tSoundListType maSoundList;
mutable OUString maCurrentSoundFile;
- typedef ::std::map< sal_uInt16, sal_uInt16 > tPresetIndexesType;
- tPresetIndexesType m_aPresetIndexes;
+ // Map from TransitionSets (as in Effects.xcu) to mpLB_SLIDE_TRANSITIONS entry index.
+ std::map< OUString, int > m_aSetToTransitionLBIndex;
+
+ // The reverse mapping: TransitionSets id of each entry in mpLB_SLIDE_TRANSITIONS.
+ std::vector< OUString > m_aTransitionLBToSet;
+
+ // How many variants each transition set has
+ std::map< OUString, int > m_aNumVariants;
Timer maLateInitTimer;
};
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 2e35e9bf41c2..46202abab5b0 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -241,6 +241,8 @@ public:
DECL_LINK_TYPED( PresTypeHdl, Button*, void );
DECL_LINK_TYPED( UpdateUserDataHdl, Edit&, void );
DECL_LINK_TYPED( SelectEffectHdl, ListBox&, void);
+ DECL_LINK_TYPED( SelectVariantHdl, ListBox&, void);
+ DECL_LINK_TYPED( SelectSpeedHdl, ListBox&, void);
DECL_LINK_TYPED( OpenButtonHdl, Button *, void );
OUString maCreateStr;
@@ -288,7 +290,9 @@ public:
VclPtr<FixedText> mpPage3EffectFL;
VclPtr<FixedText> mpPage3EffectFT;
VclPtr<FadeEffectLB> mpPage3EffectLB;
+ VclPtr<FixedText> mpPage3VariantFT;
VclPtr<FixedText> mpPage3SpeedFT;
+ VclPtr<ListBox> mpPage3VariantLB;
VclPtr<ListBox> mpPage3SpeedLB;
VclPtr<FixedText> mpPage3PresTypeFL;
VclPtr<RadioButton> mpPage3PresTypeLiveRB;
@@ -477,6 +481,8 @@ AssistentDlgImpl::AssistentDlgImpl( vcl::Window* pWindow, const Link<ListBox&,vo
assDlg->get(mpPage3EffectFL, "page3EffectLabel");
assDlg->get(mpPage3EffectFT, "effectLabel");
assDlg->get(mpPage3EffectLB, "effectCombobox");
+ assDlg->get(mpPage3VariantFT, "variantLabel");
+ assDlg->get(mpPage3VariantLB, "variantCombobox");
assDlg->get(mpPage3SpeedFT, "speedLabel");
assDlg->get(mpPage3SpeedLB, "speedCombobox");
assDlg->get(mpPage3PresTypeFL, "presTypeLabel");
@@ -496,6 +502,8 @@ AssistentDlgImpl::AssistentDlgImpl( vcl::Window* pWindow, const Link<ListBox&,vo
maAssistentFunc.InsertControl(3, mpPage3EffectFL );
maAssistentFunc.InsertControl(3, mpPage3EffectFT );
maAssistentFunc.InsertControl(3, mpPage3EffectLB );
+ maAssistentFunc.InsertControl(3, mpPage3VariantFT );
+ maAssistentFunc.InsertControl(3, mpPage3VariantLB );
maAssistentFunc.InsertControl(3, mpPage3SpeedFT );
maAssistentFunc.InsertControl(3, mpPage3SpeedLB );
maAssistentFunc.InsertControl(3, mpPage3PresTypeFL );
@@ -511,11 +519,14 @@ AssistentDlgImpl::AssistentDlgImpl( vcl::Window* pWindow, const Link<ListBox&,vo
mpPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
mpPage3EffectLB->SetDropDownLineCount( 12 );
+ mpPage3VariantLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectVariantHdl ));
+ mpPage3VariantLB->SetDropDownLineCount( 4 );
+
mpPage3SpeedLB->InsertEntry( SD_RESSTR(STR_SLOW) );
mpPage3SpeedLB->InsertEntry( SD_RESSTR(STR_MEDIUM) );
mpPage3SpeedLB->InsertEntry( SD_RESSTR(STR_FAST) );
mpPage3SpeedLB->SetDropDownLineCount( 3 );
- mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
+ mpPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectSpeedHdl ));
mpPage3SpeedLB->SelectEntryPos( 1 );
mpPage3PresTypeLiveRB->Check();
@@ -964,7 +975,7 @@ SfxObjectShellLock AssistentDlgImpl::GetDocument()
SdPage* pPage = pDoc->GetSdPage( nPgRelNum, PK_STANDARD );
if( mpPage5PageListCT->IsPageChecked(nPgAbsNum) )
{
- mpPage3EffectLB->applySelected(pPage);
+ mpPage3EffectLB->applySelected(pPage, *mpPage3VariantLB);
const sal_Int32 nPos = mpPage3SpeedLB->GetSelectEntryPos();
pPage->setTransitionDuration( (nPos == 0) ? 3.0 : (nPos == 1) ? 2.0 : 1.0 );
if(bKiosk)
@@ -1096,6 +1107,17 @@ IMPL_LINK_TYPED( AssistentDlgImpl, SelectRegionHdl, ListBox&, rLB, void )
IMPL_LINK_NOARG_TYPED(AssistentDlgImpl, SelectEffectHdl, ListBox&, void)
{
maEffectPrevIdle.Start();
+ mpPage3EffectLB->FillVariantLB(*mpPage3VariantLB);
+}
+
+IMPL_LINK_NOARG_TYPED(AssistentDlgImpl, SelectVariantHdl, ListBox&, void)
+{
+ maEffectPrevIdle.Start();
+}
+
+IMPL_LINK_NOARG_TYPED(AssistentDlgImpl, SelectSpeedHdl, ListBox&, void)
+{
+ maEffectPrevIdle.Start();
}
IMPL_LINK_NOARG_TYPED( AssistentDlgImpl, OpenButtonHdl, Button*, void )
@@ -1118,7 +1140,7 @@ IMPL_LINK_NOARG_TYPED(AssistentDlgImpl, EffectPreviewIdleHdl, Idle *, void)
{
SdPage* pPage = pDoc->GetSdPage( mnShowPage, PK_STANDARD );
if( pPage )
- mpPage3EffectLB->applySelected(pPage);
+ mpPage3EffectLB->applySelected(pPage, *mpPage3VariantLB);
}
}
mpPreview->startPreview();
diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx
index 9137f37d3388..ff6141410a6d 100644
--- a/sd/source/ui/dlg/dlgctrls.cxx
+++ b/sd/source/ui/dlg/dlgctrls.cxx
@@ -19,6 +19,9 @@
#include <vcl/builderfactory.hxx>
+#include <map>
+#include <set>
+
#include "strings.hrc"
#include "dlgctrls.hxx"
#include "sdresid.hxx"
@@ -29,6 +32,12 @@ using namespace ::sd;
struct FadeEffectLBImpl
{
+ // The set id of each entry
+ std::vector< OUString > maSet;
+
+ // How many variants each transition set has
+ std::map< OUString, int > maNumVariants;
+
std::vector< TransitionPresetPtr > maPresets;
};
@@ -51,27 +60,56 @@ void FadeEffectLB::dispose()
void FadeEffectLB::Fill()
{
- TransitionPresetPtr pPreset;
-
InsertEntry( SD_RESSTR( STR_EFFECT_NONE ) );
- mpImpl->maPresets.push_back( pPreset );
+ mpImpl->maPresets.push_back( TransitionPresetPtr() );
+ mpImpl->maSet.push_back( "" );
const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
- TransitionPresetList::const_iterator aIter;
- for( aIter = rPresetList.begin(); aIter != rPresetList.end(); ++aIter )
+
+ for( auto aIter = rPresetList.begin(); aIter != rPresetList.end(); ++aIter )
{
- pPreset = (*aIter);
- const OUString aUIName( pPreset->getUIName() );
- if( !aUIName.isEmpty() )
+ TransitionPresetPtr pPreset = *aIter;
+ const OUString sLabel( pPreset->getSetLabel() );
+ if( !sLabel.isEmpty() )
{
- InsertEntry( aUIName );
+ if( mpImpl->maNumVariants.find( pPreset->getSetId() ) == mpImpl->maNumVariants.end() )
+ {
+ InsertEntry( sLabel );
+ mpImpl->maSet.push_back( pPreset->getSetId() );
+ mpImpl->maNumVariants[pPreset->getSetId()] = 1;
+ }
+ else
+ {
+ mpImpl->maNumVariants[pPreset->getSetId()]++;
+ }
mpImpl->maPresets.push_back( pPreset );
}
}
+ assert( static_cast<size_t>( GetEntryCount() ) == mpImpl->maSet.size() );
+ assert( mpImpl->maPresets.size() == 1 + TransitionPreset::getTransitionPresetList().size() );
+
SelectEntryPos(0);
}
+void FadeEffectLB::FillVariantLB(ListBox& rVariantLB)
+{
+ rVariantLB.Clear();
+ for( auto aIter = mpImpl->maPresets.begin(); aIter != mpImpl->maPresets.end(); ++aIter )
+ {
+ TransitionPresetPtr pPreset = *aIter;
+ if( !pPreset )
+ continue;
+ const OUString sLabel( pPreset->getSetLabel() );
+ if( !sLabel.isEmpty() && mpImpl->maSet[GetSelectEntryPos()].equals( pPreset->getSetId() ) )
+ {
+ rVariantLB.InsertEntry( pPreset->getVariantLabel() );
+ }
+ }
+ if( rVariantLB.GetEntryCount() > 0 )
+ rVariantLB.SelectEntryPos( 0 );
+}
+
VCL_BUILDER_DECL_FACTORY(FadeEffectLB)
{
WinBits nBits = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK;
@@ -84,24 +122,35 @@ VCL_BUILDER_DECL_FACTORY(FadeEffectLB)
rRet = VclPtr<FadeEffectLB>::Create(pParent, nBits);
}
-void FadeEffectLB::applySelected( SdPage* pSlide ) const
+void FadeEffectLB::applySelected( SdPage* pSlide, ListBox& rVariantLB ) const
{
- const sal_Int32 nPos = GetSelectEntryPos();
+ if( !pSlide )
+ return;
- if( pSlide && (static_cast<size_t>(nPos) < mpImpl->maPresets.size() ) )
+ if( GetSelectEntryPos() == 0 )
{
- TransitionPresetPtr pPreset( mpImpl->maPresets[nPos] );
+ pSlide->setTransitionType( 0 );
+ pSlide->setTransitionSubtype( 0 );
+ pSlide->setTransitionDirection( true );
+ pSlide->setTransitionFadeColor( 0 );
+ return;
+ }
- if( pPreset.get() )
- {
- pPreset->apply( pSlide );
- }
- else
+ int nMatch = 0;
+ for( auto aIter = mpImpl->maPresets.begin(); aIter != mpImpl->maPresets.end(); ++aIter )
+ {
+ TransitionPresetPtr pPreset = *aIter;
+ if( !pPreset )
+ continue;
+ const OUString sLabel( pPreset->getSetLabel() );
+ if( !sLabel.isEmpty() && mpImpl->maSet[GetSelectEntryPos()].equals( pPreset->getSetId() ) )
{
- pSlide->setTransitionType( 0 );
- pSlide->setTransitionSubtype( 0 );
- pSlide->setTransitionDirection( true );
- pSlide->setTransitionFadeColor( 0 );
+ if( nMatch == rVariantLB.GetSelectEntryPos() )
+ {
+ pPreset->apply( pSlide );
+ break;
+ }
+ nMatch++;
}
}
}
diff --git a/sd/source/ui/inc/dlgctrls.hxx b/sd/source/ui/inc/dlgctrls.hxx
index 583c131e40d2..a8ae4ac905c2 100644
--- a/sd/source/ui/inc/dlgctrls.hxx
+++ b/sd/source/ui/inc/dlgctrls.hxx
@@ -40,8 +40,9 @@ public:
virtual void dispose() override;
void Fill();
-/* void selectEffectFromPage( SdPage* pPage ); */
- void applySelected( SdPage* pSlide ) const;
+ void FillVariantLB(ListBox& rVariantLB);
+
+ void applySelected( SdPage* pSlide, ListBox& rVariantLB ) const;
FadeEffectLBImpl* mpImpl;
};
diff --git a/sd/uiconfig/simpress/ui/assistentdialog.ui b/sd/uiconfig/simpress/ui/assistentdialog.ui
index bdb15ae8174d..e91c0d7b1e67 100644
--- a/sd/uiconfig/simpress/ui/assistentdialog.ui
+++ b/sd/uiconfig/simpress/ui/assistentdialog.ui
@@ -711,6 +711,22 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="variantLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">_Variant:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">variantCombobox</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="speedLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -721,7 +737,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -740,7 +756,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="speedCombobox">
+ <object class="GtkComboBox" id="variantCombobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
@@ -752,6 +768,19 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkComboBox" id="speedCombobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
index 3870b74a0903..aed73b8fe587 100644
--- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
+++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui
@@ -78,10 +78,11 @@
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Speed:</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
@@ -97,7 +98,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
<child>
@@ -109,7 +110,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
@@ -125,7 +126,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">2</property>
</packing>
</child>
<child>
@@ -139,7 +140,28 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="variant_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Variant</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="variant_list">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>