diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-07-28 16:08:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-04 11:02:56 +0200 |
commit | 43ea97e1f9cecd6c7cba8db35ce1307c858c6857 (patch) | |
tree | 5d4f81ad7e3a9e9e3af563ffe2df1661cb643bee /forms | |
parent | 9d07f380bb0d5053571a9f3866b0415fe8339c5b (diff) |
fdo#67235 adapt form control code to time nanosecond API change
squash of steps 1, 2 and 3 in master
Change-Id: If68ecf0691919d71d06d7b97d46db115013f9805
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/Date.cxx | 36 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 3 | ||||
-rw-r--r-- | forms/source/component/Time.cxx | 39 |
3 files changed, 14 insertions, 64 deletions
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index 2ac56ab34453..318456d53165 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -105,7 +105,7 @@ ODateModel::ODateModel(const Reference<XMultiServiceFactory>& _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/FormComponent.cxx b/forms/source/component/FormComponent.cxx index a666f6ab6bf2..12f0f6a563ec 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2347,6 +2347,7 @@ void OBoundControlModel::doSetControlValue( const Any& _rValue ) catch( const Exception& ) { OSL_FAIL( "OBoundControlModel::doSetControlValue: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -2367,6 +2368,7 @@ void OBoundControlModel::onConnectedValidator( ) catch( const Exception& ) { OSL_FAIL( "OBoundControlModel::onConnectedValidator: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } recheckValidity( false ); } @@ -2385,6 +2387,7 @@ void OBoundControlModel::onDisconnectedValidator( ) catch( const Exception& ) { OSL_FAIL( "OBoundControlModel::onDisconnectedValidator: caught an exception!" ); + DBG_UNHANDLED_EXCEPTION(); } recheckValidity( false ); } diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index 512b3f0b344c..b18383bb34ab 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; } |