chart2/source/controller/dialogs/dlg_CreationWizard.cxx | 4 +- dbaccess/source/ui/dlg/dbwizsetup.cxx | 4 +- extensions/source/abpilot/abspilot.cxx | 23 ++++++---------- include/vcl/roadmapwizard.hxx | 12 +++++++- sdext/source/minimizer/optimizerdialog.cxx | 4 ++ svtools/source/uno/wizard/wizardshell.cxx | 3 +- sw/source/ui/dbui/mailmergewizard.cxx | 5 ++- vcl/source/control/roadmapwizard.cxx | 2 - vcl/source/control/wizimpldata.hxx | 2 - 9 files changed, 35 insertions(+), 24 deletions(-)
New commits: commit 7a7ba9cbee91485a9254949d1594352b3629c070 Author: Oromidayo Owolabi <[email protected]> AuthorDate: Wed Oct 16 15:56:21 2024 +0100 Commit: Hossein <[email protected]> CommitDate: Tue Nov 12 15:27:34 2024 +0100 tdf#145614 Convert #define to enum class Converted #define to enum class Change-Id: I16195a439643bcf0111c591a829272b5bf70179d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175027 Reviewed-by: Hossein <[email protected]> Tested-by: Jenkins diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx index c8e70ac142d2..ddfa7a3b4e3e 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx @@ -35,10 +35,10 @@ using namespace css; using vcl::RoadmapWizardTypes::WizardPath; +using vcl::RoadmapWizardTypes::PathId; namespace chart { -#define PATH_FULL 1 #define STATE_FIRST 0 #define STATE_CHARTTYPE STATE_FIRST #define STATE_SIMPLE_RANGE 1 @@ -72,7 +72,7 @@ CreationWizard::CreationWizard(weld::Window* pParent, const rtl::Reference<::cha STATE_OBJECTS }; - declarePath(PATH_FULL, aPath); + declarePath(PathId::COMPLETE, aPath); // tdf#135935 ensure help ID is set when no element is clicked in the dialog m_xAssistant->set_help_id(HID_SCH_WIZARD_ROADMAP); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 9b9e05dbc317..ec6c9040fd03 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -137,7 +137,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent ::dbaccess::ODsnTypeCollection::TypeIterator aIter = m_pCollection->begin(); ::dbaccess::ODsnTypeCollection::TypeIterator aEnd = m_pCollection->end(); - for(PathId i = 1;aIter != aEnd;++aIter,++i) + for(auto i = 1;aIter != aEnd;++aIter,++i) { const OUString& sURLPrefix = aIter.getURLPrefix(); WizardPath aPath; @@ -146,7 +146,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent aPath.push_back(PAGE_DBSETUPWIZARD_AUTHENTIFICATION); aPath.push_back(PAGE_DBSETUPWIZARD_FINAL); - declareAuthDepPath(sURLPrefix,i,aPath); + declareAuthDepPath(sURLPrefix,static_cast<PathId>(i),aPath); } WizardPath aPath; diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index fc135ec80c8f..fb2be7e8ab33 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -44,10 +44,7 @@ namespace abp #define STATE_MANUAL_FIELD_MAPPING 3 #define STATE_FINAL_CONFIRM 4 -#define PATH_COMPLETE 1 -#define PATH_NO_SETTINGS 2 -#define PATH_NO_FIELDS 3 -#define PATH_NO_SETTINGS_NO_FIELDS 4 + using namespace ::com::sun::star::uno; @@ -57,26 +54,26 @@ namespace abp ,m_aNewDataSource(_rxORB) ,m_eNewDataSourceType( AST_INVALID ) { - declarePath( PATH_COMPLETE, + declarePath(PathId::COMPLETE, {STATE_SELECT_ABTYPE, STATE_INVOKE_ADMIN_DIALOG, STATE_TABLE_SELECTION, STATE_MANUAL_FIELD_MAPPING, STATE_FINAL_CONFIRM} ); - declarePath( PATH_NO_SETTINGS, + declarePath(PathId::NO_SETTINGS, {STATE_SELECT_ABTYPE, STATE_TABLE_SELECTION, STATE_MANUAL_FIELD_MAPPING, STATE_FINAL_CONFIRM} ); - declarePath( PATH_NO_FIELDS, + declarePath(PathId::NO_FIELDS, {STATE_SELECT_ABTYPE, STATE_INVOKE_ADMIN_DIALOG, STATE_TABLE_SELECTION, STATE_FINAL_CONFIRM} ); - declarePath( PATH_NO_SETTINGS_NO_FIELDS, + declarePath(PathId::NO_SETTINGS_NO_FIELDS, {STATE_SELECT_ABTYPE, STATE_TABLE_SELECTION, STATE_FINAL_CONFIRM} @@ -422,19 +419,19 @@ namespace abp void OAddressBookSourcePilot::typeSelectionChanged( AddressSourceType _eType ) { - PathId nCurrentPathID( PATH_COMPLETE ); + PathId nCurrentPathID( PathId::COMPLETE ); bool bSettingsPage = needAdminInvokationPage( _eType ); bool bFieldsPage = needManualFieldMapping( _eType ); if ( !bSettingsPage ) if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_SETTINGS_NO_FIELDS; + nCurrentPathID = PathId::NO_SETTINGS_NO_FIELDS; else - nCurrentPathID = PATH_NO_SETTINGS; + nCurrentPathID = PathId::NO_SETTINGS; else if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_FIELDS; + nCurrentPathID = PathId::NO_FIELDS; else - nCurrentPathID = PATH_COMPLETE; + nCurrentPathID = PathId::COMPLETE; activatePath( nCurrentPathID, true ); m_aNewDataSource.disconnect(); diff --git a/include/vcl/roadmapwizard.hxx b/include/vcl/roadmapwizard.hxx index f4e8526a7019..e42cf425ed4d 100644 --- a/include/vcl/roadmapwizard.hxx +++ b/include/vcl/roadmapwizard.hxx @@ -30,8 +30,18 @@ namespace vcl namespace RoadmapWizardTypes { - typedef sal_Int16 PathId; typedef ::std::vector< WizardTypes::WizardState > WizardPath; + + enum class PathId : sal_Int16 + { + INVALID = -1, + COMMON_FIRST_STATE = 0, + COMPLETE = 1, //include settings and fields page + NO_SETTINGS = 2, // exclude settings page + NO_FIELDS = 3, // exclude fields page + NO_SETTINGS_NO_FIELDS = 4, // exclude settings and fields page + }; + }; //= RoadmapWizard diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index c87498503043..9ccbe96cc9a4 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -52,6 +52,8 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; +using vcl::RoadmapWizardTypes::PathId; + OptimizedDialogPage::OptimizedDialogPage(weld::Container* pPage, OptimizerDialog& rOptimizerDialog, const OUString& rUIXMLDescription, const OUString& rID, int nPageNum) @@ -246,7 +248,7 @@ void OptimizerDialog::InitDialog() void OptimizerDialog::InitRoadmap() { declarePath( - 0, + PathId::COMMON_FIRST_STATE, {ITEM_ID_INTRODUCTION, ITEM_ID_SLIDES, ITEM_ID_GRAPHIC_OPTIMIZATION, diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 39487d13b55a..b46592a7139b 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/ui/dialogs/WizardTravelType.hpp> using vcl::RoadmapWizardTypes::WizardPath; +using vcl::RoadmapWizardTypes::PathId; namespace svt::uno { @@ -66,7 +67,7 @@ namespace svt::uno WizardPath aPath( rPath.getLength() ); std::transform(rPath.begin(), rPath.end(), aPath.begin(), [this](const sal_Int16 nPageId) -> WizardPath::value_type { return impl_pageIdToState(nPageId); }); - declarePath( i, aPath ); + declarePath( static_cast<PathId>(i), aPath ); } // create the first page, to know the page size diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index ed76c83b86c0..c0c9db53e913 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -34,6 +34,7 @@ #include <helpids.h> using namespace ::com::sun::star; +using vcl::RoadmapWizardTypes::PathId; SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeConfigItem> xItem) : RoadmapWizardMachine(rView.GetFrameWeld()) @@ -60,7 +61,7 @@ SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeC //#i51949# no output type page visible if e-Mail is not supported if (m_xConfigItem->IsMailAvailable()) declarePath( - 0, + PathId::COMMON_FIRST_STATE, {MM_DOCUMENTSELECTPAGE, MM_OUTPUTTYPETPAGE, MM_ADDRESSBLOCKPAGE, @@ -69,7 +70,7 @@ SwMailMergeWizard::SwMailMergeWizard(SwView& rView, std::shared_ptr<SwMailMergeC ); else declarePath( - 0, + PathId::COMMON_FIRST_STATE, {MM_DOCUMENTSELECTPAGE, MM_ADDRESSBLOCKPAGE, MM_GREETINGSPAGE, diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx index d1f199967c39..4306acbaa564 100644 --- a/vcl/source/control/roadmapwizard.cxx +++ b/vcl/source/control/roadmapwizard.cxx @@ -209,7 +209,7 @@ namespace vcl // determine the index of the current state in the current path sal_Int32 nCurrentStatePathIndex = -1; - if ( m_pImpl->nActivePath != -1 ) + if ( m_pImpl->nActivePath != PathId::INVALID ) nCurrentStatePathIndex = m_pImpl->getStateIndexInPath( getCurrentState(), m_pImpl->nActivePath ); DBG_ASSERT( static_cast<sal_Int32>(aNewPathPos->second.size()) > nCurrentStatePathIndex, diff --git a/vcl/source/control/wizimpldata.hxx b/vcl/source/control/wizimpldata.hxx index 9502e8ba4e81..bb00c7832bb3 100644 --- a/vcl/source/control/wizimpldata.hxx +++ b/vcl/source/control/wizimpldata.hxx @@ -91,7 +91,7 @@ namespace vcl RoadmapWizardImpl() :pRoadmap( nullptr ) - ,nActivePath( -1 ) + ,nActivePath( PathId::INVALID ) ,bActivePathIsDefinite( false ) { }
