inherit from one class

Change-Id: Ia3cb14429a42e445c14cecc20728d59d985f4b5d
Reviewed-on: https://gerrit.libreoffice.org/78837
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index 85f263b..adf1a52 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -33,6 +33,8 @@

using namespace css;

using vcl::RoadmapWizardTypes::WizardPath;

namespace chart
{
#define PATH_FULL   1
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index db64d9d..ae50675 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -30,6 +30,9 @@
namespace com { namespace sun { namespace star { namespace chart2 { class XChartDocument; } } } }
namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace chart
{

diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx
index 9e6fef0..af03675 100644
--- a/dbaccess/source/ui/dlg/dbwiz.cxx
+++ b/dbaccess/source/ui/dlg/dbwiz.cxx
@@ -105,9 +105,9 @@ IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage&, _rTabPage, void)
    enableButtons(WizardButtonFlags::FINISH,!bURLRequired);
}

vcl::WizardTypes::WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) const
WizardState ODbTypeWizDialog::determineNextState( WizardState _nCurrentState ) const
{
    WizardTypes::WizardState nNextState = WZS_INVALID_STATE;
    WizardState nNextState = WZS_INVALID_STATE;
    switch(_nCurrentState)
    {
        case START_PAGE:
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index cc901bd..e37edfa 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -99,6 +99,8 @@ using namespace ::com::sun::star::document;
using namespace ::comphelper;
using namespace ::cppu;

using vcl::RoadmapWizardTypes::WizardPath;

// ODbTypeWizDialogSetup
ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
                               ,SfxItemSet const * _pItems
@@ -152,7 +154,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
    for(PathId i = 1;aIter != aEnd;++aIter,++i)
    {
        const OUString& sURLPrefix = aIter.getURLPrefix();
        vcl::RoadmapWizardTypes::WizardPath aPath;
        WizardPath aPath;
        aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
        m_pCollection->fillPageIds(sURLPrefix,aPath);
        aPath.push_back(PAGE_DBSETUPWIZARD_AUTHENTIFICATION);
@@ -161,7 +163,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
        declareAuthDepPath(sURLPrefix,i,aPath);
    }

    vcl::RoadmapWizardTypes::WizardPath aPath;
    WizardPath aPath;
    aPath.push_back(PAGE_DBSETUPWIZARD_INTRO);
    declarePath( static_cast<PathId>(m_pCollection->size()+1), aPath);

@@ -174,7 +176,7 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
    m_xAssistant->set_current_page(0);
}

void ODbTypeWizDialogSetup::declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const vcl::RoadmapWizardTypes::WizardPath& _rPaths)
void ODbTypeWizDialogSetup::declareAuthDepPath( const OUString& _sURL, PathId _nPathId, const WizardPath& _rPaths)
{
    bool bHasAuthentication = DataSourceMetaData::getAuthentication( _sURL ) != AuthNone;

@@ -191,7 +193,7 @@ void ODbTypeWizDialogSetup::declareAuthDepPath( const OUString& _sURL, PathId _n
    ::vcl::RoadmapWizardMachine::declarePath( _nPathId, aPath );
}

OUString ODbTypeWizDialogSetup::getStateDisplayName( WizardState _nState ) const
OUString ODbTypeWizDialogSetup::getStateDisplayName(WizardState _nState) const
{
    OUString sRoadmapItem;
    switch( _nState )
@@ -596,7 +598,7 @@ IMPL_LINK_NOARG(ODbTypeWizDialogSetup, OnRecentDocumentSelected, OGeneralPageWiz

IMPL_LINK_NOARG(ODbTypeWizDialogSetup, OnSingleDocumentChosen, OGeneralPageWizard&, void)
{
    if ( prepareLeaveCurrentState( eFinish ) )
    if (prepareLeaveCurrentState(WizardTypes::eFinish))
        onFinish();
}

diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 8d1cd43..53fb201 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -286,7 +286,7 @@ namespace dbaui
        // checks if the type is supported in the destination database
        bool supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType);

        virtual VclPtr<TabPage> createPage(WizardState /*nState*/) override
        virtual VclPtr<TabPage> createPage(vcl::WizardTypes::WizardState /*nState*/) override
        {
            assert(false);
            return nullptr;
diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx
index 468efc9..8773477 100644
--- a/dbaccess/source/ui/inc/dbwiz.hxx
+++ b/dbaccess/source/ui/inc/dbwiz.hxx
@@ -38,6 +38,9 @@ namespace com { namespace sun { namespace star {
    }
}}}

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace dbaccess
{
    class ODsnTypeCollection;
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index 16969b4..4747397 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -40,6 +40,10 @@ namespace com { namespace sun { namespace star {
    }
}}}

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;
using vcl::RoadmapWizardTypes::PathId;

namespace dbaui
{

diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx
index 865252a..02eca7b 100644
--- a/extensions/source/abpilot/abspilot.cxx
+++ b/extensions/source/abpilot/abspilot.cxx
@@ -33,6 +33,7 @@
#include "fieldmappingpage.hxx"
#include "fieldmappingimpl.hxx"

using vcl::RoadmapWizardTypes::PathId;

namespace abp
{
@@ -215,7 +216,7 @@ namespace abp
        if ( !OAddressBookSourcePilot_Base::prepareLeaveCurrentState( _eReason ) )
            return false;

        if ( _eReason == eTravelBackward )
        if ( _eReason == vcl::WizardTypes::eTravelBackward )
            return true;

        bool bAllow = true;
diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx
index 2ff0459..2a3ed894 100644
--- a/extensions/source/abpilot/abspilot.hxx
+++ b/extensions/source/abpilot/abspilot.hxx
@@ -24,6 +24,9 @@
#include "addresssettings.hxx"
#include "datasourcehandling.hxx"

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace abp
{
    typedef ::vcl::RoadmapWizardMachine OAddressBookSourcePilot_Base;
diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx
index b38d58f..a0756f6 100644
--- a/extensions/source/dbpilots/gridwizard.hxx
+++ b/extensions/source/dbpilots/gridwizard.hxx
@@ -23,6 +23,8 @@
#include "controlwizard.hxx"
#include "commonpagesdbp.hxx"

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace dbp
{
diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx
index 01db875..903ac01 100644
--- a/extensions/source/dbpilots/groupboxwiz.hxx
+++ b/extensions/source/dbpilots/groupboxwiz.hxx
@@ -23,6 +23,8 @@
#include "controlwizard.hxx"
#include "commonpagesdbp.hxx"

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace dbp
{
diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx
index 4000632..1ecafaf 100644
--- a/extensions/source/dbpilots/listcombowizard.hxx
+++ b/extensions/source/dbpilots/listcombowizard.hxx
@@ -23,11 +23,12 @@
#include "controlwizard.hxx"
#include "commonpagesdbp.hxx"

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace dbp
{


#define LCW_STATE_DATASOURCE_SELECTION  0
#define LCW_STATE_TABLESELECTION        1
#define LCW_STATE_FIELDSELECTION        2
diff --git a/include/vcl/roadmapwizard.hxx b/include/vcl/roadmapwizard.hxx
index 2bd523d..9670c84 100644
--- a/include/vcl/roadmapwizard.hxx
+++ b/include/vcl/roadmapwizard.hxx
@@ -29,11 +29,10 @@ namespace vcl
    struct RoadmapWizardImpl;
    class RoadmapWizard;

    struct RoadmapWizardTypes
    namespace RoadmapWizardTypes
    {
    public:
        typedef sal_Int16                                   PathId;
        typedef ::std::vector< vcl::WizardTypes::WizardState >   WizardPath;
        typedef ::std::vector< WizardTypes::WizardState >   WizardPath;
        typedef VclPtr<TabPage> (* RoadmapPageFactory)( RoadmapWizard& );
    };

@@ -59,7 +58,7 @@ namespace vcl
        <code>n2</code>, which share at least the first <code>k</code> states (where <code>k</code>
        is at least 1), and an arbitrary number of other states.
    */
    class VCL_DLLPUBLIC RoadmapWizard : public vcl::OWizardMachine, public RoadmapWizardTypes
    class VCL_DLLPUBLIC RoadmapWizard : public vcl::OWizardMachine
    {
    private:
        std::unique_ptr<RoadmapWizardImpl>  m_pImpl;
@@ -83,7 +82,7 @@ namespace vcl
        void            ShowRoadmap(bool bShow);

        // returns whether a given state is enabled
        bool            isStateEnabled( WizardState _nState ) const;
        bool            isStateEnabled( WizardTypes::WizardState _nState ) const;

        // WizardDialog overridables
        virtual bool    canAdvance() const override;
@@ -107,7 +106,7 @@ namespace vcl
                the unique id you wish to give this path. This id can later on be used
                to refer to the path which you just declared
        */
        void    declarePath( PathId _nPathId, const WizardPath& _lWizardStates);
        void    declarePath( RoadmapWizardTypes::PathId _nPathId, const RoadmapWizardTypes::WizardPath& _lWizardStates);

        /** activates a path which has previously been declared with <member>declarePath</member>

@@ -140,7 +139,7 @@ namespace vcl
                already declared), then only steps <code>0</code> and <code>1</code> are activated,
                since they are common to both paths.
        */
        void    activatePath( PathId _nPathId, bool _bDecideForIt = false );
        void    activatePath( RoadmapWizardTypes::PathId _nPathId, bool _bDecideForIt = false );

        /** determine the next state to travel from the given one

@@ -149,7 +148,7 @@ namespace vcl

            @see activatePath
        */
        virtual WizardState     determineNextState( WizardState _nCurrentState ) const override;
        virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const override;

        /** en- or disables a state

@@ -171,14 +170,14 @@ namespace vcl

            @see declarePath
        */
        void    enableState( WizardState _nState, bool _bEnable = true );
        void    enableState(WizardTypes::WizardState nState, bool _bEnable = true);

        /** returns true if and only if the given state is known in at least one declared path
        */
        bool    knowsState( WizardState _nState ) const;
        bool    knowsState(WizardTypes::WizardState nState) const;

        // OWizardMachine overriables
        virtual void            enterState( WizardState _nState ) override;
        virtual void            enterState(WizardTypes::WizardState nState) override;

        /** returns a human readable name for a given state

@@ -187,14 +186,14 @@ namespace vcl
            this is worth an assertion in a non-product build, and then an empty string is
            returned.
        */
        virtual OUString  getStateDisplayName( WizardState _nState ) const;
        virtual OUString  getStateDisplayName(WizardTypes::WizardState nState) const;

        /** creates a page for a given state

            This member is inherited from OWizardMachine, and default-implemented in this class
            for all states which have been described using describeState.
        */
        virtual VclPtr<TabPage> createPage( WizardState _nState ) override;
        virtual VclPtr<TabPage> createPage(WizardTypes::WizardState nState) override;

    private:
        DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, LinkParamNone*, void );
@@ -208,7 +207,7 @@ namespace vcl
        VCL_DLLPRIVATE void impl_construct();
    };

    class VCL_DLLPUBLIC RoadmapWizardMachine : public vcl::WizardMachine, public RoadmapWizardTypes
    class VCL_DLLPUBLIC RoadmapWizardMachine : public vcl::WizardMachine
    {
    private:
        std::unique_ptr<RoadmapWizardImpl>  m_pImpl;
@@ -220,7 +219,7 @@ namespace vcl
        void            SetRoadmapHelpId( const OString& _rId );

        // returns whether a given state is enabled
        bool            isStateEnabled( WizardState _nState ) const;
        bool            isStateEnabled(WizardTypes::WizardState nState) const;

        // WizardDialog overridables
        virtual bool    canAdvance() const override;
@@ -244,7 +243,7 @@ namespace vcl
                the unique id you wish to give this path. This id can later on be used
                to refer to the path which you just declared
        */
        void    declarePath( PathId _nPathId, const WizardPath& _lWizardStates);
        void    declarePath( RoadmapWizardTypes::PathId _nPathId, const RoadmapWizardTypes::WizardPath& _lWizardStates);

        /** activates a path which has previously been declared with <member>declarePath</member>

@@ -277,7 +276,7 @@ namespace vcl
                already declared), then only steps <code>0</code> and <code>1</code> are activated,
                since they are common to both paths.
        */
        void    activatePath( PathId _nPathId, bool _bDecideForIt = false );
        void    activatePath( RoadmapWizardTypes::PathId _nPathId, bool _bDecideForIt = false );

        /** determine the next state to travel from the given one

@@ -286,7 +285,7 @@ namespace vcl

            @see activatePath
        */
        virtual WizardState     determineNextState( WizardState _nCurrentState ) const override;
        virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const override;

        /** en- or disables a state

@@ -308,10 +307,10 @@ namespace vcl

            @see declarePath
        */
        void    enableState( WizardState _nState, bool _bEnable = true );
        void    enableState(WizardTypes::WizardState nState, bool _bEnable = true);

        // OWizardMachine overriables
        virtual void            enterState( WizardState _nState ) override;
        virtual void            enterState(WizardTypes::WizardState nState) override;

        /** returns a human readable name for a given state

@@ -320,7 +319,7 @@ namespace vcl
            this is worth an assertion in a non-product build, and then an empty string is
            returned.
        */
        virtual OUString  getStateDisplayName( WizardState _nState ) const;
        virtual OUString  getStateDisplayName(WizardTypes::WizardState nState) const;

    private:
        DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, const OString&, bool );
diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
index c610094..e3c4679 100644
--- a/include/vcl/wizardmachine.hxx
+++ b/include/vcl/wizardmachine.hxx
@@ -34,17 +34,13 @@ namespace weld {
struct ImplWizPageData;
struct ImplWizButtonData;

// wizard states
#define WZS_INVALID_STATE (::vcl::WizardTypes::WizardState(-1))

namespace vcl
{


// wizard states
#define WZS_INVALID_STATE       (WizardState(-1))


    //= WizardTypes

    struct WizardTypes
    namespace WizardTypes
    {
        typedef sal_Int16  WizardState;
        enum CommitPageReason
@@ -82,12 +78,9 @@ namespace vcl
        ~IWizardPageController() {}
    };


    //= OWizardPage

    class VCL_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController
    {

    public:
        /** @param _pParent
                if the OWizardPage is used in an OWizardMachine, this parameter
@@ -118,9 +111,7 @@ namespace vcl
        void                updateDialogTravelUI();
    };


    //= OWizardMachine

    struct WizardMachineImplData;
    /** implements some kind of finite automata, where the states of the automata exactly correlate
        with tab pages.
@@ -137,8 +128,7 @@ namespace vcl
        on the actual data presented in the wizard (e.g. checkboxes checked, or something like this),
        they can implement non-linear traveling this way.
    */

    class VCL_DLLPUBLIC OWizardMachine : public ModalDialog, public WizardTypes
    class VCL_DLLPUBLIC OWizardMachine : public ModalDialog
    {
    private:
        Idle                    maWizardLayoutIdle;
@@ -257,10 +247,10 @@ namespace vcl
        // our own overridables

        /// to override to create new pages
        virtual VclPtr<TabPage> createPage(WizardState _nState) = 0;
        virtual VclPtr<TabPage> createPage(WizardTypes::WizardState _nState) = 0;

        /// will be called when a new page is about to be displayed
        virtual void        enterState(WizardState _nState);
        virtual void        enterState(WizardTypes::WizardState _nState);

        /** will be called when the current state is about to be left for the given reason

@@ -272,7 +262,7 @@ namespace vcl
            @return
                <TRUE/> if and only if the page is allowed to be left
        */
        virtual bool        prepareLeaveCurrentState( CommitPageReason _eReason );
        virtual bool        prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason );

        /** will be called when the given state is left

@@ -286,7 +276,7 @@ namespace vcl
            @return
                <TRUE/> if and only if the page is allowed to be left
        */
        virtual bool        leaveState( WizardState _nState );
        virtual bool        leaveState(WizardTypes::WizardState _nState);

        /** determine the next state to travel from the given one

@@ -294,7 +284,7 @@ namespace vcl

            Return WZS_INVALID_STATE to prevent traveling.
        */
        virtual WizardState determineNextState( WizardState _nCurrentState ) const;
        virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const;

        /** called when the finish button is pressed
            <p>By default, only the base class' Finish method (which is not virtual) is called</p>
@@ -317,7 +307,7 @@ namespace vcl

        /** removes a page from the history. Should be called when the page is being disabled
        */
        void                removePageFromHistory( WizardState nToRemove );
        void                removePageFromHistory(WizardTypes::WizardState nToRemove);

        /** skip a state

@@ -349,7 +339,7 @@ namespace vcl
            @see skip
            @see skipBackwardUntil
        */
        bool                    skipUntil( WizardState _nTargetState );
        bool                    skipUntil(WizardTypes::WizardState nTargetState);

        /** moves back one or more states, until a given state is reached

@@ -367,20 +357,20 @@ namespace vcl
            @see skipUntil
            @see skip
        */
        bool                    skipBackwardUntil( WizardState _nTargetState );
        bool                    skipBackwardUntil(WizardTypes::WizardState nTargetState);

        /** returns the current state of the machine

            Vulgo, this is the identifier of the current tab page :)
        */
        WizardState             getCurrentState() const { return GetCurLevel(); }
        WizardTypes::WizardState getCurrentState() const { return GetCurLevel(); }

        virtual IWizardPageController*
                                getPageController( TabPage* _pCurrentPage ) const;

        /** retrieves a copy of the state history, i.e. all states we already visited
        */
        void                    getStateHistory( ::std::vector< WizardState >& _out_rHistory );
        void                    getStateHistory(std::vector<WizardTypes::WizardState>& out_rHistory);

    public:
        class AccessGuard
@@ -395,7 +385,7 @@ namespace vcl
        bool                   isTravelingSuspended() const;

    protected:
        TabPage* GetOrCreatePage( const WizardState i_nState );
        TabPage* GetOrCreatePage(const WizardTypes::WizardState i_nState);

    private:
        VCL_DLLPRIVATE void             ImplInitData();
@@ -415,12 +405,12 @@ namespace vcl
        VCL_DLLPRIVATE void     implConstruct( const WizardButtonFlags _nButtonFlags );
    };

    class VCL_DLLPUBLIC WizardMachine : public weld::AssistantController, public WizardTypes
    class VCL_DLLPUBLIC WizardMachine : public weld::AssistantController
    {
    private:
        VclPtr<TabPage> m_xCurTabPage;

        WizardState m_nCurState;
        WizardTypes::WizardState m_nCurState;
        ImplWizPageData* m_pFirstPage;

    protected:
@@ -439,15 +429,15 @@ namespace vcl
        virtual ~WizardMachine() override;

        bool Finish(short nResult = RET_CANCEL);
        bool ShowPage(WizardState nState);
        bool ShowPage(WizardTypes::WizardState nState);

        bool ShowNextPage();
        bool ShowPrevPage();

        void                AddPage( TabPage* pPage );
        void                RemovePage( TabPage* pPage );
        void                SetPage( WizardState nLevel, TabPage* pPage );
        TabPage*            GetPage( WizardState eState ) const;
        void                SetPage( WizardTypes::WizardState nLevel, TabPage* pPage );
        TabPage*            GetPage( WizardTypes::WizardState eState ) const;

        /// enable (or disable) buttons
        void                enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable);
@@ -477,10 +467,10 @@ namespace vcl
        // our own overridables

        /// to override to create new pages
        virtual VclPtr<TabPage> createPage(WizardState _nState) = 0;
        virtual VclPtr<TabPage> createPage(WizardTypes::WizardState _nState) = 0;

        /// will be called when a new page is about to be displayed
        virtual void        enterState(WizardState _nState);
        virtual void        enterState(WizardTypes::WizardState _nState);

        /** will be called when the current state is about to be left for the given reason

@@ -492,7 +482,7 @@ namespace vcl
            @return
                <TRUE/> if and only if the page is allowed to be left
        */
        virtual bool        prepareLeaveCurrentState( CommitPageReason _eReason );
        virtual bool        prepareLeaveCurrentState( WizardTypes::CommitPageReason eReason );

        /** will be called when the given state is left

@@ -506,7 +496,7 @@ namespace vcl
            @return
                <TRUE/> if and only if the page is allowed to be left
        */
        virtual bool        leaveState( WizardState _nState );
        virtual bool        leaveState(WizardTypes::WizardState nState);

        /** determine the next state to travel from the given one

@@ -514,7 +504,7 @@ namespace vcl

            Return WZS_INVALID_STATE to prevent traveling.
        */
        virtual WizardState determineNextState( WizardState _nCurrentState ) const;
        virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const;

        /** called when the finish button is pressed
            <p>By default, only the base class' Finish method (which is not virtual) is called</p>
@@ -537,7 +527,7 @@ namespace vcl

        /** removes a page from the history. Should be called when the page is being disabled
        */
        void                removePageFromHistory( WizardState nToRemove );
        void                removePageFromHistory(WizardTypes::WizardState nToRemove);

        /** skip a state

@@ -569,7 +559,7 @@ namespace vcl
            @see skip
            @see skipBackwardUntil
        */
        bool                    skipUntil( WizardState _nTargetState );
        bool                    skipUntil(WizardTypes::WizardState nTargetState);

        /** moves back one or more states, until a given state is reached

@@ -587,20 +577,20 @@ namespace vcl
            @see skipUntil
            @see skip
        */
        bool                    skipBackwardUntil( WizardState _nTargetState );
        bool                    skipBackwardUntil(WizardTypes::WizardState nTargetState);

        /** returns the current state of the machine

            Vulgo, this is the identifier of the current tab page :)
        */
        WizardState             getCurrentState() const { return m_nCurState; }
        WizardTypes::WizardState getCurrentState() const { return m_nCurState; }

        virtual IWizardPageController*
                                getPageController( TabPage* _pCurrentPage ) const;

        /** retrieves a copy of the state history, i.e. all states we already visited
        */
        void                    getStateHistory( ::std::vector< WizardState >& _out_rHistory );
        void                    getStateHistory(std::vector<WizardTypes::WizardState>& out_rHistory);

    public:
        class AccessGuard
@@ -615,7 +605,7 @@ namespace vcl
        bool                   isTravelingSuspended() const;

    protected:
        TabPage* GetOrCreatePage( const WizardState i_nState );
        TabPage* GetOrCreatePage(const WizardTypes::WizardState i_nState);

    private:
        DECL_DLLPRIVATE_LINK(OnNextPage, weld::Button&, void);
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 539dd7c..4b8b6e9 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -25,6 +25,8 @@

#include <com/sun/star/ui/dialogs/WizardTravelType.hpp>

using vcl::RoadmapWizardTypes::WizardPath;

namespace svt { namespace uno
{

diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index 320d31e..6217f58 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -26,6 +26,8 @@
#include <map>
#include <memory>

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

namespace svt { namespace uno
{
@@ -76,7 +78,7 @@ namespace svt { namespace uno

        void        activatePath( const sal_Int16 i_nPathID, const bool i_bFinal )
        {
            WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal );
            WizardShell_Base::activatePath( vcl::RoadmapWizardTypes::PathId( i_nPathID ), i_bFinal );
        }

        css::uno::Reference< css::ui::dialogs::XWizardPage >
@@ -95,14 +97,14 @@ namespace svt { namespace uno
        }

    private:
        sal_Int16   impl_stateToPageId( const WizardTypes::WizardState i_nState ) const
        sal_Int16   impl_stateToPageId( const WizardState i_nState ) const
        {
            return static_cast< sal_Int16 >( i_nState + m_nFirstPageID );
        }

        WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const
        {
            return static_cast< WizardState >( i_nPageId - m_nFirstPageID );
            return static_cast<WizardState>(i_nPageId - m_nFirstPageID);
        }

        PWizardPageController impl_getController( TabPage* i_pPage ) const;
diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx
index 96407c1..3b1e332 100644
--- a/sw/source/uibase/inc/mailmergewizard.hxx
+++ b/sw/source/uibase/inc/mailmergewizard.hxx
@@ -25,6 +25,9 @@
class SwView;
class SwMailMergeConfigItem;

using vcl::WizardTypes::WizardState;
using vcl::WizardTypes::CommitPageReason;

#define MM_DOCUMENTSELECTPAGE   0
#define MM_OUTPUTTYPETPAGE      1
#define MM_ADDRESSBLOCKPAGE     2
diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx
index 04d11bc..f1c49d5 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -33,25 +33,27 @@

namespace vcl
{
    using namespace RoadmapWizardTypes;

    namespace
    {
        typedef ::std::set< WizardTypes::WizardState > StateSet;

        typedef ::std::map<
                    RoadmapWizardTypes::PathId,
                    RoadmapWizardTypes::WizardPath
                    PathId,
                    WizardPath
                > Paths;

        typedef ::std::map<
                    WizardTypes::WizardState,
                    ::std::pair<
                        OUString,
                        RoadmapWizardTypes::RoadmapPageFactory
                        RoadmapPageFactory
                    >
                > StateDescriptions;
    }

    struct RoadmapWizardImpl : public RoadmapWizardTypes
    struct RoadmapWizardImpl
    {
        ScopedVclPtr<ORoadmap> pRoadmap;
        Paths               aPaths;
@@ -362,7 +364,7 @@ namespace vcl
                    // there is an item with this index in the roadmap - does it match what is requested by
                    // the respective state in the active path?
                    RoadmapTypes::ItemId nPresentItemId = m_pImpl->pRoadmap->GetItemID( nItemIndex );
                    WizardState nRequiredState = rActivePath[ nItemIndex ];
                    WizardTypes::WizardState nRequiredState = rActivePath[ nItemIndex ];
                    if ( nPresentItemId != nRequiredState )
                    {
                        m_pImpl->pRoadmap->DeleteRoadmapItem( nItemIndex );
@@ -376,7 +378,7 @@ namespace vcl
                bInsertItem = bNeedItem;
            }

            WizardState nState( rActivePath[ nItemIndex ] );
            WizardTypes::WizardState nState( rActivePath[ nItemIndex ] );
            if ( bInsertItem )
            {
                m_pImpl->pRoadmap->InsertRoadmapItem(
@@ -470,7 +472,7 @@ namespace vcl
                    // there is an item with this index in the roadmap - does it match what is requested by
                    // the respective state in the active path?
                    RoadmapTypes::ItemId nPresentItemId = m_xAssistant->get_page_ident(nItemIndex).toInt32();
                    WizardState nRequiredState = rActivePath[ nItemIndex ];
                    WizardTypes::WizardState nRequiredState = rActivePath[ nItemIndex ];
                    if ( nPresentItemId != nRequiredState )
                    {
                        m_xAssistant->set_page_title(OString::number(nPresentItemId), "");
@@ -484,7 +486,7 @@ namespace vcl
                bInsertItem = bNeedItem;
            }

            WizardState nState( rActivePath[ nItemIndex ] );
            WizardTypes::WizardState nState( rActivePath[ nItemIndex ] );

            if ( bInsertItem )
            {
@@ -505,7 +507,7 @@ namespace vcl
        }
    }

    WizardTypes::WizardState RoadmapWizard::determineNextState( WizardState _nCurrentState ) const
    WizardTypes::WizardState RoadmapWizard::determineNextState( WizardTypes::WizardState _nCurrentState ) const
    {

        sal_Int32 nCurrentStatePathIndex = -1;
@@ -534,7 +536,7 @@ namespace vcl
        return aActivePathPos->second[ nNextStateIndex ];
    }

    WizardTypes::WizardState RoadmapWizardMachine::determineNextState( WizardState _nCurrentState ) const
    WizardTypes::WizardState RoadmapWizardMachine::determineNextState( WizardTypes::WizardState _nCurrentState ) const
    {
        sal_Int32 nCurrentStatePathIndex = -1;

@@ -627,7 +629,7 @@ namespace vcl
        OWizardMachine::updateTravelUI();

        // disable the "Previous" button if all states in our history are disabled
        ::std::vector< WizardState > aHistory;
        std::vector< WizardTypes::WizardState > aHistory;
        getStateHistory( aHistory );
        bool bHaveEnabledState = false;
        for (auto const& state : aHistory)
@@ -649,7 +651,7 @@ namespace vcl
        WizardMachine::updateTravelUI();

        // disable the "Previous" button if all states in our history are disabled
        ::std::vector< WizardState > aHistory;
        std::vector< WizardTypes::WizardState > aHistory;
        getStateHistory( aHistory );
        bool bHaveEnabledState = false;
        for (auto const& state : aHistory)
@@ -692,8 +694,8 @@ namespace vcl
        bool bResult = true;
        if ( nNewIndex > nCurrentIndex )
        {
            bResult = skipUntil( static_cast<WizardState>(nCurItemId) );
            WizardState nTemp = static_cast<WizardState>(nCurItemId);
            bResult = skipUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );
            WizardTypes::WizardState nTemp = static_cast<WizardTypes::WizardState>(nCurItemId);
            while( nTemp )
            {
                if( m_pImpl->aDisabledStates.find( --nTemp ) != m_pImpl->aDisabledStates.end() )
@@ -701,7 +703,7 @@ namespace vcl
            }
        }
        else
            bResult = skipBackwardUntil( static_cast<WizardState>(nCurItemId) );
            bResult = skipBackwardUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );

        if ( !bResult )
            m_pImpl->pRoadmap->SelectRoadmapItemByID( getCurrentState() );
@@ -733,8 +735,8 @@ namespace vcl
        bool bResult = true;
        if ( nNewIndex > nCurrentIndex )
        {
            bResult = skipUntil( static_cast<WizardState>(nCurItemId) );
            WizardState nTemp = static_cast<WizardState>(nCurItemId);
            bResult = skipUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );
            WizardTypes::WizardState nTemp = static_cast<WizardTypes::WizardState>(nCurItemId);
            while( nTemp )
            {
                if( m_pImpl->aDisabledStates.find( --nTemp ) != m_pImpl->aDisabledStates.end() )
@@ -742,12 +744,12 @@ namespace vcl
            }
        }
        else
            bResult = skipBackwardUntil( static_cast<WizardState>(nCurItemId) );
            bResult = skipBackwardUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );

        return bResult;
    }

    void RoadmapWizard::enterState( WizardState _nState )
    void RoadmapWizard::enterState( WizardTypes::WizardState _nState )
    {
        OWizardMachine::enterState( _nState );

@@ -756,7 +758,7 @@ namespace vcl
        m_pImpl->pRoadmap->SelectRoadmapItemByID( getCurrentState() );
    }

    void RoadmapWizardMachine::enterState( WizardState _nState )
    void RoadmapWizardMachine::enterState( WizardTypes::WizardState _nState )
    {
        WizardMachine::enterState( _nState );

@@ -764,7 +766,7 @@ namespace vcl
        implUpdateRoadmap();
    }

    OUString RoadmapWizard::getStateDisplayName( WizardState _nState ) const
    OUString RoadmapWizard::getStateDisplayName( WizardTypes::WizardState _nState ) const
    {
        OUString sDisplayName;

@@ -777,7 +779,7 @@ namespace vcl
        return sDisplayName;
    }

    OUString RoadmapWizardMachine::getStateDisplayName( WizardState _nState ) const
    OUString RoadmapWizardMachine::getStateDisplayName( WizardTypes::WizardState _nState ) const
    {
        OUString sDisplayName;

@@ -790,7 +792,7 @@ namespace vcl
        return sDisplayName;
    }

    VclPtr<TabPage> RoadmapWizard::createPage( WizardState _nState )
    VclPtr<TabPage> RoadmapWizard::createPage( WizardTypes::WizardState _nState )
    {
        VclPtr<TabPage> pPage;

@@ -806,7 +808,7 @@ namespace vcl
        return pPage;
    }

    void RoadmapWizard::enableState( WizardState _nState, bool _bEnable )
    void RoadmapWizard::enableState( WizardTypes::WizardState _nState, bool _bEnable )
    {

        // remember this (in case the state appears in the roadmap later on)
@@ -822,7 +824,7 @@ namespace vcl
        m_pImpl->pRoadmap->EnableRoadmapItem( static_cast<RoadmapTypes::ItemId>(_nState), _bEnable );
    }

    void RoadmapWizardMachine::enableState( WizardState _nState, bool _bEnable )
    void RoadmapWizardMachine::enableState( WizardTypes::WizardState _nState, bool _bEnable )
    {
        // remember this (in case the state appears in the roadmap later on)
        if ( _bEnable )
@@ -837,7 +839,7 @@ namespace vcl
        m_xAssistant->set_page_sensitive(OString::number(_nState), _bEnable);
    }

    bool RoadmapWizard::knowsState( WizardState i_nState ) const
    bool RoadmapWizard::knowsState( WizardTypes::WizardState i_nState ) const
    {
        for (auto const& path : m_pImpl->aPaths)
        {
@@ -850,12 +852,12 @@ namespace vcl
        return false;
    }

    bool RoadmapWizard::isStateEnabled( WizardState _nState ) const
    bool RoadmapWizard::isStateEnabled( WizardTypes::WizardState _nState ) const
    {
        return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end();
    }

    bool RoadmapWizardMachine::isStateEnabled( WizardState _nState ) const
    bool RoadmapWizardMachine::isStateEnabled( WizardTypes::WizardState _nState ) const
    {
        return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end();
    }
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 823b20f..e620fe7 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -102,12 +102,12 @@ namespace vcl
        return true;
    }

    struct WizardMachineImplData : public WizardTypes
    struct WizardMachineImplData
    {
        OUString                        sTitleBase;         // the base for the title
        ::std::stack< WizardState >     aStateHistory;      // the history of all states (used for implementing "Back")
        std::stack<WizardTypes::WizardState> aStateHistory;      // the history of all states (used for implementing "Back")

        WizardState                     nFirstUnknownPage;
        WizardTypes::WizardState nFirstUnknownPage;
            // the WizardDialog does not allow non-linear transitions (e.g. it's
            // not possible to add pages in a non-linear order), so we need some own maintenance data

@@ -504,7 +504,7 @@ namespace vcl

        if (m_pImpl)
        {
            for (WizardState i = 0; i < m_pImpl->nFirstUnknownPage; ++i)
            for (WizardTypes::WizardState i = 0; i < m_pImpl->nFirstUnknownPage; ++i)
            {
                TabPage *pPage = GetPage(i);
                if (pPage)
@@ -647,7 +647,7 @@ namespace vcl
    }


    TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState )
    TabPage* OWizardMachine::GetOrCreatePage( const WizardTypes::WizardState i_nState )
    {
        if ( nullptr == GetPage( i_nState ) )
        {
@@ -678,7 +678,7 @@ namespace vcl
    {
        maActivateHdl.Call( this );

        WizardState nCurrentLevel = GetCurLevel();
        WizardTypes::WizardState nCurrentLevel = GetCurLevel();
        GetOrCreatePage( nCurrentLevel );

        enterState( nCurrentLevel );
@@ -686,7 +686,7 @@ namespace vcl

    bool OWizardMachine::DeactivatePage()
    {
        WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nCurrentState = getCurrentState();
        return leaveState(nCurrentState);
    }

@@ -927,10 +927,10 @@ namespace vcl
            m_pCancel->Enable(_bEnable);
    }

    void OWizardMachine::enterState(WizardState _nState)
    void OWizardMachine::enterState(WizardTypes::WizardState nState)
    {
        // tell the page
        IWizardPageController* pController = getPageController( GetPage( _nState ) );
        IWizardPageController* pController = getPageController( GetPage( nState ) );
        if (!pController)
            return;
        pController->initializePage();
@@ -944,7 +944,7 @@ namespace vcl
        implUpdateTitle();
    }

    bool OWizardMachine::leaveState(WizardState)
    bool OWizardMachine::leaveState(WizardTypes::WizardState)
    {
        // no need to ask the page here.
        // If we reach this point, we already gave the current page the chance to commit it's data,
@@ -965,21 +965,19 @@ namespace vcl
        if ( isTravelingSuspended() )
            return;
        WizardTravelSuspension aTravelGuard( *this );
        if ( !prepareLeaveCurrentState( eFinish ) )
        if (!prepareLeaveCurrentState(WizardTypes::eFinish))
        {
            return;
        }
        onFinish();
    }


    OWizardMachine::WizardState OWizardMachine::determineNextState( WizardState _nCurrentState ) const
    WizardTypes::WizardState OWizardMachine::determineNextState( WizardTypes::WizardState _nCurrentState ) const
    {
        return _nCurrentState + 1;
    }


    bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason )
    bool OWizardMachine::prepareLeaveCurrentState( WizardTypes::CommitPageReason _eReason )
    {
        IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
        ENSURE_OR_RETURN( pController != nullptr, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", true );
@@ -987,17 +985,17 @@ namespace vcl
    }


    bool OWizardMachine::skipBackwardUntil( WizardState _nTargetState )
    bool OWizardMachine::skipBackwardUntil( WizardTypes::WizardState _nTargetState )
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelBackward ) )
        if (!prepareLeaveCurrentState(WizardTypes::eTravelBackward))
            return false;

        // don't travel directly on m_pImpl->aStateHistory, in case something goes wrong
        ::std::stack< WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        ::std::stack< WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aOldStateHistory = m_pImpl->aStateHistory;

        WizardState nCurrentRollbackState = getCurrentState();
        WizardTypes::WizardState nCurrentRollbackState = getCurrentState();
        while ( nCurrentRollbackState != _nTargetState )
        {
            DBG_ASSERT( !aTravelVirtually.empty(), "OWizardMachine::skipBackwardUntil: this target state does not exist in the history!" );
@@ -1014,20 +1012,20 @@ namespace vcl
    }


    bool OWizardMachine::skipUntil( WizardState _nTargetState )
    bool OWizardMachine::skipUntil( WizardTypes::WizardState _nTargetState )
    {
        WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nCurrentState = getCurrentState();

        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( nCurrentState < _nTargetState ? eTravelForward : eTravelBackward ) )
        if ( !prepareLeaveCurrentState( nCurrentState < _nTargetState ? WizardTypes::eTravelForward : WizardTypes::eTravelBackward ) )
            return false;

        // don't travel directly on m_pImpl->aStateHistory, in case something goes wrong
        ::std::stack< WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        ::std::stack< WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        while ( nCurrentState != _nTargetState )
        {
            WizardState nNextState = determineNextState( nCurrentState );
            WizardTypes::WizardState nNextState = determineNextState( nCurrentState );
            if ( WZS_INVALID_STATE == nNextState )
            {
                OSL_FAIL( "OWizardMachine::skipUntil: the given target state does not exist!" );
@@ -1057,11 +1055,11 @@ namespace vcl
    void OWizardMachine::skip()
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelForward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelForward ) )
            return;

        WizardState nCurrentState = getCurrentState();
        WizardState nNextState = determineNextState(nCurrentState);
        WizardTypes::WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nNextState = determineNextState(nCurrentState);

        if (WZS_INVALID_STATE == nNextState)
            return;
@@ -1090,12 +1088,12 @@ namespace vcl
    bool OWizardMachine::travelNext()
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelForward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelForward ) )
            return false;

        // determine the next state to travel to
        WizardState nCurrentState = getCurrentState();
        WizardState nNextState = determineNextState(nCurrentState);
        WizardTypes::WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nNextState = determineNextState(nCurrentState);
        if (WZS_INVALID_STATE == nNextState)
            return false;

@@ -1117,11 +1115,11 @@ namespace vcl
        DBG_ASSERT(!m_pImpl->aStateHistory.empty(), "OWizardMachine::travelPrevious: have no previous page!");

        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelBackward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelBackward ) )
            return false;

        // the next state to switch to
        WizardState nPreviousState = m_pImpl->aStateHistory.top();
        WizardTypes::WizardState nPreviousState = m_pImpl->aStateHistory.top();

        // the state history is used by the enterState method
        m_pImpl->aStateHistory.pop();
@@ -1137,13 +1135,13 @@ namespace vcl
    }


    void  OWizardMachine::removePageFromHistory( WizardState nToRemove )
    void  OWizardMachine::removePageFromHistory( WizardTypes::WizardState nToRemove )
    {

        ::std::stack< WizardState > aTemp;
        std::stack< WizardTypes::WizardState > aTemp;
        while(!m_pImpl->aStateHistory.empty())
        {
            WizardState nPreviousState = m_pImpl->aStateHistory.top();
            WizardTypes::WizardState nPreviousState = m_pImpl->aStateHistory.top();
            m_pImpl->aStateHistory.pop();
            if(nPreviousState != nToRemove)
                aTemp.push( nPreviousState );
@@ -1195,9 +1193,9 @@ namespace vcl
    }


    void OWizardMachine::getStateHistory( ::std::vector< WizardState >& _out_rHistory )
    void OWizardMachine::getStateHistory( std::vector< WizardTypes::WizardState >& _out_rHistory )
    {
        ::std::stack< WizardState > aHistoryCopy( m_pImpl->aStateHistory );
        std::stack< WizardTypes::WizardState > aHistoryCopy( m_pImpl->aStateHistory );
        while ( !aHistoryCopy.empty() )
        {
            _out_rHistory.push_back( aHistoryCopy.top() );
@@ -1346,7 +1344,7 @@ namespace vcl
        implUpdateTitle();
    }

    TabPage* WizardMachine::GetOrCreatePage( const WizardState i_nState )
    TabPage* WizardMachine::GetOrCreatePage( const WizardTypes::WizardState i_nState )
    {
        if ( nullptr == GetPage( i_nState ) )
        {
@@ -1375,7 +1373,7 @@ namespace vcl

    void WizardMachine::ActivatePage()
    {
        WizardState nCurrentLevel = m_nCurState;
        WizardTypes::WizardState nCurrentLevel = m_nCurState;
        GetOrCreatePage( nCurrentLevel );

        enterState( nCurrentLevel );
@@ -1383,7 +1381,7 @@ namespace vcl

    bool WizardMachine::DeactivatePage()
    {
        WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nCurrentState = getCurrentState();
        return leaveState(nCurrentState);
    }

@@ -1433,7 +1431,7 @@ namespace vcl
            m_xCancel->set_sensitive(_bEnable);
    }

    void WizardMachine::enterState(WizardState _nState)
    void WizardMachine::enterState(WizardTypes::WizardState _nState)
    {
        // tell the page
        IWizardPageController* pController = getPageController( GetPage( _nState ) );
@@ -1450,7 +1448,7 @@ namespace vcl
        implUpdateTitle();
    }

    bool WizardMachine::leaveState(WizardState)
    bool WizardMachine::leaveState(WizardTypes::WizardState)
    {
        // no need to ask the page here.
        // If we reach this point, we already gave the current page the chance to commit it's data,
@@ -1469,7 +1467,7 @@ namespace vcl
        if ( isTravelingSuspended() )
            return;
        WizardTravelSuspension aTravelGuard( *this );
        if ( !prepareLeaveCurrentState( eFinish ) )
        if (!prepareLeaveCurrentState(WizardTypes::eFinish))
        {
            return;
        }
@@ -1481,30 +1479,29 @@ namespace vcl
        m_xAssistant->response(RET_CANCEL);
    }

    WizardMachine::WizardState WizardMachine::determineNextState( WizardState _nCurrentState ) const
    WizardTypes::WizardState WizardMachine::determineNextState(WizardTypes::WizardState _nCurrentState ) const
    {
        return _nCurrentState + 1;
    }

    bool WizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason )
    bool WizardMachine::prepareLeaveCurrentState( WizardTypes::CommitPageReason _eReason )
    {
        IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
        ENSURE_OR_RETURN( pController != nullptr, "WizardMachine::prepareLeaveCurrentState: no controller for the current page!", true );
        return pController->commitPage( _eReason );
    }


    bool WizardMachine::skipBackwardUntil( WizardState _nTargetState )
    bool WizardMachine::skipBackwardUntil(WizardTypes::WizardState _nTargetState)
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelBackward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelBackward ) )
            return false;

        // don't travel directly on m_pImpl->aStateHistory, in case something goes wrong
        ::std::stack< WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        ::std::stack< WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aOldStateHistory = m_pImpl->aStateHistory;

        WizardState nCurrentRollbackState = getCurrentState();
        WizardTypes::WizardState nCurrentRollbackState = getCurrentState();
        while ( nCurrentRollbackState != _nTargetState )
        {
            DBG_ASSERT( !aTravelVirtually.empty(), "WizardMachine::skipBackwardUntil: this target state does not exist in the history!" );
@@ -1520,21 +1517,20 @@ namespace vcl
        return true;
    }


    bool WizardMachine::skipUntil( WizardState _nTargetState )
    bool WizardMachine::skipUntil( WizardTypes::WizardState _nTargetState )
    {
        WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nCurrentState = getCurrentState();

        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( nCurrentState < _nTargetState ? eTravelForward : eTravelBackward ) )
        if ( !prepareLeaveCurrentState( nCurrentState < _nTargetState ? WizardTypes::eTravelForward : WizardTypes::eTravelBackward ) )
            return false;

        // don't travel directly on m_pImpl->aStateHistory, in case something goes wrong
        ::std::stack< WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        ::std::stack< WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aTravelVirtually = m_pImpl->aStateHistory;
        std::stack< WizardTypes::WizardState > aOldStateHistory = m_pImpl->aStateHistory;
        while ( nCurrentState != _nTargetState )
        {
            WizardState nNextState = determineNextState( nCurrentState );
            WizardTypes::WizardState nNextState = determineNextState( nCurrentState );
            if ( WZS_INVALID_STATE == nNextState )
            {
                OSL_FAIL( "WizardMachine::skipUntil: the given target state does not exist!" );
@@ -1563,11 +1559,11 @@ namespace vcl
    void WizardMachine::skip()
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelForward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelForward ) )
            return;

        WizardState nCurrentState = getCurrentState();
        WizardState nNextState = determineNextState(nCurrentState);
        WizardTypes::WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nNextState = determineNextState(nCurrentState);

        if (WZS_INVALID_STATE == nNextState)
            return;
@@ -1596,12 +1592,12 @@ namespace vcl
    bool WizardMachine::travelNext()
    {
        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelForward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelForward ) )
            return false;

        // determine the next state to travel to
        WizardState nCurrentState = getCurrentState();
        WizardState nNextState = determineNextState(nCurrentState);
        WizardTypes::WizardState nCurrentState = getCurrentState();
        WizardTypes::WizardState nNextState = determineNextState(nCurrentState);
        if (WZS_INVALID_STATE == nNextState)
            return false;

@@ -1617,7 +1613,7 @@ namespace vcl
        return true;
    }

    bool WizardMachine::ShowPage(WizardState nState)
    bool WizardMachine::ShowPage(WizardTypes::WizardState nState)
    {
        if (DeactivatePage())
        {
@@ -1656,11 +1652,11 @@ namespace vcl
        DBG_ASSERT(!m_pImpl->aStateHistory.empty(), "WizardMachine::travelPrevious: have no previous page!");

        // allowed to leave the current page?
        if ( !prepareLeaveCurrentState( eTravelBackward ) )
        if ( !prepareLeaveCurrentState( WizardTypes::eTravelBackward ) )
            return false;

        // the next state to switch to
        WizardState nPreviousState = m_pImpl->aStateHistory.top();
        WizardTypes::WizardState nPreviousState = m_pImpl->aStateHistory.top();

        // the state history is used by the enterState method
        m_pImpl->aStateHistory.pop();
@@ -1676,13 +1672,13 @@ namespace vcl
    }


    void  WizardMachine::removePageFromHistory( WizardState nToRemove )
    void  WizardMachine::removePageFromHistory( WizardTypes::WizardState nToRemove )
    {

        ::std::stack< WizardState > aTemp;
        std::stack< WizardTypes::WizardState > aTemp;
        while(!m_pImpl->aStateHistory.empty())
        {
            WizardState nPreviousState = m_pImpl->aStateHistory.top();
            WizardTypes::WizardState nPreviousState = m_pImpl->aStateHistory.top();
            m_pImpl->aStateHistory.pop();
            if(nPreviousState != nToRemove)
                aTemp.push( nPreviousState );
@@ -1730,10 +1726,9 @@ namespace vcl
        return pController;
    }


    void WizardMachine::getStateHistory( ::std::vector< WizardState >& _out_rHistory )
    void WizardMachine::getStateHistory( std::vector< WizardTypes::WizardState >& _out_rHistory )
    {
        ::std::stack< WizardState > aHistoryCopy( m_pImpl->aStateHistory );
        std::stack< WizardTypes::WizardState > aHistoryCopy( m_pImpl->aStateHistory );
        while ( !aHistoryCopy.empty() )
        {
            _out_rHistory.push_back( aHistoryCopy.top() );
@@ -1741,13 +1736,11 @@ namespace vcl
        }
    }


    bool WizardMachine::canAdvance() const
    {
        return WZS_INVALID_STATE != determineNextState( getCurrentState() );
    }


    void WizardMachine::updateTravelUI()
    {
        const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
@@ -1759,13 +1752,11 @@ namespace vcl
        enableButtons( WizardButtonFlags::NEXT, bCanAdvance );
    }


    bool WizardMachine::isTravelingSuspended() const
    {
        return m_pImpl->m_bTravelingSuspended;
    }


    void WizardMachine::suspendTraveling( AccessGuard )
    {
        DBG_ASSERT( !m_pImpl->m_bTravelingSuspended, "WizardMachine::suspendTraveling: already suspended!" );
@@ -1834,7 +1825,7 @@ namespace vcl
        OSL_FAIL( "WizardMachine::RemovePage() - Page not in list" );
    }

    void WizardMachine::SetPage(WizardState nLevel, TabPage* pPage)
    void WizardMachine::SetPage(WizardTypes::WizardState nLevel, TabPage* pPage)
    {
        sal_uInt16              nTempLevel = 0;
        ImplWizPageData*    pPageData = m_pFirstPage;
@@ -1855,7 +1846,7 @@ namespace vcl
        }
    }

    TabPage* WizardMachine::GetPage(WizardState nLevel) const
    TabPage* WizardMachine::GetPage(WizardTypes::WizardState nLevel) const
    {
        sal_uInt16 nTempLevel = 0;