From a6dacbe1d7d17283c20c75d3c97f72a0f876a716 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 29 May 2016 12:43:29 +0200 Subject: Convert TimeFormat to scoped enum Change-Id: Ia40c70493a61886c76e515c3b2953243025c2438 Reviewed-on: https://gerrit.libreoffice.org/25602 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/vcl/field.hxx | 13 +++++++------ vcl/source/control/field2.cxx | 16 ++++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 75f82070f78d..d97e40a9cce3 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -366,12 +366,18 @@ public: class VCL_DLLPUBLIC TimeFormatter : public FormatterBase { +public: + enum class TimeFormat { + Hour12, + Hour24 + }; + private: tools::Time maLastTime; tools::Time maMin; tools::Time maMax; TimeFieldFormat meFormat; - sal_uInt16 mnTimeFormat; + TimeFormat mnTimeFormat; bool mbDuration; bool mbEnforceValidValue; @@ -389,11 +395,6 @@ protected: public: - enum TimeFormat { - HOUR_12, - HOUR_24 - }; - virtual ~TimeFormatter(); virtual void Reformat() override; diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index b3e7c8fb0534..1f17e7569168 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2199,7 +2199,7 @@ bool TimeFormatter::ImplTimeReformat( const OUString& rStr, OUString& rOutStr ) else { rOutStr = ImplGetLocaleDataWrapper().getTime( aTempTime, bSecond, b100Sec ); - if ( GetTimeFormat() == HOUR_12 ) + if ( GetTimeFormat() == TimeFormat::Hour12 ) { if ( aTempTime.GetHour() > 12 ) { @@ -2299,7 +2299,7 @@ void TimeFormatter::ImplInit() { meFormat = TimeFieldFormat::F_NONE; mbDuration = false; - mnTimeFormat = HOUR_24; // Should become a ExtTimeFieldFormat in next implementation, merge with mbDuration and meFormat + mnTimeFormat = TimeFormat::Hour24; // Should become a ExtTimeFieldFormat in next implementation, merge with mbDuration and meFormat } TimeFormatter::TimeFormatter() : @@ -2337,7 +2337,7 @@ void TimeFormatter::SetMax( const tools::Time& rNewMax ) void TimeFormatter::SetTimeFormat( TimeFormatter::TimeFormat eNewFormat ) { - mnTimeFormat = sal::static_int_cast(eNewFormat); + mnTimeFormat = eNewFormat; } @@ -2427,7 +2427,7 @@ void TimeFormatter::ImplSetUserTime( const tools::Time& rNewTime, Selection* pNe else { aStr = ImplGetLocaleDataWrapper().getTime( aNewTime, bSec, b100Sec ); - if ( GetTimeFormat() == HOUR_12 ) + if ( GetTimeFormat() == TimeFormat::Hour12 ) { if ( aNewTime.GetHour() > 12 ) { @@ -2599,28 +2599,28 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat ) { case EXTTIMEF_24H_SHORT: { - SetTimeFormat( HOUR_24 ); + SetTimeFormat( TimeFormat::Hour24 ); SetDuration( false ); SetFormat( TimeFieldFormat::F_NONE ); } break; case EXTTIMEF_24H_LONG: { - SetTimeFormat( HOUR_24 ); + SetTimeFormat( TimeFormat::Hour24 ); SetDuration( false ); SetFormat( TimeFieldFormat::F_SEC ); } break; case EXTTIMEF_12H_SHORT: { - SetTimeFormat( HOUR_12 ); + SetTimeFormat( TimeFormat::Hour12 ); SetDuration( false ); SetFormat( TimeFieldFormat::F_NONE ); } break; case EXTTIMEF_12H_LONG: { - SetTimeFormat( HOUR_12 ); + SetTimeFormat( TimeFormat::Hour12 ); SetDuration( false ); SetFormat( TimeFieldFormat::F_SEC ); } -- cgit