diff options
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 2 | ||||
-rw-r--r-- | include/vcl/field.hxx | 4 | ||||
-rw-r--r-- | include/vcl/vclenum.hxx | 15 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/field2.cxx | 140 |
5 files changed, 84 insertions, 79 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 5aa8a4ff9104..78b5ea6f8511 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -122,7 +122,7 @@ namespace pcr pControlWindow->SetLast( ::Date( 1, 1, 9999 ) ); pControlWindow->SetMax( ::Date( 1, 1, 9999 ) ); - pControlWindow->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); + pControlWindow->SetExtDateFormat( ExtDateFieldFormat::SystemShortYYYY ); pControlWindow->EnableEmptyFieldValue( true ); } diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index d277a0a55b59..7bf3c078bfc1 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -281,8 +281,8 @@ private: Date maMax; bool mbLongFormat; bool mbShowDateCentury; - sal_uInt16 mnDateFormat; - sal_uLong mnExtDateFormat; + sal_uInt16 mnDateFormat; + ExtDateFieldFormat mnExtDateFormat; bool mbEnforceValidValue; SAL_DLLPRIVATE void ImplInit(); diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx index 6581365859f7..3441ba627244 100644 --- a/include/vcl/vclenum.hxx +++ b/include/vcl/vclenum.hxx @@ -28,12 +28,17 @@ enum ExtTimeFieldFormat { EXTTIMEF_24H_SHORT, EXTTIMEF_24H_LONG, EXTTIMEF_12H_SHORT, EXTTIMEF_12H_LONG, EXTTIMEF_DURATION_SHORT, EXTTIMEF_DURATION_LONG }; -enum ExtDateFieldFormat { XTDATEF_SYSTEM_SHORT, XTDATEF_SYSTEM_SHORT_YY, XTDATEF_SYSTEM_SHORT_YYYY, - XTDATEF_SYSTEM_LONG, - XTDATEF_SHORT_DDMMYY, XTDATEF_SHORT_MMDDYY, XTDATEF_SHORT_YYMMDD, - XTDATEF_SHORT_DDMMYYYY, XTDATEF_SHORT_MMDDYYYY, XTDATEF_SHORT_YYYYMMDD, - XTDATEF_SHORT_YYMMDD_DIN5008, XTDATEF_SHORT_YYYYMMDD_DIN5008, ExtDateFieldFormat_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; +enum class ExtDateFieldFormat +{ + SystemShort, SystemShortYY, SystemShortYYYY, + SystemLong, + ShortDDMMYY, ShortMMDDYY, ShortYYMMDD, + ShortDDMMYYYY, ShortMMDDYYYY, ShortYYYYMMDD, + ShortYYMMDD_DIN5008, ShortYYYYMMDD_DIN5008, + FORCE_EQUAL_SIZE=SAL_MAX_ENUM +}; +// this appears to be a direct copy of css::awt::GradientStyle enum class GradientStyle { Linear = 0, diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index a2e8fc7c8d12..ab8c00cdad61 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1416,7 +1416,7 @@ CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) : { m_aTimeField->SetExtFormat( EXTTIMEF_24H_LONG ); - m_aDateField->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); + m_aDateField->SetExtDateFormat( ExtDateFieldFormat::SystemShortYYYY ); m_aRemoveButton->SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE))); m_aRemoveButton->SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString()); diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index eb32e17bc0e6..2a00d3faae97 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -943,9 +943,9 @@ static ExtDateFieldFormat ImplGetExtFormat( DateFormat eOld ) { switch( eOld ) { - case DMY: return XTDATEF_SHORT_DDMMYY; - case MDY: return XTDATEF_SHORT_MMDDYY; - default: return XTDATEF_SHORT_YYMMDD; + case DMY: return ExtDateFieldFormat::ShortDDMMYY; + case MDY: return ExtDateFieldFormat::ShortMMDDYY; + default: return ExtDateFieldFormat::ShortYYMMDD; } } @@ -992,7 +992,7 @@ static sal_uInt16 ImplCutMonthFromString( OUString& rStr, const CalendarWrapper& static OUString ImplGetDateSep( const LocaleDataWrapper& rLocaleDataWrapper, ExtDateFieldFormat eFormat ) { - if ( ( eFormat == XTDATEF_SHORT_YYMMDD_DIN5008 ) || ( eFormat == XTDATEF_SHORT_YYYYMMDD_DIN5008 ) ) + if ( ( eFormat == ExtDateFieldFormat::ShortYYMMDD_DIN5008 ) || ( eFormat == ExtDateFieldFormat::ShortYYYYMMDD_DIN5008 ) ) return OUString("-"); else return rLocaleDataWrapper.getDateSep(); @@ -1022,7 +1022,7 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor bool bError = false; OUString aStr( rStr ); - if ( eDateFormat == XTDATEF_SYSTEM_LONG ) + if ( eDateFormat == ExtDateFieldFormat::SystemLong ) { DateFormat eFormat = rLocaleDataWrapper.getLongDateFormat(); switch( eFormat ) @@ -1066,8 +1066,8 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor switch ( eDateFormat ) { - case XTDATEF_SHORT_DDMMYY: - case XTDATEF_SHORT_DDMMYYYY: + case ExtDateFieldFormat::ShortDDMMYY: + case ExtDateFieldFormat::ShortDDMMYYYY: { nDay = ImplGetNum( pBuf, bError ); ImplSkipDelimiters( pBuf ); @@ -1077,8 +1077,8 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor nYear = ImplGetNum( pBuf, bError ); } break; - case XTDATEF_SHORT_MMDDYY: - case XTDATEF_SHORT_MMDDYYYY: + case ExtDateFieldFormat::ShortMMDDYY: + case ExtDateFieldFormat::ShortMMDDYYYY: { nMonth = ImplGetNum( pBuf, bError ); ImplSkipDelimiters( pBuf ); @@ -1088,10 +1088,10 @@ static bool ImplDateGetValue( const OUString& rStr, Date& rDate, ExtDateFieldFor nYear = ImplGetNum( pBuf, bError ); } break; - case XTDATEF_SHORT_YYMMDD: - case XTDATEF_SHORT_YYYYMMDD: - case XTDATEF_SHORT_YYMMDD_DIN5008: - case XTDATEF_SHORT_YYYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYMMDD: + case ExtDateFieldFormat::ShortYYYYMMDD: + case ExtDateFieldFormat::ShortYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYYYMMDD_DIN5008: { if ( bYear ) nYear = ImplGetNum( pBuf, bError ); @@ -1145,12 +1145,12 @@ OUString DateFormatter::ImplGetDateAsText( const Date& rDate, bool bShowCentury = false; switch ( GetExtDateFormat() ) { - case XTDATEF_SYSTEM_SHORT_YYYY: - case XTDATEF_SYSTEM_LONG: - case XTDATEF_SHORT_DDMMYYYY: - case XTDATEF_SHORT_MMDDYYYY: - case XTDATEF_SHORT_YYYYMMDD: - case XTDATEF_SHORT_YYYYMMDD_DIN5008: + case ExtDateFieldFormat::SystemShortYYYY: + case ExtDateFieldFormat::SystemLong: + case ExtDateFieldFormat::ShortDDMMYYYY: + case ExtDateFieldFormat::ShortMMDDYYYY: + case ExtDateFieldFormat::ShortYYYYMMDD: + case ExtDateFieldFormat::ShortYYYYMMDD_DIN5008: { bShowCentury = true; } @@ -1186,12 +1186,12 @@ OUString DateFormatter::ImplGetDateAsText( const Date& rDate, switch ( GetExtDateFormat( true ) ) { - case XTDATEF_SYSTEM_LONG: + case ExtDateFieldFormat::SystemLong: { return ImplGetLocaleDataWrapper().getLongDate( rDate, GetCalendarWrapper(), !bShowCentury ); } - case XTDATEF_SHORT_DDMMYY: - case XTDATEF_SHORT_DDMMYYYY: + case ExtDateFieldFormat::ShortDDMMYY: + case ExtDateFieldFormat::ShortDDMMYYYY: { pBuf = ImplAddNum( pBuf, nDay, 2 ); pBuf = ImplAddString( pBuf, aDateSep ); @@ -1200,8 +1200,8 @@ OUString DateFormatter::ImplGetDateAsText( const Date& rDate, pBuf = ImplAddSNum( pBuf, nYear, nYearLen ); } break; - case XTDATEF_SHORT_MMDDYY: - case XTDATEF_SHORT_MMDDYYYY: + case ExtDateFieldFormat::ShortMMDDYY: + case ExtDateFieldFormat::ShortMMDDYYYY: { pBuf = ImplAddNum( pBuf, nMonth, 2 ); pBuf = ImplAddString( pBuf, aDateSep ); @@ -1210,10 +1210,10 @@ OUString DateFormatter::ImplGetDateAsText( const Date& rDate, pBuf = ImplAddSNum( pBuf, nYear, nYearLen ); } break; - case XTDATEF_SHORT_YYMMDD: - case XTDATEF_SHORT_YYYYMMDD: - case XTDATEF_SHORT_YYMMDD_DIN5008: - case XTDATEF_SHORT_YYYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYMMDD: + case ExtDateFieldFormat::ShortYYYYMMDD: + case ExtDateFieldFormat::ShortYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYYYMMDD_DIN5008: { pBuf = ImplAddSNum( pBuf, nYear, nYearLen ); pBuf = ImplAddString( pBuf, aDateSep ); @@ -1338,7 +1338,7 @@ void DateField::ImplDateSpinArea( bool bUp ) sal_Int8 nDateArea = 0; ExtDateFieldFormat eFormat = GetExtDateFormat( true ); - if ( eFormat == XTDATEF_SYSTEM_LONG ) + if ( eFormat == ExtDateFieldFormat::SystemLong ) { eFormat = ImplGetExtFormat( ImplGetLocaleDataWrapper().getLongDateFormat() ); nDateArea = 1; @@ -1363,8 +1363,8 @@ void DateField::ImplDateSpinArea( bool bUp ) switch( eFormat ) { - case XTDATEF_SHORT_MMDDYY: - case XTDATEF_SHORT_MMDDYYYY: + case ExtDateFieldFormat::ShortMMDDYY: + case ExtDateFieldFormat::ShortMMDDYYYY: switch( nDateArea ) { case 1: ImplDateIncrementMonth( aDate, bUp ); @@ -1375,8 +1375,8 @@ void DateField::ImplDateSpinArea( bool bUp ) break; } break; - case XTDATEF_SHORT_DDMMYY: - case XTDATEF_SHORT_DDMMYYYY: + case ExtDateFieldFormat::ShortDDMMYY: + case ExtDateFieldFormat::ShortDDMMYYYY: switch( nDateArea ) { case 1: ImplDateIncrementDay( aDate, bUp ); @@ -1387,10 +1387,10 @@ void DateField::ImplDateSpinArea( bool bUp ) break; } break; - case XTDATEF_SHORT_YYMMDD: - case XTDATEF_SHORT_YYYYMMDD: - case XTDATEF_SHORT_YYMMDD_DIN5008: - case XTDATEF_SHORT_YYYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYMMDD: + case ExtDateFieldFormat::ShortYYYYMMDD: + case ExtDateFieldFormat::ShortYYMMDD_DIN5008: + case ExtDateFieldFormat::ShortYYYYMMDD_DIN5008: switch( nDateArea ) { case 1: ImplDateIncrementYear( aDate, bUp ); @@ -1417,7 +1417,7 @@ void DateFormatter::ImplInit() mbShowDateCentury = true; mpCalendarWrapper = nullptr; mnDateFormat = 0xFFFF; - mnExtDateFormat = XTDATEF_SYSTEM_SHORT; + mnExtDateFormat = ExtDateFieldFormat::SystemShort; } DateFormatter::DateFormatter() : @@ -1464,16 +1464,16 @@ ExtDateFieldFormat DateFormatter::GetExtDateFormat( bool bResolveSystemFormat ) { ExtDateFieldFormat eDateFormat = (ExtDateFieldFormat)mnExtDateFormat; - if ( bResolveSystemFormat && ( eDateFormat <= XTDATEF_SYSTEM_SHORT_YYYY ) ) + if ( bResolveSystemFormat && ( eDateFormat <= ExtDateFieldFormat::SystemShortYYYY ) ) { - bool bShowCentury = (eDateFormat == XTDATEF_SYSTEM_SHORT_YYYY); + bool bShowCentury = (eDateFormat == ExtDateFieldFormat::SystemShortYYYY); switch ( ImplGetLocaleDataWrapper().getDateFormat() ) { - case DMY: eDateFormat = bShowCentury ? XTDATEF_SHORT_DDMMYYYY : XTDATEF_SHORT_DDMMYY; + case DMY: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortDDMMYYYY : ExtDateFieldFormat::ShortDDMMYY; break; - case MDY: eDateFormat = bShowCentury ? XTDATEF_SHORT_MMDDYYYY : XTDATEF_SHORT_MMDDYY; + case MDY: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortMMDDYYYY : ExtDateFieldFormat::ShortMMDDYY; break; - default: eDateFormat = bShowCentury ? XTDATEF_SHORT_YYYYMMDD : XTDATEF_SHORT_YYMMDD; + default: eDateFormat = bShowCentury ? ExtDateFieldFormat::ShortYYYYMMDD : ExtDateFieldFormat::ShortYYMMDD; } } @@ -1507,12 +1507,12 @@ void DateFormatter::SetLongFormat( bool bLong ) // #91913# Remove LongFormat and DateShowCentury - redundant if ( bLong ) { - SetExtDateFormat( XTDATEF_SYSTEM_LONG ); + SetExtDateFormat( ExtDateFieldFormat::SystemLong ); } else { - if( mnExtDateFormat == XTDATEF_SYSTEM_LONG ) - SetExtDateFormat( XTDATEF_SYSTEM_SHORT ); + if( mnExtDateFormat == ExtDateFieldFormat::SystemLong ) + SetExtDateFormat( ExtDateFieldFormat::SystemShort ); } ReformatAll(); @@ -1527,17 +1527,17 @@ void DateFormatter::SetShowDateCentury( bool bShowDateCentury ) { switch ( GetExtDateFormat() ) { - case XTDATEF_SYSTEM_SHORT: - case XTDATEF_SYSTEM_SHORT_YY: - SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); break; - case XTDATEF_SHORT_DDMMYY: - SetExtDateFormat( XTDATEF_SHORT_DDMMYYYY ); break; - case XTDATEF_SHORT_MMDDYY: - SetExtDateFormat( XTDATEF_SHORT_MMDDYYYY ); break; - case XTDATEF_SHORT_YYMMDD: - SetExtDateFormat( XTDATEF_SHORT_YYYYMMDD ); break; - case XTDATEF_SHORT_YYMMDD_DIN5008: - SetExtDateFormat( XTDATEF_SHORT_YYYYMMDD_DIN5008 ); break; + case ExtDateFieldFormat::SystemShort: + case ExtDateFieldFormat::SystemShortYY: + SetExtDateFormat( ExtDateFieldFormat::SystemShortYYYY ); break; + case ExtDateFieldFormat::ShortDDMMYY: + SetExtDateFormat( ExtDateFieldFormat::ShortDDMMYYYY ); break; + case ExtDateFieldFormat::ShortMMDDYY: + SetExtDateFormat( ExtDateFieldFormat::ShortMMDDYYYY ); break; + case ExtDateFieldFormat::ShortYYMMDD: + SetExtDateFormat( ExtDateFieldFormat::ShortYYYYMMDD ); break; + case ExtDateFieldFormat::ShortYYMMDD_DIN5008: + SetExtDateFormat( ExtDateFieldFormat::ShortYYYYMMDD_DIN5008 ); break; default: ; } @@ -1546,17 +1546,17 @@ void DateFormatter::SetShowDateCentury( bool bShowDateCentury ) { switch ( GetExtDateFormat() ) { - case XTDATEF_SYSTEM_SHORT: - case XTDATEF_SYSTEM_SHORT_YYYY: - SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YY ); break; - case XTDATEF_SHORT_DDMMYYYY: - SetExtDateFormat( XTDATEF_SHORT_DDMMYY ); break; - case XTDATEF_SHORT_MMDDYYYY: - SetExtDateFormat( XTDATEF_SHORT_MMDDYY ); break; - case XTDATEF_SHORT_YYYYMMDD: - SetExtDateFormat( XTDATEF_SHORT_YYMMDD ); break; - case XTDATEF_SHORT_YYYYMMDD_DIN5008: - SetExtDateFormat( XTDATEF_SHORT_YYMMDD_DIN5008 ); break; + case ExtDateFieldFormat::SystemShort: + case ExtDateFieldFormat::SystemShortYYYY: + SetExtDateFormat( ExtDateFieldFormat::SystemShortYY ); break; + case ExtDateFieldFormat::ShortDDMMYYYY: + SetExtDateFormat( ExtDateFieldFormat::ShortDDMMYY ); break; + case ExtDateFieldFormat::ShortMMDDYYYY: + SetExtDateFormat( ExtDateFieldFormat::ShortMMDDYY ); break; + case ExtDateFieldFormat::ShortYYYYMMDD: + SetExtDateFormat( ExtDateFieldFormat::ShortYYMMDD ); break; + case ExtDateFieldFormat::ShortYYYYMMDD_DIN5008: + SetExtDateFormat( ExtDateFieldFormat::ShortYYMMDD_DIN5008 ); break; default: ; } @@ -1745,7 +1745,7 @@ void DateField::dispose() bool DateField::PreNotify( NotifyEvent& rNEvt ) { if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() && - ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) && + ( GetExtDateFormat() != ExtDateFieldFormat::SystemLong ) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) { if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( true ), ImplGetLocaleDataWrapper() ) ) @@ -1850,7 +1850,7 @@ void DateBox::dispose() bool DateBox::PreNotify( NotifyEvent& rNEvt ) { if ( (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT) && IsStrictFormat() && - ( GetExtDateFormat() != XTDATEF_SYSTEM_LONG ) && + ( GetExtDateFormat() != ExtDateFieldFormat::SystemLong ) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) { if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetExtDateFormat( true ), ImplGetLocaleDataWrapper() ) ) |