include/vcl/wizardmachine.hxx        |    5 
 vcl/source/control/roadmapwizard.cxx |  710 ++++++++++++++++++++++++++++++++++
 vcl/source/control/wizardmachine.cxx |  713 -----------------------------------
 vcl/source/control/wizimpldata.hxx   |    3 
 4 files changed, 714 insertions(+), 717 deletions(-)

New commits:
commit 4a160b016cb3fbad3f765115f02e9e53249bbfb9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat May 17 23:13:39 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun May 18 20:37:30 2025 +0200

    vcl: Move RoadmapWizard method impls to corresponding source file
    
    Move these implementations of the vcl::Window based
    RoadmapWizard to the existing source file where the
    other methods of that class are implemented, instead
    of having some of them in the source file for the weld::Widget
    based WizardMachine, while others are elsewhere.
    
    Move definition of two strings needed by both of them to
    a header that both already include.
    
    Change-Id: I8ece77cbc9d1d8a52b1e3dcedb7b70ac8a310eba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185460
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 68a0e052c8a1..16c91b2ee890 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -21,6 +21,7 @@
 #include <tools/debug.hxx>
 #include <tools/json_writer.hxx>
 #include <osl/diagnose.h>
+#include <vcl/event.hxx>
 
 #include <strings.hrc>
 #include <svdata.hxx>
@@ -31,6 +32,11 @@
 #include "wizimpldata.hxx"
 #include <uiobject-internal.hxx>
 
+#define WIZARDDIALOG_BUTTON_OFFSET_Y        6
+#define WIZARDDIALOG_BUTTON_DLGOFFSET_X     6
+#define WIZARDDIALOG_VIEW_DLGOFFSET_X       6
+#define WIZARDDIALOG_VIEW_DLGOFFSET_Y       6
+
 namespace vcl
 {
     sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState 
_nState, const WizardPath& _rPath )
@@ -178,6 +184,710 @@ namespace vcl
         m_xRoadmapImpl->pRoadmap->SetRoadmapBitmap(rBmp);
     }
 
+    void RoadmapWizard::SetLeftAlignedButtonCount( sal_Int16 _nCount )
+    {
+        mnLeftAlignCount = _nCount;
+    }
+
+    void RoadmapWizard::ImplCalcSize( Size& rSize )
+    {
+        // calculate ButtonBar height and width
+        tools::Long                nMaxHeight = 0;
+        tools::Long                nBarWidth = WIZARDDIALOG_BUTTON_DLGOFFSET_X 
* 2 + LogicalCoordinateToPixel(6);
+        ImplWizButtonData*  pBtnData = mpFirstBtn;
+        while (pBtnData)
+        {
+            auto nBtnHeight = pBtnData->mpButton->GetSizePixel().Height();
+            auto nBtnWidth = pBtnData->mpButton->GetSizePixel().Width();
+            if (pBtnData->mpButton->IsVisible())
+            {
+                nBarWidth += nBtnWidth;
+                nBarWidth += pBtnData->mnOffset;
+            }
+            if ( nBtnHeight > nMaxHeight )
+                nMaxHeight = nBtnHeight;
+            pBtnData = pBtnData->mpNext;
+        }
+        if ( nMaxHeight )
+            nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
+        rSize.AdjustHeight(nMaxHeight);
+
+        // add in the view window size
+        if ( mpViewWindow && mpViewWindow->IsVisible() )
+        {
+            Size aViewSize = mpViewWindow->GetSizePixel();
+            // align left
+            rSize.AdjustWidth(aViewSize.Width() );
+        }
+
+        if (nBarWidth > rSize.Width())
+            rSize.setWidth(nBarWidth);
+    }
+
+    void RoadmapWizard::queue_resize(StateChangedType /*eReason*/)
+    {
+        if (maWizardLayoutIdle.IsActive())
+            return;
+        if (IsInClose())
+            return;
+        maWizardLayoutIdle.Start();
+    }
+
+    IMPL_LINK_NOARG(RoadmapWizard, ImplHandleWizardLayoutTimerHdl, Timer*, 
void)
+    {
+        ImplPosCtrls();
+        ImplPosTabPage();
+    }
+
+    void RoadmapWizard::ImplPosCtrls()
+    {
+        Size    aDlgSize = GetOutputSizePixel();
+        tools::Long    nBtnWidth = 0;
+        tools::Long    nMaxHeight = 0;
+        tools::Long    nOffY = aDlgSize.Height();
+
+        ImplWizButtonData* pBtnData = mpFirstBtn;
+        int j = 0;
+        while ( pBtnData )
+        {
+            if (j >= mnLeftAlignCount)
+            {
+                Size aBtnSize = pBtnData->mpButton->GetSizePixel();
+                tools::Long nBtnHeight = aBtnSize.Height();
+                if ( nBtnHeight > nMaxHeight )
+                    nMaxHeight = nBtnHeight;
+                nBtnWidth += aBtnSize.Width();
+                nBtnWidth += pBtnData->mnOffset;
+            }
+            pBtnData = pBtnData->mpNext;
+            j++;
+        }
+
+        if ( nMaxHeight )
+        {
+            tools::Long nOffX = 
aDlgSize.Width()-nBtnWidth-WIZARDDIALOG_BUTTON_DLGOFFSET_X;
+            tools::Long nOffLeftAlignX = LogicalCoordinateToPixel(6);
+            nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y+nMaxHeight;
+
+            pBtnData = mpFirstBtn;
+            int i = 0;
+            while ( pBtnData )
+            {
+                Size aBtnSize = pBtnData->mpButton->GetSizePixel();
+                if (i >= mnLeftAlignCount)
+                {
+                    Point aPos( nOffX, 
nOffY+((nMaxHeight-aBtnSize.Height())/2) );
+                    pBtnData->mpButton->SetPosPixel( aPos );
+                    nOffX += aBtnSize.Width();
+                    nOffX += pBtnData->mnOffset;
+                }
+                else
+                {
+                    Point aPos( nOffLeftAlignX, 
nOffY+((nMaxHeight-aBtnSize.Height())/2) );
+                    pBtnData->mpButton->SetPosPixel( aPos );
+                    nOffLeftAlignX += aBtnSize.Width();
+                    nOffLeftAlignX += pBtnData->mnOffset;
+                }
+
+                pBtnData = pBtnData->mpNext;
+                i++;
+            }
+
+            nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y;
+        }
+
+        if ( !(mpViewWindow && mpViewWindow->IsVisible()) )
+            return;
+
+        tools::Long    nViewOffX = 0;
+        tools::Long    nViewOffY = 0;
+        tools::Long    nViewWidth = 0;
+        tools::Long    nViewHeight = 0;
+        tools::Long    nDlgHeight = nOffY;
+        PosSizeFlags nViewPosFlags = PosSizeFlags::Pos;
+        // align left
+        {
+            if ( mbEmptyViewMargin )
+            {
+                nViewOffX       = 0;
+                nViewOffY       = 0;
+                nViewHeight     = nDlgHeight;
+            }
+            else
+            {
+                nViewOffX       = WIZARDDIALOG_VIEW_DLGOFFSET_X;
+                nViewOffY       = WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+                nViewHeight     = nDlgHeight-(WIZARDDIALOG_VIEW_DLGOFFSET_Y*2);
+            }
+            nViewPosFlags  |= PosSizeFlags::Height;
+        }
+        mpViewWindow->setPosSizePixel( nViewOffX, nViewOffY,
+                                      nViewWidth, nViewHeight,
+                                      nViewPosFlags );
+    }
+
+    tools::Long RoadmapWizard::LogicalCoordinateToPixel(int iCoordinate) const
+    {
+        Size aLocSize = LogicToPixel(Size(iCoordinate, 0), 
MapMode(MapUnit::MapAppFont));
+        int iPixelCoordinate =  aLocSize.Width();
+        return iPixelCoordinate;
+    }
+
+    void RoadmapWizard::ImplPosTabPage()
+    {
+        if ( !mpCurTabPage )
+            return;
+
+        if ( !IsInInitShow() )
+        {
+            // #100199# - On Unix initial size is equal to screen size, on 
Windows
+            // it's 0,0. One cannot calculate the size unless dialog is 
visible.
+            if ( !IsReallyVisible() )
+                return;
+        }
+
+        // calculate height of ButtonBar
+        tools::Long                nMaxHeight = 0;
+        ImplWizButtonData*  pBtnData = mpFirstBtn;
+        while ( pBtnData )
+        {
+            tools::Long nBtnHeight = 
pBtnData->mpButton->GetSizePixel().Height();
+            if ( nBtnHeight > nMaxHeight )
+                nMaxHeight = nBtnHeight;
+            pBtnData = pBtnData->mpNext;
+        }
+        if ( nMaxHeight )
+            nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
+
+        // position TabPage
+        Size aDlgSize = GetOutputSizePixel();
+        aDlgSize.AdjustHeight( -nMaxHeight );
+        tools::Long nOffX = 0;
+        tools::Long nOffY = 0;
+        if ( mpViewWindow && mpViewWindow->IsVisible() )
+        {
+            Size aViewSize = mpViewWindow->GetSizePixel();
+            // align left
+            tools::Long nViewOffset = mbEmptyViewMargin ? 0 : 
WIZARDDIALOG_VIEW_DLGOFFSET_X;
+            nOffX += aViewSize.Width() + nViewOffset;
+            aDlgSize.AdjustWidth( -nOffX );
+        }
+        Point aPos( nOffX, nOffY );
+        mpCurTabPage->SetPosSizePixel( aPos, aDlgSize );
+    }
+
+    void RoadmapWizard::ImplShowTabPage( TabPage* pTabPage )
+    {
+        if ( mpCurTabPage == pTabPage )
+            return;
+
+        TabPage* pOldTabPage = mpCurTabPage;
+
+        mpCurTabPage = pTabPage;
+        if ( pTabPage )
+        {
+            ImplPosTabPage();
+            pTabPage->Show();
+        }
+
+        if ( pOldTabPage )
+            pOldTabPage->Hide();
+    }
+
+    TabPage* RoadmapWizard::ImplGetPage( sal_uInt16 nLevel ) const
+    {
+        sal_uInt16              nTempLevel = 0;
+        ImplWizPageData*    pPageData = mpFirstPage;
+        while ( pPageData )
+        {
+            if ( (nTempLevel == nLevel) || !pPageData->mpNext )
+                break;
+
+            nTempLevel++;
+            pPageData = pPageData->mpNext;
+        }
+
+        if ( pPageData )
+            return pPageData->mpPage;
+        return nullptr;
+    }
+
+    void RoadmapWizard::AddButtonResponse( Button* pButton, int response)
+    {
+        m_xRoadmapImpl->maResponses[pButton] = response;
+    }
+
+    void RoadmapWizard::implConstruct()
+    {
+        m_xWizardImpl->sTitleBase = GetText();
+
+        // create buttons
+        // the help button
+        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
+        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
+        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
+        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
+        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()
+    {
+        if ( IsReallyShown() && !IsInInitShow() )
+        {
+            ImplPosCtrls();
+            ImplPosTabPage();
+        }
+
+        Dialog::Resize();
+    }
+
+    void RoadmapWizard::CalcAndSetSize()
+    {
+        Size aDlgSize = GetPageSizePixel();
+        if ( !aDlgSize.Width() || !aDlgSize.Height() )
+        {
+            ImplWizPageData*  pPageData = mpFirstPage;
+            while ( pPageData )
+            {
+                if ( pPageData->mpPage )
+                {
+                    Size aPageSize = pPageData->mpPage->GetSizePixel();
+                    if ( aPageSize.Width() > aDlgSize.Width() )
+                        aDlgSize.setWidth( aPageSize.Width() );
+                    if ( aPageSize.Height() > aDlgSize.Height() )
+                        aDlgSize.setHeight( aPageSize.Height() );
+                }
+
+                pPageData = pPageData->mpNext;
+            }
+        }
+        ImplCalcSize( aDlgSize );
+        SetMinOutputSizePixel( aDlgSize );
+        SetOutputSizePixel( aDlgSize );
+    }
+
+    void RoadmapWizard::StateChanged( StateChangedType nType )
+    {
+        if ( nType == StateChangedType::InitShow )
+        {
+            if ( IsDefaultSize() )
+            {
+                CalcAndSetSize();
+            }
+
+            ImplPosCtrls();
+            ImplPosTabPage();
+            ImplShowTabPage( ImplGetPage( mnCurLevel ) );
+        }
+
+        Dialog::StateChanged( nType );
+    }
+
+    bool RoadmapWizard::EventNotify( NotifyEvent& rNEvt )
+    {
+        if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && mpPrevBtn && 
mpNextBtn )
+        {
+            const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+            vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
+            sal_uInt16 nKeyCode = aKeyCode.GetCode();
+
+            if ( aKeyCode.IsMod1() )
+            {
+                if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) )
+                {
+                    if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) )
+                    {
+                        if ( mpPrevBtn->IsVisible() &&
+                            mpPrevBtn->IsEnabled() && 
mpPrevBtn->IsInputEnabled() )
+                        {
+                            mpPrevBtn->SetPressed( true );
+                            mpPrevBtn->SetPressed( false );
+                            mpPrevBtn->Click();
+                        }
+                        return true;
+                    }
+                }
+                else
+                {
+                    if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) )
+                    {
+                        if ( mpNextBtn->IsVisible() &&
+                            mpNextBtn->IsEnabled() && 
mpNextBtn->IsInputEnabled() )
+                        {
+                            mpNextBtn->SetPressed( true );
+                            mpNextBtn->SetPressed( false );
+                            mpNextBtn->Click();
+                        }
+                        return true;
+                    }
+                }
+            }
+        }
+
+        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::ActivatePage()
+    {
+        WizardTypes::WizardState nCurrentLevel = GetCurLevel();
+        GetOrCreatePage( nCurrentLevel );
+
+        enterState( nCurrentLevel );
+    }
+
+    bool RoadmapWizard::ShowPage( sal_uInt16 nLevel )
+    {
+        mnCurLevel = nLevel;
+        ActivatePage();
+        ImplShowTabPage( ImplGetPage( mnCurLevel ) );
+        return true;
+    }
+
+    void RoadmapWizard::Finish( tools::Long nResult )
+    {
+        if ( IsInExecute() )
+            EndDialog( nResult );
+        else if ( GetStyle() & WB_CLOSEABLE )
+            Close();
+    }
+
+    void RoadmapWizard::AddPage( TabPage* pPage )
+    {
+        ImplWizPageData* pNewPageData = new ImplWizPageData;
+        pNewPageData->mpNext    = nullptr;
+        pNewPageData->mpPage    = pPage;
+
+        if ( !mpFirstPage )
+            mpFirstPage = pNewPageData;
+        else
+        {
+            pPage->Hide();
+            ImplWizPageData* pPageData = mpFirstPage;
+            while ( pPageData->mpNext )
+                pPageData = pPageData->mpNext;
+            pPageData->mpNext = pNewPageData;
+        }
+    }
+
+    void RoadmapWizard::RemovePage( TabPage* pPage )
+    {
+        ImplWizPageData*  pPrevPageData = nullptr;
+        ImplWizPageData*  pPageData = mpFirstPage;
+        while ( pPageData )
+        {
+            if ( pPageData->mpPage == pPage )
+            {
+                if ( pPrevPageData )
+                    pPrevPageData->mpNext = pPageData->mpNext;
+                else
+                    mpFirstPage = pPageData->mpNext;
+                if ( pPage == mpCurTabPage )
+                    mpCurTabPage = nullptr;
+                delete pPageData;
+                return;
+            }
+
+            pPrevPageData = pPageData;
+            pPageData = pPageData->mpNext;
+        }
+
+        OSL_FAIL( "RoadmapWizard::RemovePage() - Page not in list" );
+    }
+
+    void RoadmapWizard::SetPage( sal_uInt16 nLevel, TabPage* pPage )
+    {
+        sal_uInt16              nTempLevel = 0;
+        ImplWizPageData*    pPageData = mpFirstPage;
+        while ( pPageData )
+        {
+            if ( (nTempLevel == nLevel) || !pPageData->mpNext )
+                break;
+
+            nTempLevel++;
+            pPageData = pPageData->mpNext;
+        }
+
+        if ( pPageData )
+        {
+            if ( pPageData->mpPage == mpCurTabPage )
+                mpCurTabPage = nullptr;
+            pPageData->mpPage = pPage;
+        }
+    }
+
+    TabPage* RoadmapWizard::GetPage( sal_uInt16 nLevel ) const
+    {
+        sal_uInt16 nTempLevel = 0;
+
+        for (ImplWizPageData* pPageData = mpFirstPage; pPageData;
+             pPageData = pPageData->mpNext)
+        {
+            if ( nTempLevel == nLevel )
+                return pPageData->mpPage;
+            nTempLevel++;
+        }
+
+        return nullptr;
+    }
+
+    void RoadmapWizard::AddButton( Button* pButton, tools::Long nOffset )
+    {
+        ImplWizButtonData* pNewBtnData = new ImplWizButtonData;
+        pNewBtnData->mpNext     = nullptr;
+        pNewBtnData->mpButton   = pButton;
+        pNewBtnData->mnOffset   = nOffset;
+
+        if ( !mpFirstBtn )
+            mpFirstBtn = pNewBtnData;
+        else
+        {
+            ImplWizButtonData* pBtnData = mpFirstBtn;
+            while ( pBtnData->mpNext )
+                pBtnData = pBtnData->mpNext;
+            pBtnData->mpNext = pNewBtnData;
+        }
+    }
+
+    void RoadmapWizard::RemoveButton( Button* pButton )
+    {
+        ImplWizButtonData*  pPrevBtnData = nullptr;
+        ImplWizButtonData*  pBtnData = mpFirstBtn;
+        while ( pBtnData )
+        {
+            if ( pBtnData->mpButton == pButton )
+            {
+                if ( pPrevBtnData )
+                    pPrevBtnData->mpNext = pBtnData->mpNext;
+                else
+                    mpFirstBtn = pBtnData->mpNext;
+                delete pBtnData;
+                return;
+            }
+
+            pPrevBtnData = pBtnData;
+            pBtnData = pBtnData->mpNext;
+        }
+
+        OSL_FAIL( "RoadmapWizard::RemoveButton() - Button not in list" );
+    }
+
+    IMPL_LINK_NOARG(RoadmapWizard, OnFinish, Button*, void)
+    {
+        if ( isTravelingSuspended() )
+            return;
+        RoadmapWizardTravelSuspension aTravelGuard( *this );
+        Finish( RET_OK );
+    }
+
+    bool RoadmapWizard::skipBackwardUntil( WizardTypes::WizardState 
_nTargetState )
+    {
+        // don't travel directly on m_xWizardImpl->aStateHistory, in case 
something goes wrong
+        std::stack< WizardTypes::WizardState > aTravelVirtually = 
m_xWizardImpl->aStateHistory;
+        std::stack< WizardTypes::WizardState > aOldStateHistory = 
m_xWizardImpl->aStateHistory;
+
+        WizardTypes::WizardState nCurrentRollbackState = getCurrentState();
+        while ( nCurrentRollbackState != _nTargetState )
+        {
+            DBG_ASSERT( !aTravelVirtually.empty(), 
"RoadmapWizard::skipBackwardUntil: this target state does not exist in the 
history!" );
+            nCurrentRollbackState = aTravelVirtually.top();
+            aTravelVirtually.pop();
+        }
+        m_xWizardImpl->aStateHistory = std::move(aTravelVirtually);
+        if ( !ShowPage( _nTargetState ) )
+        {
+            m_xWizardImpl->aStateHistory = std::move(aOldStateHistory);
+            return false;
+        }
+        return true;
+    }
+
+    bool RoadmapWizard::skipUntil( WizardTypes::WizardState _nTargetState )
+    {
+        WizardTypes::WizardState nCurrentState = getCurrentState();
+
+        // don't travel directly on m_xWizardImpl->aStateHistory, in case 
something goes wrong
+        std::stack< WizardTypes::WizardState > aTravelVirtually = 
m_xWizardImpl->aStateHistory;
+        std::stack< WizardTypes::WizardState > aOldStateHistory = 
m_xWizardImpl->aStateHistory;
+        while ( nCurrentState != _nTargetState )
+        {
+            WizardTypes::WizardState nNextState = determineNextState( 
nCurrentState );
+            if ( WZS_INVALID_STATE == nNextState )
+            {
+                OSL_FAIL( "RoadmapWizard::skipUntil: the given target state 
does not exist!" );
+                return false;
+            }
+
+            // remember the skipped state in the history
+            aTravelVirtually.push( nCurrentState );
+
+            // get the next state
+            nCurrentState = nNextState;
+        }
+        m_xWizardImpl->aStateHistory = std::move(aTravelVirtually);
+        // show the target page
+        if ( !ShowPage( nCurrentState ) )
+        {
+            // argh! prepareLeaveCurrentPage succeeded, determineNextState 
succeeded,
+            // but ShowPage doesn't? Somebody behaves very strange here...
+            OSL_FAIL( "RoadmapWizard::skipUntil: very unpolite..." );
+            m_xWizardImpl->aStateHistory = std::move(aOldStateHistory);
+            return false;
+        }
+        return true;
+    }
+
+    void RoadmapWizard::travelNext()
+    {
+        // determine the next state to travel to
+        WizardTypes::WizardState nCurrentState = getCurrentState();
+        WizardTypes::WizardState nNextState = 
determineNextState(nCurrentState);
+        if (WZS_INVALID_STATE == nNextState)
+            return;
+
+        // the state history is used by the enterState method
+        // all fine
+        m_xWizardImpl->aStateHistory.push(nCurrentState);
+        if (!ShowPage(nNextState))
+        {
+            m_xWizardImpl->aStateHistory.pop();
+        }
+    }
+
+    void RoadmapWizard::travelPrevious()
+    {
+        DBG_ASSERT(!m_xWizardImpl->aStateHistory.empty(), 
"RoadmapWizard::travelPrevious: have no previous page!");
+
+        // the next state to switch to
+        WizardTypes::WizardState nPreviousState = 
m_xWizardImpl->aStateHistory.top();
+
+        // the state history is used by the enterState method
+        m_xWizardImpl->aStateHistory.pop();
+        // show this page
+        if (!ShowPage(nPreviousState))
+        {
+            m_xWizardImpl->aStateHistory.push(nPreviousState);
+        }
+
+        // all fine
+    }
+
+    void  RoadmapWizard::removePageFromHistory( WizardTypes::WizardState 
nToRemove )
+    {
+
+        std::stack< WizardTypes::WizardState > aTemp;
+        while(!m_xWizardImpl->aStateHistory.empty())
+        {
+            WizardTypes::WizardState nPreviousState = 
m_xWizardImpl->aStateHistory.top();
+            m_xWizardImpl->aStateHistory.pop();
+            if(nPreviousState != nToRemove)
+                aTemp.push( nPreviousState );
+            else
+                break;
+        }
+        while(!aTemp.empty())
+        {
+            m_xWizardImpl->aStateHistory.push( aTemp.top() );
+            aTemp.pop();
+        }
+    }
+
+    IMPL_LINK_NOARG(RoadmapWizard, OnPrevPage, Button*, void)
+    {
+        if ( isTravelingSuspended() )
+            return;
+        RoadmapWizardTravelSuspension aTravelGuard( *this );
+        travelPrevious();
+    }
+
+    IMPL_LINK_NOARG(RoadmapWizard, OnNextPage, Button*, void)
+    {
+        if ( isTravelingSuspended() )
+            return;
+        RoadmapWizardTravelSuspension aTravelGuard( *this );
+        travelNext();
+    }
+
+    bool RoadmapWizard::isTravelingSuspended() const
+    {
+        return m_xWizardImpl->m_bTravelingSuspended;
+    }
+
+    void RoadmapWizard::suspendTraveling( AccessGuard )
+    {
+        DBG_ASSERT( !m_xWizardImpl->m_bTravelingSuspended, 
"RoadmapWizard::suspendTraveling: already suspended!" );
+        m_xWizardImpl->m_bTravelingSuspended = true;
+    }
+
+    void RoadmapWizard::resumeTraveling( AccessGuard )
+    {
+        DBG_ASSERT( m_xWizardImpl->m_bTravelingSuspended, 
"RoadmapWizard::resumeTraveling: nothing to resume!" );
+        m_xWizardImpl->m_bTravelingSuspended = false;
+    }
+
     void RoadmapWizardMachine::SetRoadmapHelpId(const OUString& rId)
     {
         m_xAssistant->set_page_side_help_id(rId);
diff --git a/vcl/source/control/wizardmachine.cxx 
b/vcl/source/control/wizardmachine.cxx
index e1d2364aec25..b901e510068e 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -19,7 +19,6 @@
 
 #include <comphelper/lok.hxx>
 #include <officecfg/Office/Common.hxx>
-#include <vcl/event.hxx>
 #include <tools/debug.hxx>
 #include <comphelper/diagnose_ex.hxx>
 #include <strings.hrc>
@@ -28,14 +27,6 @@
 #include <stack>
 #include "wizimpldata.hxx"
 
-constexpr OUString HID_WIZARD_NEXT = u"SVT_HID_WIZARD_NEXT"_ustr;
-constexpr OUString HID_WIZARD_PREVIOUS = u"SVT_HID_WIZARD_PREVIOUS"_ustr;
-
-#define WIZARDDIALOG_BUTTON_OFFSET_Y        6
-#define WIZARDDIALOG_BUTTON_DLGOFFSET_X     6
-#define WIZARDDIALOG_VIEW_DLGOFFSET_X       6
-#define WIZARDDIALOG_VIEW_DLGOFFSET_Y       6
-
 namespace vcl
 {
     //= WizardPageImplData
@@ -75,710 +66,6 @@ namespace vcl
         return true;
     }
 
-    void RoadmapWizard::SetLeftAlignedButtonCount( sal_Int16 _nCount )
-    {
-        mnLeftAlignCount = _nCount;
-    }
-
-    void RoadmapWizard::ImplCalcSize( Size& rSize )
-    {
-        // calculate ButtonBar height and width
-        tools::Long                nMaxHeight = 0;
-        tools::Long                nBarWidth = WIZARDDIALOG_BUTTON_DLGOFFSET_X 
* 2 + LogicalCoordinateToPixel(6);
-        ImplWizButtonData*  pBtnData = mpFirstBtn;
-        while (pBtnData)
-        {
-            auto nBtnHeight = pBtnData->mpButton->GetSizePixel().Height();
-            auto nBtnWidth = pBtnData->mpButton->GetSizePixel().Width();
-            if (pBtnData->mpButton->IsVisible())
-            {
-                nBarWidth += nBtnWidth;
-                nBarWidth += pBtnData->mnOffset;
-            }
-            if ( nBtnHeight > nMaxHeight )
-                nMaxHeight = nBtnHeight;
-            pBtnData = pBtnData->mpNext;
-        }
-        if ( nMaxHeight )
-            nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
-        rSize.AdjustHeight(nMaxHeight);
-
-        // add in the view window size
-        if ( mpViewWindow && mpViewWindow->IsVisible() )
-        {
-            Size aViewSize = mpViewWindow->GetSizePixel();
-            // align left
-            rSize.AdjustWidth(aViewSize.Width() );
-        }
-
-        if (nBarWidth > rSize.Width())
-            rSize.setWidth(nBarWidth);
-    }
-
-    void RoadmapWizard::queue_resize(StateChangedType /*eReason*/)
-    {
-        if (maWizardLayoutIdle.IsActive())
-            return;
-        if (IsInClose())
-            return;
-        maWizardLayoutIdle.Start();
-    }
-
-    IMPL_LINK_NOARG(RoadmapWizard, ImplHandleWizardLayoutTimerHdl, Timer*, 
void)
-    {
-        ImplPosCtrls();
-        ImplPosTabPage();
-    }
-
-    void RoadmapWizard::ImplPosCtrls()
-    {
-        Size    aDlgSize = GetOutputSizePixel();
-        tools::Long    nBtnWidth = 0;
-        tools::Long    nMaxHeight = 0;
-        tools::Long    nOffY = aDlgSize.Height();
-
-        ImplWizButtonData* pBtnData = mpFirstBtn;
-        int j = 0;
-        while ( pBtnData )
-        {
-            if (j >= mnLeftAlignCount)
-            {
-                Size aBtnSize = pBtnData->mpButton->GetSizePixel();
-                tools::Long nBtnHeight = aBtnSize.Height();
-                if ( nBtnHeight > nMaxHeight )
-                    nMaxHeight = nBtnHeight;
-                nBtnWidth += aBtnSize.Width();
-                nBtnWidth += pBtnData->mnOffset;
-            }
-            pBtnData = pBtnData->mpNext;
-            j++;
-        }
-
-        if ( nMaxHeight )
-        {
-            tools::Long nOffX = 
aDlgSize.Width()-nBtnWidth-WIZARDDIALOG_BUTTON_DLGOFFSET_X;
-            tools::Long nOffLeftAlignX = LogicalCoordinateToPixel(6);
-            nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y+nMaxHeight;
-
-            pBtnData = mpFirstBtn;
-            int i = 0;
-            while ( pBtnData )
-            {
-                Size aBtnSize = pBtnData->mpButton->GetSizePixel();
-                if (i >= mnLeftAlignCount)
-                {
-                    Point aPos( nOffX, 
nOffY+((nMaxHeight-aBtnSize.Height())/2) );
-                    pBtnData->mpButton->SetPosPixel( aPos );
-                    nOffX += aBtnSize.Width();
-                    nOffX += pBtnData->mnOffset;
-                }
-                else
-                {
-                    Point aPos( nOffLeftAlignX, 
nOffY+((nMaxHeight-aBtnSize.Height())/2) );
-                    pBtnData->mpButton->SetPosPixel( aPos );
-                    nOffLeftAlignX += aBtnSize.Width();
-                    nOffLeftAlignX += pBtnData->mnOffset;
-                }
-
-                pBtnData = pBtnData->mpNext;
-                i++;
-            }
-
-            nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y;
-        }
-
-        if ( !(mpViewWindow && mpViewWindow->IsVisible()) )
-            return;
-
-        tools::Long    nViewOffX = 0;
-        tools::Long    nViewOffY = 0;
-        tools::Long    nViewWidth = 0;
-        tools::Long    nViewHeight = 0;
-        tools::Long    nDlgHeight = nOffY;
-        PosSizeFlags nViewPosFlags = PosSizeFlags::Pos;
-        // align left
-        {
-            if ( mbEmptyViewMargin )
-            {
-                nViewOffX       = 0;
-                nViewOffY       = 0;
-                nViewHeight     = nDlgHeight;
-            }
-            else
-            {
-                nViewOffX       = WIZARDDIALOG_VIEW_DLGOFFSET_X;
-                nViewOffY       = WIZARDDIALOG_VIEW_DLGOFFSET_Y;
-                nViewHeight     = nDlgHeight-(WIZARDDIALOG_VIEW_DLGOFFSET_Y*2);
-            }
-            nViewPosFlags  |= PosSizeFlags::Height;
-        }
-        mpViewWindow->setPosSizePixel( nViewOffX, nViewOffY,
-                                       nViewWidth, nViewHeight,
-                                       nViewPosFlags );
-    }
-
-    tools::Long RoadmapWizard::LogicalCoordinateToPixel(int iCoordinate) const
-    {
-        Size aLocSize = LogicToPixel(Size(iCoordinate, 0), 
MapMode(MapUnit::MapAppFont));
-        int iPixelCoordinate =  aLocSize.Width();
-        return iPixelCoordinate;
-    }
-
-    void RoadmapWizard::ImplPosTabPage()
-    {
-        if ( !mpCurTabPage )
-            return;
-
-        if ( !IsInInitShow() )
-        {
-            // #100199# - On Unix initial size is equal to screen size, on 
Windows
-            // it's 0,0. One cannot calculate the size unless dialog is 
visible.
-            if ( !IsReallyVisible() )
-                return;
-        }
-
-        // calculate height of ButtonBar
-        tools::Long                nMaxHeight = 0;
-        ImplWizButtonData*  pBtnData = mpFirstBtn;
-        while ( pBtnData )
-        {
-            tools::Long nBtnHeight = 
pBtnData->mpButton->GetSizePixel().Height();
-            if ( nBtnHeight > nMaxHeight )
-                nMaxHeight = nBtnHeight;
-            pBtnData = pBtnData->mpNext;
-        }
-        if ( nMaxHeight )
-            nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
-
-        // position TabPage
-        Size aDlgSize = GetOutputSizePixel();
-        aDlgSize.AdjustHeight( -nMaxHeight );
-        tools::Long nOffX = 0;
-        tools::Long nOffY = 0;
-        if ( mpViewWindow && mpViewWindow->IsVisible() )
-        {
-            Size aViewSize = mpViewWindow->GetSizePixel();
-            // align left
-            tools::Long nViewOffset = mbEmptyViewMargin ? 0 : 
WIZARDDIALOG_VIEW_DLGOFFSET_X;
-            nOffX += aViewSize.Width() + nViewOffset;
-            aDlgSize.AdjustWidth( -nOffX );
-        }
-        Point aPos( nOffX, nOffY );
-        mpCurTabPage->SetPosSizePixel( aPos, aDlgSize );
-    }
-
-    void RoadmapWizard::ImplShowTabPage( TabPage* pTabPage )
-    {
-        if ( mpCurTabPage == pTabPage )
-            return;
-
-        TabPage* pOldTabPage = mpCurTabPage;
-
-        mpCurTabPage = pTabPage;
-        if ( pTabPage )
-        {
-            ImplPosTabPage();
-            pTabPage->Show();
-        }
-
-        if ( pOldTabPage )
-            pOldTabPage->Hide();
-    }
-
-    TabPage* RoadmapWizard::ImplGetPage( sal_uInt16 nLevel ) const
-    {
-        sal_uInt16              nTempLevel = 0;
-        ImplWizPageData*    pPageData = mpFirstPage;
-        while ( pPageData )
-        {
-            if ( (nTempLevel == nLevel) || !pPageData->mpNext )
-                break;
-
-            nTempLevel++;
-            pPageData = pPageData->mpNext;
-        }
-
-        if ( pPageData )
-            return pPageData->mpPage;
-        return nullptr;
-    }
-
-    void RoadmapWizard::AddButtonResponse( Button* pButton, int response)
-    {
-        m_xRoadmapImpl->maResponses[pButton] = response;
-    }
-
-    void RoadmapWizard::implConstruct()
-    {
-        m_xWizardImpl->sTitleBase = GetText();
-
-        // create buttons
-        // the help button
-        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
-        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
-        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
-        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
-        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()
-    {
-        if ( IsReallyShown() && !IsInInitShow() )
-        {
-            ImplPosCtrls();
-            ImplPosTabPage();
-        }
-
-        Dialog::Resize();
-    }
-
-    void RoadmapWizard::CalcAndSetSize()
-    {
-        Size aDlgSize = GetPageSizePixel();
-        if ( !aDlgSize.Width() || !aDlgSize.Height() )
-        {
-            ImplWizPageData*  pPageData = mpFirstPage;
-            while ( pPageData )
-            {
-                if ( pPageData->mpPage )
-                {
-                    Size aPageSize = pPageData->mpPage->GetSizePixel();
-                    if ( aPageSize.Width() > aDlgSize.Width() )
-                        aDlgSize.setWidth( aPageSize.Width() );
-                    if ( aPageSize.Height() > aDlgSize.Height() )
-                        aDlgSize.setHeight( aPageSize.Height() );
-                }
-
-                pPageData = pPageData->mpNext;
-            }
-        }
-        ImplCalcSize( aDlgSize );
-        SetMinOutputSizePixel( aDlgSize );
-        SetOutputSizePixel( aDlgSize );
-    }
-
-    void RoadmapWizard::StateChanged( StateChangedType nType )
-    {
-        if ( nType == StateChangedType::InitShow )
-        {
-            if ( IsDefaultSize() )
-            {
-                CalcAndSetSize();
-            }
-
-            ImplPosCtrls();
-            ImplPosTabPage();
-            ImplShowTabPage( ImplGetPage( mnCurLevel ) );
-        }
-
-        Dialog::StateChanged( nType );
-    }
-
-    bool RoadmapWizard::EventNotify( NotifyEvent& rNEvt )
-    {
-        if ( (rNEvt.GetType() == NotifyEventType::KEYINPUT) && mpPrevBtn && 
mpNextBtn )
-        {
-            const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
-            vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
-            sal_uInt16 nKeyCode = aKeyCode.GetCode();
-
-            if ( aKeyCode.IsMod1() )
-            {
-                if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) )
-                {
-                    if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) )
-                    {
-                        if ( mpPrevBtn->IsVisible() &&
-                             mpPrevBtn->IsEnabled() && 
mpPrevBtn->IsInputEnabled() )
-                        {
-                            mpPrevBtn->SetPressed( true );
-                            mpPrevBtn->SetPressed( false );
-                            mpPrevBtn->Click();
-                        }
-                        return true;
-                    }
-                }
-                else
-                {
-                    if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) )
-                    {
-                        if ( mpNextBtn->IsVisible() &&
-                             mpNextBtn->IsEnabled() && 
mpNextBtn->IsInputEnabled() )
-                        {
-                            mpNextBtn->SetPressed( true );
-                            mpNextBtn->SetPressed( false );
-                            mpNextBtn->Click();
-                        }
-                        return true;
-                    }
-                }
-            }
-        }
-
-        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::ActivatePage()
-    {
-        WizardTypes::WizardState nCurrentLevel = GetCurLevel();
-        GetOrCreatePage( nCurrentLevel );
-
-        enterState( nCurrentLevel );
-    }
-
-    bool RoadmapWizard::ShowPage( sal_uInt16 nLevel )
-    {
-        mnCurLevel = nLevel;
-        ActivatePage();
-        ImplShowTabPage( ImplGetPage( mnCurLevel ) );
-        return true;
-    }
-
-    void RoadmapWizard::Finish( tools::Long nResult )
-    {
-        if ( IsInExecute() )
-            EndDialog( nResult );
-        else if ( GetStyle() & WB_CLOSEABLE )
-            Close();
-    }
-
-    void RoadmapWizard::AddPage( TabPage* pPage )
-    {
-        ImplWizPageData* pNewPageData = new ImplWizPageData;
-        pNewPageData->mpNext    = nullptr;
-        pNewPageData->mpPage    = pPage;
-
-        if ( !mpFirstPage )
-            mpFirstPage = pNewPageData;
-        else
-        {
-            pPage->Hide();
-            ImplWizPageData* pPageData = mpFirstPage;
-            while ( pPageData->mpNext )
-                pPageData = pPageData->mpNext;
-            pPageData->mpNext = pNewPageData;
-        }
-    }
-
-    void RoadmapWizard::RemovePage( TabPage* pPage )
-    {
-        ImplWizPageData*  pPrevPageData = nullptr;
-        ImplWizPageData*  pPageData = mpFirstPage;
-        while ( pPageData )
-        {
-            if ( pPageData->mpPage == pPage )
-            {
-                if ( pPrevPageData )
-                    pPrevPageData->mpNext = pPageData->mpNext;
-                else
-                    mpFirstPage = pPageData->mpNext;
-                if ( pPage == mpCurTabPage )
-                    mpCurTabPage = nullptr;
-                delete pPageData;
-                return;
-            }
-
-            pPrevPageData = pPageData;
-            pPageData = pPageData->mpNext;
-        }
-
-        OSL_FAIL( "RoadmapWizard::RemovePage() - Page not in list" );
-    }
-
-    void RoadmapWizard::SetPage( sal_uInt16 nLevel, TabPage* pPage )
-    {
-        sal_uInt16              nTempLevel = 0;
-        ImplWizPageData*    pPageData = mpFirstPage;
-        while ( pPageData )
-        {
-            if ( (nTempLevel == nLevel) || !pPageData->mpNext )
-                break;
-
-            nTempLevel++;
-            pPageData = pPageData->mpNext;
-        }
-
-        if ( pPageData )
-        {
-            if ( pPageData->mpPage == mpCurTabPage )
-                mpCurTabPage = nullptr;
-            pPageData->mpPage = pPage;
-        }
-    }
-
-    TabPage* RoadmapWizard::GetPage( sal_uInt16 nLevel ) const
-    {
-        sal_uInt16 nTempLevel = 0;
-
-        for (ImplWizPageData* pPageData = mpFirstPage; pPageData;
-             pPageData = pPageData->mpNext)
-        {
-            if ( nTempLevel == nLevel )
-                return pPageData->mpPage;
-            nTempLevel++;
-        }
-
-        return nullptr;
-    }
-
-    void RoadmapWizard::AddButton( Button* pButton, tools::Long nOffset )
-    {
-        ImplWizButtonData* pNewBtnData = new ImplWizButtonData;
-        pNewBtnData->mpNext     = nullptr;
-        pNewBtnData->mpButton   = pButton;
-        pNewBtnData->mnOffset   = nOffset;
-
-        if ( !mpFirstBtn )
-            mpFirstBtn = pNewBtnData;
-        else
-        {
-            ImplWizButtonData* pBtnData = mpFirstBtn;
-            while ( pBtnData->mpNext )
-                pBtnData = pBtnData->mpNext;
-            pBtnData->mpNext = pNewBtnData;
-        }
-    }
-
-    void RoadmapWizard::RemoveButton( Button* pButton )
-    {
-        ImplWizButtonData*  pPrevBtnData = nullptr;
-        ImplWizButtonData*  pBtnData = mpFirstBtn;
-        while ( pBtnData )
-        {
-            if ( pBtnData->mpButton == pButton )
-            {
-                if ( pPrevBtnData )
-                    pPrevBtnData->mpNext = pBtnData->mpNext;
-                else
-                    mpFirstBtn = pBtnData->mpNext;
-                delete pBtnData;
-                return;
-            }
-
-            pPrevBtnData = pBtnData;
-            pBtnData = pBtnData->mpNext;
-        }
-
-        OSL_FAIL( "RoadmapWizard::RemoveButton() - Button not in list" );
-    }
-
-    IMPL_LINK_NOARG(RoadmapWizard, OnFinish, Button*, void)
-    {
-        if ( isTravelingSuspended() )
-            return;
-        RoadmapWizardTravelSuspension aTravelGuard( *this );
-        Finish( RET_OK );
-    }
-
-    bool RoadmapWizard::skipBackwardUntil( WizardTypes::WizardState 
_nTargetState )
-    {
-        // don't travel directly on m_xWizardImpl->aStateHistory, in case 
something goes wrong
-        std::stack< WizardTypes::WizardState > aTravelVirtually = 
m_xWizardImpl->aStateHistory;
-        std::stack< WizardTypes::WizardState > aOldStateHistory = 
m_xWizardImpl->aStateHistory;
-
-        WizardTypes::WizardState nCurrentRollbackState = getCurrentState();
-        while ( nCurrentRollbackState != _nTargetState )
-        {
-            DBG_ASSERT( !aTravelVirtually.empty(), 
"RoadmapWizard::skipBackwardUntil: this target state does not exist in the 
history!" );
-            nCurrentRollbackState = aTravelVirtually.top();
-            aTravelVirtually.pop();
-        }
-        m_xWizardImpl->aStateHistory = std::move(aTravelVirtually);
-        if ( !ShowPage( _nTargetState ) )
-        {
-            m_xWizardImpl->aStateHistory = std::move(aOldStateHistory);
-            return false;
-        }
-        return true;
-    }
-
-    bool RoadmapWizard::skipUntil( WizardTypes::WizardState _nTargetState )
-    {
-        WizardTypes::WizardState nCurrentState = getCurrentState();
-
-        // don't travel directly on m_xWizardImpl->aStateHistory, in case 
something goes wrong
-        std::stack< WizardTypes::WizardState > aTravelVirtually = 
m_xWizardImpl->aStateHistory;
-        std::stack< WizardTypes::WizardState > aOldStateHistory = 
m_xWizardImpl->aStateHistory;
-        while ( nCurrentState != _nTargetState )
-        {
-            WizardTypes::WizardState nNextState = determineNextState( 
nCurrentState );
-            if ( WZS_INVALID_STATE == nNextState )
-            {
-                OSL_FAIL( "RoadmapWizard::skipUntil: the given target state 
does not exist!" );
-                return false;
-            }
-
-            // remember the skipped state in the history
-            aTravelVirtually.push( nCurrentState );
-
-            // get the next state
-            nCurrentState = nNextState;
-        }
-        m_xWizardImpl->aStateHistory = std::move(aTravelVirtually);
-        // show the target page
-        if ( !ShowPage( nCurrentState ) )
-        {
-            // argh! prepareLeaveCurrentPage succeeded, determineNextState 
succeeded,
-            // but ShowPage doesn't? Somebody behaves very strange here...
-            OSL_FAIL( "RoadmapWizard::skipUntil: very unpolite..." );
-            m_xWizardImpl->aStateHistory = std::move(aOldStateHistory);
-            return false;
-        }
-        return true;
-    }
-
-    void RoadmapWizard::travelNext()
-    {
-        // determine the next state to travel to
-        WizardTypes::WizardState nCurrentState = getCurrentState();
-        WizardTypes::WizardState nNextState = 
determineNextState(nCurrentState);
-        if (WZS_INVALID_STATE == nNextState)
-            return;
-
-        // the state history is used by the enterState method
-        // all fine
-        m_xWizardImpl->aStateHistory.push(nCurrentState);
-        if (!ShowPage(nNextState))
-        {
-            m_xWizardImpl->aStateHistory.pop();
-        }
-    }
-
-    void RoadmapWizard::travelPrevious()
-    {
-        DBG_ASSERT(!m_xWizardImpl->aStateHistory.empty(), 
"RoadmapWizard::travelPrevious: have no previous page!");
-
-        // the next state to switch to
-        WizardTypes::WizardState nPreviousState = 
m_xWizardImpl->aStateHistory.top();
-
-        // the state history is used by the enterState method
-        m_xWizardImpl->aStateHistory.pop();
-        // show this page
-        if (!ShowPage(nPreviousState))
-        {
-            m_xWizardImpl->aStateHistory.push(nPreviousState);
-        }
-
-        // all fine
-    }
-
-    void  RoadmapWizard::removePageFromHistory( WizardTypes::WizardState 
nToRemove )
-    {
-
-        std::stack< WizardTypes::WizardState > aTemp;
-        while(!m_xWizardImpl->aStateHistory.empty())
-        {
-            WizardTypes::WizardState nPreviousState = 
m_xWizardImpl->aStateHistory.top();
-            m_xWizardImpl->aStateHistory.pop();
-            if(nPreviousState != nToRemove)
-                aTemp.push( nPreviousState );
-            else
-                break;
-        }
-        while(!aTemp.empty())
-        {
-            m_xWizardImpl->aStateHistory.push( aTemp.top() );
-            aTemp.pop();
-        }
-    }
-
-    IMPL_LINK_NOARG(RoadmapWizard, OnPrevPage, Button*, void)
-    {
-        if ( isTravelingSuspended() )
-            return;
-        RoadmapWizardTravelSuspension aTravelGuard( *this );
-        travelPrevious();
-    }
-
-    IMPL_LINK_NOARG(RoadmapWizard, OnNextPage, Button*, void)
-    {
-        if ( isTravelingSuspended() )
-            return;
-        RoadmapWizardTravelSuspension aTravelGuard( *this );
-        travelNext();
-    }
-
-    bool RoadmapWizard::isTravelingSuspended() const
-    {
-        return m_xWizardImpl->m_bTravelingSuspended;
-    }
-
-    void RoadmapWizard::suspendTraveling( AccessGuard )
-    {
-        DBG_ASSERT( !m_xWizardImpl->m_bTravelingSuspended, 
"RoadmapWizard::suspendTraveling: already suspended!" );
-        m_xWizardImpl->m_bTravelingSuspended = true;
-    }
-
-    void RoadmapWizard::resumeTraveling( AccessGuard )
-    {
-        DBG_ASSERT( m_xWizardImpl->m_bTravelingSuspended, 
"RoadmapWizard::resumeTraveling: nothing to resume!" );
-        m_xWizardImpl->m_bTravelingSuspended = false;
-    }
-
     WizardMachine::WizardMachine(weld::Window* pParent, WizardButtonFlags 
nButtonFlags)
         : AssistantController(pParent, u"vcl/ui/wizard.ui"_ustr, 
u"Wizard"_ustr)
         , m_pCurTabPage(nullptr)
diff --git a/vcl/source/control/wizimpldata.hxx 
b/vcl/source/control/wizimpldata.hxx
index 6a9f407d0ce2..916f1e06b602 100644
--- a/vcl/source/control/wizimpldata.hxx
+++ b/vcl/source/control/wizimpldata.hxx
@@ -24,6 +24,9 @@
 #include <set>
 #include <vcl/toolkit/roadmap.hxx>
 
+constexpr OUString HID_WIZARD_NEXT = u"SVT_HID_WIZARD_NEXT"_ustr;
+constexpr OUString HID_WIZARD_PREVIOUS = u"SVT_HID_WIZARD_PREVIOUS"_ustr;
+
 struct WizPageData
 {
     WizPageData*    mpNext;
commit 646734878fecb44f2aeab6fd116edfa0099075cb
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat May 17 23:02:26 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun May 18 20:37:21 2025 +0200

    vcl: Use #pragma once
    
    Change-Id: Id1088364587fc0c47f77cb3657cd3074e806dc52
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185459
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
index 1858f76fc536..cc68840b3acf 100644
--- a/include/vcl/wizardmachine.hxx
+++ b/include/vcl/wizardmachine.hxx
@@ -16,8 +16,7 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_VCL_WIZARDMACHINE_HXX
-#define INCLUDED_VCL_WIZARDMACHINE_HXX
+#pragma once
 
 #include <memory>
 #include <vcl/dllapi.h>
@@ -348,6 +347,4 @@ namespace vcl
 #define WIZARDDIALOG_BUTTON_STDOFFSET_X         6
 #define WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X    3
 
-#endif // INCLUDED_VCL_WIZARDMACHINE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to