summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-07-28 16:08:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-08-04 11:02:56 +0200
commit43ea97e1f9cecd6c7cba8db35ce1307c858c6857 (patch)
tree5d4f81ad7e3a9e9e3af563ffe2df1661cb643bee
parent9d07f380bb0d5053571a9f3866b0415fe8339c5b (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>
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx4
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx5
-rw-r--r--forms/source/component/Date.cxx36
-rw-r--r--forms/source/component/FormComponent.cxx3
-rw-r--r--forms/source/component/Time.cxx39
-rw-r--r--framework/source/services/license.cxx4
-rw-r--r--include/toolkit/awt/vclxwindows.hxx42
-rw-r--r--include/toolkit/controls/unocontrolbase.hxx9
-rw-r--r--include/toolkit/controls/unocontrols.hxx48
-rw-r--r--include/toolkit/helper/property.hxx12
-rw-r--r--include/tools/date.hxx16
-rw-r--r--include/tools/time.hxx5
-rw-r--r--odk/examples/DevelopersGuide/GUI/UnoDialogSample.java18
-rw-r--r--offapi/com/sun/star/awt/UnoControlDateFieldModel.idl7
-rw-r--r--offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl7
-rw-r--r--offapi/com/sun/star/awt/XDateField.idl21
-rw-r--r--offapi/com/sun/star/awt/XTimeField.idl27
-rw-r--r--offapi/type_reference/offapi.rdbbin6888448 -> 6888960 bytes
-rw-r--r--qadevOOo/tests/java/ifc/awt/_XDateField.java29
-rw-r--r--qadevOOo/tests/java/ifc/awt/_XTimeField.java31
-rw-r--r--svx/source/fmcomp/gridcell.cxx47
-rw-r--r--svx/source/form/fmobjfac.cxx2
-rw-r--r--toolkit/source/awt/vclxwindows.cxx178
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx67
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx8
-rw-r--r--toolkit/source/controls/unocontrols.cxx60
-rw-r--r--toolkit/source/helper/property.cxx16
-rw-r--r--tools/source/datetime/ttime.cxx8
-rw-r--r--vcl/source/control/field2.cxx67
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.cxx25
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx32
31 files changed, 441 insertions, 432 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index efd3899de6d8..d0bf73ecdadc 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -579,7 +579,7 @@ namespace pcr
{
util::Date aDate;
OSL_VERIFY( _rControlValue >>= aDate );
- aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aDate );
+ aPropertyValue <<= aDate;
}
break;
@@ -590,7 +590,7 @@ namespace pcr
{
util::Time aTime;
OSL_VERIFY( _rControlValue >>= aTime );
- aPropertyValue <<= DBTypeConversion::toINT64( aTime );
+ aPropertyValue <<= aTime;
}
break;
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 13ae9779365a..156b8bfe9ba4 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -98,10 +98,7 @@ namespace pcr
Any aPropValue;
if ( !getTypedControlWindow()->GetText().isEmpty() )
{
- ::Time aTime( getTypedControlWindow()->GetTime() );
- util::Time const aUNOTime( aTime.GetNanoSec(), aTime.GetSec(),
- aTime.GetMin(), aTime.GetHour(), false );
- aPropValue <<= aUNOTime;
+ aPropValue <<= getTypedControlWindow()->GetTime().GetUNOTime();
}
return aPropValue;
}
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;
}
diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index 689917006e03..72106d32aa81 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -62,6 +62,10 @@ using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::util ;
using namespace ::com::sun::star::frame ;
+using ::Date;
+using ::Time;
+using ::DateTime;
+
// license file name
static const char *szLicensePath = "/share/readme";
#ifdef UNX
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
index f822b0cc0e33..f774e64fb3ef 100644
--- a/include/toolkit/awt/vclxwindows.hxx
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -75,6 +75,8 @@
#include <com/sun/star/awt/XItemListListener.hpp>
#include <com/sun/star/awt/XImageConsumer.hpp>
#include <com/sun/star/awt/XSimpleTabController.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/Date.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -974,16 +976,16 @@ public:
// ::com::sun::star::awt::XDateField
- void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDate( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
@@ -1019,16 +1021,16 @@ public:
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XTimeField
- void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTime( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/include/toolkit/controls/unocontrolbase.hxx b/include/toolkit/controls/unocontrolbase.hxx
index 30f1bf664206..1ca1eb4cf1f3 100644
--- a/include/toolkit/controls/unocontrolbase.hxx
+++ b/include/toolkit/controls/unocontrolbase.hxx
@@ -21,6 +21,8 @@
#define _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
#include <toolkit/controls/unocontrol.hxx>
@@ -39,11 +41,16 @@ protected:
void ImplSetPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Bool bUpdateThis );
::com::sun::star::uno::Any ImplGetPropertyValue( const OUString& aPropertyName );
+ template <typename T> T ImplGetPropertyValuePOD( sal_uInt16 nProp );
+ template <typename T> T ImplGetPropertyValueClass( sal_uInt16 nProp );
sal_Bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp );
sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp );
sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp );
+ sal_Int64 ImplGetPropertyValue_INT64( sal_uInt16 nProp );
double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp );
- OUString ImplGetPropertyValue_UString( sal_uInt16 nProp );
+ OUString ImplGetPropertyValue_UString( sal_uInt16 nProp );
+ ::com::sun::star::util::Date ImplGetPropertyValue_Date( sal_uInt16 nProp );
+ ::com::sun::star::util::Time ImplGetPropertyValue_Time( sal_uInt16 nProp );
// XLayoutConstrains (nur wenn das Control es unterstuetzt!)
::com::sun::star::awt::Size Impl_getMinimumSize();
diff --git a/include/toolkit/controls/unocontrols.hxx b/include/toolkit/controls/unocontrols.hxx
index 0d3119fd8025..c8a5d7ae5843 100644
--- a/include/toolkit/controls/unocontrols.hxx
+++ b/include/toolkit/controls/unocontrols.hxx
@@ -1081,8 +1081,8 @@ class UnoDateFieldControl : public UnoSpinFieldControl,
public ::com::sun::star::awt::XDateField
{
private:
- sal_Int32 mnFirst;
- sal_Int32 mnLast;
+ ::com::sun::star::util::Date mnFirst;
+ ::com::sun::star::util::Date mnLast;
sal_Bool mbLongFormat;
public:
UnoDateFieldControl();
@@ -1103,16 +1103,16 @@ public:
void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
//XDateField
- void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDate( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( const ::com::sun::star::util::Date& Date ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Date SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
@@ -1157,8 +1157,8 @@ class UnoTimeFieldControl : public UnoSpinFieldControl,
public ::com::sun::star::awt::XTimeField
{
private:
- sal_Int32 mnFirst;
- sal_Int32 mnLast;
+ ::com::sun::star::util::Time mnFirst;
+ ::com::sun::star::util::Time mnLast;
public:
UnoTimeFieldControl();
@@ -1179,16 +1179,16 @@ public:
void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
//XTimeField
- void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTime( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( const ::com::sun::star::util::Time& Time ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::util::Time SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/include/toolkit/helper/property.hxx b/include/toolkit/helper/property.hxx
index fa1fbbf2a125..74bdff1ab32c 100644
--- a/include/toolkit/helper/property.hxx
+++ b/include/toolkit/helper/property.hxx
@@ -65,12 +65,12 @@ namespace uno {
#define BASEPROPERTY_SPIN 27 // sal_Bool
#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool
#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16
-#define BASEPROPERTY_DATE 30 // sal_Int32
-#define BASEPROPERTY_DATEMIN 31 // sal_Int32
-#define BASEPROPERTY_DATEMAX 32 // sal_Int32
-#define BASEPROPERTY_TIME 33 // sal_Int32
-#define BASEPROPERTY_TIMEMIN 34 // sal_Int32
-#define BASEPROPERTY_TIMEMAX 35 // sal_Int32
+#define BASEPROPERTY_DATE 30 // ::com::sun::star::util::Date
+#define BASEPROPERTY_DATEMIN 31 // ::com::sun::star::util::Date
+#define BASEPROPERTY_DATEMAX 32 // ::com::sun::star::util::Date
+#define BASEPROPERTY_TIME 33 // ::com::sun::star::util::Time
+#define BASEPROPERTY_TIMEMIN 34 // ::com::sun::star::util::Time
+#define BASEPROPERTY_TIMEMAX 35 // ::com::sun::star::util::Time
#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32
#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32
#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32
diff --git a/include/tools/date.hxx b/include/tools/date.hxx
index 714a97b85727..31cf706f3a5c 100644
--- a/include/tools/date.hxx
+++ b/include/tools/date.hxx
@@ -21,6 +21,8 @@
#include "tools/toolsdllapi.h"
#include <tools/solar.h>
+#include <com/sun/star/util/Date.hpp>
+#include <sal/log.hxx>
class ResId;
@@ -31,6 +33,10 @@ class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Date
{
private:
sal_uInt32 nDate;
+ void init( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
+ { nDate = ( sal_uInt32( nDay % 100 ) ) +
+ ( ( sal_uInt32( nMonth % 100 ) ) * 100 ) +
+ ( ( sal_uInt32( nYear % 10000 ) ) * 10000); }
public:
enum DateInitSystem
@@ -52,12 +58,16 @@ public:
Date( const Date& rDate )
{ nDate = rDate.nDate; }
Date( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear )
- { nDate = ( sal_uInt32( nDay % 100 ) ) +
- ( ( sal_uInt32( nMonth % 100 ) ) * 100 ) +
- ( ( sal_uInt32( nYear % 10000 ) ) * 10000); }
+ { init(nDay, nMonth, nYear); }
+ Date( const ::com::sun::star::util::Date& _rDate )
+ {
+ SAL_WARN_IF(_rDate.Year < 0, "tools.datetime", "Negative year in css::util::Date to ::Date conversion");
+ init(_rDate.Day, _rDate.Month, _rDate.Year);
+ }
void SetDate( sal_uInt32 nNewDate ) { nDate = nNewDate; }
sal_uInt32 GetDate() const { return nDate; }
+ ::com::sun::star::util::Date GetUNODate() const { return ::com::sun::star::util::Date(GetDay(), GetMonth(), GetYear()); }
void SetDay( sal_uInt16 nNewDay );
void SetMonth( sal_uInt16 nNewMonth );
diff --git a/include/tools/time.hxx b/include/tools/time.hxx
index 64751af42284..126a42199bfa 100644
--- a/include/tools/time.hxx
+++ b/include/tools/time.hxx
@@ -21,6 +21,7 @@
#include "tools/toolsdllapi.h"
#include <tools/solar.h>
+#include <com/sun/star/util/Time.hpp>
class ResId;
@@ -34,6 +35,8 @@ class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Time
{
private:
sal_Int64 nTime;
+ void init( sal_uInt32 nHour, sal_uInt32 nMin,
+ sal_uInt32 nSec, sal_uInt64 nNanoSec);
public:
enum TimeInitSystem
@@ -66,11 +69,13 @@ public:
Time( const ResId & rResId );
Time( sal_Int64 _nTime ) { Time::nTime = _nTime; }
Time( const Time& rTime );
+ Time( const ::com::sun::star::util::Time& rTime );
Time( sal_uInt32 nHour, sal_uInt32 nMin,
sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 );
void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; }
sal_Int64 GetTime() const { return nTime; }
+ ::com::sun::star::util::Time GetUNOTime() const { return ::com::sun::star::util::Time(GetNanoSec(),GetSec(),GetMin(),GetHour(),false); }
void SetHour( sal_uInt16 nNewHour );
void SetMin( sal_uInt16 nNewMin );
diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
index 2b47e82e8975..61c37d68c210 100644
--- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
+++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
@@ -95,6 +95,8 @@ import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XMacroExpander;
import com.sun.star.util.XNumberFormats;
import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.Date;
+import com.sun.star.util.Time;
// Anregung von DV:
@@ -150,7 +152,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
oUnoDialogSample.insertProgressBar(106, 44, 100, 100);
oUnoDialogSample.insertHorizontalFixedLine(106, 58, 100, "My FixedLine");
oUnoDialogSample.insertEditField(oUnoDialogSample, oUnoDialogSample, 106, 72, 60);
- oUnoDialogSample.insertTimeField(106, 96, 50, 0, 170000, 1000);
+ oUnoDialogSample.insertTimeField(106, 96, 50, new Time(0,(short)0,(short)0,(short)10,false), new Time((short)0,(short)0,(short)0,(short)0,false), new Time((short)0,(short)0,(short)0,(short)17,false));
oUnoDialogSample.insertDateField(oUnoDialogSample, 166, 96, 50);
oUnoDialogSample.insertGroupBox(102, 124, 70, 100);
oUnoDialogSample.insertPatternField(106, 136, 50);
@@ -627,7 +629,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
return xTextComponent;
}
- public XPropertySet insertTimeField(int _nPosX, int _nPosY, int _nWidth, int _nTime, int _nTimeMin, int _nTimeMax){
+ public XPropertySet insertTimeField(int _nPosX, int _nPosY, int _nWidth, Time _aTime, Time _aTimeMin, Time _aTimeMax){
XPropertySet xTFModelPSet = null;
try{
// create a unique name by means of an own implementation...
@@ -649,9 +651,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
// The following properties may also be set with XMultiPropertySet but we
// use the XPropertySet interface merely for reasons of demonstration
xTFModelPSet.setPropertyValue("TimeFormat", new Short((short) 5));
- xTFModelPSet.setPropertyValue("TimeMin", new Integer(_nTimeMin));
- xTFModelPSet.setPropertyValue("TimeMax", new Integer(_nTimeMax));
- xTFModelPSet.setPropertyValue("Time", new Integer(_nTime));
+ xTFModelPSet.setPropertyValue("TimeMin", _aTimeMin);
+ xTFModelPSet.setPropertyValue("TimeMax", _aTimeMax);
+ xTFModelPSet.setPropertyValue("Time", _aTime);
} catch (com.sun.star.uno.Exception ex) {
/* perform individual exception handling here.
* Possible exception types are:
@@ -691,9 +693,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
// The following properties may also be set with XMultiPropertySet but we
// use the XPropertySet interface merely for reasons of demonstration
xDFModelPSet.setPropertyValue("DateFormat", new Short((short) 7));
- xDFModelPSet.setPropertyValue("DateMin", new Integer(20070401));
- xDFModelPSet.setPropertyValue("DateMax", new Integer(20070501));
- xDFModelPSet.setPropertyValue("Date", new Integer(20000415));
+ xDFModelPSet.setPropertyValue("DateMin", new Date((short)1, (short)4, (short)2007));
+ xDFModelPSet.setPropertyValue("DateMax", new Date((short)1, (short)5, (short)2007));
+ xDFModelPSet.setPropertyValue("Date", new Date((short)15, (short)4, (short)2000));
Object oDFControl = m_xDlgContainer.getControl(sName);
// add a SpinListener that is notified on each change of the controlvalue...
diff --git a/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl b/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl
index a1e099e9d106..b0a237b49757 100644
--- a/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl
+++ b/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl
@@ -19,6 +19,7 @@
#ifndef __com_sun_star_awt_UnoControlDateFieldModel_idl__
#define __com_sun_star_awt_UnoControlDateFieldModel_idl__
+#include <com/sun/star/util/Date.idl>
#include <com/sun/star/awt/FontDescriptor.idl>
#include <com/sun/star/awt/UnoControlModel.idl>
@@ -67,7 +68,7 @@ published service UnoControlDateFieldModel
<p>The date must be specified in the format YYYYMMDD.</p>
*/
- [property] long Date;
+ [property] ::com::sun::star::util::Date Date;
/** specifies the format of the displayed date.
@@ -92,12 +93,12 @@ published service UnoControlDateFieldModel
/** specifies the maximum date that can be entered.
*/
- [property] long DateMax;
+ [property] ::com::sun::star::util::Date DateMax;
/** specifies the minimum date that can be entered.
*/
- [property] long DateMin;
+ [property] ::com::sun::star::util::Date DateMin;
/** specifies, if the date century is displayed.
diff --git a/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl b/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl
index 79591c751d57..d5f3ec43c6d3 100644
--- a/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl
+++ b/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl
@@ -19,6 +19,7 @@
#ifndef __com_sun_star_awt_UnoControlTimeFieldModel_idl__
#define __com_sun_star_awt_UnoControlTimeFieldModel_idl__
+#include <com/sun/star/util/Time.idl>
#include <com/sun/star/awt/FontDescriptor.idl>
#include <com/sun/star/awt/UnoControlModel.idl>
@@ -168,7 +169,7 @@ published service UnoControlTimeFieldModel
/** specifies the time displayed in the control.
*/
- [property] long Time;
+ [property] com::sun::star::util::Time Time;
/** specifies the format of the displayed time.
@@ -187,12 +188,12 @@ published service UnoControlTimeFieldModel
/** specifies the maximum time that can be entered.
*/
- [property] long TimeMax;
+ [property] com::sun::star::util::Time TimeMax;
/** specifies the minimum time that can be entered.
*/
- [property] long TimeMin;
+ [property] com::sun::star::util::Time TimeMin;
/** denotes the writing mode used in the control, as specified in the
<type scope="com::sun::star::text">WritingMode2</type> constants group.
diff --git a/offapi/com/sun/star/awt/XDateField.idl b/offapi/com/sun/star/awt/XDateField.idl
index aa7c1b1a12bd..9438f5466e0d 100644
--- a/offapi/com/sun/star/awt/XDateField.idl
+++ b/offapi/com/sun/star/awt/XDateField.idl
@@ -20,6 +20,7 @@
#define __com_sun_star_awt_XDateField_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/util/Date.idl>
@@ -36,54 +37,54 @@ published interface XDateField: com::sun::star::uno::XInterface
<p>The date value must be specified in the format
YYYYMMDD.</p>
*/
- void setDate( [in] long Date );
+ void setDate( [in] ::com::sun::star::util::Date Date );
/** returns the date value which is currently displayed in the date field.
*/
- long getDate();
+ ::com::sun::star::util::Date getDate();
/** sets the minimum date value that can be entered by the user.
*/
- void setMin( [in] long Date );
+ void setMin( [in] ::com::sun::star::util::Date Date );
/** returns the currently set minimum date value that can be entered by
the user.
*/
- long getMin();
+ ::com::sun::star::util::Date getMin();
/** sets the maximum date value that can be entered by the user.
*/
- void setMax( [in] long Date );
+ void setMax( [in] ::com::sun::star::util::Date Date );
/** returns the currently set maximum date value that can be entered by
the user.
*/
- long getMax();
+ ::com::sun::star::util::Date getMax();
/** sets the first value to be set on POS1 key.
*/
- void setFirst( [in] long Date );
+ void setFirst( [in] ::com::sun::star::util::Date Date );
/** returns the currently set first value which is set on POS1 key.
*/
- long getFirst();
+ ::com::sun::star::util::Date getFirst();
/** sets the last value to be set on END key.
*/
- void setLast( [in] long Date );
+ void setLast( [in] ::com::sun::star::util::Date Date );
/** returns the currently set last value which is set on END key.
*/
- long getLast();
+ ::com::sun::star::util::Date getLast();
/** determines if the long date format is to be used.
diff --git a/offapi/com/sun/star/awt/XTimeField.idl b/offapi/com/sun/star/awt/XTimeField.idl
index 8e26a18b6aad..6fa1548ce6b5 100644
--- a/offapi/com/sun/star/awt/XTimeField.idl
+++ b/offapi/com/sun/star/awt/XTimeField.idl
@@ -20,6 +20,7 @@
#define __com_sun_star_awt_XTimeField_idl__
#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/util/Time.idl>
@@ -33,58 +34,58 @@ published interface XTimeField: com::sun::star::uno::XInterface
/** sets the time value which is displayed in the time field.
- <p>The time value must be specified in the format HHMMSShh,
- where HH are hours, MM are minutes, SS are seconds and hh are
- hundredth seconds.</p>
+ <p>The time value must be specified in the format HHMMSSnnnnnnnnn,
+ where HH are hours, MM are minutes, SS are seconds and
+ nnnnnnnnn are nanoseconds.</p>
*/
- void setTime( [in] long Time );
+ void setTime( [in] com::sun::star::util::Time Time );
/** returns the time value which is currently displayed in the time field.
*/
- long getTime();
+ com::sun::star::util::Time getTime();
/** sets the minimum time value that can be entered by the user.
*/
- void setMin( [in] long Time );
+ void setMin( [in] com::sun::star::util::Time Time );
/** returns the currently set minimum time value that can be entered by
the user.
*/
- long getMin();
+ com::sun::star::util::Time getMin();
/** sets the maximum time value that can be entered by the user.
*/
- void setMax( [in] long Time );
+ void setMax( [in] com::sun::star::util::Time Time );
/** returns the currently set maximum time value that can be entered by
the user.
*/
- long getMax();
+ com::sun::star::util::Time getMax();
/** sets the first value to be set on POS1 key.
*/
- void setFirst( [in] long Time );
+ void setFirst( [in] com::sun::star::util::Time Time );
/** returns the currently set first value which is set on POS1 key.
*/
- long getFirst();
+ com::sun::star::util::Time getFirst();
/** sets the last value to be set on END key.
*/
- void setLast( [in] long Time );
+ void setLast( [in] com::sun::star::util::Time Time );
/** returns the currently set last value which is set on END key.
*/
- long getLast();
+ com::sun::star::util::Time getLast();
/** sets an empty value for the time.
diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb
index 51c80d3b501d..144b4cc758af 100644
--- a/offapi/type_reference/offapi.rdb
+++ b/offapi/type_reference/offapi.rdb
Binary files differ
diff --git a/qadevOOo/tests/java/ifc/awt/_XDateField.java b/qadevOOo/tests/java/ifc/awt/_XDateField.java
index 54c268b7d155..c57106bf3ad7 100644
--- a/qadevOOo/tests/java/ifc/awt/_XDateField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XDateField.java
@@ -22,6 +22,7 @@ package ifc.awt;
import lib.MultiMethodTest;
import com.sun.star.awt.XDateField;
+import com.sun.star.util.Date;
/**
* Testing <code>com.sun.star.awt.XDateField</code>
@@ -66,12 +67,12 @@ public class _XDateField extends MultiMethodTest {
requiredMethod("getDate()") ;
boolean result = true ;
- oObj.setDate(19000101) ;
+ oObj.setDate(new Date((short)1, (short)1, (short)1900)) ;
- result = oObj.getDate() == 19000101 ;
+ result = oObj.getDate() == new Date((short)1, (short)1, (short)1900); ;
if (! result ) {
- System.out.println("getDate: "+oObj.getDate()+" , expected 19000101");
+ System.out.println("getDate: " + oObj.getDate() + " , expected 1900-01-01");
}
tRes.tested("setDate()", result) ;
@@ -100,9 +101,9 @@ public class _XDateField extends MultiMethodTest {
public void _setMin() {
boolean result = true ;
- oObj.setMin(4978) ;
+ oObj.setMin(new Date((short)5, (short)2, (short)1963));
- result = oObj.getMin() == 4978 ;
+ result = oObj.getMin() == new Date((short)5, (short)2, (short)1963);
tRes.tested("setMin()", result) ;
}
@@ -130,9 +131,9 @@ public class _XDateField extends MultiMethodTest {
public void _setMax() {
boolean result = true ;
- oObj.setMax(27856) ;
+ oObj.setMax(new Date((short)18, (short)9, (short)2117)) ;
- result = oObj.getMax() == 27856 ;
+ result = oObj.getMax() == new Date((short)18, (short)9, (short)2117) ;
tRes.tested("setMax()", result) ;
}
@@ -160,9 +161,9 @@ public class _XDateField extends MultiMethodTest {
public void _setFirst() {
boolean result = true ;
- oObj.setFirst(5118) ;
+ oObj.setFirst(new Date((short)7, (short)12, (short)1972)) ;
- result = oObj.getFirst() == 5118 ;
+ result = oObj.getFirst() == new Date((short)7, (short)12, (short)1972) ;
if (!result) {
log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ;
@@ -178,7 +179,7 @@ public class _XDateField extends MultiMethodTest {
public void _getFirst() {
boolean result = true ;
- int val = oObj.getFirst() ;
+ com.sun.star.util.Date val = oObj.getFirst() ;
log.println("getFirst() = " + val) ;
@@ -196,12 +197,12 @@ public class _XDateField extends MultiMethodTest {
public void _setLast() {
boolean result = true ;
- oObj.setLast(23450) ;
+ oObj.setLast(new Date((short)23, (short)8, (short)2053)) ;
- result = oObj.getLast() == 23450 ;
+ result = oObj.getLast() == new Date((short)23, (short)8, (short)2053) ;
if (!result) {
- log.println("Set to " + 23450 + " but returned " + oObj.getLast()) ;
+ log.println("Set to 2053-08-23 but returned " + oObj.getLast()) ;
}
tRes.tested("setLast()", result) ;
@@ -214,7 +215,7 @@ public class _XDateField extends MultiMethodTest {
public void _getLast() {
boolean result = true ;
- int val = oObj.getLast() ;
+ com.sun.star.util.Date val = oObj.getLast() ;
log.println("getLast() = " + val) ;
diff --git a/qadevOOo/tests/java/ifc/awt/_XTimeField.java b/qadevOOo/tests/java/ifc/awt/_XTimeField.java
index b0061c98a2b3..955b56d7aea9 100644
--- a/qadevOOo/tests/java/ifc/awt/_XTimeField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XTimeField.java
@@ -22,6 +22,7 @@ package ifc.awt;
import lib.MultiMethodTest;
import com.sun.star.awt.XTimeField;
+import com.sun.star.util.Time;
/**
* Testing <code>com.sun.star.awt.XTimeField</code>
@@ -62,12 +63,12 @@ public class _XTimeField extends MultiMethodTest {
requiredMethod("getTime()") ;
boolean result = true ;
- oObj.setTime(11150000) ;
+ oObj.setTime(new Time(0, (short)0, (short)15, (short)11, false));
- result = oObj.getTime() == 11150000 ;
+ result = oObj.getTime() == new Time(0, (short)0, (short)15, (short)11, false) ;
if (! result ) {
- System.out.println("Getting "+oObj.getTime()+ " expected 11150000");
+ System.out.println("Getting " + oObj.getTime() + " expected 11:15");
}
tRes.tested("setTime()", result) ;
@@ -96,9 +97,9 @@ public class _XTimeField extends MultiMethodTest {
public void _setMin() {
boolean result = true ;
- oObj.setMin(4978) ;
+ oObj.setMin(new Time(0, (short)14, (short)18, (short)6, false));
- result = oObj.getMin() == 4978 ;
+ result = oObj.getMin() == new Time(0, (short)14, (short)18, (short)6, false) ;
tRes.tested("setMin()", result) ;
}
@@ -126,9 +127,9 @@ public class _XTimeField extends MultiMethodTest {
public void _setMax() {
boolean result = true ;
- oObj.setMax(27856) ;
+ oObj.setMax(new Time(855447, (short)31, (short)23, (short)22, false)) ;
- result = oObj.getMax() == 27856 ;
+ result = oObj.getMax() == new Time(855447, (short)31, (short)23, (short)22, false) ;
tRes.tested("setMax()", result) ;
}
@@ -156,12 +157,12 @@ public class _XTimeField extends MultiMethodTest {
public void _setFirst() {
boolean result = true ;
- oObj.setFirst(5118) ;
+ oObj.setFirst(new Time(0, (short)0, (short)30, (short)7, false)) ;
- result = oObj.getFirst() == 5118 ;
+ result = oObj.getFirst() == new Time(0, (short)0, (short)30, (short)7, false);
if (!result) {
- log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ;
+ log.println("Set to 07:30 but returned " + oObj.getFirst()) ;
}
tRes.tested("setFirst()", result) ;
@@ -174,7 +175,7 @@ public class _XTimeField extends MultiMethodTest {
public void _getFirst() {
boolean result = true ;
- int val = oObj.getFirst() ;
+ com.sun.star.util.Time val = oObj.getFirst() ;
log.println("getFirst() = " + val) ;
@@ -192,12 +193,12 @@ public class _XTimeField extends MultiMethodTest {
public void _setLast() {
boolean result = true ;
- oObj.setLast(23450) ;
+ oObj.setLast(new Time(500000, (short)31, (short)30, (short)18, false)) ;
- result = oObj.getLast() == 23450 ;
+ result = oObj.getLast() == new Time(500000, (short)31, (short)30, (short)18, false);
if (!result) {
- log.println("Set to " + 23450 + " but returned " + oObj.getLast()) ;
+ log.println("Set to 18:30:31.5 but returned " + oObj.getLast()) ;
}
tRes.tested("setLast()", result) ;
@@ -210,7 +211,7 @@ public class _XTimeField extends MultiMethodTest {
public void _getLast() {
boolean result = true ;
- int val = oObj.getLast() ;
+ com.sun.star.util.Time val = oObj.getLast() ;
log.println("getLast() = " + val) ;
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 22b4716829d8..5659af06618c 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -42,7 +42,8 @@
#include <com/sun/star/sdbc/XStatement.hpp>
#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/Date.hpp>
#include <comphelper/extract.hxx>
#include <comphelper/numbers.hxx>
@@ -2246,8 +2247,10 @@ void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
if ( m_pWindow && _rxModel.is() )
{
sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_DATEFORMAT ) );
- sal_Int32 nMin = getINT32( _rxModel->getPropertyValue( FM_PROP_DATEMIN ) );
- sal_Int32 nMax = getINT32( _rxModel->getPropertyValue( FM_PROP_DATEMAX ) );
+ util::Date aMin;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMIN ) >>= aMin );
+ util::Date aMax;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMAX ) >>= aMax );
sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
Any aCentury = _rxModel->getPropertyValue( FM_PROP_DATE_SHOW_CENTURY );
@@ -2260,14 +2263,14 @@ void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
}
static_cast< DateField* >( m_pWindow )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pWindow )->SetMin( nMin );
- static_cast< DateField* >( m_pWindow )->SetMax( nMax );
+ static_cast< DateField* >( m_pWindow )->SetMin( aMin );
+ static_cast< DateField* >( m_pWindow )->SetMax( aMax );
static_cast< DateField* >( m_pWindow )->SetStrictFormat( bStrict );
static_cast< DateField* >( m_pWindow )->EnableEmptyFieldValue( sal_True );
static_cast< DateField* >( m_pPainter )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pPainter )->SetMin( nMin );
- static_cast< DateField* >( m_pPainter )->SetMax( nMax );
+ static_cast< DateField* >( m_pPainter )->SetMin( aMin );
+ static_cast< DateField* >( m_pPainter )->SetMax( aMax );
static_cast< DateField* >( m_pPainter )->SetStrictFormat( bStrict );
static_cast< DateField* >( m_pPainter )->EnableEmptyFieldValue( sal_True );
}
@@ -2317,9 +2320,9 @@ void DbDateField::updateFromModel( Reference< XPropertySet > _rxModel )
{
OSL_ENSURE( _rxModel.is() && m_pWindow, "DbDateField::updateFromModel: invalid call!" );
- sal_Int32 nDate = 0;
- if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= nDate )
- static_cast< DateField* >( m_pWindow )->SetDate( ::Date( nDate ) );
+ util::Date aDate;
+ if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= aDate )
+ static_cast< DateField* >( m_pWindow )->SetDate( ::Date( aDate ) );
else
static_cast< DateField* >( m_pWindow )->SetText( OUString() );
}
@@ -2330,7 +2333,7 @@ sal_Bool DbDateField::commitControl()
OUString aText(m_pWindow->GetText());
Any aVal;
if (!aText.isEmpty())
- aVal <<= (sal_Int32)static_cast<DateField*>(m_pWindow)->GetDate().GetDate();
+ aVal <<= static_cast<DateField*>(m_pWindow)->GetDate().GetUNODate();
else
aVal.clear();
@@ -2365,19 +2368,21 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
if ( m_pWindow && _rxModel.is() )
{
sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_TIMEFORMAT ) );
- sal_Int32 nMin = getINT32( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) );
- sal_Int32 nMax = getINT32( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) );
+ util::Time aMin;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) >>= aMin );
+ util::Time aMax;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) >>= aMax );
sal_Bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
static_cast< TimeField* >( m_pWindow )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pWindow )->SetMin( nMin );
- static_cast< TimeField* >( m_pWindow )->SetMax( nMax );
+ static_cast< TimeField* >( m_pWindow )->SetMin( aMin );
+ static_cast< TimeField* >( m_pWindow )->SetMax( aMax );
static_cast< TimeField* >( m_pWindow )->SetStrictFormat( bStrict );
static_cast< TimeField* >( m_pWindow )->EnableEmptyFieldValue( sal_True );
static_cast< TimeField* >( m_pPainter )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pPainter )->SetMin( nMin );
- static_cast< TimeField* >( m_pPainter )->SetMax( nMax );
+ static_cast< TimeField* >( m_pPainter )->SetMin( aMin );
+ static_cast< TimeField* >( m_pPainter )->SetMax( aMax );
static_cast< TimeField* >( m_pPainter )->SetStrictFormat( bStrict );
static_cast< TimeField* >( m_pPainter )->EnableEmptyFieldValue( sal_True );
}
@@ -2427,9 +2432,9 @@ void DbTimeField::updateFromModel( Reference< XPropertySet > _rxModel )
{
OSL_ENSURE( _rxModel.is() && m_pWindow, "DbTimeField::updateFromModel: invalid call!" );
- sal_Int32 nTime = 0;
- if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= nTime )
- static_cast< TimeField* >( m_pWindow )->SetTime( ::Time( nTime ) );
+ util::Time aTime;
+ if ( _rxModel->getPropertyValue( FM_PROP_DATE ) >>= aTime )
+ static_cast< TimeField* >( m_pWindow )->SetTime( ::Time( aTime ) );
else
static_cast< TimeField* >( m_pWindow )->SetText( OUString() );
}
@@ -2440,7 +2445,7 @@ sal_Bool DbTimeField::commitControl()
OUString aText(m_pWindow->GetText());
Any aVal;
if (!aText.isEmpty())
- aVal <<= (sal_Int32)static_cast<TimeField*>(m_pWindow)->GetTime().GetTime();
+ aVal <<= static_cast<TimeField*>(m_pWindow)->GetTime().GetUNOTime();
else
aVal.clear();
diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx
index 39be34a73722..dc54bf9630bd 100644
--- a/svx/source/form/fmobjfac.cxx
+++ b/svx/source/form/fmobjfac.cxx
@@ -184,7 +184,7 @@ IMPL_LINK(FmFormObjFactory, MakeObject, SdrObjFactory*, pObjFactory)
case OBJ_FM_TIMEFIELD:
sServiceSpecifier = FM_COMPONENT_TIMEFIELD;
- aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_TIMEMAX, makeAny( (sal_Int32)( Time( 23, 59, 59, 99 ).GetTime() ) ) ) );
+ aInitialProperties.push_back( PropertyValueArray::value_type( FM_PROP_TIMEMAX, makeAny( Time( 23, 59, 59, 999999999 ).GetUNOTime() ) ) );
break;
case OBJ_FM_NUMERICFIELD:
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 9e4c5d833578..08a32bc264a2 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -4832,24 +4832,24 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
}
else
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setDate( n );
+ util::Date d;
+ if ( Value >>= d )
+ setDate( d );
}
}
break;
case BASEPROPERTY_DATEMIN:
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setMin( n );
+ util::Date d;
+ if ( Value >>= d )
+ setMin( d );
}
break;
case BASEPROPERTY_DATEMAX:
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setMax( n );
+ util::Date d;
+ if ( Value >>= d )
+ setMax( d );
}
break;
case BASEPROPERTY_EXTDATEFORMAT:
@@ -4894,17 +4894,17 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
{
case BASEPROPERTY_DATE:
{
- aProp <<= (sal_Int32) getDate();
+ aProp <<= getDate();
}
break;
case BASEPROPERTY_DATEMIN:
{
- aProp <<= (sal_Int32) getMin();
+ aProp <<= getMin();
}
break;
case BASEPROPERTY_DATEMAX:
{
- aProp <<= (sal_Int32) getMax();
+ aProp <<= getMax();
}
break;
case BASEPROPERTY_DATESHOWCENTURY:
@@ -4927,14 +4927,14 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const ::com::sun:
}
-void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXDateField::setDate( const util::Date& aDate ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
{
- pDateField->SetDate( nDate );
+ pDateField->SetDate( aDate );
// #107218# Call same listeners like VCL would do after user interaction
SetSynthesizingVCLEvent( sal_True );
@@ -4944,100 +4944,95 @@ void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::Runt
}
}
-sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
+util::Date VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nDate = 0;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- nDate = pDateField->GetDate().GetDate();
-
- return nDate;
+ return pDateField->GetDate().GetUNODate();
+ else
+ return util::Date();
}
-void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXDateField::setMin( const util::Date& aDate ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- pDateField->SetMin( nDate );
+ pDateField->SetMin( aDate );
}
-sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
+util::Date VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nDate = 0;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- nDate = pDateField->GetMin().GetDate();
-
- return nDate;
+ return pDateField->GetMin().GetUNODate();
+ else
+ return util::Date();
}
-void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXDateField::setMax( const util::Date& aDate ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- pDateField->SetMax( nDate );
+ pDateField->SetMax( aDate );
}
-sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
+util::Date VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nDate = 0;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- nDate = pDateField->GetMax().GetDate();
-
- return nDate;
+ return pDateField->GetMax().GetUNODate();
+ else
+ return util::Date();
}
-void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXDateField::setFirst( const util::Date& aDate ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- pDateField->SetFirst( nDate );
+ pDateField->SetFirst( aDate );
}
-sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+util::Date VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nDate = 0;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- nDate = pDateField->GetFirst().GetDate();
-
- return nDate;
+ return pDateField->GetFirst().GetUNODate();
+ else
+ return util::Date();
}
-void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXDateField::setLast( const util::Date& aDate ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- pDateField->SetLast( nDate );
+ pDateField->SetLast( aDate );
}
-sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
+util::Date VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nDate = 0;
DateField* pDateField = (DateField*) GetWindow();
if ( pDateField )
- nDate = pDateField->GetLast().GetDate();
-
- return nDate;
+ return pDateField->GetLast().GetUNODate();
+ else
+ return util::Date();
}
void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
@@ -5154,14 +5149,14 @@ IMPL_XTYPEPROVIDER_START( VCLXTimeField )
VCLXFormattedSpinField::getTypes()
IMPL_XTYPEPROVIDER_END
-void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXTimeField::setTime( const util::Time& aTime ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
{
- pTimeField->SetTime( nTime );
+ pTimeField->SetTime( aTime );
// #107218# Call same listeners like VCL would do after user interaction
SetSynthesizingVCLEvent( sal_True );
@@ -5171,100 +5166,95 @@ void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::Runt
}
}
-sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nTime = 0;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- nTime = pTimeField->GetTime().GetTime();
-
- return nTime;
+ return pTimeField->GetTime().GetUNOTime();
+ else
+ return util::Time();
}
-void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXTimeField::setMin( const util::Time& aTime ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- pTimeField->SetMin( nTime );
+ pTimeField->SetMin( aTime );
}
-sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nTime = 0;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- nTime = pTimeField->GetMin().GetTime();
-
- return nTime;
+ return pTimeField->GetMin().GetUNOTime();
+ else
+ return util::Time();
}
-void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXTimeField::setMax( const util::Time& aTime ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- pTimeField->SetMax( nTime );
+ pTimeField->SetMax( aTime );
}
-sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nTime = 0;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- nTime = pTimeField->GetMax().GetTime();
-
- return nTime;
+ return pTimeField->GetMax().GetUNOTime();
+ else
+ return util::Time();
}
-void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXTimeField::setFirst( const util::Time& aTime ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- pTimeField->SetFirst( nTime );
+ pTimeField->SetFirst( aTime );
}
-sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nTime = 0;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- nTime = pTimeField->GetFirst().GetTime();
-
- return nTime;
+ return pTimeField->GetFirst().GetUNOTime();
+ else
+ return util::Time();
}
-void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+void VCLXTimeField::setLast( const util::Time& aTime ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- pTimeField->SetLast( nTime );
+ pTimeField->SetLast( aTime );
}
-sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int32 nTime = 0;
TimeField* pTimeField = (TimeField*) GetWindow();
if ( pTimeField )
- nTime = pTimeField->GetLast().GetTime();
-
- return nTime;
+ return pTimeField->GetLast().GetUNOTime();
+ else
+ return util::Time();
}
void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
@@ -5315,24 +5305,24 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
}
else
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setTime( n );
+ util::Time t;
+ if ( Value >>= t )
+ setTime( t );
}
}
break;
case BASEPROPERTY_TIMEMIN:
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setMin( n );
+ util::Time t;
+ if ( Value >>= t )
+ setMin( t );
}
break;
case BASEPROPERTY_TIMEMAX:
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- setMax( n );
+ util::Time t;
+ if ( Value >>= t )
+ setMax( t );
}
break;
case BASEPROPERTY_EXTTIMEFORMAT:
@@ -5369,17 +5359,17 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
case BASEPROPERTY_TIME:
{
- aProp <<= (sal_Int32) getTime();
+ aProp <<= getTime();
}
break;
case BASEPROPERTY_TIMEMIN:
{
- aProp <<= (sal_Int32) getMin();
+ aProp <<= getMin();
}
break;
case BASEPROPERTY_TIMEMAX:
{
- aProp <<= (sal_Int32) getMax();
+ aProp <<= getMax();
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index 566d11bb3653..26f06be28c1a 100644
--- a/toolkit/source/controls/unocontrolbase.cxx
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -26,6 +26,8 @@
#include <tools/debug.hxx>
+using namespace com::sun::star;
+
// ----------------------------------------------------
// class UnoControlBase
// ----------------------------------------------------
@@ -112,59 +114,66 @@ void UnoControlBase::ImplSetPropertyValue( const OUString& aPropertyName, const
return ::com::sun::star::uno::Any();
}
-sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp )
+template <typename T> T UnoControlBase::ImplGetPropertyValuePOD( sal_uInt16 nProp )
{
- sal_Bool b = sal_False;
+ T t(0);
if ( mxModel.is() )
{
::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= b;
+ aVal >>= t;
}
- return b;
+ return t;
}
-sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp )
+template <typename T> T UnoControlBase::ImplGetPropertyValueClass( sal_uInt16 nProp )
{
- sal_Int16 n = 0;
+ T t;
if ( mxModel.is() )
{
::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
+ aVal >>= t;
}
- return n;
+ return t;
+}
+
+sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp )
+{
+ return ImplGetPropertyValuePOD<sal_Bool>(nProp);
+}
+
+sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp )
+{
+ return ImplGetPropertyValuePOD<sal_Int16>(nProp);
}
sal_Int32 UnoControlBase::ImplGetPropertyValue_INT32( sal_uInt16 nProp )
{
- sal_Int32 n = 0;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
- }
- return n;
+ return ImplGetPropertyValuePOD<sal_Int32>(nProp);
+}
+
+sal_Int64 UnoControlBase::ImplGetPropertyValue_INT64( sal_uInt16 nProp )
+{
+ return ImplGetPropertyValuePOD<sal_Int64>(nProp);
}
double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
{
- double n = 0;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= n;
- }
- return n;
+ return ImplGetPropertyValuePOD<double>(nProp);
}
OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp )
{
- OUString aStr;
- if ( mxModel.is() )
- {
- ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
- aVal >>= aStr;
- }
- return aStr;
+ return ImplGetPropertyValueClass<OUString>(nProp);
+}
+
+util::Date UnoControlBase::ImplGetPropertyValue_Date( sal_uInt16 nProp )
+{
+ return ImplGetPropertyValueClass<util::Date>(nProp);
+}
+
+util::Time UnoControlBase::ImplGetPropertyValue_Time( sal_uInt16 nProp )
+{
+ return ImplGetPropertyValueClass<util::Time>(nProp);
}
::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize()
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index be3aa3bfa611..0578e2c81db0 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -232,10 +232,10 @@ sal_Bool UnoControlModel::ImplHasProperty( 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 <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break;
- case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break;
- case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break;
- case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_DATEMAX: aDefault <<= util::Date( 31, 12, 2200 ); break;
+ case BASEPROPERTY_DATEMIN: aDefault <<= util::Date( 1, 1, 1900 ); 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;
case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break;
case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break;
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index d61b7412ebda..dfb3ea2b67b8 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -3246,8 +3246,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertyS
UnoDateFieldControl::UnoDateFieldControl()
:UnoSpinFieldControl()
{
- mnFirst = Date( 1, 1, 1900 ).GetDate();
- mnLast = Date( 31, 12, 2200 ).GetDate();
+ mnFirst = util::Date( 1, 1, 1900 );
+ mnLast = util::Date( 31, 12, 2200 );
mbLongFormat = 2;
}
@@ -3323,43 +3323,43 @@ void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::Runt
GetTextListeners().textChanged( e );
}
-void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(uno::RuntimeException)
+void UnoDateFieldControl::setDate( const util::Date& Date ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Date;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True );
}
-sal_Int32 UnoDateFieldControl::getDate() throw(uno::RuntimeException)
+util::Date UnoDateFieldControl::getDate() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE );
+ return ImplGetPropertyValue_Date( BASEPROPERTY_DATE );
}
-void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(uno::RuntimeException)
+void UnoDateFieldControl::setMin( const util::Date& Date ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Date;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True );
}
-sal_Int32 UnoDateFieldControl::getMin() throw(uno::RuntimeException)
+util::Date UnoDateFieldControl::getMin() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN );
+ return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMIN );
}
-void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(uno::RuntimeException)
+void UnoDateFieldControl::setMax( const util::Date& Date ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Date;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True );
}
-sal_Int32 UnoDateFieldControl::getMax() throw(uno::RuntimeException)
+util::Date UnoDateFieldControl::getMax() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX );
+ return ImplGetPropertyValue_Date( BASEPROPERTY_DATEMAX );
}
-void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException)
+void UnoDateFieldControl::setFirst( const util::Date& Date ) throw(uno::RuntimeException)
{
mnFirst = Date;
if ( getPeer().is() )
@@ -3369,12 +3369,12 @@ void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException
}
}
-sal_Int32 UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
+util::Date UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
{
return mnFirst;
}
-void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
+void UnoDateFieldControl::setLast( const util::Date& Date ) throw(uno::RuntimeException)
{
mnLast = Date;
if ( getPeer().is() )
@@ -3384,7 +3384,7 @@ void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
}
}
-sal_Int32 UnoDateFieldControl::getLast() throw(uno::RuntimeException)
+util::Date UnoDateFieldControl::getLast() throw(uno::RuntimeException)
{
return mnLast;
}
@@ -3488,8 +3488,8 @@ uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertyS
UnoTimeFieldControl::UnoTimeFieldControl()
:UnoSpinFieldControl()
{
- mnFirst = Time( 0, 0 ).GetTime();
- mnLast = Time( 23, 59, 59, 99 ).GetTime();
+ mnFirst = util::Time( 0, 0, 0, 0, false );
+ mnLast = util::Time( 999999999, 59, 59, 23, false );
}
OUString UnoTimeFieldControl::GetComponentServiceName()
@@ -3539,43 +3539,43 @@ void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::Runt
GetTextListeners().textChanged( e );
}
-void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(uno::RuntimeException)
+void UnoTimeFieldControl::setTime( const util::Time& Time ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Time;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True );
}
-sal_Int32 UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIME );
}
-void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(uno::RuntimeException)
+void UnoTimeFieldControl::setMin( const util::Time& Time ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Time;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True );
}
-sal_Int32 UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMIN );
}
-void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(uno::RuntimeException)
+void UnoTimeFieldControl::setMax( const util::Time& Time ) throw(uno::RuntimeException)
{
uno::Any aAny;
aAny <<= Time;
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True );
}
-sal_Int32 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMAX );
}
-void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException)
+void UnoTimeFieldControl::setFirst( const util::Time& Time ) throw(uno::RuntimeException)
{
mnFirst = Time;
if ( getPeer().is() )
@@ -3585,12 +3585,12 @@ void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException
}
}
-sal_Int32 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
{
return mnFirst;
}
-void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
+void UnoTimeFieldControl::setLast( const util::Time& Time ) throw(uno::RuntimeException)
{
mnLast = Time;
if ( getPeer().is() )
@@ -3600,7 +3600,7 @@ void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
}
}
-sal_Int32 UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
{
return mnLast;
}
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 451d048f7cd7..74f0e3ac05d5 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -39,6 +39,8 @@
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/resource/XStringResourceResolver.hpp>
@@ -55,6 +57,8 @@ using ::com::sun::star::awt::FontDescriptor;
using ::com::sun::star::style::VerticalAlignment;
using ::com::sun::star::graphic::XGraphic;
+using namespace com::sun::star;
+
struct ImplPropertyInfo
{
OUString aName;
@@ -119,10 +123,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "Closeable", CLOSEABLE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "CurrencySymbol", CURRENCYSYMBOL, OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "CustomUnitText", CUSTOMUNITTEXT, OUString, BOUND, MAYBEDEFAULT ),
- DECL_DEP_PROP_3 ( "Date", DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "Date", DATE, util::Date, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "DateFormat", EXTDATEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DateMax", DATEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "DateMin", DATEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMax", DATEMAX, util::Date, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMin", DATEMIN, util::Date, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "DateShowCentury", DATESHOWCENTURY, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "DecimalAccuracy", DECIMALACCURACY, sal_Int16, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "DefaultButton", DEFAULTBUTTON, bool, BOUND, MAYBEDEFAULT ),
@@ -231,10 +235,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_2 ( "Text", TEXT, OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "TextColor", TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_3 ( "TextLineColor", TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
- DECL_DEP_PROP_3 ( "Time", TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "Time", TIME, util::Time, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "TimeFormat", EXTTIMEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "TimeMax", TIMEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMax", TIMEMAX, util::Time, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMin", TIMEMIN, util::Time, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Title", TITLE, OUString, BOUND, MAYBEDEFAULT ),
DECL_PROP_2 ( "Toggle", TOGGLE, bool, BOUND, MAYBEDEFAULT ),
DECL_PROP_3 ( "TreatAsNumber", TREATASNUMBER, bool, BOUND, MAYBEDEFAULT,TRANSIENT ),
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
index 8b27d1ffa72d..33b3b949f3e7 100644
--- a/tools/source/datetime/ttime.cxx
+++ b/tools/source/datetime/ttime.cxx
@@ -140,6 +140,14 @@ Time::Time( const Time& rTime )
Time::Time( sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec, sal_uInt64 nNanoSec )
{
+ init(nHour, nMin, nSec, nNanoSec);
+}
+Time::Time( const ::com::sun::star::util::Time &_rTime )
+{
+ init(_rTime.Hours, _rTime.Minutes, _rTime.Seconds, _rTime.NanoSeconds);
+}
+void Time::init( sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec, sal_uInt64 nNanoSec )
+{
// normalize time
nSec += nNanoSec / nanoSecInSec;
nNanoSec %= nanoSecInSec;
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index af0bf3ece0e4..5ae0453f0bea 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2242,7 +2242,7 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
short nHour = 0;
short nMinute = 0;
short nSecond = 0;
- short n100Sec = 0;
+ sal_Int64 nNanoSec = 0;
Time aTime( 0, 0, 0 );
if ( rStr.isEmpty() )
@@ -2296,7 +2296,7 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
return false;
if ( !aStr.isEmpty() && aStr[0] == '-' )
bNegative = true;
- n100Sec = (short)aStr.toString().toInt32();
+ nNanoSec = aStr.toString().toInt64();
}
else
nSecond = (short)aStr.toString().toInt32();
@@ -2349,44 +2349,44 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
nHour += nMinute / 60;
nMinute %= 60;
}
- n100Sec = (short)aStr.toString().toInt32();
+ nNanoSec = aStr.toString().toInt64();
+ }
- if ( n100Sec )
- {
- xub_StrLen nLen = 1; // at least one digit, otherwise n100Sec==0
+ if ( nNanoSec )
+ {
+ assert(aStr.getLength() >= 1);
- while ( aStr[nLen] >= '0' && aStr[nLen] <= '9' )
- nLen++;
+ sal_Int32 nLen = 1; // at least one digit, otherwise nNanoSec==0
- if ( nLen > 2 )
- {
- while( nLen > 3 )
- {
- n100Sec = n100Sec / 10;
- nLen--;
- }
- // round if negative?
- n100Sec = (n100Sec + 5) / 10;
- }
- else if ( nLen == 1 )
- {
- n100Sec = n100Sec * 10;
- }
+ while ( aStr.getLength() > nLen && aStr[nLen] >= '0' && aStr[nLen] <= '9' )
+ nLen++;
+
+ while ( nLen < 9)
+ {
+ nNanoSec *= 10;
+ ++nLen;
+ }
+ while ( nLen > 9 )
+ {
+ // round if negative?
+ nNanoSec = (nNanoSec + 5) / 10;
+ --nLen;
}
}
- if ( (nMinute > 59) || (nSecond > 59) || (n100Sec > 100) )
+ assert(nNanoSec > -1000000000 && nNanoSec < 1000000000);
+ if ( (nMinute > 59) || (nSecond > 59) || (nNanoSec > 1000000000) )
return false;
if ( eFormat == TIMEF_NONE )
- nSecond = n100Sec = 0;
+ nSecond = nNanoSec = 0;
else if ( eFormat == TIMEF_SEC )
- n100Sec = 0;
+ nNanoSec = 0;
if ( !bDuration )
{
if ( bNegative || (nHour < 0) || (nMinute < 0) ||
- (nSecond < 0) || (n100Sec < 0) )
+ (nSecond < 0) || (nNanoSec < 0) )
return false;
OUString aUpperCaseStr = aStr.toString().toAsciiUpperCase();
@@ -2402,22 +2402,25 @@ static bool ImplTimeGetValue( const OUString& rStr, Time& rTime,
nHour = 0;
aTime = Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond,
- (sal_uInt16)n100Sec );
+ (sal_uInt32)nNanoSec );
}
else
{
+ assert( !bNegative || (nHour < 0) || (nMinute < 0) ||
+ (nSecond < 0) || (nNanoSec < 0) );
if ( bNegative || (nHour < 0) || (nMinute < 0) ||
- (nSecond < 0) || (n100Sec < 0) )
+ (nSecond < 0) || (nNanoSec < 0) )
{
+ // LEM TODO: this looks weird... I think buggy when parsing "05:-02:18"
bNegative = true;
nHour = nHour < 0 ? -nHour : nHour;
nMinute = nMinute < 0 ? -nMinute : nMinute;
nSecond = nSecond < 0 ? -nSecond : nSecond;
- n100Sec = n100Sec < 0 ? -n100Sec : n100Sec;
+ nNanoSec = nNanoSec < 0 ? -nNanoSec : nNanoSec;
}
aTime = Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond,
- (sal_uInt16)n100Sec );
+ (sal_uInt32)nNanoSec );
if ( bNegative )
aTime = -aTime;
}
@@ -2565,7 +2568,7 @@ void TimeField::ImplTimeSpinArea( sal_Bool bUp )
aTime += aAddTime;
if ( !IsDuration() )
{
- Time aAbsMaxTime( 23, 59, 59, 99 );
+ Time aAbsMaxTime( 23, 59, 59, 999999999 );
if ( aTime > aAbsMaxTime )
aTime = aAbsMaxTime;
Time aAbsMinTime( 0, 0 );
@@ -2592,7 +2595,7 @@ void TimeFormatter::ImplInit()
TimeFormatter::TimeFormatter() :
maLastTime( 0, 0 ),
maMin( 0, 0 ),
- maMax( 23, 59, 59, 99 ),
+ maMax( 23, 59, 59, 999999999 ),
maCorrectedTime( Time::SYSTEM ),
mbEnforceValidValue( sal_True ),
maFieldTime( 0, 0 )
diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
index b306a65ce04b..452dc5df2793 100644
--- a/xmloff/source/forms/handler/vcl_date_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_date_handler.cxx
@@ -23,6 +23,7 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
#include <sax/tools/converter.hxx>
@@ -37,6 +38,7 @@ namespace xmloff
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::util::DateTime;
+ using ::com::sun::star::util::Date;
//==================================================================================================================
//= VCLDateHandler
@@ -56,14 +58,13 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
OUString VCLDateHandler::getAttributeValue( const Any& i_propertyValue ) const
{
- sal_Int32 nVCLDate(0);
- OSL_VERIFY( i_propertyValue >>= nVCLDate );
- ::Date aVCLDate( nVCLDate );
+ Date aDate;
+ OSL_VERIFY( i_propertyValue >>= aDate );
DateTime aDateTime; // default-inited to 0
- aDateTime.Day = aVCLDate.GetDay();
- aDateTime.Month = aVCLDate.GetMonth();
- aDateTime.Year = aVCLDate.GetYear();
+ aDateTime.Day = aDate.Day;
+ aDateTime.Month = aDate.Month;
+ aDateTime.Year = aDate.Year;
OUStringBuffer aBuffer;
::sax::Converter::convertDateTime( aBuffer, aDateTime, false );
@@ -73,25 +74,27 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
bool VCLDateHandler::getPropertyValues( const OUString i_attributeValue, PropertyValues& o_propertyValues ) const
{
- sal_Int32 nVCLDate(0);
-
DateTime aDateTime;
+ Date aDate;
if (::sax::Converter::convertDateTime( aDateTime, i_attributeValue ))
{
- ::Date aVCLDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
- nVCLDate = aVCLDate.GetDate();
+ aDate.Day = aDateTime.Day;
+ aDate.Month = aDateTime.Month;
+ aDate.Year = aDateTime.Year;
}
else
{
// compatibility format, before we wrote those values in XML-schema compatible form
+ sal_Int32 nVCLDate(0);
if (!::sax::Converter::convertNumber(nVCLDate, i_attributeValue))
{
OSL_ENSURE( false, "VCLDateHandler::getPropertyValues: unknown date format (no XML-schema date, no legacy integer)!" );
return false;
}
+ aDate = ::Date(nVCLDate).GetUNODate();
}
- const Any aPropertyValue( makeAny( nVCLDate ) );
+ const Any aPropertyValue( makeAny( aDate ) );
OSL_ENSURE( o_propertyValues.size() == 1, "VCLDateHandler::getPropertyValues: date strings represent exactly one property - not more, not less!" );
for ( PropertyValues::iterator prop = o_propertyValues.begin();
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
index c73392f75a14..bbf9698d7c49 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -23,6 +23,7 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/util/Duration.hpp>
+#include <com/sun/star/util/Time.hpp>
#include <sax/tools/converter.hxx>
@@ -37,6 +38,7 @@ namespace xmloff
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::makeAny;
using ::com::sun::star::util::Duration;
+ using ::com::sun::star::util::Time;
//==================================================================================================================
//= VCLTimeHandler
@@ -56,15 +58,14 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
OUString VCLTimeHandler::getAttributeValue( const Any& i_propertyValue ) const
{
- sal_Int32 nVCLTime(0);
- OSL_VERIFY( i_propertyValue >>= nVCLTime );
- ::Time aVCLTime( nVCLTime );
+ Time aTime;
+ OSL_VERIFY( i_propertyValue >>= aTime );
Duration aDuration; // default-inited to 0
- aDuration.Hours = aVCLTime.GetHour();
- aDuration.Minutes = aVCLTime.GetMin();
- aDuration.Seconds = aVCLTime.GetSec();
- aDuration.NanoSeconds = aVCLTime.GetNanoSec();
+ aDuration.Hours = aTime.Hours;
+ aDuration.Minutes = aTime.Minutes;
+ aDuration.Seconds = aTime.Seconds;
+ aDuration.NanoSeconds = aTime.NanoSeconds;
OUStringBuffer aBuffer;
::sax::Converter::convertDuration( aBuffer, aDuration );
@@ -74,26 +75,29 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
bool VCLTimeHandler::getPropertyValues( const OUString i_attributeValue, PropertyValues& o_propertyValues ) const
{
- sal_Int32 nVCLTime(0);
-
Duration aDuration;
+ Time aTime;
if (::sax::Converter::convertDuration( aDuration, i_attributeValue ))
{
- ::Time aVCLTime(aDuration.Hours, aDuration.Minutes,
- aDuration.Seconds, aDuration.NanoSeconds);
- nVCLTime = aVCLTime.GetTime();
+ aTime = Time(aDuration.NanoSeconds, aDuration.Seconds,
+ aDuration.Minutes, aDuration.Hours,
+ false);
}
else
{
// compatibility format, before we wrote those values in XML-schema compatible form
- if (!::sax::Converter::convertNumber(nVCLTime, i_attributeValue))
+ sal_Int64 nVCLTime(0);
+ if (!::sax::Converter::convertNumber64(nVCLTime, i_attributeValue))
{
OSL_ENSURE( false, "VCLTimeHandler::getPropertyValues: unknown time format (no XML-schema time, no legacy integer)!" );
return false;
}
+ // legacy integer was in centiseconds
+ nVCLTime *= ::Time::nanoPerCenti;
+ aTime = ::Time(nVCLTime).GetUNOTime();
}
- const Any aPropertyValue( makeAny( nVCLTime ) );
+ const Any aPropertyValue( makeAny( aTime ) );
OSL_ENSURE( o_propertyValues.size() == 1, "VCLTimeHandler::getPropertyValues: time strings represent exactly one property - not more, not less!" );
for ( PropertyValues::iterator prop = o_propertyValues.begin();