diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-06-06 13:28:22 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-06-06 13:28:22 +0000 |
commit | 4d7d8b603c6fd1126e973ce1caade8f2051c8895 (patch) | |
tree | 716b90dd8a313e851e2577c8a9a7ed9670eaf9db | |
parent | 0457ea721a3fdec733d7f123895871e98a4f6dc8 (diff) |
INTEGRATION: CWS dba30c (1.20.38); FILE MERGED
2008/05/13 11:22:33 fs 1.20.38.1: joining changes from CWS odbmacros3 to CWS dba30c:
2008/04/14 11:17:43 fs 1.19.10.1: #i49133# canAdvance: be smarter if we did not yet explicitly decide for a path: if there is only one path possible at this point, then allow advancing
2008/04/15 13:07:34 fs 1.19.10.2: RESYNC: (1.19-1.20); FILE MERGED
-rw-r--r-- | svtools/source/dialogs/roadmapwizard.cxx | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index f649523b51fa..34b37455c3ea 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: roadmapwizard.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.21 $ * * This file is part of OpenOffice.org. * @@ -483,8 +483,31 @@ namespace svt bool RoadmapWizard::canAdvance() const { if ( !m_pImpl->bActivePathIsDefinite ) - // there's always a next state if we did not yet decide for a path - return true; + { + // check how many paths are still allowed + const WizardPath& rActivePath( m_pImpl->aPaths[ m_pImpl->nActivePath ] ); + sal_Int32 nCurrentStatePathIndex = m_pImpl->getStateIndexInPath( getCurrentState(), rActivePath ); + + size_t nPossiblePaths(0); + for ( Paths::const_iterator aPathPos = m_pImpl->aPaths.begin(); + aPathPos != m_pImpl->aPaths.end(); + ++aPathPos + ) + { + // the index from which on both paths differ + sal_Int32 nDivergenceIndex = m_pImpl->getFirstDifferentIndex( rActivePath, aPathPos->second ); + + if ( nDivergenceIndex > nCurrentStatePathIndex ) + // this path is still a possible path + nPossiblePaths += 1; + } + + // if we have more than one path which is still possible, then we assume + // to always have a next state. Though there might be scenarios where this + // is not true, but this is too sophisticated (means not really needed) right now. + if ( nPossiblePaths > 1 ) + return true; + } const WizardPath& rPath = m_pImpl->aPaths[ m_pImpl->nActivePath ]; if ( *rPath.rbegin() == getCurrentState() ) @@ -497,6 +520,22 @@ namespace svt void RoadmapWizard::updateTravelUI() { OWizardMachine::updateTravelUI(); + + // disable the "Previous" button if all states in our history are disabled + ::std::vector< WizardState > aHistory; + getStateHistory( aHistory ); + bool bHaveEnabledState = false; + for ( ::std::vector< WizardState >::const_iterator state = aHistory.begin(); + state != aHistory.end() && !bHaveEnabledState; + ++state + ) + { + if ( isStateEnabled( *state ) ) + bHaveEnabledState = true; + } + + enableButtons( WZB_PREVIOUS, bHaveEnabledState ); + implUpdateRoadmap(); } @@ -606,10 +645,9 @@ namespace svt m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable ); } //-------------------------------------------------------------------- - bool RoadmapWizard::isStateEnabled( WizardState _nState ) const + bool RoadmapWizard::isStateEnabled( WizardState _nState ) const { - sal_Bool bEnabled = m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end(); - return bEnabled; + return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end(); } //-------------------------------------------------------------------- void RoadmapWizard::Resize() |