summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-08-04 01:14:22 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-08-04 06:51:31 +0000
commit8ee69b0ba13f74d1515fac71df92947eb6328ab1 (patch)
tree5d5e95bb877e5e961cd02eee47011548af94bca1
parentaa5683e18de07c9e86325595ead4574efa685c3a (diff)
fdo#67235 adapt form control code to time nanosecond API change, step 3
Change-Id: I4899c89ee5b2a54c9c05b531ab284365f1558e3d Reviewed-on: https://gerrit.libreoffice.org/5270 Tested-by: Lionel Elie Mamane <lionel@mamane.lu> Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
-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/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.hxx6
-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.idl21
-rw-r--r--offapi/type_reference/offapi.rdbbin6822400 -> 6822912 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.cxx12
-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--xmloff/source/forms/handler/vcl_date_handler.cxx25
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx28
29 files changed, 368 insertions, 367 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 9ab0cbae4b70..fd3f6ce99e5e 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 47f6ea35213c..b5edf236ef14 100644
--- a/forms/source/component/Date.cxx
+++ b/forms/source/component/Date.cxx
@@ -105,7 +105,7 @@ ODateModel::ODateModel(const Reference<XComponentContext>& _rxFactory)
try
{
if ( m_xAggregateSet.is() )
- m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, makeAny( (sal_Int32)( ::Date( 1, 1, 1800 ).GetDate() ) ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_DATEMIN, makeAny(util::Date(1, 1, 1800)) );
}
catch( const Exception& )
{
@@ -170,7 +170,7 @@ OUString SAL_CALL ODateModel::getServiceName() throw ( ::com::sun::star::uno::Ru
void ODateModel::describeFixedProperties( Sequence< Property >& _rProps ) const
{
BEGIN_DESCRIBE_PROPERTIES( 4, OEditBaseModel )
- DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
+ DECL_PROP3(DEFAULT_DATE, util::Date, BOUND, MAYBEDEFAULT, MAYBEVOID);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT);
DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT);
@@ -276,44 +276,21 @@ sal_Bool ODateModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
}
//------------------------------------------------------------------------------
-void ODateModel::impl_translateControlValueToUNODate( Any& _rUNOValue ) const
-{
- _rUNOValue = getControlValue();
- if ( _rUNOValue.hasValue() )
- {
- sal_Int32 nDate = 0;
- OSL_VERIFY( _rUNOValue >>= nDate );
- _rUNOValue <<= DBTypeConversion::toDate( nDate );
- }
-}
-
-//------------------------------------------------------------------------------
Any ODateModel::translateControlValueToExternalValue( ) const
{
- Any aExternalValue;
- impl_translateControlValueToUNODate( aExternalValue );
- return aExternalValue;
+ return getControlValue();
}
//------------------------------------------------------------------------------
Any ODateModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const
{
- Any aControlValue;
- if ( _rExternalValue.hasValue() )
- {
- util::Date aDate;
- OSL_VERIFY( _rExternalValue >>= aDate );
- aControlValue <<= DBTypeConversion::toINT32( aDate );
- }
- return aControlValue;
+ return _rExternalValue;
}
//------------------------------------------------------------------------------
Any ODateModel::translateControlValueToValidatableValue( ) const
{
- Any aValidatableValue;
- impl_translateControlValueToUNODate( aValidatableValue );
- return aValidatableValue;
+ return getControlValue();
}
//------------------------------------------------------------------------------
@@ -323,8 +300,7 @@ Any ODateModel::translateDbColumnToControlValue()
if (m_xColumn->wasNull())
m_aSaveValue.clear();
else
- // the aggregated set expects an Int32 as value ...
- m_aSaveValue <<= DBTypeConversion::toINT32(aDate);
+ m_aSaveValue <<= aDate;
return m_aSaveValue;
}
diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index db81946d45a4..73e668b94070 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -167,7 +167,7 @@ OUString SAL_CALL OTimeModel::getServiceName() throw ( ::com::sun::star::uno::Ru
void OTimeModel::describeFixedProperties( Sequence< Property >& _rProps ) const
{
BEGIN_DESCRIBE_PROPERTIES( 4, OEditBaseModel )
- DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
+ DECL_PROP3(DEFAULT_TIME, util::Time, BOUND, MAYBEDEFAULT, MAYBEVOID);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT);
DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT);
@@ -274,48 +274,21 @@ sal_Bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
}
//------------------------------------------------------------------------------
-void OTimeModel::impl_translateControlValueToUNOTime( Any& _rUNOValue ) const
-{
- _rUNOValue = getControlValue();
- if ( _rUNOValue.hasValue() )
- {
- sal_Int64 nTime = 0;
- OSL_VERIFY( _rUNOValue >>= nTime );
- if ( nTime == ::Time( 99, 99, 99 ).GetTime() )
- // "invalid time" in VCL is different from "invalid time" in UNO
- _rUNOValue.clear();
- else
- _rUNOValue <<= DBTypeConversion::toTime( nTime );
- }
-}
-
-//------------------------------------------------------------------------------
Any OTimeModel::translateControlValueToExternalValue( ) const
{
- Any aExternalValue;
- impl_translateControlValueToUNOTime( aExternalValue );
- return aExternalValue;
+ return getControlValue();
}
//------------------------------------------------------------------------------
Any OTimeModel::translateExternalValueToControlValue( const Any& _rExternalValue ) const
{
- Any aControlValue;
- if ( _rExternalValue.hasValue() )
- {
- util::Time aTime;
- OSL_VERIFY( _rExternalValue >>= aTime );
- aControlValue <<= DBTypeConversion::toINT64( aTime );
- }
- return aControlValue;
+ return _rExternalValue;
}
//------------------------------------------------------------------------------
Any OTimeModel::translateControlValueToValidatableValue( ) const
{
- Any aValidatableValue;
- impl_translateControlValueToUNOTime( aValidatableValue );
- return aValidatableValue;
+ return getControlValue();
}
//------------------------------------------------------------------------------
@@ -325,9 +298,7 @@ Any OTimeModel::translateDbColumnToControlValue()
if ( m_xColumn->wasNull() )
m_aSaveValue.clear();
else
- // TODO FIXME: "the aggregated set expects an Int32 as value ..."
- // need to fix it for int64
- m_aSaveValue <<= DBTypeConversion::toINT64( aTime );
+ m_aSaveValue <<= aTime;
return m_aSaveValue;
}
diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index 76f0d7ec9611..0d5a874256c6 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -63,6 +63,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 a3a9f1b64d00..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_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 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 1fa03a8735e7..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>
@@ -46,7 +48,9 @@ protected:
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 fdcb44af3197..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_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMin( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setMax( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFirst( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setLast( sal_Int64 Time ) throw(::com::sun::star::uno::RuntimeException);
- sal_Int64 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 5f009ddbbc68..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_Int64
-#define BASEPROPERTY_TIMEMIN 34 // sal_Int64
-#define BASEPROPERTY_TIMEMAX 35 // sal_Int64
+#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 87ba2774eb1b..7933e7efe9eb 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;
@@ -32,6 +34,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
@@ -53,12 +59,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 31a8f94d23b9..d04652d0a77f 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 a76c918504ee..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, long _nTime, long _nTimeMin, long _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 Long(_nTimeMin));
- xTFModelPSet.setPropertyValue("TimeMax", new Long(_nTimeMax));
- xTFModelPSet.setPropertyValue("Time", new Long(_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 8d73ec787cbb..478bbd8e9ebc 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 5b59ff7461a3..bd9da9755a24 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] hyper 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] hyper TimeMax;
+ [property] com::sun::star::util::Time TimeMax;
/** specifies the minimum time that can be entered.
*/
- [property] hyper TimeMin;
+ [property] com::sun::star::util::Time TimeMin;
/** denotes the writing mode used in the control, as specified in the
com::sun::star::text::WritingMode2 constants group.
diff --git a/offapi/com/sun/star/awt/XDateField.idl b/offapi/com/sun/star/awt/XDateField.idl
index a04ef8cdfe48..1884c3ec972f 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 0e056e85acf2..1c4e02a5347d 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>
@@ -37,54 +38,54 @@ published interface XTimeField: com::sun::star::uno::XInterface
where HH are hours, MM are minutes, SS are seconds and
nnnnnnnnn are nanoseconds.</p>
*/
- void setTime( [in] hyper Time );
+ void setTime( [in] com::sun::star::util::Time Time );
/** returns the time value which is currently displayed in the time field.
*/
- hyper getTime();
+ com::sun::star::util::Time getTime();
/** sets the minimum time value that can be entered by the user.
*/
- void setMin( [in] hyper Time );
+ void setMin( [in] com::sun::star::util::Time Time );
/** returns the currently set minimum time value that can be entered by
the user.
*/
- hyper getMin();
+ com::sun::star::util::Time getMin();
/** sets the maximum time value that can be entered by the user.
*/
- void setMax( [in] hyper Time );
+ void setMax( [in] com::sun::star::util::Time Time );
/** returns the currently set maximum time value that can be entered by
the user.
*/
- hyper getMax();
+ com::sun::star::util::Time getMax();
/** sets the first value to be set on POS1 key.
*/
- void setFirst( [in] hyper Time );
+ void setFirst( [in] com::sun::star::util::Time Time );
/** returns the currently set first value which is set on POS1 key.
*/
- hyper getFirst();
+ com::sun::star::util::Time getFirst();
/** sets the last value to be set on END key.
*/
- void setLast( [in] hyper Time );
+ void setLast( [in] com::sun::star::util::Time Time );
/** returns the currently set last value which is set on END key.
*/
- hyper 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 e85a07330320..dec9b4413542 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 77cde0f316f4..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 ;
- long 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 ;
- long 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 79a5ae8ec45b..ffca6817ff23 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>
@@ -2250,8 +2251,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 );
@@ -2264,14 +2267,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 );
}
@@ -2321,9 +2324,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() );
}
@@ -2334,7 +2337,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();
@@ -2369,19 +2372,21 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
if ( m_pWindow && _rxModel.is() )
{
sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_TIMEFORMAT ) );
- sal_Int64 nMin = getINT64( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) );
- sal_Int64 nMax = getINT64( _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 );
}
@@ -2431,9 +2436,9 @@ void DbTimeField::updateFromModel( Reference< XPropertySet > _rxModel )
{
OSL_ENSURE( _rxModel.is() && m_pWindow, "DbTimeField::updateFromModel: invalid call!" );
- sal_Int64 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() );
}
@@ -2444,7 +2449,7 @@ sal_Bool DbTimeField::commitControl()
OUString aText(m_pWindow->GetText());
Any aVal;
if (!aText.isEmpty())
- aVal <<= (sal_Int64)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 15c1f60c7c32..528a0fb15fd1 100644
--- a/svx/source/form/fmobjfac.cxx
+++ b/svx/source/form/fmobjfac.cxx
@@ -186,7 +186,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_Int64)( Time( 23, 59, 59, 999999999 ).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 898a38b40468..079b994e689b 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -4831,24 +4831,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:
@@ -4893,17 +4893,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:
@@ -4926,14 +4926,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 );
@@ -4943,100 +4943,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)
@@ -5153,14 +5148,14 @@ IMPL_XTYPEPROVIDER_START( VCLXTimeField )
VCLXFormattedSpinField::getTypes()
IMPL_XTYPEPROVIDER_END
-void VCLXTimeField::setTime( sal_Int64 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 );
@@ -5170,100 +5165,95 @@ void VCLXTimeField::setTime( sal_Int64 nTime ) throw(::com::sun::star::uno::Runt
}
}
-sal_Int64 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int64 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_Int64 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_Int64 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int64 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_Int64 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_Int64 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int64 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_Int64 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_Int64 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int64 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_Int64 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_Int64 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
+util::Time VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
- sal_Int64 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)
@@ -5314,24 +5304,24 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
}
else
{
- sal_Int64 n = 0;
- if ( Value >>= n )
- setTime( n );
+ util::Time t;
+ if ( Value >>= t )
+ setTime( t );
}
}
break;
case BASEPROPERTY_TIMEMIN:
{
- sal_Int64 n = 0;
- if ( Value >>= n )
- setMin( n );
+ util::Time t;
+ if ( Value >>= t )
+ setMin( t );
}
break;
case BASEPROPERTY_TIMEMAX:
{
- sal_Int64 n = 0;
- if ( Value >>= n )
- setMax( n );
+ util::Time t;
+ if ( Value >>= t )
+ setMax( t );
}
break;
case BASEPROPERTY_EXTTIMEFORMAT:
@@ -5368,17 +5358,17 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
{
case BASEPROPERTY_TIME:
{
- aProp <<= (sal_Int64) getTime();
+ aProp <<= getTime();
}
break;
case BASEPROPERTY_TIMEMIN:
{
- aProp <<= (sal_Int64) getMin();
+ aProp <<= getMin();
}
break;
case BASEPROPERTY_TIMEMAX:
{
- aProp <<= (sal_Int64) getMax();
+ aProp <<= getMax();
}
break;
case BASEPROPERTY_ENFORCE_FORMAT:
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index 4f0cb43ace7f..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
// ----------------------------------------------------
@@ -164,6 +166,16 @@ OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp )
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()
{
::com::sun::star::awt::Size aSz;
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index c2aa7b73a6a4..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_Int64) Time( 23, 59 ).GetTime(); break;
- case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int64) 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 c9d7f354cc2f..e2503cfc2001 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_Int64 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_Int64 UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT64( BASEPROPERTY_TIME );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIME );
}
-void UnoTimeFieldControl::setMin( sal_Int64 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_Int64 UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT64( BASEPROPERTY_TIMEMIN );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMIN );
}
-void UnoTimeFieldControl::setMax( sal_Int64 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_Int64 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
{
- return ImplGetPropertyValue_INT64( BASEPROPERTY_TIMEMAX );
+ return ImplGetPropertyValue_Time( BASEPROPERTY_TIMEMAX );
}
-void UnoTimeFieldControl::setFirst( sal_Int64 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_Int64 Time ) throw(uno::RuntimeException
}
}
-sal_Int64 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
+util::Time UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
{
return mnFirst;
}
-void UnoTimeFieldControl::setLast( sal_Int64 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_Int64 Time ) throw(uno::RuntimeException)
}
}
-sal_Int64 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 9926b3c77e71..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_Int64, 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_Int64, BOUND, MAYBEDEFAULT ),
- DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int64, 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 bf25206c0fbc..0b147b443c33 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/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
index a1ac74ec265b..b3ff4f744e8d 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, 0, 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::parseDateTime( aDateTime, 0, 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 b50806018661..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_Int64 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,18 +75,18 @@ namespace xmloff
//------------------------------------------------------------------------------------------------------------------
bool VCLTimeHandler::getPropertyValues( const OUString i_attributeValue, PropertyValues& o_propertyValues ) const
{
- sal_Int64 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
+ 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)!" );
@@ -93,9 +94,10 @@ namespace xmloff
}
// 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();