diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-08-04 01:14:22 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-08-04 06:51:31 +0000 |
commit | 8ee69b0ba13f74d1515fac71df92947eb6328ab1 (patch) | |
tree | 5d5e95bb877e5e961cd02eee47011548af94bca1 /forms/source | |
parent | aa5683e18de07c9e86325595ead4574efa685c3a (diff) |
fdo#67235 adapt form control code to time nanosecond API change, step 3
Change-Id: I4899c89ee5b2a54c9c05b531ab284365f1558e3d
Reviewed-on: https://gerrit.libreoffice.org/5270
Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/Date.cxx | 36 | ||||
-rw-r--r-- | forms/source/component/Time.cxx | 39 |
2 files changed, 11 insertions, 64 deletions
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index 47f6ea35213c..b5edf236ef14 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -105,7 +105,7 @@ ODateModel::ODateModel(const Reference<XComponentContext>& _rxFactory) try { if ( m_xAggregateSet.is() ) - m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, makeAny( (sal_Int32)( ::Date( 1, 1, 1800 ).GetDate() ) ) ); + m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, makeAny(util::Date(1, 1, 1800)) ); } catch( const Exception& ) { @@ -170,7 +170,7 @@ OUString SAL_CALL ODateModel::getServiceName() throw ( ::com::sun::star::uno::Ru void ODateModel::describeFixedProperties( Sequence< Property >& _rProps ) const { BEGIN_DESCRIBE_PROPERTIES( 4, OEditBaseModel ) - DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); + DECL_PROP3(DEFAULT_DATE, util::Date, BOUND, MAYBEDEFAULT, MAYBEVOID); DECL_PROP1(TABINDEX, sal_Int16, BOUND); DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT); DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT); @@ -276,44 +276,21 @@ sal_Bool ODateModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) } //------------------------------------------------------------------------------ -void ODateModel::impl_translateControlValueToUNODate( Any& _rUNOValue ) const -{ - _rUNOValue = getControlValue(); - if ( _rUNOValue.hasValue() ) - { - sal_Int32 nDate = 0; - OSL_VERIFY( _rUNOValue >>= nDate ); - _rUNOValue <<= DBTypeConversion::toDate( nDate ); - } -} - -//------------------------------------------------------------------------------ Any ODateModel::translateControlValueToExternalValue( ) const { - Any aExternalValue; - impl_translateControlValueToUNODate( aExternalValue ); - return aExternalValue; + return getControlValue(); } //------------------------------------------------------------------------------ Any ODateModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const { - Any aControlValue; - if ( _rExternalValue.hasValue() ) - { - util::Date aDate; - OSL_VERIFY( _rExternalValue >>= aDate ); - aControlValue <<= DBTypeConversion::toINT32( aDate ); - } - return aControlValue; + return _rExternalValue; } //------------------------------------------------------------------------------ Any ODateModel::translateControlValueToValidatableValue( ) const { - Any aValidatableValue; - impl_translateControlValueToUNODate( aValidatableValue ); - return aValidatableValue; + return getControlValue(); } //------------------------------------------------------------------------------ @@ -323,8 +300,7 @@ Any ODateModel::translateDbColumnToControlValue() if (m_xColumn->wasNull()) m_aSaveValue.clear(); else - // the aggregated set expects an Int32 as value ... - m_aSaveValue <<= DBTypeConversion::toINT32(aDate); + m_aSaveValue <<= aDate; return m_aSaveValue; } diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index db81946d45a4..73e668b94070 100644 --- a/forms/source/component/Time.cxx +++ b/forms/source/component/Time.cxx @@ -167,7 +167,7 @@ OUString SAL_CALL OTimeModel::getServiceName() throw ( ::com::sun::star::uno::Ru void OTimeModel::describeFixedProperties( Sequence< Property >& _rProps ) const { BEGIN_DESCRIBE_PROPERTIES( 4, OEditBaseModel ) - DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); + DECL_PROP3(DEFAULT_TIME, util::Time, BOUND, MAYBEDEFAULT, MAYBEVOID); DECL_PROP1(TABINDEX, sal_Int16, BOUND); DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT); DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT); @@ -274,48 +274,21 @@ sal_Bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) } //------------------------------------------------------------------------------ -void OTimeModel::impl_translateControlValueToUNOTime( Any& _rUNOValue ) const -{ - _rUNOValue = getControlValue(); - if ( _rUNOValue.hasValue() ) - { - sal_Int64 nTime = 0; - OSL_VERIFY( _rUNOValue >>= nTime ); - if ( nTime == ::Time( 99, 99, 99 ).GetTime() ) - // "invalid time" in VCL is different from "invalid time" in UNO - _rUNOValue.clear(); - else - _rUNOValue <<= DBTypeConversion::toTime( nTime ); - } -} - -//------------------------------------------------------------------------------ Any OTimeModel::translateControlValueToExternalValue( ) const { - Any aExternalValue; - impl_translateControlValueToUNOTime( aExternalValue ); - return aExternalValue; + return getControlValue(); } //------------------------------------------------------------------------------ Any OTimeModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const { - Any aControlValue; - if ( _rExternalValue.hasValue() ) - { - util::Time aTime; - OSL_VERIFY( _rExternalValue >>= aTime ); - aControlValue <<= DBTypeConversion::toINT64( aTime ); - } - return aControlValue; + return _rExternalValue; } //------------------------------------------------------------------------------ Any OTimeModel::translateControlValueToValidatableValue( ) const { - Any aValidatableValue; - impl_translateControlValueToUNOTime( aValidatableValue ); - return aValidatableValue; + return getControlValue(); } //------------------------------------------------------------------------------ @@ -325,9 +298,7 @@ Any OTimeModel::translateDbColumnToControlValue() if ( m_xColumn->wasNull() ) m_aSaveValue.clear(); else - // TODO FIXME: "the aggregated set expects an Int32 as value ..." - // need to fix it for int64 - m_aSaveValue <<= DBTypeConversion::toINT64( aTime ); + m_aSaveValue <<= aTime; return m_aSaveValue; } |