diff options
author | Javiya Vivekkumar Dineshbhai <vivek.javiya@collabora.com> | 2024-08-14 12:06:45 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-10-18 13:19:47 +0200 |
commit | feb80bccc3fcf91523a86569aab52dd650e3f8f4 (patch) | |
tree | d78542cdea5f1c6e0316bdf2acc461136481e0c1 | |
parent | f51bf81cfb4330d57909e00aeca7229b71c02dd0 (diff) |
lok: enable transition repeat after x property
Change-Id: I61bd2ebaebfb19350aa3b3634f5877c0bfa05880
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171773
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | sd/source/ui/animations/SlideTransitionPane.cxx | 65 | ||||
-rw-r--r-- | sd/source/ui/inc/SlideTransitionPane.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 10 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/slidetransitionspanel.ui | 105 |
4 files changed, 184 insertions, 2 deletions
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 30c92016e305..0ae1a5dd7d7a 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -368,6 +368,7 @@ SlideTransitionPane::SlideTransitionPane( mpDrawDoc( rBase.GetDocShell() ? rBase.GetDocShell()->GetDoc() : nullptr ), mxTransitionsIconView(m_xBuilder->weld_icon_view("transitions_icons")), mxTransitionsScrollWindow(m_xBuilder->weld_scrolled_window("transitions_icons_scrolled_window")), + mxRepeatAutoFrame(m_xBuilder->weld_frame("repeat_after_frame")), mbHasSelection( false ), mbUpdatingControls( false ), mbIsMainViewChangePending( false ), @@ -392,6 +393,9 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) mxRB_ADVANCE_ON_MOUSE = m_xBuilder->weld_radio_button(u"rb_mouse_click"_ustr); mxRB_ADVANCE_AUTO = m_xBuilder->weld_radio_button(u"rb_auto_after"_ustr); mxMF_ADVANCE_AUTO_AFTER = m_xBuilder->weld_metric_spin_button(u"auto_after_value"_ustr, FieldUnit::SECOND); + mxRB_REPEAT_DISABLED = m_xBuilder->weld_radio_button(u"rb_disabled"_ustr); + mxRB_REPEAT_AUTO = m_xBuilder->weld_radio_button(u"rb_auto_repeat"_ustr); + mxMF_REPEAT_AUTO_AFTER = m_xBuilder->weld_metric_spin_button(u"rb_auto_repeat_value"_ustr, FieldUnit::SECOND); mxPB_APPLY_TO_ALL = m_xBuilder->weld_button(u"apply_to_all"_ustr); mxPB_PLAY = m_xBuilder->weld_button(u"play"_ustr); mxCB_AUTO_PREVIEW = m_xBuilder->weld_check_button(u"auto_preview"_ustr); @@ -401,6 +405,8 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) int nWidthChars = mxMF_ADVANCE_AUTO_AFTER->get_width_chars(); mxMF_ADVANCE_AUTO_AFTER->set_max(nMax, FieldUnit::SECOND); mxMF_ADVANCE_AUTO_AFTER->set_width_chars(nWidthChars); + mxMF_REPEAT_AUTO_AFTER->set_max(nMax, FieldUnit::SECOND); + mxMF_REPEAT_AUTO_AFTER->set_width_chars(nWidthChars); mxCBX_duration->set_width_chars(nWidthChars); if( pDoc ) @@ -430,9 +436,14 @@ void SlideTransitionPane::Initialize(SdDrawDocument* pDoc) mxRB_ADVANCE_ON_MOUSE->connect_toggled( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); mxRB_ADVANCE_AUTO->connect_toggled( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled )); mxMF_ADVANCE_AUTO_AFTER->connect_value_changed( LINK( this, SlideTransitionPane, AdvanceTimeModified )); + mxRB_REPEAT_DISABLED->connect_toggled( LINK( this, SlideTransitionPane, RepeatAfterRadioButtonToggled )); + mxRB_REPEAT_AUTO->connect_toggled( LINK( this, SlideTransitionPane, RepeatAfterRadioButtonToggled )); + mxMF_REPEAT_AUTO_AFTER->connect_value_changed( LINK( this, SlideTransitionPane, RepeatAfterTimeModified )); mxCB_AUTO_PREVIEW->connect_toggled( LINK( this, SlideTransitionPane, AutoPreviewClicked )); addListener(); + mxRB_REPEAT_DISABLED->set_active( true ); + maLateInitTimer.SetTimeout(200); maLateInitTimer.SetInvokeHandler(LINK(this, SlideTransitionPane, LateInitCallback)); maLateInitTimer.Start(); @@ -444,6 +455,7 @@ SlideTransitionPane::~SlideTransitionPane() removeListener(); mxTransitionsScrollWindow.reset(); mxTransitionsIconView.reset(); + mxRepeatAutoFrame.reset(); mxLB_VARIANT.reset(); mxCBX_duration.reset(); mxFT_SOUND.reset(); @@ -452,6 +464,9 @@ SlideTransitionPane::~SlideTransitionPane() mxRB_ADVANCE_ON_MOUSE.reset(); mxRB_ADVANCE_AUTO.reset(); mxMF_ADVANCE_AUTO_AFTER.reset(); + mxRB_REPEAT_DISABLED.reset(); + mxRB_REPEAT_AUTO.reset(); + mxMF_REPEAT_AUTO_AFTER.reset(); mxPB_APPLY_TO_ALL.reset(); mxPB_PLAY.reset(); mxCB_AUTO_PREVIEW.reset(); @@ -593,6 +608,20 @@ void SlideTransitionPane::updateControls() mxMF_ADVANCE_AUTO_AFTER->set_value(aEffect.mfTime * 100.0, FieldUnit::SECOND); } + sd::PresentationSettings& rSettings = mpDrawDoc->getPresentationSettings(); + + if ( !rSettings.mbEndless ) + { + mxRB_REPEAT_DISABLED->set_active( true ); + mxRB_REPEAT_AUTO->set_active( false ); + } + else + { + mxRB_REPEAT_DISABLED->set_active( false ); + mxRB_REPEAT_AUTO->set_active( true ); + mxMF_REPEAT_AUTO_AFTER->set_value(rSettings.mnPauseTimeout, FieldUnit::SECOND); + } + if (comphelper::LibreOfficeKit::isActive()) { mxPB_PLAY->hide(); @@ -604,6 +633,7 @@ void SlideTransitionPane::updateControls() } else { + mxRepeatAutoFrame->hide(); SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress); mxCB_AUTO_PREVIEW->set_active( pOptions->IsPreviewTransitions() ); } @@ -624,6 +654,9 @@ void SlideTransitionPane::updateControlState() mxRB_ADVANCE_ON_MOUSE->set_sensitive( mbHasSelection ); mxRB_ADVANCE_AUTO->set_sensitive( mbHasSelection ); mxMF_ADVANCE_AUTO_AFTER->set_sensitive( mbHasSelection && mxRB_ADVANCE_AUTO->get_active()); + mxRB_REPEAT_DISABLED->set_sensitive( mbHasSelection ); + mxRB_REPEAT_AUTO->set_sensitive( mbHasSelection ); + mxMF_REPEAT_AUTO_AFTER->set_sensitive( mbHasSelection && mxRB_REPEAT_AUTO->get_active()); mxPB_APPLY_TO_ALL->set_sensitive( mbHasSelection ); mxPB_PLAY->set_sensitive( mbHasSelection ); @@ -793,6 +826,27 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co aResult.mbPresChangeAmbiguous = false; } + // transition repeat after + if (mxRB_REPEAT_DISABLED->get_sensitive() && mxRB_REPEAT_AUTO->get_sensitive() + && (mxRB_REPEAT_DISABLED->get_active() || mxRB_REPEAT_AUTO->get_active())) + { + sd::PresentationSettings& rSettings = mpDrawDoc->getPresentationSettings(); + + if ( mxRB_REPEAT_DISABLED->get_active() ) + { + rSettings.mbEndless = false; + rSettings.mnPauseTimeout = 0; + } + else + { + if ( mxMF_REPEAT_AUTO_AFTER->get_sensitive() ) + { + rSettings.mbEndless = true; + rSettings.mnPauseTimeout = static_cast<sal_uInt32>(mxMF_REPEAT_AUTO_AFTER->get_value(FieldUnit::SECOND)); + } + } + } + // sound if( mxLB_SOUND->get_sensitive()) { @@ -1005,11 +1059,22 @@ IMPL_LINK_NOARG(SlideTransitionPane, AdvanceSlideRadioButtonToggled, weld::Toggl applyToSelectedPages(false); } +IMPL_LINK_NOARG(SlideTransitionPane, RepeatAfterRadioButtonToggled, weld::Toggleable&, void) +{ + updateControlState(); + applyToSelectedPages(false); +} + IMPL_LINK_NOARG(SlideTransitionPane, AdvanceTimeModified, weld::MetricSpinButton&, void) { applyToSelectedPages(false); } +IMPL_LINK_NOARG(SlideTransitionPane, RepeatAfterTimeModified, weld::MetricSpinButton&, void) +{ + applyToSelectedPages(false); +} + IMPL_LINK_NOARG(SlideTransitionPane, VariantListBoxSelected, weld::ComboBox&, void) { applyToSelectedPages(); diff --git a/sd/source/ui/inc/SlideTransitionPane.hxx b/sd/source/ui/inc/SlideTransitionPane.hxx index 5f8437c859aa..0a7eeed88ef4 100644 --- a/sd/source/ui/inc/SlideTransitionPane.hxx +++ b/sd/source/ui/inc/SlideTransitionPane.hxx @@ -94,7 +94,9 @@ private: DECL_LINK( TransitionSelected, weld::IconView&, bool ); DECL_LINK( AdvanceSlideRadioButtonToggled, weld::Toggleable&, void ); + DECL_LINK( RepeatAfterRadioButtonToggled, weld::Toggleable&, void ); DECL_LINK( AdvanceTimeModified, weld::MetricSpinButton&, void ); + DECL_LINK( RepeatAfterTimeModified, weld::MetricSpinButton&, void ); DECL_LINK( VariantListBoxSelected, weld::ComboBox&, void ); DECL_LINK( DurationModifiedHdl, weld::MetricSpinButton&, void ); DECL_LINK( DurationLoseFocusHdl, weld::Widget&, void ); @@ -108,6 +110,7 @@ private: std::unique_ptr<weld::IconView> mxTransitionsIconView; std::unique_ptr<weld::ScrolledWindow> mxTransitionsScrollWindow; + std::unique_ptr<weld::Frame> mxRepeatAutoFrame; std::unique_ptr<weld::ComboBox> mxLB_VARIANT; std::unique_ptr<weld::MetricSpinButton> mxCBX_duration; std::unique_ptr<weld::Label> mxFT_SOUND; @@ -116,6 +119,9 @@ private: std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_ON_MOUSE; std::unique_ptr<weld::RadioButton> mxRB_ADVANCE_AUTO; std::unique_ptr<weld::MetricSpinButton> mxMF_ADVANCE_AUTO_AFTER; + std::unique_ptr<weld::RadioButton> mxRB_REPEAT_DISABLED; + std::unique_ptr<weld::RadioButton> mxRB_REPEAT_AUTO; + std::unique_ptr<weld::MetricSpinButton> mxMF_REPEAT_AUTO_AFTER; std::unique_ptr<weld::Button> mxPB_APPLY_TO_ALL; std::unique_ptr<weld::Button> mxPB_PLAY; std::unique_ptr<weld::CheckButton> mxCB_AUTO_PREVIEW; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index c6efd223e4bb..1c58c986c218 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -4378,6 +4378,16 @@ OString SdXImpressDocument::getPresentationInfo() const aJsonWriter.put("nextSlideDuration", fSlideDuration * 1000); } } + + sd::PresentationSettings const& rSettings = mpDoc->getPresentationSettings(); + + const bool bIsEndless = rSettings.mbEndless; + aJsonWriter.put("isEndless", bIsEndless); + + if (bIsEndless) { + const sal_Int32 nPauseTimeout = rSettings.mnPauseTimeout; + aJsonWriter.put("loopAndRepeatDuration", nPauseTimeout); + } } AnimationsExporter aAnimationExporter(aJsonWriter, pSlide); diff --git a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui index 73916f1fb947..16bc2d0ffa12 100644 --- a/sd/uiconfig/simpress/ui/slidetransitionspanel.ui +++ b/sd/uiconfig/simpress/ui/slidetransitionspanel.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.40.0 --> +<!-- Generated with glade 3.38.2 --> <interface domain="sd"> <requires lib="gtk+" version="3.20"/> <object class="GtkAdjustment" id="adjustment1"> @@ -333,6 +333,106 @@ </packing> </child> <child> + <object class="GtkFrame" id="repeat_after_frame"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label-xalign">0</property> + <property name="shadow-type">none</property> + <child> + <!-- n-columns=2 n-rows=2 --> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">12</property> + <property name="margin-top">3</property> + <property name="row-spacing">6</property> + <property name="column-spacing">12</property> + <child> + <object class="GtkRadioButton" id="rb_disabled"> + <property name="label" translatable="yes" context="slidetransitionspanel|rb_disabled">Disabled</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="active">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="rb_disabled-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="slidetransitionspanel|extended_tip|rb_disabled">Select to advance to the next slide on a mouse click.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="rb_auto_repeat"> + <property name="label" translatable="yes" context="slidetransitionspanel|rb_auto_repeat">After Slideshow:</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + <property name="group">rb_disabled</property> + <accessibility> + <relation type="label-for" target="rb_auto_repeat_value"/> + </accessibility> + <child internal-child="accessible"> + <object class="AtkObject" id="rb_auto_repeat-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="slidetransitionspanel|extended_tip|rb_auto_repeat">Select to advance to the next slide after a number of seconds. Enter the seconds in the numerical field next to the spin button, or click the spin button.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="rb_auto_repeat_value"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="truncate-multiline">True</property> + <property name="adjustment">adjustment1</property> + <property name="digits">2</property> + <accessibility> + <relation type="labelled-by" target="rb_auto_repeat"/> + </accessibility> + <child internal-child="accessible"> + <object class="AtkObject" id="rb_auto_repeat_value-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="slidetransitionspanel|extended_tip|rb_auto_repeat_value">Select to advance to the next slide after a number of seconds. Enter the seconds in the numerical field next to the spin button, or click the spin button.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">1</property> + <property name="top-attach">1</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="lable3"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="slidetransitionspanel|rb_auto_repeat">Repeat After</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> <object class="GtkBox" id="box2"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -439,7 +539,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> @@ -461,6 +561,7 @@ <widget name="sound_label"/> <widget name="variant_label"/> <widget name="rb_auto_after"/> + <widget name="rb_auto_repeat"/> </widgets> </object> </interface> |