From e232878701402b8e13f5b8e45b1bfb85bbd1ec8c Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Tue, 6 Aug 2013 08:38:20 +0200 Subject: IN PROGRESS: UnoControlModel::read/write nanoseconds with backwards compatibility Change-Id: I5288bf844d396341baba45d1b4a5ef8b3c8e7a6d --- toolkit/source/controls/unocontrolmodel.cxx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 0578e2c81db0..21e394f73b6d 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -58,7 +58,7 @@ using namespace ::com::sun::star::i18n; using ::com::sun::star::awt::FontDescriptor; -#define UNOCONTROL_STREAMVERSION (short)2 +#define UNOCONTROL_STREAMVERSION (short)3 static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, const Any& rValue ) { @@ -770,7 +770,24 @@ void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun:: sal_Bool bIsVoid = InStream->readBoolean(); if ( !bIsVoid ) { - if ( maData.find( nPropId ) != maData.end() ) + if ( nVersion < 3 && + ( nPropId == BASEPROPERTY_TIME || + nPropId == BASEPROPERTY_TIMEMAX || + nPropId == BASEPROPERTY_TIMEMIN )) + { + sal_Int64 n = InStream->readLong(); + n *= ::Time::NanosPerCenti; + aValue <<= ::Time(n).getUNOTime(); + } + else if ( nVersion < 3 && + ( nPropId == BASEPROPERTY_DATE || + nPropId == BASEPROPERTY_DATEMIN || + nPropId == BASEPROPERTY_DATEMAX )) + { + sal_Int32 n = InStream->readLong(); + aValue <<= ::Date(n).getUNODate(); + } + else if ( maData.find( nPropId ) != maData.end() ) { const ::com::sun::star::uno::Type* pType = GetPropertyType( nPropId ); if ( *pType == ::getBooleanCppuType() ) -- cgit