include/vcl/field.hxx | 3 ++- vcl/source/control/field.cxx | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-)
New commits: commit 557ca49197ff3db6f2c5a28a9ed9cc736faf5796 Author: Caolán McNamara <caol...@redhat.com> Date: Wed May 9 14:41:21 2018 +0100 refactor ImplNumericReformat Change-Id: I92e3a5592691b99683e5c879a3a07b9f3bac7c41 Reviewed-on: https://gerrit.libreoffice.org/54064 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index b0a7f45680e4..3af20ff93558 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -183,7 +183,7 @@ protected: void FieldFirst(); void FieldLast(); - SAL_DLLPRIVATE void ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr ); + SAL_DLLPRIVATE void ImplNumericReformat( sal_Int64& rValue, OUString& rOutStr ); SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue ); SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection const * pNewSelection = nullptr ); @@ -626,6 +626,7 @@ public: class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter { + SAL_DLLPRIVATE void ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, OUString& rOutStr ); public: explicit NumericBox( vcl::Window* pParent, WinBits nWinStyle ); diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index b2bd446fe521..6221a6f688fa 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -474,10 +474,9 @@ bool FormatterBase::IsEmptyFieldValue() const return (!mpField || mpField->GetText().isEmpty()); } -void NumericFormatter::ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, - OUString& rOutStr ) +void NumericFormatter::ImplNumericReformat(sal_Int64& rValue, OUString& rOutStr) { - if (ImplNumericGetValue(rStr, rValue, GetDecimalDigits(), ImplGetLocaleDataWrapper())) + if (ImplNumericGetValue(GetField()->GetText(), rValue, GetDecimalDigits(), ImplGetLocaleDataWrapper())) { sal_Int64 nTempVal = ClipAgainstMinMax(rValue); rOutStr = CreateFieldText( nTempVal ); @@ -646,7 +645,7 @@ void NumericFormatter::Reformat() OUString aStr; sal_Int64 nTemp = mnLastValue; - ImplNumericReformat(GetField()->GetText(), nTemp, aStr); + ImplNumericReformat(nTemp, aStr); mnLastValue = nTemp; if ( !aStr.isEmpty() ) @@ -949,6 +948,16 @@ void NumericBox::Modify() ComboBox::Modify(); } +void NumericBox::ImplNumericReformat( const OUString& rStr, sal_Int64& rValue, + OUString& rOutStr ) +{ + if (ImplNumericGetValue(rStr, rValue, GetDecimalDigits(), ImplGetLocaleDataWrapper())) + { + sal_Int64 nTempVal = ClipAgainstMinMax(rValue); + rOutStr = CreateFieldText( nTempVal ); + } +} + void NumericBox::ReformatAll() { sal_Int64 nValue; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits