From 5333782d090a9e147c0c431f0f741863d1d8cf8e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 12 Jan 2015 12:55:32 +0200 Subject: convert SETTINGS_ #defines to 'enum class' and dump the ones that nothing is listening to Change-Id: I253ef284df785812a439dd160edba1b07fdbaac4 --- vcl/source/app/settings.cxx | 63 ++++++++++++--------------------------------- vcl/source/app/svapp.cxx | 4 +-- 2 files changed, 18 insertions(+), 49 deletions(-) (limited to 'vcl/source/app') diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 7a7e4259d667..95308ef0686a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -240,7 +240,7 @@ struct ImplAllSettingsData MiscSettings maMiscSettings; HelpSettings maHelpSettings; LanguageTag maLocale; - sal_uLong mnWindowUpdate; + AllSettingsFlags mnWindowUpdate; LanguageTag maUILocale; LocaleDataWrapper* mpLocaleDataWrapper; LocaleDataWrapper* mpUILocaleDataWrapper; @@ -2640,7 +2640,7 @@ ImplAllSettingsData::ImplAllSettingsData() maLocale( LANGUAGE_SYSTEM ), maUILocale( LANGUAGE_SYSTEM ) { - mnWindowUpdate = SETTINGS_ALLSETTINGS; + mnWindowUpdate = AllSettingsFlags::STYLE | AllSettingsFlags::MISC | AllSettingsFlags::LOCALE; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; mpI18nHelper = NULL; @@ -2699,87 +2699,56 @@ void AllSettings::CopyData() } -sal_uLong AllSettings::Update( sal_uLong nFlags, const AllSettings& rSet ) +AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet ) { - sal_uLong nChangeFlags = 0; + AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE; - if ( nFlags & SETTINGS_MOUSE ) - { - if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings ) - { - CopyData(); - mpData->maMouseSettings = rSet.mpData->maMouseSettings; - nChangeFlags |= SETTINGS_MOUSE; - } - } - - if ( nFlags & SETTINGS_STYLE ) + if ( nFlags & AllSettingsFlags::STYLE ) { if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings ) { CopyData(); mpData->maStyleSettings = rSet.mpData->maStyleSettings; - nChangeFlags |= SETTINGS_STYLE; + nChangeFlags |= AllSettingsFlags::STYLE; } } - if ( nFlags & SETTINGS_MISC ) + if ( nFlags & AllSettingsFlags::MISC ) { if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings ) { CopyData(); mpData->maMiscSettings = rSet.mpData->maMiscSettings; - nChangeFlags |= SETTINGS_MISC; - } - } - - if ( nFlags & SETTINGS_HELP ) - { - if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings ) - { - CopyData(); - mpData->maHelpSettings = rSet.mpData->maHelpSettings; - nChangeFlags |= SETTINGS_HELP; + nChangeFlags |= AllSettingsFlags::MISC; } } - if ( nFlags & SETTINGS_LOCALE ) + if ( nFlags & AllSettingsFlags::LOCALE ) { if ( mpData->maLocale != rSet.mpData->maLocale ) { SetLanguageTag( rSet.mpData->maLocale ); - nChangeFlags |= SETTINGS_LOCALE; + nChangeFlags |= AllSettingsFlags::LOCALE; } } - if ( nFlags & SETTINGS_UILOCALE ) - { - // UILocale can't be changed - } - return nChangeFlags; } -sal_uLong AllSettings::GetChangeFlags( const AllSettings& rSet ) const +AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const { - sal_uLong nChangeFlags = 0; - - if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings ) - nChangeFlags |= SETTINGS_MOUSE; + AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE; if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings ) - nChangeFlags |= SETTINGS_STYLE; + nChangeFlags |= AllSettingsFlags::STYLE; if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings ) - nChangeFlags |= SETTINGS_MISC; - - if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings ) - nChangeFlags |= SETTINGS_HELP; + nChangeFlags |= AllSettingsFlags::MISC; if ( mpData->maLocale != rSet.mpData->maLocale ) - nChangeFlags |= SETTINGS_LOCALE; + nChangeFlags |= AllSettingsFlags::LOCALE; return nChangeFlags; } @@ -3076,7 +3045,7 @@ AllSettings::GetHelpSettings() const return mpData->maHelpSettings; } -sal_uLong +AllSettingsFlags AllSettings::GetWindowUpdate() const { return mpData->mnWindowUpdate; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 55cc90811299..c02f0a93a138 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -511,8 +511,8 @@ void Application::SetSettings( const AllSettings& rSettings ) } ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag() ); *pSVData->maAppData.mpSettings = rSettings; - sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); - if ( nChangeFlags ) + AllSettingsFlags nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); + if ( bool(nChangeFlags) ) { DataChangedEvent aDCEvt( DataChangedEventType::SETTINGS, &aOldSettings, nChangeFlags ); -- cgit