vcl/inc/wizdlg.hxx                          |   32 +---------------
 vcl/source/control/roadmapwizard.cxx        |   56 +---------------------------
 vcl/source/control/roadmapwizardmachine.cxx |   13 +-----
 3 files changed, 8 insertions(+), 93 deletions(-)

New commits:
commit fff9dcb058ae06bacc87f402a7df181dd032bfc0
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 19 11:02:52 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 19 23:30:53 2025 +0200

    vcl: Drop RoadmapWizard::GetOrCreatePage
    
    As is obvious since
    
        Change-Id: Ib45aac9d75a8b3d2f71e92b08ec19863cb9acb00
        Author: Michael Weghorn <[email protected]>
        Date:   Mon May 19 10:45:20 2025 +0200
    
            vcl: Don't search in always empty map
    
    , RoadmapWizard::createPage always returns nullptr.
    
    This also means that RoadmapWizard::GetOrCreatePage
    doesn't insert any "real" pages (and a `DBG_ASSERT`
    for the null page would already have been triggered),
    but may at most result in dummy pages getting added.
    That doesn't seem useful, so drop it altogether.
    
    If anything was relying on the code path triggering
    a `DBG_ASSERT` inserting dummy pages, that caller
    of RoadmapWizard::ShowPage should most likely be adjusted.
    
    Change-Id: I7a3e711073bd64cc8cbae004ac33c82e268bf280
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185513
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index 242a88f705ff..edec50ab0b82 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -182,10 +182,6 @@ namespace vcl
         FactoryFunction GetUITestFactory() const override;
 
     private:
-
-        /// to override to create new pages
-        static VclPtr<TabPage> createPage(WizardTypes::WizardState nState);
-
         /** determine the next state to travel from the given one
 
             This method ensures that traveling happens along the active path.
@@ -269,8 +265,6 @@ namespace vcl
         bool                   isTravelingSuspended() const;
 
     private:
-        void GetOrCreatePage(const WizardTypes::WizardState i_nState);
-
         void             ImplCalcSize( Size& rSize );
         void             ImplPosCtrls();
         void             ImplPosTabPage();
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 1f3a26607984..5eb8bb677c52 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -556,36 +556,9 @@ namespace vcl
         return Dialog::EventNotify( rNEvt );
     }
 
-    void RoadmapWizard::GetOrCreatePage( const WizardTypes::WizardState 
i_nState )
-    {
-        if ( nullptr != GetPage( i_nState ) )
-            return;
-
-        VclPtr<TabPage> pNewPage = createPage( i_nState );
-        DBG_ASSERT( pNewPage, "RoadmapWizard::GetOrCreatePage: invalid new 
page (NULL)!" );
-
-        // fill up the page sequence of our base class (with dummies)
-        while ( m_xWizardImpl->nFirstUnknownPage < i_nState )
-        {
-            AddPage( nullptr );
-            ++m_xWizardImpl->nFirstUnknownPage;
-        }
-
-        if ( m_xWizardImpl->nFirstUnknownPage == i_nState )
-        {
-            // encountered this page number the first time
-            AddPage( pNewPage );
-            ++m_xWizardImpl->nFirstUnknownPage;
-        }
-        else
-            // already had this page - just change it
-            SetPage( i_nState, pNewPage );
-    }
-
     void RoadmapWizard::ShowPage(sal_uInt16 nLevel)
     {
         mnCurLevel = nLevel;
-        GetOrCreatePage(mnCurLevel);
 
         // synchronize the roadmap
         implUpdateRoadmap();
@@ -1019,12 +992,6 @@ namespace vcl
         return OUString();
     }
 
-    VclPtr<TabPage> RoadmapWizard::createPage( WizardTypes::WizardState /* 
_nState */)
-    {
-        SAL_WARN("vcl", "RoadmapWizard::createPage: no default implementation 
available for this state!");
-        return nullptr;
-    }
-
     void RoadmapWizard::InsertRoadmapItem(int nItemIndex, const OUString& 
rText, int nItemId, bool bEnable)
     {
         m_xRoadmapImpl->pRoadmap->InsertRoadmapItem(nItemIndex, rText, 
nItemId, bEnable);
commit 0b3cf125e5ef2295485b9f779a880113e69fc34a
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon May 19 10:45:20 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon May 19 23:30:43 2025 +0200

    vcl: Don't search in always empty map
    
    RoadmapWizardImpl::aStateDescriptors is always empty,
    as entries are never inserted. Therefore, drop it
    altogether instead of trying to find (non-existent)
    entries.
    
    Before
    
        commit 6fb45286490f866013c90a9d5dc4d296e67c7d04
        Date:   Sun Sep 1 13:42:22 2019 +0200
    
            loplugin:unusedmethods
    
    , there was a RoadmapWizard::describeState that
    would have inserted entries into the map, but
    it was already unused back then.
    
    This makes clearer that some methods don't actually
    do anything useful, which might be worth investigating
    further.
    
    Change-Id: Ib45aac9d75a8b3d2f71e92b08ec19863cb9acb00
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185512
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index fda45e0818b3..242a88f705ff 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -44,13 +44,6 @@ struct ImplWizButtonData
 
 namespace vcl
 {
-    class RoadmapWizard;
-
-    namespace RoadmapWizardTypes
-    {
-        typedef VclPtr<TabPage> (* RoadmapPageFactory)( RoadmapWizard& );
-    };
-
     using namespace RoadmapWizardTypes;
     namespace
     {
@@ -60,14 +53,6 @@ namespace vcl
             PathId,
             WizardPath
             > Paths;
-
-        typedef ::std::map<
-            WizardTypes::WizardState,
-            ::std::pair<
-                OUString,
-                RoadmapPageFactory
-                >
-            > StateDescriptions;
     }
 
     struct RoadmapWizardImpl
@@ -76,7 +61,6 @@ namespace vcl
         std::map<VclPtr<vcl::Window>, short> maResponses;
         Paths               aPaths;
         PathId              nActivePath;
-        StateDescriptions   aStateDescriptors;
         StateSet            aDisabledStates;
         bool                bActivePathIsDefinite;
 
@@ -200,7 +184,7 @@ namespace vcl
     private:
 
         /// to override to create new pages
-        VclPtr<TabPage>     createPage(WizardTypes::WizardState nState);
+        static VclPtr<TabPage> createPage(WizardTypes::WizardState nState);
 
         /** determine the next state to travel from the given one
 
@@ -262,14 +246,8 @@ namespace vcl
         */
         WizardTypes::WizardState getCurrentState() const { return 
GetCurLevel(); }
 
-        /** returns a human readable name for a given state
-
-            There is a default implementation for this method, which returns 
the display name
-            as given in a call to describeState. If there is no description 
for the given state,
-            this is worth an assertion in a non-product build, and then an 
empty string is
-            returned.
-        */
-        OUString  getStateDisplayName(WizardTypes::WizardState nState) const;
+        /** returns a human readable name for a given state */
+        static OUString getStateDisplayName(WizardTypes::WizardState nState);
 
         DECL_LINK( OnRoadmapItemSelected, LinkParamNone*, void );
 
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index f67980111c59..1f3a26607984 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -1013,33 +1013,16 @@ namespace vcl
             m_xRoadmapImpl->pRoadmap->SelectRoadmapItemByID( getCurrentState() 
);
     }
 
-    OUString RoadmapWizard::getStateDisplayName( WizardTypes::WizardState 
_nState ) const
+    OUString RoadmapWizard::getStateDisplayName( WizardTypes::WizardState /* 
_nState */)
     {
-        OUString sDisplayName;
-
-        StateDescriptions::const_iterator pos = 
m_xRoadmapImpl->aStateDescriptors.find( _nState );
-        OSL_ENSURE( pos != m_xRoadmapImpl->aStateDescriptors.end(),
-            "RoadmapWizard::getStateDisplayName: no default implementation 
available for this state!" );
-        if ( pos != m_xRoadmapImpl->aStateDescriptors.end() )
-            sDisplayName = pos->second.first;
-
-        return sDisplayName;
+        SAL_WARN("vcl", "RoadmapWizard::getStateDisplayName: no name available 
for this state!");
+        return OUString();
     }
 
-    VclPtr<TabPage> RoadmapWizard::createPage( WizardTypes::WizardState 
_nState )
+    VclPtr<TabPage> RoadmapWizard::createPage( WizardTypes::WizardState /* 
_nState */)
     {
-        VclPtr<TabPage> pPage;
-
-        StateDescriptions::const_iterator pos = 
m_xRoadmapImpl->aStateDescriptors.find( _nState );
-        OSL_ENSURE( pos != m_xRoadmapImpl->aStateDescriptors.end(),
-            "RoadmapWizard::createPage: no default implementation available 
for this state!" );
-        if ( pos != m_xRoadmapImpl->aStateDescriptors.end() )
-        {
-            RoadmapPageFactory pFactory = pos->second.second;
-            pPage = (*pFactory)( *this );
-        }
-
-        return pPage;
+        SAL_WARN("vcl", "RoadmapWizard::createPage: no default implementation 
available for this state!");
+        return nullptr;
     }
 
     void RoadmapWizard::InsertRoadmapItem(int nItemIndex, const OUString& 
rText, int nItemId, bool bEnable)
diff --git a/vcl/source/control/roadmapwizardmachine.cxx 
b/vcl/source/control/roadmapwizardmachine.cxx
index 754f0956398b..8d523e9cd457 100644
--- a/vcl/source/control/roadmapwizardmachine.cxx
+++ b/vcl/source/control/roadmapwizardmachine.cxx
@@ -299,17 +299,10 @@ namespace vcl
         implUpdateRoadmap();
     }
 
-    OUString RoadmapWizardMachine::getStateDisplayName( 
WizardTypes::WizardState _nState ) const
+    OUString RoadmapWizardMachine::getStateDisplayName( 
WizardTypes::WizardState /* _nState */) const
     {
-        OUString sDisplayName;
-
-        StateDescriptions::const_iterator pos = 
m_pImpl->aStateDescriptors.find( _nState );
-        OSL_ENSURE( pos != m_pImpl->aStateDescriptors.end(),
-                   "RoadmapWizard::getStateDisplayName: no default 
implementation available for this state!" );
-        if ( pos != m_pImpl->aStateDescriptors.end() )
-            sDisplayName = pos->second.first;
-
-        return sDisplayName;
+        SAL_WARN("vcl", "RoadmapWizardMachine::getStateDisplayName: no default 
implementation available");
+        return OUString();
     }
 
     void RoadmapWizardMachine::enableState( WizardTypes::WizardState _nState, 
bool _bEnable )

Reply via email to