Bump version to 5.0-14
[LibreOffice.git] / svtools / source / uno / wizard / wizardshell.hxx
blob68650dd067cf1c1d2587a82df915ff82f4db989f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SVT_UNO_WIZARD_SHELL
21 #define SVT_UNO_WIZARD_SHELL
23 #include <com/sun/star/ui/dialogs/XWizardController.hpp>
24 #include <com/sun/star/ui/dialogs/XWizard.hpp>
26 #include <svtools/roadmapwizard.hxx>
28 #include <boost/shared_ptr.hpp>
29 #include <map>
32 namespace svt { namespace uno
36 class WizardPageController;
37 typedef ::boost::shared_ptr< WizardPageController > PWizardPageController;
40 //= WizardShell
42 typedef ::svt::RoadmapWizard WizardShell_Base;
43 class WizardShell : public WizardShell_Base
45 public:
46 WizardShell(
47 vcl::Window* _pParent,
48 const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController,
49 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths
52 // Dialog overridables
53 virtual short Execute() SAL_OVERRIDE;
55 // OWizardMachine overridables
56 virtual VclPtr<TabPage> createPage( WizardState i_nState ) SAL_OVERRIDE;
57 virtual void enterState( WizardState i_nState ) SAL_OVERRIDE;
58 virtual bool leaveState( WizardState i_nState ) SAL_OVERRIDE;
59 virtual OUString getStateDisplayName( WizardState i_nState ) const SAL_OVERRIDE;
60 virtual bool canAdvance() const SAL_OVERRIDE;
61 virtual bool onFinish() SAL_OVERRIDE;
62 virtual IWizardPageController*
63 getPageController( TabPage* _pCurrentPage ) const SAL_OVERRIDE;
65 static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason );
67 // operations
68 bool advanceTo( const sal_Int16 i_nPageId )
70 return skipUntil( impl_pageIdToState( i_nPageId ) );
72 bool goBackTo( const sal_Int16 i_nPageId )
74 return skipBackwardUntil( impl_pageIdToState( i_nPageId ) );
76 bool travelNext() { return WizardShell_Base::travelNext(); }
77 bool travelPrevious() { return WizardShell_Base::travelPrevious(); }
79 void activatePath( const sal_Int16 i_nPathID, const bool i_bFinal )
81 WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal );
84 ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >
85 getCurrentWizardPage() const;
87 sal_Int16 getCurrentPage() const
89 return impl_stateToPageId( getCurrentState() );
92 void enablePage( const sal_Int16 i_PageID, const bool i_Enable );
94 bool knowsPage( const sal_Int16 i_nPageID ) const
96 return knowsState( impl_pageIdToState( i_nPageID ) );
99 private:
100 sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const
102 return static_cast< sal_Int16 >( i_nState + m_nFirstPageID );
105 WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const
107 return static_cast< WizardState >( i_nPageId - m_nFirstPageID );
110 PWizardPageController impl_getController( TabPage* i_pPage ) const;
112 // prevent outside access to some base class members
113 using WizardShell_Base::skip;
114 using WizardShell_Base::skipUntil;
115 using WizardShell_Base::skipBackwardUntil;
116 using WizardShell_Base::getCurrentState;
117 using WizardShell_Base::activatePath;
119 private:
120 typedef ::std::map< VclPtr<TabPage>, PWizardPageController > Page2ControllerMap;
122 const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController;
123 const sal_Int16 m_nFirstPageID;
124 Page2ControllerMap m_aPageControllers;
128 } } // namespace svt::uno
131 #endif // SVT_UNO_WIZARD_SHELL
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */