summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/field.cxx10
-rw-r--r--vcl/source/window/builder.cxx11
2 files changed, 16 insertions, 5 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 1ebcfe95e9ad..5401e0300244 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1314,8 +1314,8 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
return nValue;
}
-static bool ImplMetricGetValue( const OUString& rStr, double& rValue, sal_Int64 nBaseValue,
- sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, FieldUnit eUnit )
+bool MetricFormatter::TextToValue(const OUString& rStr, double& rValue, sal_Int64 nBaseValue,
+ sal_uInt16 nDecDigits, const LocaleDataWrapper& rLocaleDataWrapper, FieldUnit eUnit)
{
// Get value
sal_Int64 nValue;
@@ -1334,7 +1334,7 @@ static bool ImplMetricGetValue( const OUString& rStr, double& rValue, sal_Int64
bool MetricFormatter::ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr )
{
- if ( !ImplMetricGetValue( rStr, rValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit ) )
+ if ( !TextToValue( rStr, rValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit ) )
return true;
else
{
@@ -1425,7 +1425,7 @@ sal_Int64 MetricFormatter::GetValueFromStringUnit(const OUString& rStr, FieldUni
{
double nTempValue;
// caution: precision loss in double cast
- if (!ImplMetricGetValue(rStr, nTempValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit))
+ if (!TextToValue(rStr, nTempValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit))
nTempValue = static_cast<double>(mnLastValue);
// caution: precision loss in double cast
@@ -1788,7 +1788,7 @@ void MetricBox::InsertValue( sal_Int64 nValue, FieldUnit eInUnit, sal_Int32 nPos
sal_Int64 MetricBox::GetValue( sal_Int32 nPos ) const
{
double nValue = 0;
- ImplMetricGetValue( ComboBox::GetEntry( nPos ), nValue, mnBaseValue,
+ TextToValue( ComboBox::GetEntry( nPos ), nValue, mnBaseValue,
GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit );
// convert to previously configured units
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index fa0f1dc4ef30..219fb2dcab0b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -243,6 +243,17 @@ namespace weld
return MetricField::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
}
+ IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool)
+ {
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
+ double fResult(0.0);
+ bool bRet = MetricFormatter::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit);
+ if (bRet)
+ *result = fResult;
+ return bRet;
+ }
+
IMPL_LINK_NOARG(TimeSpinButton, spin_button_cursor_position, Entry&, void)
{
int nStartPos, nEndPos;