From c32a5a3b8e2e3a49ac9f1fd3f2872b00612676b7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 11 Jan 2015 13:35:38 +0200 Subject: simplify Date/Time/DateTime conversion code add constructors to Date/DateTime/Time, that take the css::util counterparts, to simplify code converting between these type Change-Id: I4b03da02c63f65b6ec18cb4d6ecc3859bdef1ff7 Reviewed-on: https://gerrit.libreoffice.org/13855 Tested-by: Jenkins Reviewed-by: Eike Rathke --- sfx2/source/doc/SfxDocumentMetaData.cxx | 3 +-- sfx2/source/doc/objcont.cxx | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'sfx2/source/doc') diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 2310e6b78e47..022d96fb04cd 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1827,8 +1827,7 @@ SfxDocumentMetaData::resetUserData(const OUString & the_value) bool bModified( false ); 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(), false); + css::util::DateTime uDT(now.GetUNODateTime()); 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 00e03330fb44..cd5c294546ea 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -203,10 +203,7 @@ void SfxObjectShell::UpdateDocInfoForSave() { // update ModificationAuthor, revision and editing time ::DateTime now( ::DateTime::SYSTEM ); - xDocProps->setModificationDate( util::DateTime( - now.GetNanoSec(), now.GetSec(), now.GetMin(), - now.GetHour(), now.GetDay(), now.GetMonth(), - now.GetYear(), false) ); + xDocProps->setModificationDate( now.GetUNODateTime() ); xDocProps->setModifiedBy( aUserName ); UpdateTime_Impl( xDocProps ); } @@ -541,10 +538,7 @@ void SfxObjectShell::ResetFromTemplate( const OUString& rTemplateName, const OUS xDocProps->setTemplateName( rTemplateName ); ::DateTime now( ::DateTime::SYSTEM ); - xDocProps->setTemplateDate( util::DateTime( - now.GetNanoSec(), now.GetSec(), now.GetMin(), - now.GetHour(), now.GetDay(), now.GetMonth(), - now.GetYear(), false) ); + xDocProps->setTemplateDate( now.GetUNODateTime() ); SetQueryLoadTemplate( true ); } -- cgit