From b20594f2fc8f6f9fdbf0b257b4e74d95a8d90139 Mon Sep 17 00:00:00 2001 From: jucasaca Date: Thu, 25 Aug 2022 20:21:24 +0200 Subject: tdf#150569 Modify hardcoded dates to extend the range of accepted dates Replaces date range limits to allow entry of dates between 1/1/0001 and 31/12/9999, which is the normal date range in most database manager May need some discussion Change-Id: Ide8dfc64663d2ef2a66d8b7e1af3ef8ed3bb0af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138845 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- extensions/source/propctrlr/standardcontrol.cxx | 4 ++-- forms/source/component/Date.cxx | 2 +- toolkit/source/controls/unocontrolmodel.cxx | 4 ++-- toolkit/source/controls/unocontrols.cxx | 4 ++-- vcl/source/app/weldutils.cxx | 4 ++-- vcl/source/control/field2.cxx | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 95b4143c76b8..1c88f98ecf8c 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -99,8 +99,8 @@ namespace pcr m_xEntryFormatter.reset(new weld::DateFormatter(*m_xEntry)); m_xEntryFormatter->SetStrictFormat(true); - m_xEntryFormatter->SetMin(::Date(1, 1, 1600)); - m_xEntryFormatter->SetMax(::Date(1, 1, 9999)); + m_xEntryFormatter->SetMin(::Date(1, 1, 0001)); + m_xEntryFormatter->SetMax(::Date(31, 12, 9999)); m_xEntryFormatter->SetExtDateFormat(ExtDateFieldFormat::SystemShortYYYY); m_xEntryFormatter->EnableEmptyField(true); diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index 3305e7695dff..e2be9e2ef8c1 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -86,7 +86,7 @@ ODateModel::ODateModel(const Reference& _rxFactory) try { if ( m_xAggregateSet.is() ) - m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, Any(util::Date(1, 1, 1800)) ); + m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, Any(util::Date(1, 1, 0001)) ); } catch( const Exception& ) { diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 986f55efbc50..efd25aa998e7 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -226,8 +226,8 @@ css::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const case BASEPROPERTY_PUSHBUTTONTYPE: aDefault <<= sal_Int16(0) /*PushButtonType::STANDARD*/; break; case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= sal_Int16(awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY); break; - case BASEPROPERTY_DATEMAX: aDefault <<= util::Date( 31, 12, 2200 ); break; - case BASEPROPERTY_DATEMIN: aDefault <<= util::Date( 1, 1, 1900 ); break; + case BASEPROPERTY_DATEMAX: aDefault <<= util::Date( 31, 12, 9999 ); break; + case BASEPROPERTY_DATEMIN: aDefault <<= util::Date( 1, 1, 0001 ); break; case BASEPROPERTY_TIMEMAX: aDefault <<= util::Time(0, 0, 59, 23, false); break; case BASEPROPERTY_TIMEMIN: aDefault <<= util::Time(); break; case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= double(1000000); break; diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 3bc095cf3f03..de764e7b8be1 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -3433,8 +3433,8 @@ stardiv_Toolkit_UnoControlDateFieldModel_get_implementation( UnoDateFieldControl::UnoDateFieldControl() { - mnFirst = util::Date( 1, 1, 1900 ); - mnLast = util::Date( 31, 12, 2200 ); + mnFirst = util::Date( 1, 1, 0001 ); + mnLast = util::Date( 31, 12, 9999 ); mbLongFormat = TRISTATE_INDET; } diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index f17aed238ae8..8e916ce984b9 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -444,8 +444,8 @@ void DateFormatter::Init() SetOutputHdl(LINK(this, DateFormatter, FormatOutputHdl)); SetInputHdl(LINK(this, DateFormatter, ParseInputHdl)); - SetMin(Date(1, 1, 1900)); - SetMax(Date(31, 12, 2200)); + SetMin(Date(1, 1, 0001)); + SetMax(Date(31, 12, 9999)); } void DateFormatter::SetExtDateFormat(ExtDateFieldFormat eFormat) diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index 89efabf08c3f..6af391a6cede 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -1718,8 +1718,8 @@ DateFormatter::DateFormatter(Edit* pEdit) : FormatterBase(pEdit) , maFieldDate(0) , maLastDate(0) - , maMin(1, 1, 1900) - , maMax(31, 12, 2200) + , maMin(1, 1, 0001) + , maMax(31, 12, 9999) , mbLongFormat(false) , mbShowDateCentury(true) , mnExtDateFormat(ExtDateFieldFormat::SystemShort) -- cgit v1.2.3