summaryrefslogtreecommitdiffstats
path: root/include/tools
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 /include/tools
parentfixup SAL_INFO macros to actually print the strings (diff)
downloadcore-8ee69b0ba13f74d1515fac71df92947eb6328ab1.tar.gz
core-8ee69b0ba13f74d1515fac71df92947eb6328ab1.zip
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>
Diffstat (limited to 'include/tools')
-rw-r--r--include/tools/date.hxx16
-rw-r--r--include/tools/time.hxx5
2 files changed, 18 insertions, 3 deletions
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 );