summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-14 16:45:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-15 15:00:56 +0200
commit299e128b5175f4c3d794848ab51e81d14385a547 (patch)
treeb2af5ebbd9c2692e121f0b6ba064d34bfef60a1a /sd
parent0abbf64dc1ebe9f12523a69ce1cfd25fe189d869 (diff)
replace TimeSpinButton with FormattedSpinButton
with a TimeFormatter rather than have duplicate functionality Change-Id: I99f1f2aabee5f81485f97755ba3675870317cfb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98791 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/html/pubdlg.cxx12
-rw-r--r--sd/source/ui/dlg/animobjs.cxx23
-rw-r--r--sd/source/ui/dlg/present.cxx16
-rw-r--r--sd/source/ui/inc/animobjs.hxx6
-rw-r--r--sd/source/ui/inc/present.hxx6
-rw-r--r--sd/source/ui/inc/pubdlg.hxx4
6 files changed, 43 insertions, 24 deletions
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index 144797fd1a8e..0855240aac7d 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -532,7 +532,9 @@ void SdPublishingDlg::CreatePages()
m_xPage2_ChgDefault = m_xBuilder->weld_radio_button("chgDefaultRadiobutton");
m_xPage2_ChgAuto = m_xBuilder->weld_radio_button("chgAutoRadiobutton");
m_xPage2_Duration_txt = m_xBuilder->weld_label("durationTxtLabel");
- m_xPage2_Duration = m_xBuilder->weld_time_spin_button("durationSpinbutton", TimeFieldFormat::F_SEC);
+ m_xPage2_Duration = m_xBuilder->weld_formatted_spin_button("durationSpinbutton");
+ m_xFormatter.reset(new weld::TimeFormatter(*m_xPage2_Duration));
+ m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
m_xPage2_Endless = m_xBuilder->weld_check_button("endlessCheckbutton");
aAssistentFunc.InsertControl(2, m_xPage2_Title_WebCast.get());
aAssistentFunc.InsertControl(2, m_xPage2_Index_txt.get());
@@ -547,7 +549,7 @@ void SdPublishingDlg::CreatePages()
aAssistentFunc.InsertControl(2, m_xPage2_ChgDefault.get());
aAssistentFunc.InsertControl(2, m_xPage2_ChgAuto.get());
aAssistentFunc.InsertControl(2, m_xPage2_Duration_txt.get());
- aAssistentFunc.InsertControl(2, &m_xPage2_Duration->get_widget());
+ aAssistentFunc.InsertControl(2, m_xPage2_Duration.get());
aAssistentFunc.InsertControl(2, m_xPage2_Endless.get());
// Page 3
@@ -712,7 +714,7 @@ void SdPublishingDlg::GetParameterSequence( Sequence< PropertyValue >& rParams )
if( m_xPage2_Kiosk->get_active() && m_xPage2_ChgAuto->get_active() )
{
aValue.Name = "KioskSlideDuration";
- aValue.Value <<= static_cast<sal_uInt32>(m_xPage2_Duration->get_value().GetMSFromTime()) / 1000;
+ aValue.Value <<= static_cast<sal_uInt32>(m_xFormatter->GetTime().GetMSFromTime()) / 1000;
aProps.push_back( aValue );
aValue.Name = "KioskEndless";
@@ -1281,7 +1283,7 @@ void SdPublishingDlg::SetDesign( SdPublishingDesign const * pDesign )
tools::Time aTime( tools::Time::EMPTY );
aTime.MakeTimeFromMS( pDesign->m_nSlideDuration * 1000 );
- m_xPage2_Duration->set_value(aTime);
+ m_xFormatter->SetTime(aTime);
m_xPage2_Endless->set_sensitive( pDesign->m_bEndless );
@@ -1385,7 +1387,7 @@ void SdPublishingDlg::GetDesign( SdPublishingDesign* pDesign )
pDesign->m_aURL = m_xPage2_URL->get_text();
pDesign->m_bAutoSlide = m_xPage2_ChgAuto->get_active();
- pDesign->m_nSlideDuration = static_cast<sal_uInt32>(m_xPage2_Duration->get_value().GetMSFromTime()) / 1000;
+ pDesign->m_nSlideDuration = static_cast<sal_uInt32>(m_xFormatter->GetTime().GetMSFromTime()) / 1000;
pDesign->m_bEndless = m_xPage2_Endless->get_active();
}
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 7b11b240748e..830149e62a0a 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -132,7 +132,8 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW,
, m_xBtnPlay(m_xBuilder->weld_button("next"))
, m_xBtnLast(m_xBuilder->weld_button("last"))
, m_xNumFldBitmap(m_xBuilder->weld_spin_button("numbitmap"))
- , m_xTimeField(m_xBuilder->weld_time_spin_button("duration", TimeFieldFormat::F_SEC_CS))
+ , m_xTimeField(m_xBuilder->weld_formatted_spin_button("duration"))
+ , m_xFormatter(new weld::TimeFormatter(*m_xTimeField))
, m_xLbLoopCount(m_xBuilder->weld_combo_box("loopcount"))
, m_xBtnGetOneObject(m_xBuilder->weld_button("getone"))
, m_xBtnGetAllObjects(m_xBuilder->weld_button("getall"))
@@ -151,6 +152,10 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW,
{
SetText(SdResId(STR_ANIMATION_DIALOG_TITLE));
+ m_xFormatter->SetDuration(true);
+ m_xFormatter->SetTimeFormat(TimeFieldFormat::F_SEC_CS);
+ m_xFormatter->EnableEmptyField(false);
+
// create new document with page
pMyDoc.reset( new SdDrawDocument(DocumentType::Impress, nullptr) );
SdPage* pPage = pMyDoc->AllocSdPage(false);
@@ -207,6 +212,7 @@ void AnimationWindow::dispose()
m_xBtnPlay.reset();
m_xBtnLast.reset();
m_xNumFldBitmap.reset();
+ m_xFormatter.reset();
m_xTimeField.reset();
m_xLbLoopCount.reset();
m_xBtnGetOneObject.reset();
@@ -293,7 +299,7 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, weld::Button&, rButton, void )
{
::tools::Time const & rTime = m_FrameList[i].second;
- m_xTimeField->set_value( rTime );
+ m_xFormatter->SetTime( rTime );
sal_uLong nTime = rTime.GetMSFromTime();
WaitInEffect( nTime, nTmpTime, pProgress.get() );
@@ -369,7 +375,8 @@ IMPL_LINK_NOARG(AnimationWindow, ClickRbtHdl, weld::Button&, void)
if( n > 0 )
{
::tools::Time const & rTime = m_FrameList[n - 1].second;
- m_xTimeField->set_value( rTime );
+ m_xFormatter->SetTime( rTime );
+ m_xFormatter->ReFormat();
}
m_xTimeField->set_sensitive(true);
m_xLbLoopCount->set_sensitive(true);
@@ -486,13 +493,13 @@ IMPL_LINK_NOARG(AnimationWindow, ModifyBitmapHdl, weld::SpinButton&, void)
UpdateControl();
}
-IMPL_LINK_NOARG(AnimationWindow, ModifyTimeHdl, weld::TimeSpinButton&, void)
+IMPL_LINK_NOARG(AnimationWindow, ModifyTimeHdl, weld::FormattedSpinButton&, void)
{
sal_uLong nPos = m_xNumFldBitmap->get_value() - 1;
::tools::Time & rTime = m_FrameList[nPos].second;
- rTime = m_xTimeField->get_value();
+ rTime = m_xFormatter->GetTime();
}
void AnimationWindow::UpdateControl(bool const bDisableCtrls)
@@ -759,7 +766,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
m_FrameList.begin() + nIndex,
- ::std::make_pair(aBitmapEx, m_xTimeField->get_value()));
+ ::std::make_pair(aBitmapEx, m_xFormatter->GetTime()));
// increment => next one inserted after this one
++m_nCurrentFrame;
@@ -777,7 +784,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
{
BitmapEx aBitmapEx(rView.GetAllMarkedGraphic().GetBitmapEx());
- ::tools::Time aTime( m_xTimeField->get_value() );
+ ::tools::Time aTime( m_xFormatter->GetTime() );
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
@@ -808,7 +815,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
size_t nIndex = m_nCurrentFrame + 1;
m_FrameList.insert(
m_FrameList.begin() + nIndex,
- ::std::make_pair(aBitmapEx, m_xTimeField->get_value()));
+ ::std::make_pair(aBitmapEx, m_xFormatter->GetTime()));
// increment => next one inserted after this one
++m_nCurrentFrame;
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 244cfd218880..bd06661554cb 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -45,7 +45,8 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
, m_xRbtStandard(m_xBuilder->weld_radio_button("default"))
, m_xRbtWindow(m_xBuilder->weld_radio_button("window"))
, m_xRbtAuto(m_xBuilder->weld_radio_button("auto"))
- , m_xTmfPause(m_xBuilder->weld_time_spin_button("pauseduration", TimeFieldFormat::F_SEC))
+ , m_xTmfPause(m_xBuilder->weld_formatted_spin_button("pauseduration"))
+ , m_xFormatter(new weld::TimeFormatter(*m_xTmfPause))
, m_xCbxAutoLogo(m_xBuilder->weld_check_button("showlogo"))
, m_xCbxManuel(m_xBuilder->weld_check_button("manualslides"))
, m_xCbxMousepointer(m_xBuilder->weld_check_button("pointervisible"))
@@ -60,6 +61,9 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
, m_xMonitorExternal(m_xBuilder->weld_label("externalmonitor_str"))
, m_xExternal(m_xBuilder->weld_label("external_str"))
{
+ m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
+ m_xFormatter->EnableEmptyField(false);
+
Link<weld::Button&,void> aLink( LINK( this, SdStartPresentationDlg, ChangeRangeHdl ) );
m_xRbtAll->connect_clicked( aLink );
@@ -113,7 +117,7 @@ SdStartPresentationDlg::SdStartPresentationDlg(weld::Window* pWindow, const SfxI
const bool bWindow = !static_cast<const SfxBoolItem&>( rOutAttrs.Get( ATTR_PRESENT_FULLSCREEN ) ).GetValue();
const long nPause = static_cast<const SfxUInt32Item&>( rOutAttrs.Get( ATTR_PRESENT_PAUSE_TIMEOUT ) ).GetValue();
- m_xTmfPause->set_value( tools::Time( 0, 0, nPause ) );
+ m_xFormatter->SetTime( tools::Time( 0, 0, nPause ) );
// set cursor in timefield to end
m_xTmfPause->set_position(-1);
@@ -258,7 +262,7 @@ void SdStartPresentationDlg::GetAttr( SfxItemSet& rAttr )
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ALWAYS_ON_TOP, m_xCbxAlwaysOnTop->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_FULLSCREEN, !m_xRbtWindow->get_active() ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_ENDLESS, m_xRbtAuto->get_active() ) );
- rAttr.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, m_xTmfPause->get_value().GetMSFromTime() / 1000 ) );
+ rAttr.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, m_xFormatter->GetTime().GetMSFromTime() / 1000 ) );
rAttr.Put( SfxBoolItem ( ATTR_PRESENT_SHOW_PAUSELOGO, m_xCbxAutoLogo->get_active() ) );
int nPos = m_xLBMonitor->get_active();
@@ -289,7 +293,7 @@ IMPL_LINK_NOARG(SdStartPresentationDlg, ClickWindowPresentationHdl, weld::Button
// m_xFtPause.set_sensitive( bAuto );
m_xTmfPause->set_sensitive( bAuto );
- m_xCbxAutoLogo->set_sensitive( bAuto && ( m_xTmfPause->get_value().GetMSFromTime() > 0 ) );
+ m_xCbxAutoLogo->set_sensitive( bAuto && ( m_xFormatter->GetTime().GetMSFromTime() > 0 ) );
const bool bDisplay = !bWindow && ( mnMonitors > 1 );
m_xFtMonitor->set_sensitive( bDisplay );
@@ -307,14 +311,14 @@ IMPL_LINK_NOARG(SdStartPresentationDlg, ClickWindowPresentationHdl, weld::Button
/**
* Handler: Enabled/Disabled Checkbox "AlwaysOnTop"
*/
-IMPL_LINK_NOARG(SdStartPresentationDlg, ChangePauseHdl, weld::TimeSpinButton&, void)
+IMPL_LINK_NOARG(SdStartPresentationDlg, ChangePauseHdl, weld::FormattedSpinButton&, void)
{
ChangePause();
}
void SdStartPresentationDlg::ChangePause()
{
- m_xCbxAutoLogo->set_sensitive(m_xRbtAuto->get_active() && ( m_xTmfPause->get_value().GetMSFromTime() > 0 ));
+ m_xCbxAutoLogo->set_sensitive(m_xRbtAuto->get_active() && ( m_xFormatter->GetTime().GetMSFromTime() > 0 ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 34b48dbea665..1d3321e0dbb6 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -27,6 +27,7 @@
#include <misc/scopelock.hxx>
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
+#include <vcl/weldutils.hxx>
class SdDrawDocument;
@@ -94,7 +95,8 @@ private:
std::unique_ptr<weld::Button> m_xBtnPlay;
std::unique_ptr<weld::Button> m_xBtnLast;
std::unique_ptr<weld::SpinButton> m_xNumFldBitmap;
- std::unique_ptr<weld::TimeSpinButton> m_xTimeField;
+ std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
+ std::unique_ptr<weld::TimeFormatter> m_xFormatter;
std::unique_ptr<weld::ComboBox> m_xLbLoopCount;
std::unique_ptr<weld::Button> m_xBtnGetOneObject;
std::unique_ptr<weld::Button> m_xBtnGetAllObjects;
@@ -131,7 +133,7 @@ private:
DECL_LINK( ClickHelpHdl, weld::Button&, void );
DECL_LINK( ClickCreateGroupHdl, weld::Button&, void );
DECL_LINK( ModifyBitmapHdl, weld::SpinButton&, void );
- DECL_LINK( ModifyTimeHdl, weld::TimeSpinButton&, void );
+ DECL_LINK( ModifyTimeHdl, weld::FormattedSpinButton&, void );
void UpdateControl(bool bDisableCtrls = false);
void ResetAttrs();
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index fc84f0e8cbb1..ef6523fd9b61 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SD_SOURCE_UI_INC_PRESENT_HXX
#include <vcl/weld.hxx>
+#include <vcl/weldutils.hxx>
class SfxItemSet;
class SdCustomShowList;
@@ -44,7 +45,8 @@ private:
std::unique_ptr<weld::RadioButton> m_xRbtStandard;
std::unique_ptr<weld::RadioButton> m_xRbtWindow;
std::unique_ptr<weld::RadioButton> m_xRbtAuto;
- std::unique_ptr<weld::TimeSpinButton> m_xTmfPause;
+ std::unique_ptr<weld::FormattedSpinButton> m_xTmfPause;
+ std::unique_ptr<weld::TimeFormatter> m_xFormatter;
std::unique_ptr<weld::CheckButton> m_xCbxAutoLogo;
std::unique_ptr<weld::CheckButton> m_xCbxManuel;
@@ -65,7 +67,7 @@ private:
DECL_LINK(ChangeRangeHdl, weld::Button&, void);
DECL_LINK(ClickWindowPresentationHdl, weld::Button&, void);
void ChangePause();
- DECL_LINK(ChangePauseHdl, weld::TimeSpinButton&, void);
+ DECL_LINK(ChangePauseHdl, weld::FormattedSpinButton&, void);
void InitMonitorSettings();
enum DisplayType {
diff --git a/sd/source/ui/inc/pubdlg.hxx b/sd/source/ui/inc/pubdlg.hxx
index 4b89a7cf3083..9556249c1135 100644
--- a/sd/source/ui/inc/pubdlg.hxx
+++ b/sd/source/ui/inc/pubdlg.hxx
@@ -22,6 +22,7 @@
#include <svtools/valueset.hxx>
#include <vcl/weld.hxx>
+#include <vcl/weldutils.hxx>
#include <pres.hxx>
#include "assclass.hxx"
@@ -86,7 +87,8 @@ private:
std::unique_ptr<weld::RadioButton> m_xPage2_ChgDefault;
std::unique_ptr<weld::RadioButton> m_xPage2_ChgAuto;
std::unique_ptr<weld::Label> m_xPage2_Duration_txt;
- std::unique_ptr<weld::TimeSpinButton> m_xPage2_Duration;
+ std::unique_ptr<weld::FormattedSpinButton> m_xPage2_Duration;
+ std::unique_ptr<weld::TimeFormatter> m_xFormatter;
std::unique_ptr<weld::CheckButton> m_xPage2_Endless;
// page 3 controls