[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 24 11:33:35 UTC 2020
include/vcl/fmtfield.hxx | 1 +
vcl/source/control/fmtfield.cxx | 16 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 1c75d4df766098b51221ad20f9f569aff87d1b1b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 19 11:27:29 2020 +0000
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Feb 24 12:32:49 2020 +0100
Resolves: tdf#130762 honour "wrap" in FormattedField
Change-Id: Iefd9a537aa358eab179cf6f0eeb6f80a9a77284a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89011
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 20c08e47f7c156a4726194215b389f4d0b165904)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88953
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/include/vcl/fmtfield.hxx b/include/vcl/fmtfield.hxx
index c2c3bb7d619b..f8e5e210416e 100644
--- a/include/vcl/fmtfield.hxx
+++ b/include/vcl/fmtfield.hxx
@@ -65,6 +65,7 @@ protected:
bool m_bHasMin : 1;
bool m_bHasMax : 1;
+ bool m_bWrapOnLimits : 1;
bool m_bStrictFormat : 1;
bool m_bEnableEmptyField : 1;
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index 7ae57b9f62b7..30c29d5796b2 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -21,6 +21,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <vcl/builder.hxx>
#include <vcl/event.hxx>
#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
@@ -287,7 +288,6 @@ FormattedField::StaticFormatter::~StaticFormatter()
}
}
-
FormattedField::FormattedField(vcl::Window* pParent, WinBits nStyle)
:SpinField(pParent, nStyle)
,m_aLastSelection(0,0)
@@ -295,6 +295,7 @@ FormattedField::FormattedField(vcl::Window* pParent, WinBits nStyle)
,m_dMaxValue(0)
,m_bHasMin(false)
,m_bHasMax(false)
+ ,m_bWrapOnLimits(false)
,m_bStrictFormat(true)
,m_bEnableEmptyField(true)
,m_bAutoColor(false)
@@ -840,11 +841,16 @@ void FormattedField::EnableEmptyField(bool bEnable)
void FormattedField::ImplSetValue(double dVal, bool bForce)
{
-
if (m_bHasMin && (dVal<m_dMinValue))
- dVal = m_dMinValue;
+ {
+ dVal = m_bWrapOnLimits ? fmod(dVal + m_dMaxValue + 1 - m_dMinValue, m_dMaxValue + 1) + m_dMinValue
+ : m_dMinValue;
+ }
if (m_bHasMax && (dVal>m_dMaxValue))
- dVal = m_dMaxValue;
+ {
+ dVal = m_bWrapOnLimits ? fmod(dVal - m_dMinValue, m_dMaxValue + 1) + m_dMinValue
+ : m_dMaxValue;
+ }
if (!bForce && (dVal == GetValue()))
return;
@@ -979,6 +985,8 @@ bool FormattedField::set_property(const OString &rKey, const OUString &rValue)
{
if (rKey == "digits")
SetDecimalDigits(rValue.toInt32());
+ else if (rKey == "wrap")
+ m_bWrapOnLimits = toBool(rValue);
else
return SpinField::set_property(rKey, rValue);
return true;
More information about the Libreoffice-commits
mailing list