diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 13 | ||||
-rw-r--r-- | vcl/source/app/weldutils.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/field2.cxx | 12 | ||||
-rw-r--r-- | vcl/source/control/fmtfield.cxx | 13 | ||||
-rw-r--r-- | vcl/source/control/longcurr.cxx | 6 |
6 files changed, 24 insertions, 28 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 19b292e500ab..5be5314157c9 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -680,7 +680,7 @@ protected: private: DECL_LINK(UpDownHdl, SpinField&, void); DECL_LINK(LoseFocusHdl, Control&, void); - DECL_LINK(OutputHdl, LinkParamNone*, bool); + DECL_LINK(OutputHdl, double, std::optional<OUString>); DECL_LINK(InputHdl, double*, TriState); DECL_LINK(ActivateHdl, Edit&, bool); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ca2078879c26..89c024ab220d 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5855,7 +5855,7 @@ SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanc m_xButton->SetUpHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetDownHdl(LINK(this, SalInstanceSpinButton, UpDownHdl)); m_xButton->SetLoseFocusHdl(LINK(this, SalInstanceSpinButton, LoseFocusHdl)); - m_rFormatter.SetOutputHdl(LINK(this, SalInstanceSpinButton, OutputHdl)); + m_rFormatter.SetFormatValueHdl(LINK(this, SalInstanceSpinButton, OutputHdl)); m_rFormatter.SetInputHdl(LINK(this, SalInstanceSpinButton, InputHdl)); if (Edit* pEdit = m_xButton->GetSubEdit()) pEdit->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl)); @@ -5914,7 +5914,7 @@ SalInstanceSpinButton::~SalInstanceSpinButton() else m_xButton->SetActivateHdl(Link<Edit&, bool>()); m_rFormatter.SetInputHdl(Link<double*, TriState>()); - m_rFormatter.SetOutputHdl(Link<LinkParamNone*, bool>()); + m_rFormatter.SetFormatValueHdl(Link<double, std::optional<OUString>>()); m_xButton->SetLoseFocusHdl(Link<Control&, void>()); m_xButton->SetDownHdl(Link<SpinField&, void>()); m_xButton->SetUpHdl(Link<SpinField&, void>()); @@ -5931,14 +5931,9 @@ IMPL_LINK_NOARG(SalInstanceSpinButton, UpDownHdl, SpinField&, void) { signal_val IMPL_LINK_NOARG(SalInstanceSpinButton, LoseFocusHdl, Control&, void) { signal_value_changed(); } -IMPL_LINK_NOARG(SalInstanceSpinButton, OutputHdl, LinkParamNone*, bool) +IMPL_LINK(SalInstanceSpinButton, OutputHdl, double, fValue, std::optional<OUString>) { - std::optional<OUString> aText = format_floating_point_value(get_floating_point_value()); - if (!aText.has_value()) - return false; - - set_text(aText.value()); - return true; + return format_floating_point_value(fValue); } IMPL_LINK(SalInstanceSpinButton, InputHdl, double*, pResult, TriState) diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index 9cc759dcdf12..92b421757e1e 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -317,7 +317,7 @@ LongCurrencyFormatter::LongCurrencyFormatter(weld::FormattedSpinButton& rSpinBut void LongCurrencyFormatter::Init() { - SetOutputHdl(LINK(this, LongCurrencyFormatter, FormatOutputHdl)); + SetFormatValueHdl(LINK(this, LongCurrencyFormatter, FormatOutputHdl)); SetInputHdl(LINK(this, LongCurrencyFormatter, ParseInputHdl)); } @@ -357,7 +357,7 @@ void TimeFormatter::Init() { DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss - SetOutputHdl(LINK(this, TimeFormatter, FormatOutputHdl)); + SetFormatValueHdl(LINK(this, TimeFormatter, FormatOutputHdl)); SetInputHdl(LINK(this, TimeFormatter, ParseInputHdl)); SetMin(tools::Time(0, 0)); @@ -441,7 +441,7 @@ DateFormatter::DateFormatter(weld::Entry& rEntry) void DateFormatter::Init() { - SetOutputHdl(LINK(this, DateFormatter, FormatOutputHdl)); + SetFormatValueHdl(LINK(this, DateFormatter, FormatOutputHdl)); SetInputHdl(LINK(this, DateFormatter, ParseInputHdl)); SetMin(Date(1, 1, 1900)); diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index ac47e1166567..fc0cab000da8 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2247,11 +2247,9 @@ namespace weld return ::DateFormatter::FormatDate(Date(nValue), m_eFormat, rLocaleData, m_aStaticFormatter); } - IMPL_LINK_NOARG(DateFormatter, FormatOutputHdl, LinkParamNone*, bool) + IMPL_LINK(DateFormatter, FormatOutputHdl, double, fValue, std::optional<OUString>) { - OUString sText = FormatNumber(GetValue()); - ImplSetTextImpl(sText, nullptr); - return true; + return std::optional<OUString>(FormatNumber(fValue)); } IMPL_LINK(DateFormatter, ParseInputHdl, double*, result, TriState) @@ -3145,11 +3143,9 @@ namespace weld return ::TimeFormatter::FormatTime(ConvertValue(nValue), m_eFormat, m_eTimeFormat, m_bDuration, rLocaleData); } - IMPL_LINK_NOARG(TimeFormatter, FormatOutputHdl, LinkParamNone*, bool) + IMPL_LINK(TimeFormatter, FormatOutputHdl, double, fValue, std::optional<OUString>) { - OUString sText = FormatNumber(GetValue()); - ImplSetTextImpl(sText, nullptr); - return true; + return std::optional<OUString>(FormatNumber(fValue)); } IMPL_LINK(TimeFormatter, ParseInputHdl, double*, result, TriState) diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 0210f4e8727a..3dc7f1ac9a29 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -746,7 +746,11 @@ void Formatter::ImplSetValue(double dVal, bool bForce) m_ValueState = valueDouble; UpdateCurrentValue(dVal); - if (!m_aOutputHdl.IsSet() || !m_aOutputHdl.Call(nullptr)) + std::optional<OUString> aText; + if (m_aFormatValueHdl.IsSet()) + aText = m_aFormatValueHdl.Call(dVal); + + if (!aText.has_value()) { OUString sNewText; if (GetOrCreateFormatter()->IsTextFormat(m_nFormatKey)) @@ -768,10 +772,13 @@ void Formatter::ImplSetValue(double dVal, bool bForce) GetOrCreateFormatter()->GetOutputString(dVal, m_nFormatKey, sNewText, &m_pLastOutputColor); } } - ImplSetTextImpl(sNewText, nullptr); - DBG_ASSERT(CheckText(sNewText), "FormattedField::ImplSetValue : formatted string doesn't match the criteria !"); + aText = sNewText; } + assert(aText.has_value()); + ImplSetTextImpl(*aText, nullptr); + DBG_ASSERT(CheckText(*aText), "FormattedField::ImplSetValue : formatted string doesn't match the criteria !"); + m_ValueState = valueDouble; } diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 39f3e295147a..a1698afb1f90 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -211,11 +211,10 @@ bool ImplCurrencyGetValue( const OUString& rStr, BigInt& rValue, namespace weld { - IMPL_LINK_NOARG(LongCurrencyFormatter, FormatOutputHdl, LinkParamNone*, bool) + IMPL_LINK(LongCurrencyFormatter, FormatOutputHdl, double, fValue, std::optional<OUString>) { const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); const OUString& rCurrencySymbol = !m_aCurrencySymbol.isEmpty() ? m_aCurrencySymbol : rLocaleDataWrapper.getCurrSymbol(); - double fValue = GetValue(); sal_uInt16 nDecimalDigits = GetDecimalDigits(); if (nDecimalDigits) { @@ -223,8 +222,7 @@ namespace weld fValue = std::round(fValue * weld::SpinButton::Power10(nDecimalDigits)); } OUString aText = ImplGetCurr(rLocaleDataWrapper, fValue, GetDecimalDigits(), rCurrencySymbol, m_bThousandSep); - ImplSetTextImpl(aText, nullptr); - return true; + return std::optional<OUString>(aText); } IMPL_LINK(LongCurrencyFormatter, ParseInputHdl, double*, result, TriState) |