tdf#132110 page ids might not be state ids
Change-Id: I9f8946acbcf593e9adf6d31631b82cdafcd3f472
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147327
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit cdf7b51229f2353376fb4e9de309fb9ee5580b3a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147356
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
index 04698f3..a29b03a 100644
--- a/include/vcl/wizardmachine.hxx
+++ b/include/vcl/wizardmachine.hxx
@@ -302,6 +302,9 @@ namespace vcl
*/
void getStateHistory(std::vector<WizardTypes::WizardState>& out_rHistory);
virtual OString getPageIdentForState(WizardTypes::WizardState nState) const;
virtual WizardTypes::WizardState getStateFromPageIdent(const OString& rIdent) const;
public:
class AccessGuard
{
diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx
index 93113d4..4b93f09 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -83,6 +83,16 @@ namespace svt::uno
return WizardShell_Base::run();
}
OString WizardShell::getPageIdentForState(WizardState nState) const
{
return OString::number(impl_stateToPageId(nState));
}
WizardState WizardShell::getStateFromPageIdent(const OString& rIdent) const
{
return impl_pageIdToState(rIdent.toInt32());
}
sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason )
{
switch ( i_eReason )
diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx
index a563ab9..90e7269 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -106,6 +106,9 @@ namespace svt::uno
PWizardPageController impl_getController(BuilderPage* i_pPage) const;
virtual OString getPageIdentForState(WizardState nState) const override;
virtual WizardState getStateFromPageIdent(const OString& rIdent) const override;
// prevent outside access to some base class members
using WizardShell_Base::skip;
using WizardShell_Base::skipUntil;
diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx
index fe4c53b..49c28de 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -470,7 +470,7 @@ namespace vcl
GetOrCreatePage(nState);
}
OString sIdent(OString::number(nState));
OString sIdent(getPageIdentForState(nState));
m_xAssistant->set_page_index(sIdent, nItemIndex);
m_xAssistant->set_page_title(sIdent, getStateDisplayName(nState));
@@ -639,9 +639,9 @@ namespace vcl
IMPL_LINK(RoadmapWizardMachine, OnRoadmapItemSelected, const OString&, rCurItemId, bool)
{
int nCurItemId = rCurItemId.toInt32();
WizardTypes::WizardState nSelectedState = getStateFromPageIdent(rCurItemId);
if ( nCurItemId == getCurrentState() )
if (nSelectedState == getCurrentState())
// nothing to do
return false;
@@ -651,7 +651,7 @@ namespace vcl
WizardTravelSuspension aTravelGuard( *this );
sal_Int32 nCurrentIndex = m_pImpl->getStateIndexInPath( getCurrentState(), m_pImpl->nActivePath );
sal_Int32 nNewIndex = m_pImpl->getStateIndexInPath( nCurItemId, m_pImpl->nActivePath );
sal_Int32 nNewIndex = m_pImpl->getStateIndexInPath( nSelectedState, m_pImpl->nActivePath );
DBG_ASSERT( ( nCurrentIndex != -1 ) && ( nNewIndex != -1 ),
"RoadmapWizard::OnRoadmapItemSelected: something's wrong here!" );
@@ -663,8 +663,8 @@ namespace vcl
bool bResult = true;
if ( nNewIndex > nCurrentIndex )
{
bResult = skipUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );
WizardTypes::WizardState nTemp = static_cast<WizardTypes::WizardState>(nCurItemId);
bResult = skipUntil(nSelectedState);
WizardTypes::WizardState nTemp = nSelectedState;
while( nTemp )
{
if( m_pImpl->aDisabledStates.find( --nTemp ) != m_pImpl->aDisabledStates.end() )
@@ -672,7 +672,7 @@ namespace vcl
}
}
else
bResult = skipBackwardUntil( static_cast<WizardTypes::WizardState>(nCurItemId) );
bResult = skipBackwardUntil(nSelectedState);
return bResult;
}
@@ -746,7 +746,7 @@ namespace vcl
}
// if the state is currently in the roadmap, reflect it's new status
m_xAssistant->set_page_sensitive(OString::number(_nState), _bEnable);
m_xAssistant->set_page_sensitive(getPageIdentForState(_nState), _bEnable);
}
bool RoadmapWizardMachine::knowsState( WizardTypes::WizardState i_nState ) const
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 86176f2f..fc76037 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -893,6 +893,16 @@ namespace vcl
implUpdateTitle();
}
OString WizardMachine::getPageIdentForState(WizardTypes::WizardState nState) const
{
return OString::number(nState);
}
WizardTypes::WizardState WizardMachine::getStateFromPageIdent(const OString& rIdent) const
{
return rIdent.toInt32();
}
BuilderPage* WizardMachine::GetOrCreatePage( const WizardTypes::WizardState i_nState )
{
if ( nullptr == GetPage( i_nState ) )
@@ -1174,7 +1184,7 @@ namespace vcl
if (pOldTabPage)
pOldTabPage->Deactivate();
m_xAssistant->set_current_page(OString::number(nState));
m_xAssistant->set_current_page(getPageIdentForState(nState));
m_pCurTabPage = GetPage(m_nCurState);
m_pCurTabPage->Activate();