Convert TimeFormat to scoped enum

Change-Id: Ia40c70493a61886c76e515c3b2953243025c2438
Reviewed-on: https://gerrit.libreoffice.org/25602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-29 12:43:29 +02:00
parent 98d0983935
commit a6dacbe1d7
2 changed files with 15 additions and 14 deletions

View File

@ -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;

View File

@ -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<sal_uInt16>(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 );
}