20#include <com/sun/star/drawing/XDrawView.hpp>
55using ::com::sun::star::uno::Reference;
71 mnType( rPreset.getTransition()),
79 mnType( rPage.getTransitionType() ),
80 mnSubType( rPage.getTransitionSubtype() ),
125 (
mnType == rPreset.getTransition()) &&
217void lcl_ApplyToPages(
219 const ::sd::impl::TransitionEffect & rEffect )
221 for(
const auto& rpPage : *rpPages )
223 rEffect.applyTo( *rpPage );
227void lcl_CreateUndoForPages(
241 OUString aComment(
SdResId(STR_UNDO_SLIDE_PARAMS) );
243 std::unique_ptr<SdUndoGroup> pUndoGroup(
new SdUndoGroup( pDoc ));
244 pUndoGroup->SetComment( aComment );
246 for(
const auto& rpPage : *rpPages )
255struct lcl_EqualsSoundFileName
257 explicit lcl_EqualsSoundFileName( OUString aStr ) :
261 bool operator() (
const OUString & rStr )
const
267 return maStr.equalsIgnoreAsciiCase(
aURL.GetBase() );
269 return maStr ==
aURL.GetBase();
278bool lcl_findSoundInList( const ::std::vector< OUString > & rSoundList,
279 std::u16string_view rFileName,
280 ::std::vector< OUString >::size_type & rOutPosition )
283 ::std::vector< OUString >::const_iterator aIt =
284 ::std::find_if( rSoundList.begin(), rSoundList.end(),
285 lcl_EqualsSoundFileName(
aURL.GetBase()));
286 if( aIt != rSoundList.end())
288 rOutPosition = ::std::distance( rSoundList.begin(), aIt );
295OUString lcl_getSoundFileURL(
296 const ::std::vector< OUString > & rSoundList,
304 "Sound list-box is not synchronized to sound list" );
307 return rSoundList[
nPos ];
313struct lcl_AppendSoundToListBox
316 : mrListBox( rListBox )
319 void operator() ( std::u16string_view rString )
const
322 mrListBox.append_text(
aURL.GetBase() );
329void lcl_FillSoundListBox(
330 const ::std::vector< OUString > & rSoundList,
336 for( sal_Int32 i=nCount - 1;
i>=3; --
i )
339 ::std::for_each( rSoundList.begin(), rSoundList.end(),
340 lcl_AppendSoundToListBox( rOutListBox ));
350 for(
const auto& aIt: rPresetList )
352 if( rEffect.operator==( *aIt ))
383 SetOutputSizePixel(aSize);
395 PanelLayout( pParent,
"SlideTransitionsPanel",
"modules/simpress/ui/slidetransitionspanel.ui" ),
397 mpDrawDoc( rBase.GetDocShell() ? rBase.GetDocShell()->GetDoc() : nullptr ),
398 mbHasSelection( false ),
399 mbUpdatingControls( false ),
400 mbIsMainViewChangePending( false ),
401 maLateInitTimer(
"sd SlideTransitionPane maLateInitTimer")
409 return css::ui::LayoutSize(nMinimumHeight, -1, nMinimumHeight);
412constexpr sal_uInt16
nNoneId = std::numeric_limits<sal_uInt16>::max();
442 mxView.set(
mxModel->getCurrentController(), uno::UNO_QUERY );
446 nNoneId,
Image( StockImage::Yes,
"sd/cmd/transition-none.png" ),
447 SdResId( STR_SLIDETRANSITION_NONE ),
513 std::shared_ptr<sd::slidesorter::SlideSorterViewShell::PageSelection> pSelection;
515 if( pSlideSorterViewShell )
521 pSelection = std::make_shared<sd::slidesorter::SlideSorterViewShell::PageSelection>();
526 pSelection->push_back(pPage);
536 if( pSelectedPages->empty())
547 SdPage * pFirstPage = pSelectedPages->front();
555 for(
const auto& rpPage : *pSelectedPages )
564 SAL_WARN(
"sd.transitions",
"Unusual, ambiguous transition effect" );
601 std::vector<OUString>::size_type
nPos = 0;
690 "Dialog should only open when \"Other sound\" is selected" );
692 bool bValidSoundFile(
false );
693 bool bQuitLoop(
false );
695 while( ! bQuitLoop &&
698 OUString aFile = aFileDialog.
GetPath();
699 std::vector<OUString>::size_type
nPos = 0;
702 if( bValidSoundFile )
713 DBG_ASSERT( bValidSoundFile,
"Adding sound to gallery failed" );
719 OUString aStrWarning(
SdResId(STR_WARNING_NOSOUNDFILE));
720 aStrWarning = aStrWarning.replaceFirst(
"%", aFile);
722 VclMessageType::Warning, VclButtonsType::NONE,
728 bValidSoundFile =
false;
732 if( bValidSoundFile )
737 if( bValidSoundFile )
742 std::vector<OUString>::size_type
nPos = 0;
765 auto aSelected = rPresetList.begin();
778 for(
const auto& aIter: rPresetList )
780 if( aIter->getSetId() == (*aSelected)->getSetId() )
802 else if (bNoneSelected)
835 if( mxLB_SOUND->get_sensitive())
837 maCurrentSoundFile.clear();
838 sal_Int32
nPos = mxLB_SOUND->get_active();
841 aResult.mbStopSound =
nPos == 1;
842 aResult.mbSoundOn =
nPos > 1;
843 if( aResult.mbStopSound )
845 aResult.maSound.clear();
846 aResult.mbSoundAmbiguous =
false;
850 aResult.maSound = lcl_getSoundFileURL(maSoundList, *mxLB_SOUND);
851 aResult.mbSoundAmbiguous =
false;
852 maCurrentSoundFile = aResult.maSound;
858 if( mxCB_LOOP_SOUND->get_sensitive() )
860 aResult.mbLoopSound = mxCB_LOOP_SOUND->get_active();
861 aResult.mbLoopSoundAmbiguous =
false;
867void SlideTransitionPane::applyToSelectedPages(
bool bPreview =
true)
869 if( mbUpdatingControls )
876 if( ! pSelectedPages->empty())
878 lcl_CreateUndoForPages( pSelectedPages, mrBase );
879 lcl_ApplyToPages( pSelectedPages, aEffect );
880 mrBase.GetDocShell()->SetModified();
882 if( mxCB_AUTO_PREVIEW->get_sensitive() &&
883 mxCB_AUTO_PREVIEW->get_active() && bPreview)
888 SlideShow::Stop( mrBase );
895void SlideTransitionPane::playCurrentEffect()
900 Reference< css::animations::XAnimationNode > xNode;
901 SlideShow::StartPreview( mrBase,
mxView->getCurrentPage(), xNode );
905void SlideTransitionPane::addListener()
908 mrBase.GetEventMultiplexer()->AddEventListener( aLink );
911void SlideTransitionPane::removeListener()
914 mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
920 switch (rEvent.meEventId)
923 onSelectionChanged();
928 onChangeCurrentPage();
933 onSelectionChanged();
934 onChangeCurrentPage();
938 mbIsMainViewChangePending =
true;
942 if (mbIsMainViewChangePending)
944 mbIsMainViewChangePending =
false;
949 if (mrBase.GetMainViewShell() !=
nullptr)
951 mxView.set(mrBase.GetController(), css::uno::UNO_QUERY);
952 onSelectionChanged();
953 onChangeCurrentPage();
961 onSelectionChanged();
962 onChangeCurrentPage();
970 DBG_ASSERT( mpDrawDoc,
"Invalid Draw Document!" );
975 std::make_shared<::sd::slidesorter::SlideSorterViewShell::PageSelection>();
978 pPages->reserve( nPageCount );
979 for( sal_uInt16
i=0;
i<nPageCount; ++
i )
983 pPages->push_back( pPage );
986 if( ! pPages->empty())
988 lcl_CreateUndoForPages( pPages, mrBase );
989 lcl_ApplyToPages( pPages, getTransitionEffectFromControls() );
1000 updateVariants( mxVS_TRANSITION_ICONS->GetSelectedItemId() - 1 );
1001 applyToSelectedPages();
1005void SlideTransitionPane::updateVariants(
size_t nPresetOffset )
1008 mxLB_VARIANT->clear();
1009 mxVS_TRANSITION_ICONS->SelectItem(
nNoneId);
1011 if( nPresetOffset >= rPresetList.size() )
1013 mxLB_VARIANT->set_sensitive(
false );
1017 auto pFound = rPresetList.begin();
1018 std::advance( pFound, nPresetOffset );
1021 size_t nFirstItem = 0, nItem = 1;
1022 for(
const auto& aIt: rPresetList )
1024 if( aIt->getSetId() == (*pFound)->getSetId() )
1028 if( !aIt->getVariantLabel().isEmpty() )
1030 mxLB_VARIANT->append_text( aIt->getVariantLabel() );
1031 if( *pFound == aIt )
1032 mxLB_VARIANT->set_active( mxLB_VARIANT->get_count()-1 );
1038 if( mxLB_VARIANT->get_count() == 0 )
1039 mxLB_VARIANT->set_sensitive(
false );
1041 mxLB_VARIANT->set_sensitive(
true);
1044 mxVS_TRANSITION_ICONS->SelectItem( nFirstItem );
1050 updateControlState();
1051 applyToSelectedPages(
false);
1056 applyToSelectedPages(
false);
1061 applyToSelectedPages();
1066 double duration_value =
static_cast<double>(mxCBX_duration->get_value(FieldUnit::SECOND));
1067 if (duration_value <= 0.0)
1068 mxCBX_duration->set_value(0, FieldUnit::SECOND);
1070 mxCBX_duration->set_value(duration_value, FieldUnit::SECOND);
1072 applyToSelectedPages();
1077 applyToSelectedPages();
1082 sal_Int32
nPos = mxLB_SOUND->get_active();
1086 openSoundFileDialog();
1088 updateControlState();
1089 applyToSelectedPages();
1094 applyToSelectedPages();
1107 size_t nPresetOffset = 0;
1110 const OUString sLabel( pPreset->getSetLabel() );
1111 if( !sLabel.isEmpty() )
1113 if( m_aNumVariants.find( pPreset->getSetId() ) == m_aNumVariants.end() )
1115 OUString sImageName(
"sd/cmd/transition-" + pPreset->getSetId() +
".png");
1118 sImageName =
"sd/cmd/transition-none.png";
1120 mxVS_TRANSITION_ICONS->InsertItem(
1121 nPresetOffset + 1,
Image(StockImage::Yes, sImageName), sLabel,
1124 m_aNumVariants[ pPreset->getSetId() ] = 1;
1128 m_aNumVariants[ pPreset->getSetId() ]++;
1133 mxVS_TRANSITION_ICONS->Recalculate();
1135 SAL_INFO(
"sd.transitions",
"Item transition offsets in ValueSet:");
1136 for(
size_t i = 0;
i < mxVS_TRANSITION_ICONS->GetItemCount(); ++
i )
1137 SAL_INFO(
"sd.transitions",
i <<
":" << mxVS_TRANSITION_ICONS->GetItemId(
i ) );
1140 SAL_INFO(
"sd.transitions",
"Transition presets by offsets:");
1141 for(
const auto& aIter: rPresetList )
1143 SAL_INFO(
"sd.transitions", nPresetOffset++ <<
" " <<
1144 aIter->getPresetId() <<
": " << aIter->getSetId() );
@ EditViewSelection
The selection in the center pane has changed.
@ SlideSortedSelection
The selection in the slide sorter has changed, regardless of whether the slide sorter is displayed in...
@ Disposing
The EventMultiplexer itself is being disposed.
@ MainViewRemoved
The current MainViewShell (the ViewShell displayed in the center pane) has been removed.
@ MainViewAdded
A new ViewShell has been made the MainViewShell.
@ ConfigurationUpdated
A configuration update has been completed.
@ CurrentPageChanged
The current page has changed.
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static vcl::Window * GetFocusWindow()
static bool FillObjList(std::u16string_view rThemeName, std::vector< OUString > &rObjList)
static bool InsertURL(std::u16string_view rThemeName, std::u16string_view rURL)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
virtual weld::Window * GetFrameWeld() const
std::unique_ptr< weld::Builder > m_xBuilder
Size get_preferred_size() const
The class SdOpenSoundFileDialog wraps the FileDialogHelper, displaying the FILEOPEN_PLAY dialog templ...
bool IsPreviewTransitions() const
void SetPreviewTransitions(bool bOn)
void setTransitionFadeColor(sal_Int32 nTransitionFadeColor)
void SetTime(double fNewTime)
PresChange GetPresChange() const
double getTransitionDuration() const
void setTransitionDirection(bool bTransitionbDirection)
static SdPage * getImplementation(const css::uno::Reference< css::drawing::XDrawPage > &xPage)
returns the SdPage implementation for the given XDrawPage or 0 if not available
const OUString & GetSoundFile() const
void SetLoopSound(bool bLoopSound)
void setTransitionSubtype(sal_Int16 nTransitionSubtype)
void SetPresChange(PresChange eChange)
void SetSoundFile(const OUString &rStr)
void SetStopSound(bool bStopSound)
void setTransitionType(sal_Int16 nTransitionType)
void SetSound(bool bNewSoundOn)
void setTransitionDuration(double fTransitionDuration)
css::uno::Reference< css::uno::XInterface > const & getUnoModel()
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
ViewShellId GetViewShellId() const override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
void RecalculateItemSizes()
void SetStyle(WinBits nStyle)
void EnableFullItemMode(bool bFullMode)
void SetColCount(sal_uInt16 nNewCols=1)
weld::ScrolledWindow * GetScrollBar() const
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
virtual SfxUndoManager * GetUndoManager() override
SdDrawDocument * GetDoc()
virtual ~SlideTransitionPane() override
impl::TransitionEffect getTransitionEffectFromControls() const
::sd::slidesorter::SharedPageSelection getSelectedPages() const
OUString maCurrentSoundFile
std::unique_ptr< weld::Button > mxPB_PLAY
std::unique_ptr< weld::RadioButton > mxRB_ADVANCE_ON_MOUSE
std::unique_ptr< weld::CustomWeld > mxVS_TRANSITION_ICONSWin
std::unique_ptr< weld::ComboBox > mxLB_SOUND
void openSoundFileDialog()
std::vector< OUString > maSoundList
void onSelectionChanged()
std::unique_ptr< weld::ComboBox > mxLB_VARIANT
SlideTransitionPane(weld::Widget *pParent, ViewShellBase &rBase)
void Initialize(SdDrawDocument *pDoc)
std::unique_ptr< TransitionPane > mxVS_TRANSITION_ICONS
std::unique_ptr< weld::Label > mxFT_SOUND
std::unique_ptr< weld::CheckButton > mxCB_AUTO_PREVIEW
SdDrawDocument * mpDrawDoc
std::unique_ptr< weld::MetricSpinButton > mxCBX_duration
std::unique_ptr< weld::CheckButton > mxCB_LOOP_SOUND
virtual css::ui::LayoutSize GetHeightForWidth(const sal_Int32 nWidth) override
css::uno::Reference< css::frame::XModel > mxModel
std::unique_ptr< weld::Button > mxPB_APPLY_TO_ALL
std::unique_ptr< weld::MetricSpinButton > mxMF_ADVANCE_AUTO_AFTER
std::unique_ptr< weld::RadioButton > mxRB_ADVANCE_AUTO
void onChangeCurrentPage()
void updateVariants(size_t nPresetOffset)
we use an integer offset into the list of transition presets
css::uno::Reference< css::drawing::XDrawView > mxView
void updateControlState()
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
TransitionPane(std::unique_ptr< weld::ScrolledWindow > pScrolledWindow)
static const TransitionPresetList & getTransitionPresetList()
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
DrawDocShell * GetDocShell() const
SD_DLLPUBLIC SlideSorter & GetSlideSorter() const
std::shared_ptr< PageSelection > GetPageSelection() const
Return the set of selected pages.
virtual void remove(int pos)=0
virtual int get_active() const=0
virtual int get_count() const=0
virtual OutputDevice & get_ref_device()=0
#define DBG_ASSERT(sCon, aError)
#define GALLERY_THEME_USERSOUNDS
#define GALLERY_THEME_SOUNDS
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::shared_ptr< SlideSorterViewShell::PageSelection > SharedPageSelection
IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback, Timer *, void)
std::vector< TransitionPresetPtr > TransitionPresetList
std::shared_ptr< TransitionPreset > TransitionPresetPtr
IMPL_LINK(SlideTransitionPane, EventMultiplexerListener, tools::EventMultiplexerEvent &, rEvent, void)
constexpr sal_uInt16 nNoneId
OUString SdResId(TranslateId aId)
uno::Reference< presentation::XSlideShowView > mxView
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
bool mbPresChangeAmbiguous
bool operator==(const ::sd::TransitionPreset &rPreset) const
TransitionEffect(const ::sd::TransitionPreset &rPreset)
TransitionEffect(const SdPage &rPage)
bool mbLoopSoundAmbiguous
void compareWith(const SdPage &rPage)
void applyTo(SdPage &rOutPage) const