vcl/inc/wizdlg.hxx                   |    2 
 vcl/source/control/roadmapwizard.cxx |    2 
 vcl/source/control/wizardmachine.cxx |   96 +++++++++++++----------------------
 3 files changed, 39 insertions(+), 61 deletions(-)

New commits:
commit 819ff5b50958fc1ac630d4774ea51d644f6c8478
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Feb 24 22:46:16 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Feb 25 08:22:12 2025 +0100

    vcl: Drop RoadmapWizard::implConstruct param
    
    The only caller (the ctor) passes all of the WizardButtonFlags,
    so drop the param and simplify the code a little.
    
    The actual logic which buttons to show/hide is implemented in
    class WizardMachine.
    
    Change-Id: Ief89a116a26682e6e7210184ebe4a3dd7a54b966
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182126
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index f708be01a511..d847b6e9a6be 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -257,7 +257,7 @@ namespace vcl
         DECL_LINK(OnPrevPage, Button*, void);
         DECL_LINK(OnFinish, Button*, void);
 
-        void     implConstruct( const WizardButtonFlags _nButtonFlags );
+        void implConstruct();
 
         virtual void     DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) 
override;
     };
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 4306acbaa564..3aa3429a0e43 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -91,7 +91,7 @@ namespace vcl
         maWizardLayoutIdle.SetPriority(TaskPriority::RESIZE);
         maWizardLayoutIdle.SetInvokeHandler( LINK( this, RoadmapWizard, 
ImplHandleWizardLayoutTimerHdl ) );
 
-        implConstruct(WizardButtonFlags::NEXT | WizardButtonFlags::PREVIOUS | 
WizardButtonFlags::FINISH | WizardButtonFlags::CANCEL | 
WizardButtonFlags::HELP);
+        implConstruct();
 
         SetLeftAlignedButtonCount( 1 );
         mbEmptyViewMargin = true;
diff --git a/vcl/source/control/wizardmachine.cxx 
b/vcl/source/control/wizardmachine.cxx
index 45d42fc21e68..e1d2364aec25 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -308,77 +308,55 @@ namespace vcl
         m_xRoadmapImpl->maResponses[pButton] = response;
     }
 
-    void RoadmapWizard::implConstruct( const WizardButtonFlags _nButtonFlags )
+    void RoadmapWizard::implConstruct()
     {
         m_xWizardImpl->sTitleBase = GetText();
 
-        // create the buttons according to the wizard button flags
+        // create buttons
         // the help button
-        if (_nButtonFlags & WizardButtonFlags::HELP)
-        {
-            m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
-            m_pHelp->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
-            m_pHelp->Show();
-            m_pHelp->set_id(u"help"_ustr);
-            AddButtonResponse(m_pHelp, RET_HELP);
-            AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X);
-        }
+        m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
+        m_pHelp->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
+        m_pHelp->Show();
+        m_pHelp->set_id(u"help"_ustr);
+        AddButtonResponse(m_pHelp, RET_HELP);
+        AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X);
 
         // the previous button
-        if (_nButtonFlags & WizardButtonFlags::PREVIOUS)
-        {
-            m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
-            m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS );
-            m_pPrevPage->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
-            m_pPrevPage->SetText(VclResId(STR_WIZDLG_PREVIOUS));
-            m_pPrevPage->Show();
-            m_pPrevPage->set_id(u"previous"_ustr);
-
-            if (_nButtonFlags & WizardButtonFlags::NEXT)
-                AddButton( m_pPrevPage, ( 
WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X) );      // half x-offset to the next 
button
-            else
-                AddButton( m_pPrevPage, WIZARDDIALOG_BUTTON_STDOFFSET_X );
-            mpPrevBtn = m_pPrevPage;
-            m_pPrevPage->SetClickHdl( LINK( this, RoadmapWizard, OnPrevPage ) 
);
-        }
+        m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
+        m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS );
+        m_pPrevPage->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
+        m_pPrevPage->SetText(VclResId(STR_WIZDLG_PREVIOUS));
+        m_pPrevPage->Show();
+        m_pPrevPage->set_id(u"previous"_ustr);
+        AddButton( m_pPrevPage, ( WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X) );     
 // half x-offset to the next button
+        mpPrevBtn = m_pPrevPage;
+        m_pPrevPage->SetClickHdl( LINK( this, RoadmapWizard, OnPrevPage ) );
 
         // the next button
-        if (_nButtonFlags & WizardButtonFlags::NEXT)
-        {
-            m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
-            m_pNextPage->SetHelpId( HID_WIZARD_NEXT );
-            m_pNextPage->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
-            m_pNextPage->SetText(VclResId(STR_WIZDLG_NEXT));
-            m_pNextPage->Show();
-            m_pNextPage->set_id(u"next"_ustr);
-
-            AddButton( m_pNextPage, WIZARDDIALOG_BUTTON_STDOFFSET_X );
-            mpNextBtn = m_pNextPage;
-            m_pNextPage->SetClickHdl( LINK( this, RoadmapWizard, OnNextPage ) 
);
-        }
+        m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
+        m_pNextPage->SetHelpId( HID_WIZARD_NEXT );
+        m_pNextPage->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
+        m_pNextPage->SetText(VclResId(STR_WIZDLG_NEXT));
+        m_pNextPage->Show();
+        m_pNextPage->set_id(u"next"_ustr);
+        AddButton( m_pNextPage, WIZARDDIALOG_BUTTON_STDOFFSET_X );
+        mpNextBtn = m_pNextPage;
+        m_pNextPage->SetClickHdl( LINK( this, RoadmapWizard, OnNextPage ) );
 
         // the finish button
-        if (_nButtonFlags & WizardButtonFlags::FINISH)
-        {
-            m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP);
-            m_pFinish->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
-            m_pFinish->SetText(VclResId(STR_WIZDLG_FINISH));
-            m_pFinish->Show();
-            m_pFinish->set_id(u"finish"_ustr);
-
-            AddButton( m_pFinish, WIZARDDIALOG_BUTTON_STDOFFSET_X );
-            m_pFinish->SetClickHdl( LINK( this, RoadmapWizard, OnFinish ) );
-        }
+        m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP);
+        m_pFinish->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
+        m_pFinish->SetText(VclResId(STR_WIZDLG_FINISH));
+        m_pFinish->Show();
+        m_pFinish->set_id(u"finish"_ustr);
+        AddButton( m_pFinish, WIZARDDIALOG_BUTTON_STDOFFSET_X );
+        m_pFinish->SetClickHdl( LINK( this, RoadmapWizard, OnFinish ) );
 
         // the cancel button
-        if (_nButtonFlags & WizardButtonFlags::CANCEL)
-        {
-            m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
-            m_pCancel->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
-            m_pCancel->Show();
-
-            AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
-        }
+        m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
+        m_pCancel->SetSizePixel(LogicToPixel(Size(50, 14), 
MapMode(MapUnit::MapAppFont)));
+        m_pCancel->Show();
+        AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
     }
 
     void RoadmapWizard::Resize()

Reply via email to