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:
@@ -366,12 +366,18 @@ public:
|
|||||||
|
|
||||||
class VCL_DLLPUBLIC TimeFormatter : public FormatterBase
|
class VCL_DLLPUBLIC TimeFormatter : public FormatterBase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
enum class TimeFormat {
|
||||||
|
Hour12,
|
||||||
|
Hour24
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
tools::Time maLastTime;
|
tools::Time maLastTime;
|
||||||
tools::Time maMin;
|
tools::Time maMin;
|
||||||
tools::Time maMax;
|
tools::Time maMax;
|
||||||
TimeFieldFormat meFormat;
|
TimeFieldFormat meFormat;
|
||||||
sal_uInt16 mnTimeFormat;
|
TimeFormat mnTimeFormat;
|
||||||
bool mbDuration;
|
bool mbDuration;
|
||||||
bool mbEnforceValidValue;
|
bool mbEnforceValidValue;
|
||||||
|
|
||||||
@@ -389,11 +395,6 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum TimeFormat {
|
|
||||||
HOUR_12,
|
|
||||||
HOUR_24
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~TimeFormatter();
|
virtual ~TimeFormatter();
|
||||||
|
|
||||||
virtual void Reformat() override;
|
virtual void Reformat() override;
|
||||||
|
@@ -2199,7 +2199,7 @@ bool TimeFormatter::ImplTimeReformat( const OUString& rStr, OUString& rOutStr )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
rOutStr = ImplGetLocaleDataWrapper().getTime( aTempTime, bSecond, b100Sec );
|
rOutStr = ImplGetLocaleDataWrapper().getTime( aTempTime, bSecond, b100Sec );
|
||||||
if ( GetTimeFormat() == HOUR_12 )
|
if ( GetTimeFormat() == TimeFormat::Hour12 )
|
||||||
{
|
{
|
||||||
if ( aTempTime.GetHour() > 12 )
|
if ( aTempTime.GetHour() > 12 )
|
||||||
{
|
{
|
||||||
@@ -2299,7 +2299,7 @@ void TimeFormatter::ImplInit()
|
|||||||
{
|
{
|
||||||
meFormat = TimeFieldFormat::F_NONE;
|
meFormat = TimeFieldFormat::F_NONE;
|
||||||
mbDuration = false;
|
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() :
|
TimeFormatter::TimeFormatter() :
|
||||||
@@ -2337,7 +2337,7 @@ void TimeFormatter::SetMax( const tools::Time& rNewMax )
|
|||||||
|
|
||||||
void TimeFormatter::SetTimeFormat( TimeFormatter::TimeFormat eNewFormat )
|
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
|
else
|
||||||
{
|
{
|
||||||
aStr = ImplGetLocaleDataWrapper().getTime( aNewTime, bSec, b100Sec );
|
aStr = ImplGetLocaleDataWrapper().getTime( aNewTime, bSec, b100Sec );
|
||||||
if ( GetTimeFormat() == HOUR_12 )
|
if ( GetTimeFormat() == TimeFormat::Hour12 )
|
||||||
{
|
{
|
||||||
if ( aNewTime.GetHour() > 12 )
|
if ( aNewTime.GetHour() > 12 )
|
||||||
{
|
{
|
||||||
@@ -2599,28 +2599,28 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat )
|
|||||||
{
|
{
|
||||||
case EXTTIMEF_24H_SHORT:
|
case EXTTIMEF_24H_SHORT:
|
||||||
{
|
{
|
||||||
SetTimeFormat( HOUR_24 );
|
SetTimeFormat( TimeFormat::Hour24 );
|
||||||
SetDuration( false );
|
SetDuration( false );
|
||||||
SetFormat( TimeFieldFormat::F_NONE );
|
SetFormat( TimeFieldFormat::F_NONE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTTIMEF_24H_LONG:
|
case EXTTIMEF_24H_LONG:
|
||||||
{
|
{
|
||||||
SetTimeFormat( HOUR_24 );
|
SetTimeFormat( TimeFormat::Hour24 );
|
||||||
SetDuration( false );
|
SetDuration( false );
|
||||||
SetFormat( TimeFieldFormat::F_SEC );
|
SetFormat( TimeFieldFormat::F_SEC );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTTIMEF_12H_SHORT:
|
case EXTTIMEF_12H_SHORT:
|
||||||
{
|
{
|
||||||
SetTimeFormat( HOUR_12 );
|
SetTimeFormat( TimeFormat::Hour12 );
|
||||||
SetDuration( false );
|
SetDuration( false );
|
||||||
SetFormat( TimeFieldFormat::F_NONE );
|
SetFormat( TimeFieldFormat::F_NONE );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EXTTIMEF_12H_LONG:
|
case EXTTIMEF_12H_LONG:
|
||||||
{
|
{
|
||||||
SetTimeFormat( HOUR_12 );
|
SetTimeFormat( TimeFormat::Hour12 );
|
||||||
SetDuration( false );
|
SetDuration( false );
|
||||||
SetFormat( TimeFieldFormat::F_SEC );
|
SetFormat( TimeFieldFormat::F_SEC );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user