summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-02-21 00:30:16 +0300
committerAndras Timar <andras.timar@collabora.com>2018-03-25 20:14:06 +0200
commit73629949c1d6245f7fad419b677cf92a49ffd18a (patch)
tree65b6fab1a7759b3f32cf355a1de868650870e743 /include
parent3ac438cde11c4cbe32a1c09e9fe885a0b0accc2c (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. Reviewed-on: https://gerrit.libreoffice.org/50066 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit f00e891f3369f7b8c2532634d9ff4ab19da17c33) Change-Id: I09a84a6bf33b17e0192b79b31af21ef14d7e9c63
Diffstat (limited to 'include')
-rw-r--r--include/svtools/ctrlbox.hxx3
-rw-r--r--include/vcl/field.hxx18
2 files changed, 12 insertions, 9 deletions
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 6e0358721885..d1a8a90cdd2b 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -363,6 +363,7 @@ class SVT_DLLPUBLIC FontSizeBox : public MetricBox
protected:
virtual OUString CreateFieldText( sal_Int64 nValue ) const override;
+ virtual sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const override;
public:
FontSizeBox( vcl::Window* pParent, WinBits nWinStyle );
@@ -385,8 +386,6 @@ public:
virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ) override;
virtual void SetValue( sal_Int64 nNewValue ) override;
- virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const override;
- virtual sal_Int64 GetValue() const override;
private:
FontSizeBox( const FontSizeBox& ) = delete;
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 3fb0633fe3a6..de00346a2e51 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -153,7 +153,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;
@@ -184,6 +185,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();
@@ -223,8 +226,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;
@@ -240,6 +243,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();
@@ -253,6 +259,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;
@@ -260,7 +267,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;
};
@@ -659,8 +665,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;
};
@@ -679,7 +684,6 @@ public:
virtual void ReformatAll() override;
- virtual sal_Int64 GetValue() const override;
virtual void dispose() override;
};