summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-06-28 00:43:19 +0200
committerMichael Stahl <mstahl@redhat.com>2013-07-15 16:54:56 +0200
commitdd780228cca25dc818ca7fdb628ff607c109618e (patch)
treecec08040b1cd42296773a557fc821951615e9c3b
parenteb426753811befc69b3929146ac68cb97f92f7b0 (diff)
i#108348 API CHANGE: add IsUTC to css.util.DateTime etc.
Add IsUTC member to: com.sun.star.util.DateTime com.sun.star.util.DateTimeRange com.sun.star.util.Time Add new stucts with explicit time zones: com.sun.star.util.DateTimeWithTimezone com.sun.star.util.DateWithTimezone com.sun.star.util.TimeWithTimezone Adapt the sax::Converter to read/write timezones, and fix the unit test. Everything else just uses default (no time zone), this commit is just to fix the API. STRUCT: /UCR/com/sun/star/util/DateTime nFields1 = 7 != nFields2 = 8 Registry2 contains 1 more fields STRUCT: /UCR/com/sun/star/util/DateTimeRange nFields1 = 14 != nFields2 = 15 Registry2 contains 1 more fields STRUCT: /UCR/com/sun/star/util/Time nFields1 = 4 != nFields2 = 5 Registry2 contains 1 more fields Conflicts: sc/source/filter/oox/unitconverter.cxx Reviewed-on: https://gerrit.libreoffice.org/4833 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 652ccbdf3111766fadc379a8cf4650b744e1e19c) i#108348: fix TimeZone -> Timezone in struct names (cherry picked from commit 604aae1fd240254fe851d93dc35b5408bd13296c) Signed-off-by: Michael Stahl <mstahl@redhat.com> Signed-off-by: Lionel Elie Mamane <lionel@mamane.lu> Signed-off-by: Michael Meeks <michael.meeks@suse.com> Conflicts: forms/source/xforms/convert.cxx offapi/type_reference/offapi.rdb reportdesign/source/core/sdr/RptObject.cxx sc/source/filter/oox/unitconverter.cxx
-rw-r--r--comphelper/source/misc/anycompare.cxx3
-rw-r--r--connectivity/source/commontools/dbconversion.cxx5
-rw-r--r--connectivity/source/drivers/file/FDateFunctions.cxx10
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx5
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx5
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx3
-rw-r--r--forms/source/xforms/convert.cxx10
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/util/Date.idl3
-rw-r--r--offapi/com/sun/star/util/DateTime.idl7
-rw-r--r--offapi/com/sun/star/util/DateTimeRange.idl8
-rw-r--r--offapi/com/sun/star/util/DateTimeWithTimezone.idl43
-rw-r--r--offapi/com/sun/star/util/DateWithTimezone.idl43
-rw-r--r--offapi/com/sun/star/util/Time.idl7
-rw-r--r--offapi/com/sun/star/util/TimeWithTimezone.idl44
-rw-r--r--offapi/type_reference/offapi.rdbbin6862336 -> 6888448 bytes
-rw-r--r--oox/source/docprop/docprophandler.cxx4
-rw-r--r--qadevOOo/tests/java/ifc/sdbc/_XParameters.java4
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx3
-rw-r--r--sax/qa/cppunit/test_converter.cxx63
-rw-r--r--sax/source/tools/converter.cxx204
-rw-r--r--sc/source/filter/oox/unitconverter.cxx2
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx5
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx2
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx16
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx5
-rw-r--r--sfx2/source/doc/objcont.cxx4
-rw-r--r--sfx2/source/doc/oleprops.cxx13
-rw-r--r--sfx2/source/view/viewprn.cxx2
-rw-r--r--svl/source/items/dateitem.cxx4
-rw-r--r--svtools/source/misc/templatefoldercache.cxx3
-rw-r--r--svtools/source/svhtml/parhtml.cxx3
-rw-r--r--sw/source/core/doc/docglbl.cxx3
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--toolkit/source/controls/unocontrols.cxx2
-rw-r--r--ucb/source/ucp/ftp/ftpdirp.hxx3
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx2
-rw-r--r--unotools/source/misc/datetime.cxx3
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx2
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx2
40 files changed, 446 insertions, 109 deletions
diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx
index 775386e9c083..30e805a791fc 100644
--- a/comphelper/source/misc/anycompare.cxx
+++ b/comphelper/source/misc/anycompare.cxx
@@ -70,6 +70,7 @@ namespace comphelper
|| !( _rhs >>= rhs )
)
throw ::com::sun::star::lang::IllegalArgumentException();
+ // FIXME Timezone?
if ( lhs.Year < rhs.Year )
return true;
@@ -100,6 +101,7 @@ namespace comphelper
|| !( _rhs >>= rhs )
)
throw ::com::sun::star::lang::IllegalArgumentException();
+ // FIXME Timezone?
if ( lhs.Hours < rhs.Hours )
return true;
@@ -135,6 +137,7 @@ namespace comphelper
|| !( _rhs >>= rhs )
)
throw ::com::sun::star::lang::IllegalArgumentException();
+ // FIXME Timezone?
if ( lhs.Year < rhs.Year )
return true;
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 73b76385fa9f..0b04dbd951e4 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -102,7 +102,8 @@ namespace dbtools
utl::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
OUStringBuffer aTemp(toDateString(aDate));
aTemp.appendAscii(" ");
- utl::Time aTime(_rDateTime.NanoSeconds,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours);
+ utl::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds,
+ _rDateTime.Minutes, _rDateTime.Hours, _rDateTime.IsUTC);
aTemp.append( toTimeString(aTime) );
return aTemp.makeStringAndClear();
}
@@ -452,7 +453,7 @@ namespace dbtools
aTime = toTime( _sSQLString.copy( nSeparation ) );
return utl::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
- aDate.Day, aDate.Month, aDate.Year);
+ aDate.Day, aDate.Month, aDate.Year, false);
}
//-----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx
index a24c46d5c153..1bea9fec099f 100644
--- a/connectivity/source/drivers/file/FDateFunctions.cxx
+++ b/connectivity/source/drivers/file/FDateFunctions.cxx
@@ -263,7 +263,9 @@ ORowSetValue OOp_CurTime::operate(const ::std::vector<ORowSetValue>& lhs) const
return ORowSetValue();
Time aCurTime( Time::SYSTEM );
- return ::com::sun::star::util::Time(aCurTime.GetNanoSec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour());
+ return ::com::sun::star::util::Time(aCurTime.GetNanoSec(),
+ aCurTime.GetSec(), aCurTime.GetMin(), aCurTime.GetHour(),
+ false);
}
//------------------------------------------------------------------
ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const
@@ -272,8 +274,10 @@ ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const
return ORowSetValue();
DateTime aCurTime( DateTime::SYSTEM );
- return ::com::sun::star::util::DateTime(aCurTime.GetNanoSec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour(),
- aCurTime.GetDay(),aCurTime.GetMonth(),aCurTime.GetYear());
+ return ::com::sun::star::util::DateTime(aCurTime.GetNanoSec(),
+ aCurTime.GetSec(), aCurTime.GetMin(), aCurTime.GetHour(),
+ aCurTime.GetDay(), aCurTime.GetMonth(), aCurTime.GetYear(),
+ false);
}
//------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index fec060d556c1..fbb1b597a0b0 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -418,7 +418,7 @@ OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime);
else
m_bWasNull = sal_True;
- return Time(0,aTime.second,aTime.minute,aTime.hour);
+ return Time(0, aTime.second,aTime.minute,aTime.hour, false);
}
// -------------------------------------------------------------------------
@@ -436,7 +436,8 @@ OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime);
else
m_bWasNull = sal_True;
- return DateTime(aTime.fraction,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year);
+ return DateTime(aTime.fraction, aTime.second, aTime.minute, aTime.hour,
+ aTime.day, aTime.month, aTime.year, false);
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index 211ba70703ee..9d77984501db 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -651,7 +651,7 @@ Time OResultSet::impl_getTime( sal_Int32 columnIndex ) throw(SQLException, Runti
TIME_STRUCT aTime = impl_getValue< TIME_STRUCT > ( columnIndex,
m_pStatement->getOwnConnection()->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME );
- return Time(0,aTime.second,aTime.minute,aTime.hour);
+ return Time(0, aTime.second,aTime.minute,aTime.hour, false);
}
Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
@@ -669,7 +669,8 @@ DateTime OResultSet::impl_getTimestamp( sal_Int32 columnIndex ) throw(SQLExcepti
aTime.hour,
aTime.day,
aTime.month,
- aTime.year);
+ aTime.year,
+ false);
}
DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 60f533ac9df1..13ae9779365a 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -99,7 +99,8 @@ namespace pcr
if ( !getTypedControlWindow()->GetText().isEmpty() )
{
::Time aTime( getTypedControlWindow()->GetTime() );
- util::Time aUNOTime( aTime.GetNanoSec(), aTime.GetSec(), aTime.GetMin(), aTime.GetHour() );
+ util::Time const aUNOTime( aTime.GetNanoSec(), aTime.GetSec(),
+ aTime.GetMin(), aTime.GetHour(), false );
aPropValue <<= aUNOTime;
}
return aPropValue;
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 6dac9298aa6a..9fd09fdc2ebd 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -342,7 +342,7 @@ namespace
{
bool bWellformed = true;
- UNOTime aTime( 0, 0, 0, 0 );
+ UNOTime aTime;
bWellformed = ISO8601parseTime(rString, aTime);
@@ -366,7 +366,7 @@ namespace
// all okay?
if ( !bWellformed )
- return UNOTime( 0, 0, 0, 0 );
+ return UNOTime();
return aTime;
}
@@ -386,7 +386,8 @@ namespace
UNODate aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
OUString sDate = lcl_toXSD_UNODate_typed( aDate );
- UNOTime aTime( aDateTime.NanoSeconds, aDateTime.Seconds, aDateTime.Minutes, aDateTime.Hours );
+ UNOTime const aTime( aDateTime.NanoSeconds, aDateTime.Seconds,
+ aDateTime.Minutes, aDateTime.Hours, aDateTime.IsUTC);
OUString sTime = lcl_toXSD_UNOTime_typed( aTime );
OUStringBuffer sInfo;
@@ -409,7 +410,6 @@ namespace
if ( nDateTimeSep == -1 )
{ // no time part
aDate = lcl_toUNODate( rString );
- aTime = UNOTime( 0, 0, 0, 0 );
}
else
{
@@ -418,7 +418,7 @@ namespace
}
UNODateTime aDateTime(
aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
- aDate.Day, aDate.Month, aDate.Year
+ aDate.Day, aDate.Month, aDate.Year, aTime.IsUTC
);
return makeAny( aDateTime );
}
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 4ebb0438c4c4..50e68bca15ee 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -4020,7 +4020,9 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/util,\
DataEditorEvent \
DataEditorEventType \
Date \
+ DateWithTimezone \
DateTime \
+ DateTimeWithTimezone \
DateTimeRange \
Duration \
ElementChange \
@@ -4041,6 +4043,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/util,\
SortField \
SortFieldType \
Time \
+ TimeWithTimezone \
TriState \
URL \
VetoException \
diff --git a/offapi/com/sun/star/util/Date.idl b/offapi/com/sun/star/util/Date.idl
index f8bc2ddc3be0..7b38b05d1aa5 100644
--- a/offapi/com/sun/star/util/Date.idl
+++ b/offapi/com/sun/star/util/Date.idl
@@ -20,11 +20,12 @@
#define __com_sun_star_util_Date_idl__
-
module com { module sun { module star { module util {
/** represents a date value.
+
+ The time zone is unknown.
*/
published struct Date
{
diff --git a/offapi/com/sun/star/util/DateTime.idl b/offapi/com/sun/star/util/DateTime.idl
index 397f9d768f13..443e62053f61 100644
--- a/offapi/com/sun/star/util/DateTime.idl
+++ b/offapi/com/sun/star/util/DateTime.idl
@@ -20,7 +20,6 @@
#define __com_sun_star_util_DateTime_idl__
-
module com { module sun { module star { module util {
@@ -61,7 +60,11 @@ published struct DateTime
*/
short Year;
- /** TODO: timezone **/
+ /** true: time zone is UTC false: unknown time zone.
+
+ @since LibreOffice 4.1
+ */
+ boolean IsUTC;
};
diff --git a/offapi/com/sun/star/util/DateTimeRange.idl b/offapi/com/sun/star/util/DateTimeRange.idl
index 0e01883ecb87..12aea4f0fd82 100644
--- a/offapi/com/sun/star/util/DateTimeRange.idl
+++ b/offapi/com/sun/star/util/DateTimeRange.idl
@@ -20,7 +20,6 @@
#define __com_sun_star_util_DateTimeRange_idl__
-
module com { module sun { module star { module util {
@@ -84,7 +83,12 @@ published struct DateTimeRange
*/
short EndYear;
- /** TODO timezones **/
+ /** true: time zone is UTC false: unknown time zone.
+
+ @since LibreOffice 4.1
+ */
+ boolean IsUTC;
+
};
diff --git a/offapi/com/sun/star/util/DateTimeWithTimezone.idl b/offapi/com/sun/star/util/DateTimeWithTimezone.idl
new file mode 100644
index 000000000000..398ed5efea83
--- /dev/null
+++ b/offapi/com/sun/star/util/DateTimeWithTimezone.idl
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_util_DateTimeTZ_idl__
+#define __com_sun_star_util_DateTimeTZ_idl__
+
+#include <com/sun/star/util/DateTime.idl>
+
+
+module com { module sun { module star { module util {
+
+/** represents a combined date+time value with time zone.
+
+ @since LibreOffice 4.1
+ */
+struct DateTimeWithTimezone
+{
+ /** the date and time (in TimeZone)
+ */
+ DateTime DateTimeInTZ;
+
+ /** contains the time zone, as signed offset in minutes *from* UTC,
+ that is *east* of UTC, that is the amount of minutes that should
+ be added to UTC time to obtain the time in that timezone.
+
+ To obtain UTC datetime from DateTimeInTZ, you need to *subtract*
+ TimeZone minutes.
+ */
+ short Timezone;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/util/DateWithTimezone.idl b/offapi/com/sun/star/util/DateWithTimezone.idl
new file mode 100644
index 000000000000..e60bcb7b8cfc
--- /dev/null
+++ b/offapi/com/sun/star/util/DateWithTimezone.idl
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_util_DateTZ_idl__
+#define __com_sun_star_util_DateTZ_idl__
+
+#include <com/sun/star/util/Date.idl>
+
+
+module com { module sun { module star { module util {
+
+/** represents a date value with time zone.
+
+ @since LibreOffice 4.1
+ */
+struct DateWithTimezone
+{
+ /** the date.
+ @note XMLSchema-2 defines this as a 24 hour interval.
+ The TimeZone shifts the interval along the UTC time line.
+ */
+ Date DateInTZ;
+
+ /** contains the time zone, as signed offset in minutes *from* UTC,
+ that is *east* of UTC, that is the amount of minutes that should
+ be added to UTC time to obtain time in that timezone.
+ */
+ short Timezone;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/offapi/com/sun/star/util/Time.idl b/offapi/com/sun/star/util/Time.idl
index fce062daadbd..31a67b31bf85 100644
--- a/offapi/com/sun/star/util/Time.idl
+++ b/offapi/com/sun/star/util/Time.idl
@@ -20,7 +20,6 @@
#define __com_sun_star_util_Time_idl__
-
module com { module sun { module star { module util {
@@ -44,6 +43,12 @@ published struct Time
*/
unsigned short Hours;
+ /** true: time zone is UTC false: unknown time zone.
+
+ @since LibreOffice 4.1
+ */
+ boolean IsUTC;
+
};
diff --git a/offapi/com/sun/star/util/TimeWithTimezone.idl b/offapi/com/sun/star/util/TimeWithTimezone.idl
new file mode 100644
index 000000000000..70442ec0a147
--- /dev/null
+++ b/offapi/com/sun/star/util/TimeWithTimezone.idl
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_util_TimeTZ_idl__
+#define __com_sun_star_util_TimeTZ_idl__
+
+#include <com/sun/star/util/Time.idl>
+
+
+module com { module sun { module star { module util {
+
+/** represents a combined time value with time zone.
+
+ @since LibreOffice 4.1
+ */
+struct TimeWithTimezone
+{
+ /** the time (in TimeZone)
+ */
+ Time TimeInTZ;
+
+ /** contains the time zone, as signed offset in minutes *from* UTC,
+ that is *east* of UTC, that is the amount of minutes that should
+ be added to UTC time to obtain the time in that timezone.
+
+ To obtain UTC time from TimeInTZ, you need to *subtract* TimeZone
+ minutes.
+ */
+ short Timezone;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/offapi/type_reference/offapi.rdb b/offapi/type_reference/offapi.rdb
index f2d883f3aa31..51c80d3b501d 100644
--- a/offapi/type_reference/offapi.rdb
+++ b/offapi/type_reference/offapi.rdb
Binary files differ
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 974e5ab8546e..6f152458e0f8 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -153,7 +153,9 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar
}
}
- return util::DateTime( aOslDTime.NanoSeconds, aOslDTime.Seconds, aOslDTime.Minutes, aOslDTime.Hours, aOslDTime.Day, aOslDTime.Month, aOslDTime.Year );
+ return util::DateTime( aOslDTime.NanoSeconds, aOslDTime.Seconds,
+ aOslDTime.Minutes, aOslDTime.Hours,
+ aOslDTime.Day, aOslDTime.Month, aOslDTime.Year, false);
}
// ------------------------------------------------
diff --git a/qadevOOo/tests/java/ifc/sdbc/_XParameters.java b/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
index e9d9774c0688..9f975420d9b7 100644
--- a/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
+++ b/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
@@ -357,7 +357,7 @@ public class _XParameters extends MultiMethodTest {
else {
try {
oObj.setTime(
- idx, new Time((short)1,(short)2,(short)3,(short)44)) ;
+ idx, new Time((short)1,(short)2,(short)3,(short)44, false));
} catch (SQLException e) {
log.println("Unexpected SQL exception:") ;
log.println(e) ;
@@ -379,7 +379,7 @@ public class _XParameters extends MultiMethodTest {
else {
try {
oObj.setTimestamp(idx, new DateTime((short)1,(short)2,(short)3,
- (short)4, (short)19, (short)01, (short)1979)) ;
+ (short)4, (short)19, (short)01, (short)1979, false)) ;
} catch (SQLException e) {
log.println("Unexpected SQL exception:") ;
log.println(e) ;
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index ad3b0c2fff32..b852cc4422cd 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -1238,7 +1238,8 @@ void OOle2Obj::initializeOle()
{
uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
if ( xChartProps.is() )
- xChartProps->setPropertyValue(OUString("NullDate"),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900)));
+ xChartProps->setPropertyValue(OUString("NullDate"),
+ uno::makeAny(util::DateTime(0,0,0,0,1,1,1900,false)));
}
}
}
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 8a5f72826a92..cfda248adf6c 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -157,7 +157,8 @@ static bool eqDateTime(util::DateTime a, util::DateTime b) {
return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
&& a.Hours == b.Hours && a.Minutes == b.Minutes
&& a.Seconds == b.Seconds
- && a.NanoSeconds == b.NanoSeconds;
+ && a.NanoSeconds == b.NanoSeconds
+ && a.IsUTC == b.IsUTC;
}
static void doTest(util::DateTime const & rdt, char const*const pis,
@@ -168,13 +169,14 @@ static void doTest(util::DateTime const & rdt, char const*const pis,
util::DateTime odt;
SAL_INFO("sax.cppunit","about to convert '" << is << "'");
bool bSuccess( Converter::convertDateTime(odt, is) );
- SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
+ SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC);
CPPUNIT_ASSERT(bSuccess);
CPPUNIT_ASSERT(eqDateTime(rdt, odt));
OUStringBuffer buf;
Converter::convertDateTime(buf, odt, true);
SAL_INFO("sax.cppunit","" << buf.getStr());
- CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos));
+ CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos),
+ buf.makeStringAndClear());
}
static void doTestDateTimeF(char const*const pis)
@@ -189,43 +191,42 @@ static void doTestDateTimeF(char const*const pis)
void ConverterTest::testDateTime()
{
SAL_INFO("sax.cppunit","\nSAX CONVERTER TEST BEGIN");
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00");
-// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z");
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, -324),
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1, false), "0001-01-01T00:00:00" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1, true), "0001-01-01T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1, false),
+ "-0001-01-01T00:00:00");
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1, true),
+ "-0001-01-01T01:00:00+01:00", "-0001-01-01T00:00:00Z");
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, -324, false),
"-0324-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
- "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/,
- "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" );
-// "0001-02-01T12:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
- "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
-// "0001-01-01T12:00:00" );
- doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999),
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1, true),
+ "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1, true),
+ "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 12, 2, 1, 1, true),
+ "0001-01-02T00:00:00-12:00", "0001-01-02T12:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 12, 1, 1, 1, true),
+ "0001-01-02T00:00:00+12:00", "0001-01-01T12:00:00Z" );
+ doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999, false),
"9999-12-31T23:59:59.99", "9999-12-31T23:59:59.990000000" );
- doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999),
- "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.990000000" );
- doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999),
+ doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999, true),
+ "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.990000000Z" );
+ doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999, false),
"9999-12-31T23:59:59.9999999999999999999999999999999999999",
"9999-12-31T23:59:59.999999999" );
- doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999),
+ doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999, true),
"9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
- "9999-12-31T23:59:59.999999999" );
- doTest( util::DateTime(0, 0, 0, 0, 29, 2, 2000), // leap year
- "2000-02-29T00:00:00-00:00", "2000-02-29T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 0, 29, 2, 1600), // leap year
- "1600-02-29T00:00:00-00:00", "1600-02-29T00:00:00" );
- doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
+ "9999-12-31T23:59:59.999999999Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 29, 2, 2000, true), // leap year
+ "2000-02-29T00:00:00-00:00", "2000-02-29T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 0, 29, 2, 1600, true), // leap year
+ "1600-02-29T00:00:00-00:00", "1600-02-29T00:00:00Z" );
+ doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333, false)
/*(0, 0, 0, 0, 2, 1, 333)*/,
"0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
// While W3C XMLSchema specifies a minimum of 4 year digits we are lenient
// in what we accept.
- doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1, false),
"1-01-01T00:00:00", "0001-01-01T00:00:00" );
doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 690c3e581c51..e99690e91546 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -28,6 +28,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
+#include <osl/time.h>
#include <algorithm>
@@ -1185,13 +1186,48 @@ bool Converter::convertDuration(util::Duration& rDuration,
}
+static void
+lcl_AppendTimezone(OUStringBuffer & i_rBuffer, sal_Int16 const nOffset)
+{
+ if (0 == nOffset)
+ {
+ i_rBuffer.append(sal_Unicode('Z'));
+ }
+ else
+ {
+ if (0 < nOffset)
+ {
+ i_rBuffer.append(sal_Unicode('+'));
+ }
+ else
+ {
+ i_rBuffer.append(sal_Unicode('-'));
+ }
+ const sal_Int32 nHours (abs(nOffset) / 60);
+ const sal_Int32 nMinutes(abs(nOffset) % 60);
+ SAL_WARN_IF(nHours > 14 || (nHours == 14 && nMinutes > 0),
+ "sax", "convertDateTime: timezone overflow");
+ if (nHours < 10)
+ {
+ i_rBuffer.append('0');
+ }
+ i_rBuffer.append(nHours);
+ i_rBuffer.append(':');
+ if (nMinutes < 10)
+ {
+ i_rBuffer.append('0');
+ }
+ i_rBuffer.append(nMinutes);
+ }
+}
+
/** convert util::Date to ISO "date" string */
void Converter::convertDate(
OUStringBuffer& i_rBuffer,
const util::Date& i_rDate)
{
- const util::DateTime dt(
- 0, 0, 0, 0, i_rDate.Day, i_rDate.Month, i_rDate.Year);
+ const util::DateTime dt(0, 0, 0, 0,
+ i_rDate.Day, i_rDate.Month, i_rDate.Year, false);
convertDateTime(i_rBuffer, dt, false);
}
@@ -1260,6 +1296,17 @@ void Converter::convertDateTime(
i_rBuffer.append(OUString::createFromAscii(ostr.str().c_str()));
}
}
+
+ sal_uInt16 * pTimezone(0); // FIXME pass this as parameter
+ if (pTimezone)
+ {
+ lcl_AppendTimezone(i_rBuffer, *pTimezone);
+ }
+ else if (i_rDateTime.IsUTC)
+ {
+ // append local time
+ lcl_AppendTimezone(i_rBuffer, 0);
+ }
}
/** convert ISO "date" or "dateTime" string to util::DateTime */
@@ -1279,6 +1326,10 @@ bool Converter::convertDateTime( util::DateTime& rDateTime,
rDateTime.Minutes = 0;
rDateTime.Seconds = 0;
rDateTime.NanoSeconds = 0;
+ // FIXME
+#if 0
+ rDateTime.IsUTC = date.IsUTC;
+#endif
}
return true;
}
@@ -1288,6 +1339,99 @@ bool Converter::convertDateTime( util::DateTime& rDateTime,
}
}
+static bool lcl_isLeapYear(const sal_uInt32 nYear)
+{
+ return ((nYear % 4) == 0)
+ && (((nYear % 100) != 0) || ((nYear % 400) == 0));
+}
+
+static sal_uInt16
+lcl_MaxDaysPerMonth(const sal_Int32 nMonth, const sal_Int32 nYear)
+{
+ static sal_uInt16 s_MaxDaysPerMonth[12] =
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ OSL_ASSERT(0 < nMonth && nMonth <= 12);
+ if ((2 == nMonth) && lcl_isLeapYear(nYear))
+ {
+ return 29;
+ }
+ return s_MaxDaysPerMonth[nMonth - 1];
+}
+
+static void lcl_ConvertToUTC(
+ sal_Int16 & o_rYear, sal_uInt16 & o_rMonth, sal_uInt16 & o_rDay,
+ sal_uInt16 & o_rHours, sal_uInt16 & o_rMinutes,
+ sal_Int16 const nSourceOffset)
+{
+ sal_Int16 nOffsetHours(abs(nSourceOffset) / 60);
+ sal_Int16 const nOffsetMinutes(abs(nSourceOffset) % 60);
+ o_rMinutes += nOffsetMinutes;
+ if (nSourceOffset < 0)
+ {
+ o_rMinutes += nOffsetMinutes;
+ if (60 <= o_rMinutes)
+ {
+ o_rMinutes -= 60;
+ ++nOffsetHours;
+ }
+ o_rHours += nOffsetHours;
+ if (o_rHours < 24)
+ {
+ return;
+ }
+ while (24 <= o_rHours)
+ {
+ o_rHours -= 24;
+ ++o_rDay;
+ }
+ sal_Int16 const nDaysInMonth(lcl_MaxDaysPerMonth(o_rMonth, o_rYear));
+ if (o_rDay <= nDaysInMonth)
+ {
+ return;
+ }
+ o_rDay -= nDaysInMonth;
+ ++o_rMonth;
+ if (o_rMonth <= 12)
+ {
+ return;
+ }
+ o_rMonth = 1;
+ ++o_rYear; // works for negative year too
+ }
+ else if (0 < nSourceOffset)
+ {
+ // argh everything is unsigned
+ if (o_rMinutes < nOffsetMinutes)
+ {
+ o_rMinutes += 60;
+ ++nOffsetHours;
+ }
+ o_rMinutes -= nOffsetMinutes;
+ sal_Int16 nDaySubtract(0);
+ while (o_rHours < nOffsetHours)
+ {
+ o_rHours += 24;
+ ++nDaySubtract;
+ }
+ o_rHours -= nOffsetHours;
+ if (nDaySubtract < o_rDay)
+ {
+ o_rDay -= nDaySubtract;
+ return;
+ }
+ sal_Int16 const nPrevMonth((o_rMonth == 1) ? 12 : o_rMonth - 1);
+ sal_Int16 const nDaysInMonth(lcl_MaxDaysPerMonth(nPrevMonth, o_rYear));
+ o_rDay += nDaysInMonth;
+ --o_rMonth;
+ if (0 == o_rMonth)
+ {
+ o_rMonth = 12;
+ --o_rYear; // works for negative year too
+ }
+ o_rDay -= nDaySubtract;
+ }
+}
+
static bool
readDateTimeComponent(const OUString & rString,
sal_Int32 & io_rnPos, sal_Int32 & o_rnTarget,
@@ -1309,24 +1453,7 @@ readDateTimeComponent(const OUString & rString,
return true;
}
-static bool lcl_isLeapYear(const sal_uInt32 nYear)
-{
- return ((nYear % 4) == 0)
- && (((nYear % 100) != 0) || ((nYear % 400) == 0));
-}
-static sal_uInt16
-lcl_MaxDaysPerMonth(const sal_Int32 nMonth, const sal_Int32 nYear)
-{
- static sal_uInt16 s_MaxDaysPerMonth[12] =
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- OSL_ASSERT(0 < nMonth && nMonth <= 12);
- if ((2 == nMonth) && lcl_isLeapYear(nYear))
- {
- return 29;
- }
- return s_MaxDaysPerMonth[nMonth - 1];
-}
/** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */
bool Converter::convertDateOrDateTime(
@@ -1526,13 +1653,11 @@ bool Converter::convertDateOrDateTime(
bSuccess &= (nPos == string.getLength()); // trailing junk?
- if (bSuccess && bHaveTimezone)
- {
- // util::DateTime does not support timezones!
- }
-
if (bSuccess)
{
+ sal_uInt16 * pTimezone(0); // FIXME pass this as parameter
+ sal_Int16 const nTimezoneOffset = ((bHaveTimezoneMinus) ? (-1) : (+1))
+ * ((nTimezoneHours * 60) + nTimezoneMinutes);
if (bHaveTime) // time is optional
{
rDateTime.Year =
@@ -1543,6 +1668,25 @@ bool Converter::convertDateOrDateTime(
rDateTime.Minutes = static_cast<sal_uInt16>(nMinutes);
rDateTime.Seconds = static_cast<sal_uInt16>(nSeconds);
rDateTime.NanoSeconds = static_cast<sal_uInt32>(nNanoSeconds);
+ if (bHaveTimezone)
+ {
+ if (pTimezone)
+ {
+ *pTimezone = nTimezoneOffset;
+ rDateTime.IsUTC = (0 == nTimezoneOffset);
+ }
+ else
+ {
+ lcl_ConvertToUTC(rDateTime.Year, rDateTime.Month,
+ rDateTime.Day, rDateTime.Hours, rDateTime.Minutes,
+ nTimezoneOffset);
+ rDateTime.IsUTC = true;
+ }
+ }
+ else
+ {
+ rDateTime.IsUTC = false;
+ }
rbDateTime = true;
}
else
@@ -1551,6 +1695,18 @@ bool Converter::convertDateOrDateTime(
((isNegative) ? (-1) : (+1)) * static_cast<sal_Int16>(nYear);
rDate.Month = static_cast<sal_uInt16>(nMonth);
rDate.Day = static_cast<sal_uInt16>(nDay);
+ if (bHaveTimezone)
+ {
+ if (pTimezone)
+ {
+ *pTimezone = nTimezoneOffset;
+ }
+ else
+ {
+ // a Date cannot be adjusted
+ SAL_INFO("sax", "dropping timezone");
+ }
+ }
rbDateTime = false;
}
}
diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx
index 20d9c487258c..0db45415fdec 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -190,7 +190,7 @@ double UnitConverter::calcSerialFromDateTime( const DateTime& rDateTime ) const
DateTime UnitConverter::calcDateTimeFromSerial( double fSerial ) const
{
- DateTime aDateTime( 0, 0, 0, 0, 1, 1, 0 );
+ DateTime aDateTime( 0, 0, 0, 0, 1, 1, 0, false );
double fDays = 0.0;
double fTime = modf( fSerial, &fDays );
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 20233f2c9038..184cc3df337e 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -143,7 +143,10 @@ static SfxDispatcher* getDispatcher( ViewShellBase& rBase )
com::sun::star::util::DateTime getCurrentDateTime()
{
DateTime aCurrentDate( DateTime::SYSTEM );
- return com::sun::star::util::DateTime( 0, aCurrentDate.GetSec(), aCurrentDate.GetMin(), aCurrentDate.GetHour(), aCurrentDate.GetDay(), aCurrentDate.GetMonth(), aCurrentDate.GetYear() );
+ return com::sun::star::util::DateTime( 0, aCurrentDate.GetSec(),
+ aCurrentDate.GetMin(), aCurrentDate.GetHour(),
+ aCurrentDate.GetDay(), aCurrentDate.GetMonth(),
+ aCurrentDate.GetYear(), false );
}
OUString getAnnotationDateTimeString( const Reference< XAnnotation >& xAnnotation )
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index f18b1db0b3da..a32cfee1fe78 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -367,7 +367,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
xDocProps->setCreationDate( util::DateTime(
now.GetNanoSec(), now.GetSec(), now.GetMin(),
now.GetHour(), now.GetDay(), now.GetMonth(),
- now.GetYear() ) );
+ now.GetYear(), false) );
}
if ( bAllowModif )
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index f5f619dde86c..fd4b537510b3 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -99,7 +99,8 @@ bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
&& i_rLeft.Hours == i_rRight.Hours
&& i_rLeft.Minutes == i_rRight.Minutes
&& i_rLeft.Seconds == i_rRight.Seconds
- && i_rLeft.NanoSeconds == i_rRight.NanoSeconds;
+ && i_rLeft.NanoSeconds == i_rRight.NanoSeconds
+ && i_rLeft.IsUTC == i_rRight.IsUTC;
}
// STATIC DATA -----------------------------------------------------------
@@ -353,7 +354,7 @@ void SfxDocumentInfoItem::resetUserData(const OUString & i_rAuthor)
DateTime now( DateTime::SYSTEM );
setCreationDate( util::DateTime(
now.GetNanoSec(), now.GetSec(), now.GetMin(), now.GetHour(),
- now.GetDay(), now.GetMonth(), now.GetYear() ) );
+ now.GetDay(), now.GetMonth(), now.GetYear(), false) );
setModifiedBy(OUString());
setPrintedBy(OUString());
setModificationDate(util::DateTime());
@@ -799,7 +800,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl)
DateTime now( DateTime::SYSTEM );
util::DateTime uDT(
now.GetNanoSec(), now.GetSec(), now.GetMin(), now.GetHour(),
- now.GetDay(), now.GetMonth(), now.GetYear() );
+ now.GetDay(), now.GetMonth(), now.GetYear(), false);
m_pCreateValFt->SetText( ConvertDateTime_Impl( aName, uDT, rLocaleWrapper ) );
OUString aEmpty;
m_pChangeValFt->SetText( aEmpty );
@@ -1866,8 +1867,10 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
{
Date aTmpDate = pLine->m_aDateField.GetDate();
Time aTmpTime = pLine->m_aTimeField.GetTime();
- util::DateTime aDateTime(aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
- aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear() );
+ util::DateTime const aDateTime(aTmpTime.GetNanoSec(),
+ aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
+ aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(),
+ false);
aPropertiesSeq[i].Value <<= aDateTime;
}
else if ( CUSTOM_TYPE_DURATION == nType )
@@ -1877,7 +1880,8 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
else if ( CUSTOM_TYPE_DATE == nType )
{
Date aTmpDate = pLine->m_aDateField.GetDate();
- util::Date aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear());
+ util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(),
+ aTmpDate.GetYear());
aPropertiesSeq[i].Value <<= aDate;
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index d83b1950dc7d..5376c646ce3f 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -412,7 +412,8 @@ bool operator== (const css::util::DateTime &i_rLeft,
&& i_rLeft.Hours == i_rRight.Hours
&& i_rLeft.Minutes == i_rRight.Minutes
&& i_rLeft.Seconds == i_rRight.Seconds
- && i_rLeft.NanoSeconds == i_rRight.NanoSeconds;
+ && i_rLeft.NanoSeconds == i_rRight.NanoSeconds
+ && i_rLeft.IsUTC == i_rRight.IsUTC;
}
// NB: keep these two arrays in sync!
@@ -1838,7 +1839,7 @@ SfxDocumentMetaData::resetUserData(const OUString & the_value)
bModified |= setMetaText("meta:initial-creator", the_value);
::DateTime now( ::DateTime::SYSTEM );
css::util::DateTime uDT(now.GetNanoSec(), now.GetSec(), now.GetMin(),
- now.GetHour(), now.GetDay(), now.GetMonth(), now.GetYear());
+ now.GetHour(), now.GetDay(), now.GetMonth(), now.GetYear(), false);
bModified |= setMetaText("meta:creation-date", dateTimeToText(uDT));
bModified |= setMetaText("dc:creator", OUString());
bModified |= setMetaText("meta:printed-by", OUString());
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 41f20461203f..eb8a0a2b9f4b 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -205,7 +205,7 @@ void SfxObjectShell::UpdateDocInfoForSave()
xDocProps->setModificationDate( util::DateTime(
now.GetNanoSec(), now.GetSec(), now.GetMin(),
now.GetHour(), now.GetDay(), now.GetMonth(),
- now.GetYear() ) );
+ now.GetYear(), false) );
xDocProps->setModifiedBy( aUserName );
if ( !HasName() || pImp->bIsSaving )
// QUESTION: not in case of "real" SaveAs as this is meant to create a new document
@@ -836,7 +836,7 @@ void SfxObjectShell::ResetFromTemplate( const String& rTemplateName, const Strin
xDocProps->setTemplateDate( util::DateTime(
now.GetNanoSec(), now.GetSec(), now.GetMin(),
now.GetHour(), now.GetDay(), now.GetMonth(),
- now.GetYear() ) );
+ now.GetYear(), false) );
SetQueryLoadTemplate( sal_True );
}
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 6ecc27a05e84..56c4b83f875a 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -40,8 +40,10 @@ using ::com::sun::star::uno::makeAny;
using namespace ::com::sun::star;
#define TIMESTAMP_INVALID_DATETIME ( DateTime ( Date ( 1, 1, 1601 ), Time ( 0, 0, 0 ) ) ) /// Invalid value for date and time to create invalid instance of TimeStamp.
-#define TIMESTAMP_INVALID_UTILDATETIME ( util::DateTime ( 0, 0, 0, 0, 1, 1, 1601 ) ) /// Invalid value for date and time to create invalid instance of TimeStamp.
-#define TIMESTAMP_INVALID_UTILDATE ( util::Date ( 1, 1, 1601 ) ) /// Invalid value for date to create invalid instance of TimeStamp.
+/// Invalid value for date and time to create invalid instance of TimeStamp.
+#define TIMESTAMP_INVALID_UTILDATETIME (util::DateTime(0, 0, 0, 0, 1, 1, 1601, false))
+/// Invalid value for date to create invalid instance of TimeStamp.
+#define TIMESTAMP_INVALID_UTILDATE (util::Date(1, 1, 1601))
static
bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
@@ -52,7 +54,8 @@ bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
&& i_rLeft.Hours == i_rRight.Hours
&& i_rLeft.Minutes == i_rRight.Minutes
&& i_rLeft.Seconds == i_rRight.Seconds
- && i_rLeft.NanoSeconds == i_rRight.NanoSeconds;
+ && i_rLeft.NanoSeconds == i_rRight.NanoSeconds
+ && i_rLeft.IsUTC == i_rRight.IsUTC;
}
static
@@ -587,6 +590,7 @@ void SfxOleFileTimeProperty::ImplLoad( SvStream& rStrm )
maDateTime.Minutes = aDateTime.GetMin();
maDateTime.Seconds = aDateTime.GetSec();
maDateTime.NanoSeconds = aDateTime.GetNanoSec();
+ maDateTime.IsUTC = false;
}
void SfxOleFileTimeProperty::ImplSave( SvStream& rStrm )
@@ -895,7 +899,8 @@ void SfxOleSection::SetDateValue( sal_Int32 nPropId, const util::Date& rValue )
SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, TIMESTAMP_INVALID_UTILDATETIME ) ) );
else
{
- const util::DateTime aValue(0, 0, 0, 0, rValue.Day, rValue.Month, rValue.Year );
+ const util::DateTime aValue(0, 0, 0, 0, rValue.Day, rValue.Month,
+ rValue.Year, false );
SetProperty( SfxOlePropertyRef( new SfxOleFileTimeProperty( nPropId, aValue ) ) );
}
}
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 0a9c080121c9..251dbb054d96 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -318,7 +318,7 @@ void SfxPrinterController::jobStarted()
xDocProps->setPrintDate( util::DateTime(
now.GetNanoSec(), now.GetSec(), now.GetMin(), now.GetHour(),
- now.GetDay(), now.GetMonth(), now.GetYear() ) );
+ now.GetDay(), now.GetMonth(), now.GetYear(), false) );
SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), mpObjectShell ) );
// FIXME: how to get all print options incl. AdditionalOptions easily?
diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx
index 67ebba630cc9..be6017334edb 100644
--- a/svl/source/items/dateitem.cxx
+++ b/svl/source/items/dateitem.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/Locale.hpp>
+
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxDateTimeItem)
@@ -182,7 +183,8 @@ bool SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal,
aDateTime.GetHour(),
aDateTime.GetDay(),
aDateTime.GetMonth(),
- aDateTime.GetYear() );
+ aDateTime.GetYear(),
+ false);
rVal <<= aValue;
return true;
}
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index c0237203d63c..9866c95211d5 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -97,7 +97,8 @@ namespace svt
&& _rLHS.Hours == _rRHS.Hours
&& _rLHS.Day == _rRHS.Day
&& _rLHS.Month == _rRHS.Month
- && _rLHS.Year == _rRHS.Year;
+ && _rLHS.Year == _rRHS.Year
+ && _rLHS.IsUTC == _rRHS.IsUTC;
}
//---------------------------------------------------------------------
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index a95ec7958b74..90809ecec9b3 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -2187,7 +2187,8 @@ bool HTMLParser::ParseMetaOptionsImpl(
::util::DateTime uDT(aDateTime.GetNanoSec(),
aDateTime.GetSec(), aDateTime.GetMin(),
aDateTime.GetHour(), aDateTime.GetDay(),
- aDateTime.GetMonth(), aDateTime.GetYear());
+ aDateTime.GetMonth(), aDateTime.GetYear(),
+ false);
if ( HTML_META_CREATED==nAction )
i_xDocProps->setCreationDate( uDT );
else
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 58dd0333b0b2..f9e025074b1b 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -275,7 +275,8 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, c
::util::DateTime uDT(aTmplDate.GetNanoSec(),
aTmplDate.GetSec(), aTmplDate.GetMin(),
aTmplDate.GetHour(), aTmplDate.GetDay(),
- aTmplDate.GetMonth(), aTmplDate.GetYear());
+ aTmplDate.GetMonth(), aTmplDate.GetYear(),
+ false );
xDocProps->setTemplateDate(uDT);
xDocProps->setTemplateURL(rPath);
// Set the new doc's title to the text of the "split para".
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 907454f44349..26c788924ca0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1488,7 +1488,7 @@ void SwWW8ImplReader::ImportDop()
::util::DateTime uDT(aLastPrinted.GetNanoSec(),
aLastPrinted.GetSec(), aLastPrinted.GetMin(),
aLastPrinted.GetHour(), aLastPrinted.GetDay(),
- aLastPrinted.GetMonth(), aLastPrinted.GetYear());
+ aLastPrinted.GetMonth(), aLastPrinted.GetYear(), false);
xDocuProps->setPrintDate(uDT);
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index abff7d28bb8f..d61b7412ebda 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -3310,7 +3310,7 @@ void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::Runt
if ( xText.is() && xText->getText().getLength() )
// and in real, the text of the peer is *not* empty
// -> simulate an invalid date, which is different from "no date"
- aValue <<= util::Date( 0, 0, 0 );
+ aValue <<= util::Date();
}
}
else
diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx
index f8e04b9f138f..54249ee8c12f 100644
--- a/ucb/source/ucp/ftp/ftpdirp.hxx
+++ b/ucb/source/ucp/ftp/ftpdirp.hxx
@@ -54,7 +54,8 @@ namespace ftp {
hours,
day,
month,
- year) { }
+ year,
+ false) { }
void SetYear(sal_uInt16 year) { Year = year; }
void SetMonth(sal_uInt16 month) { Month = month; }
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 06e3920d10c8..34857d2f839a 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -381,7 +381,7 @@ static util::DateTime getDateFromUnix (time_t t)
if ( osl_getDateTimeFromTimeValue( &tv, &dt ) )
return util::DateTime( 0, dt.Seconds, dt.Minutes, dt.Hours,
- dt.Day, dt.Month, dt.Year);
+ dt.Day, dt.Month, dt.Year, false);
else
return util::DateTime();
}
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index b383dc587709..5710350e3b5a 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -25,6 +25,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
+
namespace
{
sal_Int32 impl_pow(sal_Int32 x, sal_Int32 y)
@@ -328,7 +329,7 @@ bool ISO8601parseDateTime(const OUString &rString, starutil::DateTime& rDateTime
if (bSuccess)
{
rDateTime = starutil::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
- aDate.Day, aDate.Month, aDate.Year);
+ aDate.Day, aDate.Month, aDate.Year, false);
}
return bSuccess;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index fe1589205f86..e6d51a5bce04 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -188,7 +188,7 @@ static const char* lcl_RtfToString(RTFKeyword nKeyword)
static util::DateTime lcl_getDateTime(RTFParserState& aState)
{
return util::DateTime(0 /*100sec*/, 0 /*sec*/, aState.nMinute, aState.nHour,
- aState.nDay, aState.nMonth, aState.nYear);
+ aState.nDay, aState.nMonth, aState.nYear, false);
}
static void lcl_DestinationToMath(OUStringBuffer& rDestinationText, oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor)
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 120070202c80..89a8dae3c885 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1167,7 +1167,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >&
sal_Bool bHasMainTitle = sal_False;
sal_Bool bHasSubTitle = sal_False;
sal_Bool bHasLegend = sal_False;
- util::DateTime aNullDate(0,0,0,0,30,12,1899);
+ util::DateTime aNullDate(0,0,0,0,30,12,1899, false);
std::vector< XMLPropertyState > aPropertyStates;