From dd780228cca25dc818ca7fdb628ff607c109618e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 28 Jun 2013 00:43:19 +0200 Subject: 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 Tested-by: Eike Rathke (cherry picked from commit 652ccbdf3111766fadc379a8cf4650b744e1e19c) i#108348: fix TimeZone -> Timezone in struct names (cherry picked from commit 604aae1fd240254fe851d93dc35b5408bd13296c) Signed-off-by: Michael Stahl Signed-off-by: Lionel Elie Mamane Signed-off-by: Michael Meeks Conflicts: forms/source/xforms/convert.cxx offapi/type_reference/offapi.rdb reportdesign/source/core/sdr/RptObject.cxx sc/source/filter/oox/unitconverter.cxx --- sfx2/source/appl/sfxpicklist.cxx | 2 +- sfx2/source/dialog/dinfdlg.cxx | 16 ++++++++++------ sfx2/source/doc/SfxDocumentMetaData.cxx | 5 +++-- sfx2/source/doc/objcont.cxx | 4 ++-- sfx2/source/doc/oleprops.cxx | 13 +++++++++---- sfx2/source/view/viewprn.cxx | 2 +- 6 files changed, 26 insertions(+), 16 deletions(-) (limited to 'sfx2/source') 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? -- cgit