summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-03 20:17:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-16 22:32:42 +0200
commit4d450704d672dddf2c555fda5ff3140d8c537d02 (patch)
treea7e13e2b579792695ebc900740b9c0ce466634bd /svtools
parentf52d015b04779b8aaa3e353cbd9d0d5da3e73a16 (diff)
move WizardMachine to vcl
Change-Id: I55cc4a6c1ad111a22a43fd66a3cd01b5b02fb7cb Reviewed-on: https://gerrit.libreoffice.org/76902 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx18
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx686
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.cxx4
-rw-r--r--svtools/source/uno/wizard/wizardpagecontroller.hxx6
-rw-r--r--svtools/source/uno/wizard/wizardshell.cxx8
-rw-r--r--svtools/source/uno/wizard/wizardshell.hxx2
7 files changed, 18 insertions, 707 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 5ebfeb980dd1..62981eea217d 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -125,7 +125,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/dialogs/restartdialog \
svtools/source/dialogs/roadmapwizard \
svtools/source/dialogs/ServerDetailsControls \
- svtools/source/dialogs/wizardmachine \
svtools/source/edit/editsyntaxhighlighter \
svtools/source/edit/svmedit \
svtools/source/edit/svmedit2 \
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index 6139634edfe1..8e9b4e38a260 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -34,7 +34,7 @@ namespace svt
{
namespace
{
- typedef ::std::set< WizardTypes::WizardState > StateSet;
+ typedef ::std::set< vcl::WizardTypes::WizardState > StateSet;
typedef ::std::map<
RoadmapWizardTypes::PathId,
@@ -42,7 +42,7 @@ namespace svt
> Paths;
typedef ::std::map<
- WizardTypes::WizardState,
+ vcl::WizardTypes::WizardState,
::std::pair<
OUString,
RoadmapWizardTypes::RoadmapPageFactory
@@ -67,15 +67,15 @@ namespace svt
}
/// returns the index of the current state in given path, or -1
- static sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath );
+ static sal_Int32 getStateIndexInPath( vcl::WizardTypes::WizardState _nState, const WizardPath& _rPath );
/// returns the index of the current state in the path with the given id, or -1
- sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, PathId _nPathId );
+ sal_Int32 getStateIndexInPath( vcl::WizardTypes::WizardState _nState, PathId _nPathId );
/// returns the index of the first state in which the two given paths differ
static sal_Int32 getFirstDifferentIndex( const WizardPath& _rLHS, const WizardPath& _rRHS );
};
- sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState _nState, const WizardPath& _rPath )
+ sal_Int32 RoadmapWizardImpl::getStateIndexInPath( vcl::WizardTypes::WizardState _nState, const WizardPath& _rPath )
{
sal_Int32 nStateIndexInPath = 0;
bool bFound = false;
@@ -94,7 +94,7 @@ namespace svt
}
- sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState _nState, PathId _nPathId )
+ sal_Int32 RoadmapWizardImpl::getStateIndexInPath( vcl::WizardTypes::WizardState _nState, PathId _nPathId )
{
sal_Int32 nStateIndexInPath = -1;
Paths::const_iterator aPathPos = aPaths.find( _nPathId );
@@ -271,7 +271,7 @@ namespace svt
TabPage* pCurrentPage = GetPage( getCurrentState() );
if ( pCurrentPage )
{
- const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
+ const vcl::IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
OSL_ENSURE( pController != nullptr, "RoadmapWizard::implUpdateRoadmap: no controller for the current page!" );
bCurrentPageCanAdvance = !pController || pController->canAdvance();
}
@@ -337,7 +337,7 @@ namespace svt
}
- WizardTypes::WizardState RoadmapWizard::determineNextState( WizardState _nCurrentState ) const
+ vcl::WizardTypes::WizardState RoadmapWizard::determineNextState( WizardState _nCurrentState ) const
{
sal_Int32 nCurrentStatePathIndex = -1;
@@ -432,7 +432,7 @@ namespace svt
if ( isTravelingSuspended() )
return;
- WizardTravelSuspension aTravelGuard( *this );
+ vcl::WizardTravelSuspension aTravelGuard( *this );
sal_Int32 nCurrentIndex = m_pImpl->getStateIndexInPath( getCurrentState(), m_pImpl->nActivePath );
sal_Int32 nNewIndex = m_pImpl->getStateIndexInPath( nCurItemId, m_pImpl->nActivePath );
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
deleted file mode 100644
index 54c830c42507..000000000000
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ /dev/null
@@ -1,686 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svtools/wizardmachine.hxx>
-#include <svtools/helpids.h>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <svtools/svtresid.hxx>
-#include <svtools/strings.hrc>
-#include <vcl/svapp.hxx>
-#include <stack>
-
-namespace svt
-{
- //= WizardPageImplData
- OWizardPage::OWizardPage(vcl::Window *pParent, const OString& rID,
- const OUString& rUIXMLDescription)
- : TabPage(pParent, rID, rUIXMLDescription)
- {
- }
-
- OWizardPage::OWizardPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID)
- : TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get()) //just drag this along hidden in this scenario
- , m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, rUIXMLDescription)
- : Application::CreateInterimBuilder(this, rUIXMLDescription))
- , m_xContainer(m_xBuilder->weld_container(rID))
- {
- }
-
- OWizardPage::~OWizardPage()
- {
- disposeOnce();
- }
-
- void OWizardPage::dispose()
- {
- m_xBuilder.reset();
- TabPage::dispose();
- }
-
- void OWizardPage::initializePage()
- {
- }
-
- void OWizardPage::ActivatePage()
- {
- TabPage::ActivatePage();
- updateDialogTravelUI();
- }
-
- void OWizardPage::updateDialogTravelUI()
- {
- OWizardMachine* pWizardMachine = dynamic_cast< OWizardMachine* >( GetParent() );
- if ( pWizardMachine )
- pWizardMachine->updateTravelUI();
- }
-
- bool OWizardPage::canAdvance() const
- {
- return true;
- }
-
- bool OWizardPage::commitPage( WizardTypes::CommitPageReason )
- {
- return true;
- }
-
- struct WizardMachineImplData : public WizardTypes
- {
- OUString sTitleBase; // the base for the title
- ::std::stack< WizardState > aStateHistory; // the history of all states (used for implementing "Back")
-
- 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
-
- bool m_bAutoNextButtonState;
-
- bool m_bTravelingSuspended;
-
- WizardMachineImplData()
- :nFirstUnknownPage( 0 )
- ,m_bAutoNextButtonState( false )
- ,m_bTravelingSuspended( false )
- {
- }
- };
-
- OWizardMachine::OWizardMachine(vcl::Window* _pParent, WizardButtonFlags _nButtonFlags )
- :WizardDialog( _pParent, "WizardDialog", "svt/ui/wizarddialog.ui" )
- ,m_pFinish(nullptr)
- ,m_pCancel(nullptr)
- ,m_pNextPage(nullptr)
- ,m_pPrevPage(nullptr)
- ,m_pHelp(nullptr)
- ,m_pImpl( new WizardMachineImplData )
- {
- implConstruct( _nButtonFlags );
- }
-
-
- void OWizardMachine::implConstruct( const WizardButtonFlags _nButtonFlags )
- {
- m_pImpl->sTitleBase = GetText();
-
- // create the buttons according to the wizard button flags
- // the help button
- if (_nButtonFlags & WizardButtonFlags::HELP)
- {
- m_pHelp= VclPtr<HelpButton>::Create(this, WB_TABSTOP);
- m_pHelp->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
- m_pHelp->Show();
- AddButton( m_pHelp, WIZARDDIALOG_BUTTON_STDOFFSET_X);
- }
-
- // the previous button
- if (_nButtonFlags & WizardButtonFlags::PREVIOUS)
- {
- m_pPrevPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- m_pPrevPage->SetHelpId( HID_WIZARD_PREVIOUS );
- m_pPrevPage->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
- m_pPrevPage->SetText(SvtResId(STR_WIZDLG_PREVIOUS));
- m_pPrevPage->Show();
- m_pPrevPage->set_id("previous");
-
- if (_nButtonFlags & WizardButtonFlags::NEXT)
- AddButton( m_pPrevPage, ( WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X) ); // half x-offset to the next button
- else
- AddButton( m_pPrevPage, WIZARDDIALOG_BUTTON_STDOFFSET_X );
- SetPrevButton( m_pPrevPage );
- m_pPrevPage->SetClickHdl( LINK( this, OWizardMachine, OnPrevPage ) );
- }
-
- // the next button
- if (_nButtonFlags & WizardButtonFlags::NEXT)
- {
- m_pNextPage = VclPtr<PushButton>::Create(this, WB_TABSTOP);
- m_pNextPage->SetHelpId( HID_WIZARD_NEXT );
- m_pNextPage->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
- m_pNextPage->SetText(SvtResId(STR_WIZDLG_NEXT));
- m_pNextPage->Show();
- m_pNextPage->set_id("next");
-
- AddButton( m_pNextPage, WIZARDDIALOG_BUTTON_STDOFFSET_X );
- SetNextButton( m_pNextPage );
- m_pNextPage->SetClickHdl( LINK( this, OWizardMachine, OnNextPage ) );
- }
-
- // the finish button
- if (_nButtonFlags & WizardButtonFlags::FINISH)
- {
- m_pFinish = VclPtr<OKButton>::Create(this, WB_TABSTOP);
- m_pFinish->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
- m_pFinish->SetText(SvtResId(STR_WIZDLG_FINISH));
- m_pFinish->Show();
- m_pFinish->set_id("finish");
-
- AddButton( m_pFinish, WIZARDDIALOG_BUTTON_STDOFFSET_X );
- m_pFinish->SetClickHdl( LINK( this, OWizardMachine, OnFinish ) );
- }
-
- // the cancel button
- if (_nButtonFlags & WizardButtonFlags::CANCEL)
- {
- m_pCancel = VclPtr<CancelButton>::Create(this, WB_TABSTOP);
- m_pCancel->SetSizePixel(LogicToPixel(Size(50, 14), MapMode(MapUnit::MapAppFont)));
- m_pCancel->Show();
-
- AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X );
- }
- }
-
-
- OWizardMachine::~OWizardMachine()
- {
- disposeOnce();
- }
-
- void OWizardMachine::dispose()
- {
- m_pFinish.disposeAndClear();
- m_pCancel.disposeAndClear();
- m_pNextPage.disposeAndClear();
- m_pPrevPage.disposeAndClear();
- m_pHelp.disposeAndClear();
-
- if (m_pImpl)
- {
- for (WizardState i = 0; i < m_pImpl->nFirstUnknownPage; ++i)
- {
- TabPage *pPage = GetPage(i);
- if (pPage)
- pPage->disposeOnce();
- }
- m_pImpl.reset();
- }
-
- WizardDialog::dispose();
- }
-
-
- void OWizardMachine::implUpdateTitle()
- {
- OUString sCompleteTitle(m_pImpl->sTitleBase);
-
- // append the page title
- TabPage* pCurrentPage = GetPage(getCurrentState());
- if ( pCurrentPage && !pCurrentPage->GetText().isEmpty() )
- {
- sCompleteTitle += " - " + pCurrentPage->GetText();
- }
-
- SetText(sCompleteTitle);
- }
-
-
- void OWizardMachine::setTitleBase(const OUString& _rTitleBase)
- {
- m_pImpl->sTitleBase = _rTitleBase;
- implUpdateTitle();
- }
-
-
- TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState )
- {
- if ( nullptr == GetPage( i_nState ) )
- {
- VclPtr<TabPage> pNewPage = createPage( i_nState );
- DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" );
-
- // fill up the page sequence of our base class (with dummies)
- while ( m_pImpl->nFirstUnknownPage < i_nState )
- {
- AddPage( nullptr );
- ++m_pImpl->nFirstUnknownPage;
- }
-
- if ( m_pImpl->nFirstUnknownPage == i_nState )
- {
- // encountered this page number the first time
- AddPage( pNewPage );
- ++m_pImpl->nFirstUnknownPage;
- }
- else
- // already had this page - just change it
- SetPage( i_nState, pNewPage );
- }
- return GetPage( i_nState );
- }
-
-
- void OWizardMachine::ActivatePage()
- {
- WizardDialog::ActivatePage();
-
- WizardState nCurrentLevel = GetCurLevel();
- GetOrCreatePage( nCurrentLevel );
-
- enterState( nCurrentLevel );
- }
-
-
- bool OWizardMachine::DeactivatePage()
- {
- WizardState nCurrentState = getCurrentState();
- return leaveState(nCurrentState) && WizardDialog::DeactivatePage();
- }
-
-
- void OWizardMachine::defaultButton(WizardButtonFlags _nWizardButtonFlags)
- {
- // the new default button
- PushButton* pNewDefButton = nullptr;
- if (m_pFinish && (_nWizardButtonFlags & WizardButtonFlags::FINISH))
- pNewDefButton = m_pFinish;
- if (m_pNextPage && (_nWizardButtonFlags & WizardButtonFlags::NEXT))
- pNewDefButton = m_pNextPage;
- if (m_pPrevPage && (_nWizardButtonFlags & WizardButtonFlags::PREVIOUS))
- pNewDefButton = m_pPrevPage;
- if (m_pHelp && (_nWizardButtonFlags & WizardButtonFlags::HELP))
- pNewDefButton = m_pHelp;
- if (m_pCancel && (_nWizardButtonFlags & WizardButtonFlags::CANCEL))
- pNewDefButton = m_pCancel;
-
- if ( pNewDefButton )
- defaultButton( pNewDefButton );
- else
- implResetDefault( this );
- }
-
-
- void OWizardMachine::implResetDefault(vcl::Window const * _pWindow)
- {
- vcl::Window* pChildLoop = _pWindow->GetWindow(GetWindowType::FirstChild);
- while (pChildLoop)
- {
- // does the window participate in the tabbing order?
- if (pChildLoop->GetStyle() & WB_DIALOGCONTROL)
- implResetDefault(pChildLoop);
-
- // is it a button?
- WindowType eType = pChildLoop->GetType();
- if ( (WindowType::PUSHBUTTON == eType)
- || (WindowType::OKBUTTON == eType)
- || (WindowType::CANCELBUTTON == eType)
- || (WindowType::HELPBUTTON == eType)
- || (WindowType::IMAGEBUTTON == eType)
- || (WindowType::MENUBUTTON == eType)
- || (WindowType::MOREBUTTON == eType)
- )
- {
- pChildLoop->SetStyle(pChildLoop->GetStyle() & ~WB_DEFBUTTON);
- }
-
- // the next one ...
- pChildLoop = pChildLoop->GetWindow(GetWindowType::Next);
- }
- }
-
-
- void OWizardMachine::defaultButton(PushButton* _pNewDefButton)
- {
- // loop through all (direct and indirect) descendants which participate in our tabbing order, and
- // reset the WB_DEFBUTTON for every window which is a button
- implResetDefault(this);
-
- // set its new style
- if (_pNewDefButton)
- _pNewDefButton->SetStyle(_pNewDefButton->GetStyle() | WB_DEFBUTTON);
- }
-
-
- void OWizardMachine::enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable)
- {
- if (m_pFinish && (_nWizardButtonFlags & WizardButtonFlags::FINISH))
- m_pFinish->Enable(_bEnable);
- if (m_pNextPage && (_nWizardButtonFlags & WizardButtonFlags::NEXT))
- m_pNextPage->Enable(_bEnable);
- if (m_pPrevPage && (_nWizardButtonFlags & WizardButtonFlags::PREVIOUS))
- m_pPrevPage->Enable(_bEnable);
- if (m_pHelp && (_nWizardButtonFlags & WizardButtonFlags::HELP))
- m_pHelp->Enable(_bEnable);
- if (m_pCancel && (_nWizardButtonFlags & WizardButtonFlags::CANCEL))
- m_pCancel->Enable(_bEnable);
- }
-
-
- void OWizardMachine::enterState(WizardState _nState)
- {
- // tell the page
- IWizardPageController* pController = getPageController( GetPage( _nState ) );
- OSL_ENSURE( pController, "OWizardMachine::enterState: no controller for the given page!" );
- if ( pController )
- pController->initializePage();
-
- if ( isAutomaticNextButtonStateEnabled() )
- enableButtons( WizardButtonFlags::NEXT, canAdvance() );
-
- enableButtons( WizardButtonFlags::PREVIOUS, !m_pImpl->aStateHistory.empty() );
-
- // set the new title - it depends on the current page (i.e. state)
- implUpdateTitle();
- }
-
-
- bool OWizardMachine::leaveState(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,
- // and it was allowed to commit it's data
-
- return true;
- }
-
-
- bool OWizardMachine::onFinish()
- {
- return Finish( RET_OK );
- }
-
-
- IMPL_LINK_NOARG(OWizardMachine, OnFinish, Button*, void)
- {
- if ( isTravelingSuspended() )
- return;
- WizardTravelSuspension aTravelGuard( *this );
- if ( !prepareLeaveCurrentState( eFinish ) )
- {
- return;
- }
- onFinish();
- }
-
-
- OWizardMachine::WizardState OWizardMachine::determineNextState( WizardState _nCurrentState ) const
- {
- return _nCurrentState + 1;
- }
-
-
- bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason )
- {
- IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
- ENSURE_OR_RETURN( pController != nullptr, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", true );
- return pController->commitPage( _eReason );
- }
-
-
- bool OWizardMachine::skipBackwardUntil( WizardState _nTargetState )
- {
- // allowed to leave the current page?
- if ( !prepareLeaveCurrentState( 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;
-
- WizardState nCurrentRollbackState = getCurrentState();
- while ( nCurrentRollbackState != _nTargetState )
- {
- DBG_ASSERT( !aTravelVirtually.empty(), "OWizardMachine::skipBackwardUntil: this target state does not exist in the history!" );
- nCurrentRollbackState = aTravelVirtually.top();
- aTravelVirtually.pop();
- }
- m_pImpl->aStateHistory = aTravelVirtually;
- if ( !ShowPage( _nTargetState ) )
- {
- m_pImpl->aStateHistory = aOldStateHistory;
- return false;
- }
- return true;
- }
-
-
- bool OWizardMachine::skipUntil( WizardState _nTargetState )
- {
- WizardState nCurrentState = getCurrentState();
-
- // allowed to leave the current page?
- if ( !prepareLeaveCurrentState( nCurrentState < _nTargetState ? eTravelForward : 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;
- while ( nCurrentState != _nTargetState )
- {
- WizardState nNextState = determineNextState( nCurrentState );
- if ( WZS_INVALID_STATE == nNextState )
- {
- OSL_FAIL( "OWizardMachine::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_pImpl->aStateHistory = aTravelVirtually;
- // show the target page
- if ( !ShowPage( nCurrentState ) )
- {
- // argh! prepareLeaveCurrentPage succeeded, determineNextState succeeded,
- // but ShowPage doesn't? Somebody behaves very strange here ....
- OSL_FAIL( "OWizardMachine::skipUntil: very unpolite ...." );
- m_pImpl->aStateHistory = aOldStateHistory;
- return false;
- }
- return true;
- }
-
-
- void OWizardMachine::skip()
- {
- // allowed to leave the current page?
- if ( !prepareLeaveCurrentState( eTravelForward ) )
- return;
-
- WizardState nCurrentState = getCurrentState();
- WizardState nNextState = determineNextState(nCurrentState);
-
- if (WZS_INVALID_STATE == nNextState)
- return;
-
- // remember the skipped state in the history
- m_pImpl->aStateHistory.push(nCurrentState);
-
- // get the next state
- nCurrentState = nNextState;
-
- // show the (n+1)th page
- if (!ShowPage(nCurrentState))
- {
- // TODO: this leaves us in a state where we have no current page and an inconsistent state history.
- // Perhaps we should rollback the skipping here ....
- OSL_FAIL("OWizardMachine::skip: very unpolite ....");
- // if somebody does a skip and then does not allow to leave ...
- // (can't be a commit error, as we've already committed the current page. So if ShowPage fails here,
- // somebody behaves really strange ...)
- return;
- }
-
- // all fine
- }
-
-
- bool OWizardMachine::travelNext()
- {
- // allowed to leave the current page?
- if ( !prepareLeaveCurrentState( eTravelForward ) )
- return false;
-
- // determine the next state to travel to
- WizardState nCurrentState = getCurrentState();
- WizardState nNextState = determineNextState(nCurrentState);
- if (WZS_INVALID_STATE == nNextState)
- return false;
-
- // the state history is used by the enterState method
- // all fine
- m_pImpl->aStateHistory.push(nCurrentState);
- if (!ShowPage(nNextState))
- {
- m_pImpl->aStateHistory.pop();
- return false;
- }
-
- return true;
- }
-
-
- bool OWizardMachine::travelPrevious()
- {
- DBG_ASSERT(!m_pImpl->aStateHistory.empty(), "OWizardMachine::travelPrevious: have no previous page!");
-
- // allowed to leave the current page?
- if ( !prepareLeaveCurrentState( eTravelBackward ) )
- return false;
-
- // the next state to switch to
- WizardState nPreviousState = m_pImpl->aStateHistory.top();
-
- // the state history is used by the enterState method
- m_pImpl->aStateHistory.pop();
- // show this page
- if (!ShowPage(nPreviousState))
- {
- m_pImpl->aStateHistory.push(nPreviousState);
- return false;
- }
-
- // all fine
- return true;
- }
-
-
- void OWizardMachine::removePageFromHistory( WizardState nToRemove )
- {
-
- ::std::stack< WizardState > aTemp;
- while(!m_pImpl->aStateHistory.empty())
- {
- WizardState nPreviousState = m_pImpl->aStateHistory.top();
- m_pImpl->aStateHistory.pop();
- if(nPreviousState != nToRemove)
- aTemp.push( nPreviousState );
- else
- break;
- }
- while(!aTemp.empty())
- {
- m_pImpl->aStateHistory.push( aTemp.top() );
- aTemp.pop();
- }
- }
-
-
- void OWizardMachine::enableAutomaticNextButtonState()
- {
- m_pImpl->m_bAutoNextButtonState = true;
- }
-
-
- bool OWizardMachine::isAutomaticNextButtonStateEnabled() const
- {
- return m_pImpl->m_bAutoNextButtonState;
- }
-
-
- IMPL_LINK_NOARG(OWizardMachine, OnPrevPage, Button*, void)
- {
- if ( isTravelingSuspended() )
- return;
- WizardTravelSuspension aTravelGuard( *this );
- travelPrevious();
- }
-
-
- IMPL_LINK_NOARG(OWizardMachine, OnNextPage, Button*, void)
- {
- if ( isTravelingSuspended() )
- return;
- WizardTravelSuspension aTravelGuard( *this );
- travelNext();
- }
-
-
- IWizardPageController* OWizardMachine::getPageController( TabPage* _pCurrentPage ) const
- {
- IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage );
- return pController;
- }
-
-
- void OWizardMachine::getStateHistory( ::std::vector< WizardState >& _out_rHistory )
- {
- ::std::stack< WizardState > aHistoryCopy( m_pImpl->aStateHistory );
- while ( !aHistoryCopy.empty() )
- {
- _out_rHistory.push_back( aHistoryCopy.top() );
- aHistoryCopy.pop();
- }
- }
-
-
- bool OWizardMachine::canAdvance() const
- {
- return WZS_INVALID_STATE != determineNextState( getCurrentState() );
- }
-
-
- void OWizardMachine::updateTravelUI()
- {
- const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) );
- OSL_ENSURE( pController != nullptr, "RoadmapWizard::updateTravelUI: no controller for the current page!" );
-
- bool bCanAdvance =
- ( !pController || pController->canAdvance() ) // the current page allows to advance
- && canAdvance(); // the dialog as a whole allows to advance
- enableButtons( WizardButtonFlags::NEXT, bCanAdvance );
- }
-
-
- bool OWizardMachine::isTravelingSuspended() const
- {
- return m_pImpl->m_bTravelingSuspended;
- }
-
-
- void OWizardMachine::suspendTraveling( AccessGuard )
- {
- DBG_ASSERT( !m_pImpl->m_bTravelingSuspended, "OWizardMachine::suspendTraveling: already suspended!" );
- m_pImpl->m_bTravelingSuspended = true;
- }
-
-
- void OWizardMachine::resumeTraveling( AccessGuard )
- {
- DBG_ASSERT( m_pImpl->m_bTravelingSuspended, "OWizardMachine::resumeTraveling: nothing to resume!" );
- m_pImpl->m_bTravelingSuspended = false;
- }
-
-
-} // namespace svt
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx
index 70364d67034e..5c5a4a725b6a 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.cxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -128,8 +128,7 @@ namespace svt { namespace uno
}
}
-
- bool WizardPageController::commitPage( WizardTypes::CommitPageReason i_eReason )
+ bool WizardPageController::commitPage( vcl::WizardTypes::CommitPageReason i_eReason )
{
if ( !m_xWizardPage.is() )
return true;
@@ -146,7 +145,6 @@ namespace svt { namespace uno
return true;
}
-
bool WizardPageController::canAdvance() const
{
if ( !m_xWizardPage.is() )
diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx
index 7d11c292cf8a..b81421372e82 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.hxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_SVTOOLS_SOURCE_UNO_WIZARD_WIZARDPAGECONTROLLER_HXX
#define INCLUDED_SVTOOLS_SOURCE_UNO_WIZARD_WIZARDPAGECONTROLLER_HXX
-#include <svtools/wizardmachine.hxx>
+#include <vcl/wizardmachine.hxx>
#include <com/sun/star/ui/dialogs/XWizardController.hpp>
@@ -34,7 +34,7 @@ namespace svt { namespace uno
//= WizardPageController
- class WizardPageController : public IWizardPageController
+ class WizardPageController : public vcl::IWizardPageController
{
public:
WizardPageController(
@@ -46,7 +46,7 @@ namespace svt { namespace uno
// IWizardPageController overridables
virtual void initializePage() override;
- virtual bool commitPage( WizardTypes::CommitPageReason _eReason ) override;
+ virtual bool commitPage( vcl::WizardTypes::CommitPageReason _eReason ) override;
virtual bool canAdvance() const override;
const css::uno::Reference< css::ui::dialogs::XWizardPage >&
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 81843f74befa..539dd7cea2d5 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -89,13 +89,13 @@ namespace svt { namespace uno
{
switch ( i_eReason )
{
- case WizardTypes::eTravelForward:
+ case vcl::WizardTypes::eTravelForward:
return WizardTravelType::FORWARD;
- case WizardTypes::eTravelBackward:
+ case vcl::WizardTypes::eTravelBackward:
return WizardTravelType::BACKWARD;
- case WizardTypes::eFinish:
+ case vcl::WizardTypes::eFinish:
return WizardTravelType::FINISH;
default:
@@ -188,7 +188,7 @@ namespace svt { namespace uno
return pPage;
}
- IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
+ vcl::IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const
{
return impl_getController( i_pCurrentPage ).get();
}
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index 34016a16f259..2b17fcff5167 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -57,7 +57,7 @@ namespace svt { namespace uno
virtual OUString getStateDisplayName( WizardState i_nState ) const override;
virtual bool canAdvance() const override;
virtual bool onFinish() override;
- virtual IWizardPageController*
+ virtual vcl::IWizardPageController*
getPageController( TabPage* _pCurrentPage ) const override;
static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason );