summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-02 17:53:06 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-08-02 19:10:23 +0200
commit6ca5d288ca810f128163da121777ee2e11c46edc (patch)
tree6f421bfc721366f3b51dd55134a5c1c56ca1d842 /sw/inc
parent82828c6c4030ccc8b7af8ee4e7eebd9c6d32fdf9 (diff)
sw user field type: fix locale of string -> float conversion
The key part is the SwUserFieldType::GetValue() hunk, the field type has to always use the same locale, which means if we get an SwCalc reference that works with the document or field locale that has to be switched temporarily. Change-Id: I26ff18e74f477729a66b066c4baf6d215a7685bc Reviewed-on: https://gerrit.libreoffice.org/58492 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/calc.hxx1
-rw-r--r--sw/inc/usrfld.hxx14
2 files changed, 15 insertions, 0 deletions
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 3396c506ab18..94d2643a547f 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -231,6 +231,7 @@ public:
bool Push(const SwUserFieldType* pUserFieldType);
void Pop();
+ CharClass* GetCharClass();
void SetCalcError( SwCalcError eErr ) { m_eError = eErr; }
bool IsCalcError() const { return SwCalcError::NONE != m_eError; }
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx
index e98258c624c3..ee565278fe6d 100644
--- a/sw/inc/usrfld.hxx
+++ b/sw/inc/usrfld.hxx
@@ -26,12 +26,20 @@ class SfxPoolItem;
class SwCalc;
class SwDoc;
+/**
+ * The shared part of a user field.
+ *
+ * Tracks the value, but conversion between the float and string representation
+ * always happens with the system locale.
+ */
class SW_DLLPUBLIC SwUserFieldType : public SwValueFieldType
{
bool bValidValue : 1;
bool bDeleted : 1;
+ /// Float value type.
double nValue;
OUString aName;
+ /// String value type.
OUString aContent;
sal_uInt16 nType;
@@ -84,6 +92,12 @@ inline void SwUserFieldType::SetType(sal_uInt16 nSub)
EnableFormat(!(nSub & nsSwGetSetExpType::GSE_STRING));
}
+/**
+ * The non-shared part of a user field.
+ *
+ * Tracks the number format and the language, conversion between the float and
+ * string representation is independent from the system locale.
+ */
class SW_DLLPUBLIC SwUserField : public SwValueField
{
sal_uInt16 nSubType;