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>
diff --git a/compilerplugins/clang/constantparam.booleans.results b/compilerplugins/clang/constantparam.booleans.results
index 141f316..c93c2533 100644
--- a/compilerplugins/clang/constantparam.booleans.results
+++ b/compilerplugins/clang/constantparam.booleans.results
@@ -1842,10 +1842,6 @@ include/vcl/weld.hxx:2282
class std::unique_ptr<class weld::FormattedSpinButton, struct std::default_delete<class weld::FormattedSpinButton> > weld::Builder::weld_formatted_spin_button(const class rtl::OString &,_Bool)
_Bool bTakeOwnership
0
include/vcl/weld.hxx:2284
class std::unique_ptr<class weld::TimeSpinButton, struct std::default_delete<class weld::TimeSpinButton> > weld::Builder::weld_time_spin_button(const class rtl::OString &,enum TimeFieldFormat,_Bool)
_Bool bTakeOwnership
0
include/vcl/weld.hxx:2286
class std::unique_ptr<class weld::ComboBox, struct std::default_delete<class weld::ComboBox> > weld::Builder::weld_combo_box(const class rtl::OString &,_Bool)
_Bool bTakeOwnership
diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx
index 02f52a6..243bbd8 100644
--- a/extensions/source/propctrlr/commoncontrol.cxx
+++ b/extensions/source/propctrlr/commoncontrol.cxx
@@ -93,7 +93,7 @@ namespace pcr
setModified();
}
IMPL_LINK_NOARG( CommonBehaviourControlHelper, TimeModifiedHdl, weld::TimeSpinButton&, void )
IMPL_LINK_NOARG( CommonBehaviourControlHelper, TimeModifiedHdl, weld::FormattedSpinButton&, void )
{
setModified();
}
diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx
index 2097a88..919a774 100644
--- a/extensions/source/propctrlr/commoncontrol.hxx
+++ b/extensions/source/propctrlr/commoncontrol.hxx
@@ -91,7 +91,7 @@ namespace pcr
DECL_LINK( EditModifiedHdl, weld::Entry&, void );
DECL_LINK( MetricModifiedHdl, weld::MetricSpinButton&, void );
DECL_LINK( FormattedModifiedHdl, weld::FormattedSpinButton&, void );
DECL_LINK( TimeModifiedHdl, weld::TimeSpinButton&, void );
DECL_LINK( TimeModifiedHdl, weld::FormattedSpinButton&, void );
DECL_LINK( DateModifiedHdl, SvtCalendarBox&, void );
DECL_LINK( GetFocusHdl, weld::Widget&, void );
DECL_LINK( LoseFocusHdl, weld::Widget&, void );
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index d75c117..76e92f0 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -790,7 +790,7 @@ namespace pcr
case PropertyControlType::TimeField:
{
std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/timefield.ui", m_xContext));
auto pTimeSpinButton = xBuilder->weld_time_spin_button("timefield", TimeFieldFormat::F_SEC);
auto pTimeSpinButton = xBuilder->weld_formatted_spin_button("timefield");
auto pControl = new OTimeControl(std::move(pTimeSpinButton), std::move(xBuilder), bCreateReadOnly);
pControl->SetModifyHandler();
xControl = pControl;
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index dc1891e..2084a9d 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -53,9 +53,11 @@ namespace pcr
using namespace ::com::sun::star::inspection;
//= OTimeControl
OTimeControl::OTimeControl(std::unique_ptr<weld::TimeSpinButton> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly)
OTimeControl::OTimeControl(std::unique_ptr<weld::FormattedSpinButton> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly)
: OTimeControl_Base(PropertyControlType::TimeField, std::move(xBuilder), std::move(xWidget), bReadOnly)
, m_xFormatter(new weld::TimeFormatter(*getTypedControlWindow()))
{
m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
}
void SAL_CALL OTimeControl::setValue( const Any& _rValue )
@@ -64,11 +66,11 @@ namespace pcr
if ( !( _rValue >>= aUNOTime ) )
{
getTypedControlWindow()->set_text("");
getTypedControlWindow()->set_value(tools::Time(tools::Time::EMPTY));
m_xFormatter->SetTime(tools::Time(tools::Time::EMPTY));
}
else
{
getTypedControlWindow()->set_value(::tools::Time(aUNOTime));
m_xFormatter->SetTime(::tools::Time(aUNOTime));
}
}
@@ -77,7 +79,7 @@ namespace pcr
Any aPropValue;
if ( !getTypedControlWindow()->get_text().isEmpty() )
{
aPropValue <<= getTypedControlWindow()->get_value().GetUNOTime();
aPropValue <<= m_xFormatter->GetTime().GetUNOTime();
}
return aPropValue;
}
@@ -205,8 +207,10 @@ namespace pcr
ODateTimeControl::ODateTimeControl(std::unique_ptr<weld::Container> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly)
: ODateTimeControl_Base(PropertyControlType::DateTimeField, std::move(xBuilder), std::move(xWidget), bReadOnly)
, m_xDate(std::make_unique<SvtCalendarBox>(m_xBuilder->weld_menu_button("datefield")))
, m_xTime(m_xBuilder->weld_time_spin_button("timefield", TimeFieldFormat::F_SEC))
, m_xTime(m_xBuilder->weld_formatted_spin_button("timefield"))
, m_xFormatter(new weld::TimeFormatter(*m_xTime))
{
m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
}
void SAL_CALL ODateTimeControl::setValue( const Any& _rValue )
@@ -215,7 +219,7 @@ namespace pcr
{
m_xDate->set_date(::Date(::Date::SYSTEM));
m_xTime->set_text("");
m_xTime->set_value(tools::Time(tools::Time::EMPTY));
m_xFormatter->SetTime(tools::Time(tools::Time::EMPTY));
}
else
{
@@ -226,7 +230,7 @@ namespace pcr
::utl::typeConvert( aUNODateTime, aDateTime );
m_xDate->set_date(aDateTime);
m_xTime->set_value(aDateTime);
m_xFormatter->SetTime(aDateTime);
}
}
@@ -235,7 +239,7 @@ namespace pcr
Any aPropValue;
if (!m_xTime->get_text().isEmpty())
{
::DateTime aDateTime(m_xDate->get_date(), m_xTime->get_value());
::DateTime aDateTime(m_xDate->get_date(), m_xFormatter->GetTime());
util::DateTime aUNODateTime;
::utl::typeConvert( aDateTime, aUNODateTime );
diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx
index 1b4fd2f..1eccceb 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -35,11 +35,12 @@ namespace pcr
//= OTimeControl
typedef CommonBehaviourControl<css::inspection::XPropertyControl, weld::TimeSpinButton> OTimeControl_Base;
typedef CommonBehaviourControl<css::inspection::XPropertyControl, weld::FormattedSpinButton> OTimeControl_Base;
class OTimeControl : public OTimeControl_Base
{
std::unique_ptr<weld::TimeFormatter> m_xFormatter;
public:
OTimeControl(std::unique_ptr<weld::TimeSpinButton> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly);
OTimeControl(std::unique_ptr<weld::FormattedSpinButton> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly);
// XPropertyControl
virtual css::uno::Any SAL_CALL getValue() override;
@@ -52,7 +53,7 @@ namespace pcr
getTypedControlWindow()->connect_value_changed( LINK( this, CommonBehaviourControlHelper, TimeModifiedHdl ) );
}
virtual weld::Widget* getWidget() override { return &getTypedControlWindow()->get_widget(); }
virtual weld::Widget* getWidget() override { return getTypedControlWindow(); }
};
//= ODateControl
@@ -108,7 +109,8 @@ namespace pcr
{
private:
std::unique_ptr<SvtCalendarBox> m_xDate;
std::unique_ptr<weld::TimeSpinButton> m_xTime;
std::unique_ptr<weld::FormattedSpinButton> m_xTime;
std::unique_ptr<weld::TimeFormatter> m_xFormatter;
public:
ODateTimeControl(std::unique_ptr<weld::Container> xWidget, std::unique_ptr<weld::Builder> xBuilder, bool bReadOnly);
@@ -126,6 +128,7 @@ namespace pcr
virtual void SAL_CALL disposing() override
{
m_xFormatter.reset();
m_xTime.reset();
m_xDate.reset();
ODateTimeControl_Base::disposing();
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx
index 09e2473..5f1efdf 100644
--- a/include/sfx2/dinfdlg.hxx
+++ b/include/sfx2/dinfdlg.hxx
@@ -248,16 +248,23 @@ public:
~CustomPropertiesDateField();
};
namespace weld
{
class TimeFormatter;
}
class CustomPropertiesTimeField
{
public:
std::unique_ptr<weld::TimeSpinButton> m_xTimeField;
std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
std::unique_ptr<weld::TimeFormatter> m_xFormatter;
bool m_isUTC;
CustomPropertiesTimeField(std::unique_ptr<weld::TimeSpinButton> xTimeField);
CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField);
void set_visible(bool bVisible) { m_xTimeField->set_visible(bVisible); }
tools::Time get_value() const { return m_xTimeField->get_value(); }
void set_value(const tools::Time& rTime) { m_xTimeField->set_value(rTime); }
tools::Time get_value() const;
void set_value(const tools::Time& rTime);
~CustomPropertiesTimeField();
};
@@ -459,7 +466,8 @@ struct CmisDateTime
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Frame> m_xFrame;
std::unique_ptr<SvtCalendarBox> m_xDateField;
std::unique_ptr<weld::TimeSpinButton> m_xTimeField;
std::unique_ptr<weld::FormattedSpinButton> m_xTimeField;
std::unique_ptr<weld::TimeFormatter> m_xFormatter;
CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime);
};
diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx
index 55462c9..b7d0f80 100644
--- a/include/svx/ctredlin.hxx
+++ b/include/svx/ctredlin.hxx
@@ -144,6 +144,11 @@ public:
void Show() { m_xContainer->show(); }
};
namespace weld
{
class TimeFormatter;
}
/// Tabpage with the filter text entries etc.
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
{
@@ -156,11 +161,13 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
std::unique_ptr<weld::CheckButton> m_xCbDate;
std::unique_ptr<weld::ComboBox> m_xLbDate;
std::unique_ptr<SvtCalendarBox> m_xDfDate;
std::unique_ptr<weld::TimeSpinButton> m_xTfDate;
std::unique_ptr<weld::FormattedSpinButton> m_xTfDate;
std::unique_ptr<weld::TimeFormatter> m_xTfDateFormatter;
std::unique_ptr<weld::Button> m_xIbClock;
std::unique_ptr<weld::Label> m_xFtDate2;
std::unique_ptr<SvtCalendarBox> m_xDfDate2;
std::unique_ptr<weld::TimeSpinButton> m_xTfDate2;
std::unique_ptr<weld::FormattedSpinButton> m_xTfDate2;
std::unique_ptr<weld::TimeFormatter> m_xTfDate2Formatter;
std::unique_ptr<weld::Button> m_xIbClock2;
std::unique_ptr<weld::CheckButton> m_xCbAuthor;
std::unique_ptr<weld::ComboBox> m_xLbAuthor;
@@ -178,7 +185,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxTPFilter final : public SvxTPage
DECL_LINK( ModifyHdl, weld::Entry&, void );
DECL_LINK( ModifyListBoxHdl, weld::ComboBox&, void );
DECL_LINK( ModifyDate, SvtCalendarBox&, void );
DECL_LINK( ModifyTime, weld::TimeSpinButton&, void );
DECL_LINK( ModifyTime, weld::FormattedSpinButton&, void );
DECL_LINK( RefHandle, weld::Button&, void );
void EnableDateLine1(bool bFlag);
diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx
index 4f9a016..fce7f50 100644
--- a/include/vcl/formatter.hxx
+++ b/include/vcl/formatter.hxx
@@ -287,6 +287,8 @@ public:
void EntryLostFocus();
void ReFormat();
// any aspect of the current format has changed
virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
@@ -305,8 +307,6 @@ protected:
SvNumberFormatter* CreateFormatter() { SetFormatter(StandardFormatter()); return m_pFormatter; }
virtual void UpdateCurrentValue(double dCurrentValue) { m_dCurrentValue = dCurrentValue; }
void ReFormat();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0d8b702..7bd5492 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1924,74 +1924,6 @@ public:
weld::SpinButton& get_widget() { return *m_xSpinButton; }
};
class VCL_DLLPUBLIC TimeSpinButton final
{
TimeFieldFormat m_eFormat;
std::unique_ptr<weld::SpinButton> m_xSpinButton;
Link<TimeSpinButton&, void> m_aValueChangedHdl;
DECL_LINK(spin_button_value_changed, weld::SpinButton&, void);
DECL_LINK(spin_button_output, weld::SpinButton&, void);
DECL_LINK(spin_button_input, int* result, bool);
DECL_LINK(spin_button_cursor_position, weld::Entry&, void);
void signal_value_changed() { m_aValueChangedHdl.Call(*this); }
static tools::Time ConvertValue(int nValue);
static int ConvertValue(const tools::Time& rTime);
OUString format_number(int nValue) const;
void update_width_chars();
public:
TimeSpinButton(std::unique_ptr<SpinButton> pSpinButton, TimeFieldFormat eFormat)
: m_eFormat(eFormat)
, m_xSpinButton(std::move(pSpinButton))
{
update_width_chars();
m_xSpinButton->connect_output(LINK(this, TimeSpinButton, spin_button_output));
m_xSpinButton->connect_input(LINK(this, TimeSpinButton, spin_button_input));
m_xSpinButton->connect_value_changed(LINK(this, TimeSpinButton, spin_button_value_changed));
m_xSpinButton->connect_cursor_position(
LINK(this, TimeSpinButton, spin_button_cursor_position));
spin_button_output(*m_xSpinButton);
}
void set_value(const tools::Time& rTime) { m_xSpinButton->set_value(ConvertValue(rTime)); }
tools::Time get_value() const { return ConvertValue(m_xSpinButton->get_value()); }
void connect_value_changed(const Link<TimeSpinButton&, void>& rLink)
{
m_aValueChangedHdl = rLink;
}
void set_sensitive(bool sensitive) { m_xSpinButton->set_sensitive(sensitive); }
bool get_sensitive() const { return m_xSpinButton->get_sensitive(); }
void set_visible(bool bShow) { m_xSpinButton->set_visible(bShow); }
bool get_visible() const { return m_xSpinButton->get_visible(); }
void grab_focus() { m_xSpinButton->grab_focus(); }
bool has_focus() const { return m_xSpinButton->has_focus(); }
void show() { m_xSpinButton->show(); }
void hide() { m_xSpinButton->hide(); }
void save_value() { m_xSpinButton->save_value(); }
bool get_value_changed_from_saved() const
{
return m_xSpinButton->get_value_changed_from_saved();
}
void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); }
OUString get_text() const { return m_xSpinButton->get_text(); }
void connect_focus_in(const Link<Widget&, void>& rLink)
{
m_xSpinButton->connect_focus_in(rLink);
}
void connect_focus_out(const Link<Widget&, void>& rLink)
{
m_xSpinButton->connect_focus_out(rLink);
}
weld::SpinButton& get_widget() { return *m_xSpinButton; }
};
class VCL_DLLPUBLIC Label : virtual public Widget
{
public:
@@ -2308,9 +2240,6 @@ public:
weld_metric_spin_button(const OString& id, FieldUnit eUnit, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<FormattedSpinButton>
weld_formatted_spin_button(const OString& id, bool bTakeOwnership = false) = 0;
virtual std::unique_ptr<TimeSpinButton>
weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<ComboBox> weld_combo_box(const OString& id, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool bTakeOwnership = false)
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index e4faeea..e1944cc 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -160,12 +160,6 @@ public:
EntryFormatter(weld::Entry& rEntry);
EntryFormatter(weld::FormattedSpinButton& rSpinButton);
// EntryFormatter will set listeners to "changed" and "focus-out" of the
// entry so users that want to add their own listeners to those must set
// them through this formatter and not directly on the entry
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
weld::Entry& get_widget() { return m_rEntry; }
// public Formatter overrides, drives interactions with the Entry
@@ -186,6 +180,17 @@ public:
void SetEntrySelectionOptions(SelectionOptions eOptions) { m_eOptions = eOptions; }
/* EntryFormatter will set listeners to "changed" and "focus-out" of the
Entry so users that want to add their own listeners to those must set
them through this formatter and not directly on that entry.
If EntryFormatter is used with a weld::FormattedSpinButton this is
handled transparently by the FormattedSpinButton for the user and the
handlers can be set on the FormattedSpinButton
*/
void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aModifyHdl = rLink; }
void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; }
virtual ~EntryFormatter() override;
private:
@@ -247,6 +252,8 @@ public:
TimeFormatter(weld::FormattedSpinButton& rSpinButton);
void SetExtFormat(ExtTimeFieldFormat eFormat);
void SetDuration(bool bDuration);
void SetTimeFormat(TimeFieldFormat eTimeFormat);
void SetMin(const tools::Time& rNewMin);
void SetMax(const tools::Time& rNewMax);
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index 144797f..0855240 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 7b11b24..830149e 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 244cfd2..bd06661 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 34b48db..1d3321e 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 fc84f0e..ef6523f 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 4b89a7c..9556249 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
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 0d1fac1..23774c4 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -23,6 +23,7 @@
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <vcl/weldutils.hxx>
#include <unotools/datetime.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/cmdoptions.hxx>
@@ -1265,7 +1266,7 @@ CustomPropertyLine::CustomPropertyLine(CustomPropertiesWindow* pParent, weld::Wi
, m_xValueEdit(m_xBuilder->weld_entry("valueedit"))
, m_xDateTimeBox(m_xBuilder->weld_widget("datetimebox"))
, m_xDateField(new CustomPropertiesDateField(new SvtCalendarBox(m_xBuilder->weld_menu_button("date"))))
, m_xTimeField(new CustomPropertiesTimeField(m_xBuilder->weld_time_spin_button("time", TimeFieldFormat::F_SEC)))
, m_xTimeField(new CustomPropertiesTimeField(m_xBuilder->weld_formatted_spin_button("time")))
, m_xDurationBox(m_xBuilder->weld_widget("durationbox"))
, m_xDurationField(new CustomPropertiesDurationField(m_xBuilder->weld_entry("duration"),
m_xBuilder->weld_button("durationbutton")))
@@ -1523,10 +1524,23 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties()
return aPropertiesSeq;
}
CustomPropertiesTimeField::CustomPropertiesTimeField(std::unique_ptr<weld::TimeSpinButton> xTimeField)
CustomPropertiesTimeField::CustomPropertiesTimeField(std::unique_ptr<weld::FormattedSpinButton> xTimeField)
: m_xTimeField(std::move(xTimeField))
, m_xFormatter(new weld::TimeFormatter(*m_xTimeField))
, m_isUTC(false)
{
m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
m_xFormatter->EnableEmptyField(false);
}
tools::Time CustomPropertiesTimeField::get_value() const
{
return m_xFormatter->GetTime();
}
void CustomPropertiesTimeField::set_value(const tools::Time& rTime)
{
m_xFormatter->SetTime(rTime);
}
CustomPropertiesTimeField::~CustomPropertiesTimeField()
@@ -1964,12 +1978,16 @@ CmisDateTime::CmisDateTime(weld::Widget* pParent, const util::DateTime& aDateTim
: m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui"))
, m_xFrame(m_xBuilder->weld_frame("CmisFrame"))
, m_xDateField(new SvtCalendarBox(m_xBuilder->weld_menu_button("date")))
, m_xTimeField(m_xBuilder->weld_time_spin_button("time", TimeFieldFormat::F_SEC))
, m_xTimeField(m_xBuilder->weld_formatted_spin_button("time"))
, m_xFormatter(new weld::TimeFormatter(*m_xTimeField))
{
m_xFormatter->SetExtFormat(ExtTimeFieldFormat::LongDuration);
m_xFormatter->EnableEmptyField(false);
m_xDateField->show();
m_xTimeField->show();
m_xDateField->set_date(Date(aDateTime));
m_xTimeField->set_value(tools::Time(aDateTime));
m_xFormatter->SetTime(tools::Time(aDateTime));
}
CmisYesNo::CmisYesNo(weld::Widget* pParent, bool bValue)
@@ -2185,7 +2203,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
for ( const auto& rxDateTime : pLine->m_aDateTimes )
{
Date aTmpDate = rxDateTime->m_xDateField->get_date();
tools::Time aTmpTime = rxDateTime->m_xTimeField->get_value();
tools::Time aTmpTime = rxDateTime->m_xFormatter->GetTime();
util::DateTime aDateTime( aTmpTime.GetNanoSec(), aTmpTime.GetSec(),
aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(),
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
index 3374efd..3b07ab6 100644
--- a/svx/source/dialog/ctredlin.cxx
+++ b/svx/source/dialog/ctredlin.cxx
@@ -22,6 +22,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/weldutils.hxx>
#include <svtools/ctrlbox.hxx>
#include <unotools/textsearch.hxx>
@@ -496,11 +497,13 @@ SvxTPFilter::SvxTPFilter(weld::Container* pParent)
, m_xCbDate(m_xBuilder->weld_check_button("date"))
, m_xLbDate(m_xBuilder->weld_combo_box("datecond"))
, m_xDfDate(new SvtCalendarBox(m_xBuilder->weld_menu_button("startdate")))
, m_xTfDate(m_xBuilder->weld_time_spin_button("starttime", TimeFieldFormat::F_NONE))
, m_xTfDate(m_xBuilder->weld_formatted_spin_button("starttime"))
, m_xTfDateFormatter(new weld::TimeFormatter(*m_xTfDate))
, m_xIbClock(m_xBuilder->weld_button("startclock"))
, m_xFtDate2(m_xBuilder->weld_label("and"))
, m_xDfDate2(new SvtCalendarBox(m_xBuilder->weld_menu_button("enddate")))
, m_xTfDate2(m_xBuilder->weld_time_spin_button("endtime", TimeFieldFormat::F_NONE))
, m_xTfDate2(m_xBuilder->weld_formatted_spin_button("endtime"))
, m_xTfDate2Formatter(new weld::TimeFormatter(*m_xTfDate2))
, m_xIbClock2(m_xBuilder->weld_button("endclock"))
, m_xCbAuthor(m_xBuilder->weld_check_button("author"))
, m_xLbAuthor(m_xBuilder->weld_combo_box("authorlist"))
@@ -512,6 +515,9 @@ SvxTPFilter::SvxTPFilter(weld::Container* pParent)
, m_xCbComment(m_xBuilder->weld_check_button("comment"))
, m_xEdComment(m_xBuilder->weld_entry("commentedit"))
{
m_xTfDateFormatter->EnableEmptyField(false);
m_xTfDate2Formatter->EnableEmptyField(false);
m_xLbDate->set_active(0);
m_xLbDate->connect_changed( LINK( this, SvxTPFilter, SelDateHdl ) );
m_xIbClock->connect_clicked( LINK( this, SvxTPFilter, TimeHdl) );
@@ -529,7 +535,7 @@ SvxTPFilter::SvxTPFilter(weld::Container* pParent)
m_xDfDate->connect_activated(a2Link);
m_xDfDate2->connect_activated(a2Link);
Link<weld::TimeSpinButton&,void> a3Link=LINK(this, SvxTPFilter, ModifyTime);
Link<weld::FormattedSpinButton&,void> a3Link=LINK(this, SvxTPFilter, ModifyTime);
m_xTfDate->connect_value_changed(a3Link);
m_xTfDate2->connect_value_changed(a3Link);
@@ -545,11 +551,11 @@ SvxTPFilter::SvxTPFilter(weld::Container* pParent)
RowEnableHdl(*m_xCbAction);
RowEnableHdl(*m_xCbComment);
DateTime aDateTime( DateTime::SYSTEM );
m_xDfDate->set_date(aDateTime);
m_xDfDate2->set_date(aDateTime);
m_xTfDate->set_value(aDateTime);
m_xTfDate2->set_value(aDateTime);
DateTime aDateTime(DateTime::SYSTEM);
SetFirstDate(aDateTime);
SetLastDate(aDateTime);
SetFirstTime(aDateTime);
SetLastTime(aDateTime);
HideRange();
ShowAction();
bModified=false;
@@ -611,12 +617,12 @@ void SvxTPFilter::SetFirstDate(const Date &aDate)
tools::Time SvxTPFilter::GetFirstTime() const
{
return m_xTfDate->get_value();
return m_xTfDateFormatter->GetTime();
}
void SvxTPFilter::SetFirstTime(const tools::Time &aTime)
{
m_xTfDate->set_value(aTime);
m_xTfDateFormatter->SetTime(aTime);
}
Date SvxTPFilter::GetLastDate() const
@@ -631,12 +637,12 @@ void SvxTPFilter::SetLastDate(const Date &aDate)
tools::Time SvxTPFilter::GetLastTime() const
{
return m_xTfDate2->get_value();
return m_xTfDate2Formatter->GetTime();
}
void SvxTPFilter::SetLastTime(const tools::Time &aTime)
{
m_xTfDate2->set_value(aTime);
m_xTfDate2Formatter->SetTime(aTime);
}
void SvxTPFilter::SetDateMode(sal_uInt16 nMode)
@@ -865,13 +871,13 @@ IMPL_LINK(SvxTPFilter, TimeHdl, weld::Button&, rIB, void)
DateTime aDateTime( DateTime::SYSTEM );
if (&rIB == m_xIbClock.get())
{
m_xDfDate->set_date(aDateTime);
m_xTfDate->set_value(aDateTime);
SetFirstDate(aDateTime);
SetFirstTime(aDateTime);
}
else if (&rIB == m_xIbClock2.get())
{
m_xDfDate2->set_date(aDateTime);
m_xTfDate2->set_value(aDateTime);
SetLastDate(aDateTime);
SetLastTime(aDateTime);
}
bModified=true;
}
@@ -894,10 +900,10 @@ void SvxTPFilter::DeactivatePage()
{
m_pRedlinTable->SetFilterDate(IsDate());
m_pRedlinTable->SetDateTimeMode(GetDateMode());
m_pRedlinTable->SetFirstDate(m_xDfDate->get_date());
m_pRedlinTable->SetLastDate(m_xDfDate2->get_date());
m_pRedlinTable->SetFirstTime(m_xTfDate->get_value());
m_pRedlinTable->SetLastTime(m_xTfDate2->get_value());
m_pRedlinTable->SetFirstDate(GetFirstDate());
m_pRedlinTable->SetLastDate(GetLastDate());
m_pRedlinTable->SetFirstTime(GetFirstTime());
m_pRedlinTable->SetLastTime(GetLastTime());
m_pRedlinTable->SetFilterAuthor(IsAuthor());
m_pRedlinTable->SetAuthor(GetSelectedAuthor());
@@ -950,24 +956,24 @@ IMPL_LINK(SvxTPFilter, ModifyDate, SvtCalendarBox&, rTF, void)
bModified=true;
}
IMPL_LINK(SvxTPFilter, ModifyTime, weld::TimeSpinButton&, rTF, void)
IMPL_LINK(SvxTPFilter, ModifyTime, weld::FormattedSpinButton&, rTF, void)
{
tools::Time aTime(0);
if (m_xTfDate.get() == &rTF)
{
if (m_xTfDate->get_text().isEmpty())
m_xTfDate->set_value(aTime);
SetFirstTime(aTime);
if(m_pRedlinTable!=nullptr)
m_pRedlinTable->SetFirstTime(m_xTfDate->get_value());
if (m_pRedlinTable!=nullptr)
m_pRedlinTable->SetFirstTime(GetFirstTime());
}
else if (m_xTfDate2.get() == &rTF)
{
if (m_xTfDate2->get_text().isEmpty())
m_xTfDate2->set_value(aTime);
SetLastTime(aTime);
if(m_pRedlinTable!=nullptr)
m_pRedlinTable->SetLastTime(m_xTfDate2->get_value());
if (m_pRedlinTable!=nullptr)
m_pRedlinTable->SetLastTime(GetLastTime());
}
bModified=true;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 062bf9b..1e2fa89 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -117,10 +117,6 @@ public:
virtual std::unique_ptr<weld::FormattedSpinButton>
weld_formatted_spin_button(const OString& id, bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::TimeSpinButton>
weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
bool bTakeOwnership = false) override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3c564aa..a4f8fb4 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5343,12 +5343,14 @@ class SalInstanceFormattedSpinButton : public SalInstanceEntry,
{
private:
VclPtr<FormattedField> m_xButton;
weld::EntryFormatter* m_pFormatter;
public:
SalInstanceFormattedSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
bool bTakeOwnership)
: SalInstanceEntry(pButton, pBuilder, bTakeOwnership)
, m_xButton(pButton)
, m_pFormatter(nullptr)
{
}
@@ -5359,8 +5361,29 @@ public:
enable_notify_events();
}
virtual void connect_changed(const Link<weld::Entry&, void>& rLink) override
{
if (!m_pFormatter) // once a formatter is set, it takes over "changed"
{
SalInstanceEntry::connect_changed(rLink);
return;
}
m_pFormatter->connect_changed(rLink);
}
virtual void connect_focus_out(const Link<weld::Widget&, void>& rLink) override
{
if (!m_pFormatter) // once a formatter is set, it takes over "focus-out"
{
SalInstanceEntry::connect_focus_out(rLink);
return;
}
m_pFormatter->connect_focus_out(rLink);
}
virtual void SetFormatter(weld::EntryFormatter* pFormatter) override
{
m_pFormatter = pFormatter;
m_xButton->SetFormatter(pFormatter);
}
@@ -6650,17 +6673,6 @@ SalInstanceBuilder::weld_formatted_spin_button(const OString& id, bool bTakeOwne
: nullptr;
}
std::unique_ptr<weld::TimeSpinButton>
SalInstanceBuilder::weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
bool bTakeOwnership)
{
std::unique_ptr<weld::TimeSpinButton> pRet(
new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat));
SalInstanceSpinButton& rButton = dynamic_cast<SalInstanceSpinButton&>(pRet->get_widget());
rButton.DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss
return pRet;
}
std::unique_ptr<weld::ComboBox> SalInstanceBuilder::weld_combo_box(const OString& id,
bool bTakeOwnership)
{
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index 21161e3..9efab32 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -346,6 +346,8 @@ TimeFormatter::TimeFormatter(weld::FormattedSpinButton& rSpinButton)
void TimeFormatter::Init()
{
DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss
SetOutputHdl(LINK(this, TimeFormatter, FormatOutputHdl));
SetInputHdl(LINK(this, TimeFormatter, ParseInputHdl));
@@ -407,6 +409,18 @@ void TimeFormatter::SetExtFormat(ExtTimeFieldFormat eFormat)
ReFormat();
}
void TimeFormatter::SetDuration(bool bDuration)
{
m_bDuration = bDuration;
ReFormat();
}
void TimeFormatter::SetTimeFormat(TimeFieldFormat eTimeFormat)
{
m_eFormat = eTimeFormat;
ReFormat();
}
TimeFormatter::~TimeFormatter() = default;
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 368c429..6a02b7a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -354,78 +354,6 @@ namespace weld
return bRet;
}
IMPL_LINK_NOARG(TimeSpinButton, spin_button_cursor_position, Entry&, void)
{
int nStartPos, nEndPos;
m_xSpinButton->get_selection_bounds(nStartPos, nEndPos);
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper();
const int nTimeArea = ::TimeFormatter::GetTimeArea(m_eFormat, m_xSpinButton->get_text(), nEndPos,
rLocaleData);
int nIncrements = 1;
if (nTimeArea == 1)
nIncrements = 1000 * 60 * 60;
else if (nTimeArea == 2)
nIncrements = 1000 * 60;
else if (nTimeArea == 3)
nIncrements = 1000;
m_xSpinButton->set_increments(nIncrements, nIncrements * 10);
}
IMPL_LINK_NOARG(TimeSpinButton, spin_button_value_changed, SpinButton&, void)
{
signal_value_changed();
}
IMPL_LINK(TimeSpinButton, spin_button_output, SpinButton&, rSpinButton, void)
{
int nStartPos, nEndPos;
rSpinButton.get_selection_bounds(nStartPos, nEndPos);
rSpinButton.set_text(format_number(rSpinButton.get_value()));
rSpinButton.set_position(nEndPos);
}
IMPL_LINK(TimeSpinButton, spin_button_input, int*, result, bool)
{
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper();
tools::Time aResult(0);
bool bRet = ::TimeFormatter::TextToTime(m_xSpinButton->get_text(), aResult, m_eFormat, true, rLocaleData);
if (bRet)
*result = ConvertValue(aResult);
return bRet;
}
void TimeSpinButton::update_width_chars()
{
int min, max;
m_xSpinButton->get_range(min, max);
auto width = std::max(m_xSpinButton->get_pixel_size(format_number(min)).Width(),
m_xSpinButton->get_pixel_size(format_number(max)).Width());
int chars = ceil(width / m_xSpinButton->get_approximate_digit_width());
m_xSpinButton->set_width_chars(chars);
}
tools::Time TimeSpinButton::ConvertValue(int nValue)
{
tools::Time aTime(0);
aTime.MakeTimeFromMS(nValue);
return aTime;
}
int TimeSpinButton::ConvertValue(const tools::Time& rTime)
{
return rTime.GetMSFromTime();
}
OUString TimeSpinButton::format_number(int nValue) const
{
const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper();
return ::TimeFormatter::FormatTime(ConvertValue(nValue), m_eFormat, TimeFormat::Hour24, true, rLocaleData);
}
EntryTreeView::EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView)
: m_xEntry(std::move(xEntry))
, m_xTreeView(std::move(xTreeView))
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2919917..3b37ab2 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -15856,12 +15856,6 @@ public:
return std::make_unique<GtkInstanceFormattedSpinButton>(pSpinButton, this, bTakeOwnership);
}
virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
bool bTakeOwnership) override
{
return std::make_unique<weld::TimeSpinButton>(weld_spin_button(id, bTakeOwnership), eFormat);
}
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString &id, bool bTakeOwnership) override
{
GtkComboBox* pComboBox = GTK_COMBO_BOX(gtk_builder_get_object(m_pBuilder, id.getStr()));