1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3*cdf0e10cSrcweir * 4*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * This file is part of OpenOffice.org. 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 11*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 12*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 15*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 16*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 18*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 19*cdf0e10cSrcweir * 20*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 21*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 22*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 23*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 24*cdf0e10cSrcweir * 25*cdf0e10cSrcweir ************************************************************************/ 26*cdf0e10cSrcweir 27*cdf0e10cSrcweir #ifndef SVT_UNO_WIZARD_SHELL 28*cdf0e10cSrcweir #define SVT_UNO_WIZARD_SHELL 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir /** === begin UNO includes === **/ 31*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XWizardController.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XWizard.hpp> 33*cdf0e10cSrcweir /** === end UNO includes === **/ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <svtools/roadmapwizard.hxx> 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 38*cdf0e10cSrcweir #include <map> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir //...................................................................................................................... 41*cdf0e10cSrcweir namespace svt { namespace uno 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir //...................................................................................................................... 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir class WizardPageController; 46*cdf0e10cSrcweir typedef ::boost::shared_ptr< WizardPageController > PWizardPageController; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir //================================================================================================================== 49*cdf0e10cSrcweir //= WizardShell 50*cdf0e10cSrcweir //================================================================================================================== 51*cdf0e10cSrcweir typedef ::svt::RoadmapWizard WizardShell_Base; 52*cdf0e10cSrcweir class WizardShell : public WizardShell_Base 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir public: 55*cdf0e10cSrcweir WizardShell( 56*cdf0e10cSrcweir Window* _pParent, 57*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard, 58*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, 59*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths 60*cdf0e10cSrcweir ); 61*cdf0e10cSrcweir virtual ~WizardShell(); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // Dialog overridables 64*cdf0e10cSrcweir virtual short Execute(); 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir // OWizardMachine overridables 67*cdf0e10cSrcweir virtual TabPage* createPage( WizardState i_nState ); 68*cdf0e10cSrcweir virtual void enterState( WizardState i_nState ); 69*cdf0e10cSrcweir virtual sal_Bool leaveState( WizardState i_nState ); 70*cdf0e10cSrcweir virtual String getStateDisplayName( WizardState i_nState ) const; 71*cdf0e10cSrcweir virtual bool canAdvance() const; 72*cdf0e10cSrcweir virtual sal_Bool onFinish(); 73*cdf0e10cSrcweir virtual IWizardPageController* 74*cdf0e10cSrcweir getPageController( TabPage* _pCurrentPage ) const; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // attribute access 77*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& 78*cdf0e10cSrcweir getWizard() const { return m_xWizard; } 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason ); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir // operations 83*cdf0e10cSrcweir sal_Bool advanceTo( const sal_Int16 i_nPageId ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir return skipUntil( impl_pageIdToState( i_nPageId ) ); 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir sal_Bool goBackTo( const sal_Int16 i_nPageId ) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir return skipBackwardUntil( impl_pageIdToState( i_nPageId ) ); 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir sal_Bool travelNext() { return WizardShell_Base::travelNext(); } 92*cdf0e10cSrcweir sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir void activatePath( const sal_Int16 i_nPathID, const sal_Bool i_bFinal ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal ); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > 100*cdf0e10cSrcweir getCurrentWizardPage() const; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir sal_Int16 getCurrentPage() const 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir return impl_stateToPageId( getCurrentState() ); 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void enablePage( const sal_Int16 i_PageID, const sal_Bool i_Enable ); 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir bool knowsPage( const sal_Int16 i_nPageID ) const 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir return knowsState( impl_pageIdToState( i_nPageID ) ); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir private: 115*cdf0e10cSrcweir sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir return static_cast< sal_Int16 >( i_nState + m_nFirstPageID ); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir return static_cast< WizardState >( i_nPageId - m_nFirstPageID ); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir PWizardPageController impl_getController( TabPage* i_pPage ) const; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // prevent outside access to some base class members 128*cdf0e10cSrcweir using WizardShell_Base::skip; 129*cdf0e10cSrcweir using WizardShell_Base::skipUntil; 130*cdf0e10cSrcweir using WizardShell_Base::skipBackwardUntil; 131*cdf0e10cSrcweir using WizardShell_Base::getCurrentState; 132*cdf0e10cSrcweir using WizardShell_Base::activatePath; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir private: 135*cdf0e10cSrcweir typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard; 138*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; 139*cdf0e10cSrcweir const sal_Int16 m_nFirstPageID; 140*cdf0e10cSrcweir Page2ControllerMap m_aPageControllers; 141*cdf0e10cSrcweir }; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir //...................................................................................................................... 144*cdf0e10cSrcweir } } // namespace svt::uno 145*cdf0e10cSrcweir //...................................................................................................................... 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir #endif // SVT_UNO_WIZARD_SHELL 148