summaryrefslogtreecommitdiff
path: root/include/vcl/field.hxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-02-21 00:30:16 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-02-21 08:11:23 +0100
commitf00e891f3369f7b8c2532634d9ff4ab19da17c33 (patch)
tree752901b046836b0aab906cd7966a178636bf290e /include/vcl/field.hxx
parentba8a70365ef459c967cd8a71a6d48ca53dd341bd (diff)
tdf#115892: properly get the box' saved value
Previously textual value like "10,5 pt" was converted to int as simply 10 (multiplied by 10, it became 100), which compared as different from unchanged value of 105. This made the fractional values to be treated as always changed. This patch uses the same code to convert saved value as is used for current edit box value. Change-Id: I09a84a6bf33b17e0192b79b31af21ef14d7e9c63 Reviewed-on: https://gerrit.libreoffice.org/50066 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/vcl/field.hxx')
-rw-r--r--include/vcl/field.hxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 0380259acf01..615421153a0d 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -155,7 +155,8 @@ public:
void SetUserValue( sal_Int64 nNewValue );
virtual void SetValue( sal_Int64 nNewValue );
- virtual sal_Int64 GetValue() const;
+ sal_Int64 GetValue() const;
+ sal_Int64 GetSavedIntValue() const;
virtual OUString CreateFieldText( sal_Int64 nValue ) const;
bool IsValueModified() const;
@@ -186,6 +187,8 @@ protected:
SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue );
SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection const * pNewSelection = nullptr );
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const;
+
private:
SAL_DLLPRIVATE void ImplInit();
@@ -225,8 +228,8 @@ public:
virtual void SetValue( sal_Int64 nValue ) override;
using NumericFormatter::SetUserValue;
void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit );
- virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const;
- virtual sal_Int64 GetValue() const override;
+ using NumericFormatter::GetValue;
+ sal_Int64 GetValue( FieldUnit eOutUnit ) const;
virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const;
@@ -242,6 +245,9 @@ protected:
SAL_DLLPRIVATE bool ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr );
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
+ virtual sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const;
+
private:
SAL_DLLPRIVATE void ImplInit();
@@ -255,6 +261,7 @@ class VCL_DLLPUBLIC CurrencyFormatter : public NumericFormatter
protected:
CurrencyFormatter();
SAL_DLLPRIVATE bool ImplCurrencyReformat( const OUString& rStr, OUString& rOutStr );
+ virtual sal_Int64 GetValueFromString(const OUString& rStr) const override;
public:
virtual ~CurrencyFormatter() override;
@@ -262,7 +269,6 @@ public:
virtual void Reformat() override;
virtual void SetValue( sal_Int64 nNewValue ) override;
- virtual sal_Int64 GetValue() const override;
virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
};
@@ -661,8 +667,7 @@ public:
FieldUnit eInUnit = FUNIT_NONE ) const;
// Needed, because GetValue() with nPos hide these functions
- virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const override;
- virtual sal_Int64 GetValue() const override;
+ using MetricFormatter::GetValue;
virtual void dispose() override;
};
@@ -681,7 +686,6 @@ public:
virtual void ReformatAll() override;
- virtual sal_Int64 GetValue() const override;
virtual void dispose() override;
};