diff options
author | Noel Grandin <noel@peralex.com> | 2014-09-28 15:49:26 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-01 07:34:23 +0000 |
commit | fc04f76336fdf8c96e35382cdeb497e2f939705c (patch) | |
tree | 70c9bbd054a34a9bca9d22bb7afbb9c4349beff0 /include | |
parent | eb4811590c85895ce531674596bdd6afb3397725 (diff) |
fdo#82577: Handle Time
Put the TOOLS Time class in the tools namespace. Avoids clash with the X11
Time typedef.
Change-Id: Iac57d5aef35e81ace1ee0d5e6d76cb278f8ad866
Reviewed-on: https://gerrit.libreoffice.org/11684
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/editeng/flditem.hxx | 8 | ||||
-rw-r--r-- | include/editeng/svxacorr.hxx | 2 | ||||
-rw-r--r-- | include/postx.h | 1 | ||||
-rw-r--r-- | include/prex.h | 3 | ||||
-rw-r--r-- | include/svl/fstathelper.hxx | 4 | ||||
-rw-r--r-- | include/svx/ctredlin.hxx | 12 | ||||
-rw-r--r-- | include/svx/galmisc.hxx | 4 | ||||
-rw-r--r-- | include/tools/datetime.hxx | 14 | ||||
-rw-r--r-- | include/tools/time.hxx | 32 | ||||
-rw-r--r-- | include/unotools/datetime.hxx | 2 | ||||
-rw-r--r-- | include/unotools/localedatawrapper.hxx | 6 | ||||
-rw-r--r-- | include/vcl/field.hxx | 46 | ||||
-rw-r--r-- | include/xmloff/xmluconv.hxx | 2 |
13 files changed, 68 insertions, 68 deletions
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx index 532e30af1a8a..e35e503b0c37 100644 --- a/include/editeng/flditem.hxx +++ b/include/editeng/flditem.hxx @@ -276,12 +276,12 @@ private: public: SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME ) SvxExtTimeField(); - explicit SvxExtTimeField( const Time& rTime, + explicit SvxExtTimeField( const tools::Time& rTime, SvxTimeType eType = SVXTIMETYPE_VAR, SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD ); sal_Int64 GetFixTime() const { return m_nFixTime; } - void SetFixTime( const Time& rTime ) { m_nFixTime = rTime.GetTime(); } + void SetFixTime( const tools::Time& rTime ) { m_nFixTime = rTime.GetTime(); } SvxTimeType GetType() const { return eType; } void SetType( SvxTimeType eTp ) { eType = eTp; } @@ -292,7 +292,7 @@ public: // If eLanguage==LANGUAGE_DONTKNOW the language/country // used in number formatter initialization is taken. OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const; - static OUString GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + static OUString GetFormatted( tools::Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); virtual SvxFieldData* Clone() const SAL_OVERRIDE; virtual bool operator==( const SvxFieldData& ) const SAL_OVERRIDE; @@ -418,7 +418,7 @@ public: SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME ) SvxDateTimeField(); - static OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); + static OUString GetFormatted( Date& rDate, tools::Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage ); virtual SvxFieldData* Clone() const SAL_OVERRIDE; virtual bool operator==( const SvxFieldData& ) const SAL_OVERRIDE; diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index aff3c036f4e3..8ad8564e699a 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -171,7 +171,7 @@ class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists OUString sShareAutoCorrFile, sUserAutoCorrFile; // If the AutoCorr file is newer Date aModifiedDate; - Time aModifiedTime, aLastCheckTime; + tools::Time aModifiedTime, aLastCheckTime; SvStringsISortDtor* pCplStt_ExcptLst; SvStringsISortDtor* pWrdStt_ExcptLst; diff --git a/include/postx.h b/include/postx.h index 0952f7ebabf4..195786fcee85 100644 --- a/include/postx.h +++ b/include/postx.h @@ -26,7 +26,6 @@ /* X Types */ #undef Icon -#undef Time #undef Min #undef Max diff --git a/include/prex.h b/include/prex.h index 7b1a3574fb70..a7db2bdc1100 100644 --- a/include/prex.h +++ b/include/prex.h @@ -29,9 +29,6 @@ */ #define Icon HIDE_XLIB_Icon -/* Types from <X11/X.h> that clash, but we do use. */ -#define Time XLIB_Time - #if defined __cplusplus extern "C" { #endif diff --git a/include/svl/fstathelper.hxx b/include/svl/fstathelper.hxx index feb43cefa7fa..f6e4343f4108 100644 --- a/include/svl/fstathelper.hxx +++ b/include/svl/fstathelper.hxx @@ -24,7 +24,7 @@ #include <svl/svldllapi.h> class Date; -class Time; +namespace tools { class Time; } namespace FStatHelper { @@ -39,7 +39,7 @@ namespace FStatHelper { @return it was be able to get the date/time stamp */ SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile( const OUString& rURL, - Date* pDate, Time* pTime ); + Date* pDate, tools::Time* pTime ); /** Return if under the URL a document exist. This is only a wrapper for the UCB.IsContent. diff --git a/include/svx/ctredlin.hxx b/include/svx/ctredlin.hxx index 685696106672..eca260ae844a 100644 --- a/include/svx/ctredlin.hxx +++ b/include/svx/ctredlin.hxx @@ -120,8 +120,8 @@ public: void SetDateTimeMode(sal_uInt16 nMode); void SetFirstDate(const Date&); void SetLastDate(const Date&); - void SetFirstTime(const Time&); - void SetLastTime(const Time&); + void SetFirstTime(const tools::Time&); + void SetLastTime(const tools::Time&); void SetFilterAuthor(bool bFlag=true); void SetAuthor(const OUString &); void SetFilterComment(bool bFlag=true); @@ -209,13 +209,13 @@ public: Date GetFirstDate() const; void SetFirstDate(const Date &aDate); - Time GetFirstTime() const; - void SetFirstTime(const Time &aTime); + tools::Time GetFirstTime() const; + void SetFirstTime(const tools::Time &aTime); Date GetLastDate() const; void SetLastDate(const Date &aDate); - Time GetLastTime() const; - void SetLastTime(const Time &aTime); + tools::Time GetLastTime() const; + void SetLastTime(const tools::Time &aTime); void SetDateMode(sal_uInt16 nMode); sal_uInt16 GetDateMode(); diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx index 4feff17a0f2c..5336de75ebb2 100644 --- a/include/svx/galmisc.hxx +++ b/include/svx/galmisc.hxx @@ -39,12 +39,12 @@ struct ExchangeData GalleryTheme* pTheme; OUString aEditedTitle; Date aThemeChangeDate; - Time aThemeChangeTime; + tools::Time aThemeChangeTime; ExchangeData() : pTheme(NULL) , aThemeChangeDate( Date::EMPTY ) - , aThemeChangeTime( Time::EMPTY ) + , aThemeChangeTime( tools::Time::EMPTY ) { } }; diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index c5e45ec72734..256bb7258622 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -23,7 +23,7 @@ #include <tools/date.hxx> #include <tools/time.hxx> -class TOOLS_DLLPUBLIC SAL_WARN_UNUSED DateTime : public Date, public Time +class TOOLS_DLLPUBLIC SAL_WARN_UNUSED DateTime : public Date, public tools::Time { public: enum DateTimeInitSystem @@ -42,8 +42,8 @@ public: DateTime( const DateTime& rDateTime ) : Date( rDateTime ), Time( rDateTime ) {} DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} - DateTime( const Time& rTime ) : Date(0), Time( rTime ) {} - DateTime( const Date& rDate, const Time& rTime ) : + DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {} + DateTime( const Date& rDate, const tools::Time& rTime ) : Date( rDate ), Time( rTime ) {} bool IsBetween( const DateTime& rFrom, @@ -79,16 +79,16 @@ public: DateTime& operator +=( double fTimeInDays ); DateTime& operator -=( double fTimeInDays ) { return operator+=( -fTimeInDays ); } - DateTime& operator +=( const Time& rTime ); - DateTime& operator -=( const Time& rTime ); + DateTime& operator +=( const tools::Time& rTime ); + DateTime& operator -=( const tools::Time& rTime ); TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, long nDays ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, long nDays ); TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, double fTimeInDays ); TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, double fTimeInDays ) { return operator+( rDateTime, -fTimeInDays ); } - TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const Time& rTime ); - TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const Time& rTime ); + TOOLS_DLLPUBLIC friend DateTime operator +( const DateTime& rDateTime, const tools::Time& rTime ); + TOOLS_DLLPUBLIC friend DateTime operator -( const DateTime& rDateTime, const tools::Time& rTime ); TOOLS_DLLPUBLIC friend double operator -( const DateTime& rDateTime1, const DateTime& rDateTime2 ); TOOLS_DLLPUBLIC friend long operator -( const DateTime& rDateTime, const Date& rDate ) { return (const Date&) rDateTime - rDate; } diff --git a/include/tools/time.hxx b/include/tools/time.hxx index ac259bc4c7ff..cac4117e5426 100644 --- a/include/tools/time.hxx +++ b/include/tools/time.hxx @@ -31,6 +31,8 @@ class ResId; 25 hours or 10 minus 20 seconds being (non-negative) 10 seconds. */ +namespace tools { + class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Time { private: @@ -68,7 +70,7 @@ public: Time( TimeInitSystem ); Time( const ResId & rResId ); Time( sal_Int64 _nTime ) { Time::nTime = _nTime; } - Time( const Time& rTime ); + Time( const tools::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 ); @@ -103,22 +105,22 @@ public: /// 12 hours == 0.5 days double GetTimeInDays() const; - bool IsBetween( const Time& rFrom, const Time& rTo ) const + bool IsBetween( const tools::Time& rFrom, const tools::Time& rTo ) const { return ((nTime >= rFrom.nTime) && (nTime <= rTo.nTime)); } - bool IsEqualIgnoreNanoSec( const Time& rTime ) const; + bool IsEqualIgnoreNanoSec( const tools::Time& rTime ) const; - bool operator ==( const Time& rTime ) const + bool operator ==( const tools::Time& rTime ) const { return (nTime == rTime.nTime); } - bool operator !=( const Time& rTime ) const + bool operator !=( const tools::Time& rTime ) const { return (nTime != rTime.nTime); } - bool operator >( const Time& rTime ) const + bool operator >( const tools::Time& rTime ) const { return (nTime > rTime.nTime); } - bool operator <( const Time& rTime ) const + bool operator <( const tools::Time& rTime ) const { return (nTime < rTime.nTime); } - bool operator >=( const Time& rTime ) const + bool operator >=( const tools::Time& rTime ) const { return (nTime >= rTime.nTime); } - bool operator <=( const Time& rTime ) const + bool operator <=( const tools::Time& rTime ) const { return (nTime <= rTime.nTime); } static Time GetUTCOffset(); @@ -127,15 +129,17 @@ public: void ConvertToUTC() { *this -= Time::GetUTCOffset(); } void ConvertToLocalTime() { *this += Time::GetUTCOffset(); } - Time& operator =( const Time& rTime ); + tools::Time& operator =( const tools::Time& rTime ); Time operator -() const { return Time( -nTime ); } - Time& operator +=( const Time& rTime ); - Time& operator -=( const Time& rTime ); - TOOLS_DLLPUBLIC friend Time operator +( const Time& rTime1, const Time& rTime2 ); - TOOLS_DLLPUBLIC friend Time operator -( const Time& rTime1, const Time& rTime2 ); + tools::Time& operator +=( const tools::Time& rTime ); + tools::Time& operator -=( const tools::Time& rTime ); + TOOLS_DLLPUBLIC friend Time operator +( const tools::Time& rTime1, const tools::Time& rTime2 ); + TOOLS_DLLPUBLIC friend Time operator -( const tools::Time& rTime1, const tools::Time& rTime2 ); }; +} /* namespace tools */ + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx index 306db2805e67..c7de9badd3f8 100644 --- a/include/unotools/datetime.hxx +++ b/include/unotools/datetime.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/util/DateTime.hpp> class Date; -class Time; +namespace tools { class Time; } class DateTime; namespace utl diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index 15c9520e383a..77e580fb37da 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -36,7 +36,7 @@ namespace com { namespace sun { namespace star { } }}} class Date; -class Time; +namespace tools { class Time; } class CalendarWrapper; enum DateFormat { @@ -241,9 +241,9 @@ public: DateFormat getLongDateFormat() const; /// only numerical values of Gregorian calendar OUString getDate( const Date& rDate ) const; - OUString getTime( const Time& rTime, bool bSec = true, + OUString getTime( const tools::Time& rTime, bool bSec = true, bool b100Sec = false ) const; - OUString getDuration( const Time& rTime, + OUString getDuration( const tools::Time& rTime, bool bSec = true, bool b100Sec = false ) const; /** The CalendarWrapper already <b>MUST</b> diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 35648a839639..f3d6c8209bdd 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -405,26 +405,26 @@ public: class VCL_DLLPUBLIC TimeFormatter : public FormatterBase { private: - Time maLastTime; - Time maMin; - Time maMax; - Time maCorrectedTime; + tools::Time maLastTime; + tools::Time maMin; + tools::Time maMax; + tools::Time maCorrectedTime; TimeFieldFormat meFormat; - sal_uInt16 mnTimeFormat; + sal_uInt16 mnTimeFormat; bool mbDuration; bool mbEnforceValidValue; SAL_DLLPRIVATE void ImplInit(); protected: - Time maFieldTime; + tools::Time maFieldTime; TimeFormatter(); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE bool ImplTimeReformat( const OUString& rStr, OUString& rOutStr ); - SAL_DLLPRIVATE void ImplNewFieldValue( const Time& rTime ); - SAL_DLLPRIVATE void ImplSetUserTime( const Time& rNewTime, Selection* pNewSelection = NULL ); + SAL_DLLPRIVATE void ImplNewFieldValue( const tools::Time& rTime ); + SAL_DLLPRIVATE void ImplSetUserTime( const tools::Time& rNewTime, Selection* pNewSelection = NULL ); SAL_DLLPRIVATE bool ImplAllowMalformedInput() const; public: @@ -439,10 +439,10 @@ public: virtual void Reformat() SAL_OVERRIDE; virtual void ReformatAll() SAL_OVERRIDE; - void SetMin( const Time& rNewMin ); - const Time& GetMin() const { return maMin; } - void SetMax( const Time& rNewMax ); - const Time& GetMax() const { return maMax; } + void SetMin( const tools::Time& rNewMin ); + const tools::Time& GetMin() const { return maMin; } + void SetMax( const tools::Time& rNewMax ); + const tools::Time& GetMax() const { return maMax; } void SetTimeFormat( TimeFormat eNewFormat ); TimeFormat GetTimeFormat() const { return (TimeFormat)mnTimeFormat;} @@ -453,14 +453,14 @@ public: void SetDuration( bool mbDuration ); bool IsDuration() const { return mbDuration; } - void SetTime( const Time& rNewTime ); - void SetUserTime( const Time& rNewTime ); - Time GetTime() const; + void SetTime( const tools::Time& rNewTime ); + void SetUserTime( const tools::Time& rNewTime ); + tools::Time GetTime() const; void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); } bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); } - Time GetCorrectedTime() const { return maCorrectedTime; } + tools::Time GetCorrectedTime() const { return maCorrectedTime; } - static Time GetInvalidTime() { return Time( 99, 99, 99 ); } + static tools::Time GetInvalidTime() { return tools::Time( 99, 99, 99 ); } /** enables or disables the enforcement of valid values @@ -662,8 +662,8 @@ public: class VCL_DLLPUBLIC TimeField : public SpinField, public TimeFormatter { private: - Time maFirst; - Time maLast; + tools::Time maFirst; + tools::Time maLast; protected: SAL_DLLPRIVATE void ImplTimeSpinArea( bool bUp ); @@ -685,10 +685,10 @@ public: virtual void First() SAL_OVERRIDE; virtual void Last() SAL_OVERRIDE; - void SetFirst( const Time& rNewFirst ) { maFirst = rNewFirst; } - Time GetFirst() const { return maFirst; } - void SetLast( const Time& rNewLast ) { maLast = rNewLast; } - Time GetLast() const { return maLast; } + void SetFirst( const tools::Time& rNewFirst ) { maFirst = rNewFirst; } + tools::Time GetFirst() const { return maFirst; } + void SetLast( const tools::Time& rNewLast ) { maLast = rNewLast; } + tools::Time GetLast() const { return maLast; } void SetExtFormat( ExtTimeFieldFormat eFormat ); }; diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx index f41e0d379998..32c3d13e6183 100644 --- a/include/xmloff/xmluconv.hxx +++ b/include/xmloff/xmluconv.hxx @@ -44,7 +44,7 @@ // predeclarations -class Time; +namespace tools { class Time; } namespace com { namespace sun { namespace star { namespace util { struct DateTime; } |