LibreOffice Module svtools (master) 1
wizardshell.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/ui/dialogs/XWizardController.hpp>
23#include <vcl/roadmapwizard.hxx>
24#include <map>
25#include <memory>
26
29
30namespace svt::uno
31{
32
33
34 class WizardPageController;
35 typedef std::shared_ptr< WizardPageController > PWizardPageController;
36
37
38 //= WizardShell
39
42 {
43 public:
45 weld::Window* pParent,
46 const css::uno::Reference< css::ui::dialogs::XWizardController >& i_rController,
47 const css::uno::Sequence< css::uno::Sequence< sal_Int16 > >& i_rPaths
48 );
49
50 // Dialog overridables
51 virtual short run() override;
52
53 // OWizardMachine overridables
54 virtual std::unique_ptr<BuilderPage> createPage( WizardState i_nState ) override;
55 virtual void enterState( WizardState i_nState ) override;
56 virtual bool leaveState( WizardState i_nState ) override;
57 virtual OUString getStateDisplayName( WizardState i_nState ) const override;
58 virtual bool canAdvance() const override;
59 virtual bool onFinish() override;
60 virtual vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override;
61
62 static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason );
63
64 // operations
65 bool advanceTo( const sal_Int16 i_nPageId )
66 {
67 return skipUntil( impl_pageIdToState( i_nPageId ) );
68 }
69 bool goBackTo( const sal_Int16 i_nPageId )
70 {
71 return skipBackwardUntil( impl_pageIdToState( i_nPageId ) );
72 }
75
76 void activatePath( const sal_Int16 i_nPathID, const bool i_bFinal )
77 {
79 }
80
81 css::uno::Reference< css::ui::dialogs::XWizardPage >
83
84 sal_Int16 getCurrentPage() const
85 {
87 }
88
89 void enablePage( const sal_Int16 i_PageID, const bool i_Enable );
90
91 bool knowsPage( const sal_Int16 i_nPageID ) const
92 {
93 return knowsState( impl_pageIdToState( i_nPageID ) );
94 }
95
96 private:
97 sal_Int16 impl_stateToPageId( const WizardState i_nState ) const
98 {
99 return static_cast< sal_Int16 >( i_nState + m_nFirstPageID );
100 }
101
102 WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const
103 {
104 return static_cast<WizardState>(i_nPageId - m_nFirstPageID);
105 }
106
108
109 virtual OUString getPageIdentForState(WizardState nState) const override;
110 virtual WizardState getStateFromPageIdent(const OUString& rIdent) const override;
111
112 // prevent outside access to some base class members
118
119 private:
120 typedef std::map<BuilderPage*, PWizardPageController> Page2ControllerMap;
121
122 const css::uno::Reference< css::ui::dialogs::XWizardController > m_xController;
123 const sal_Int16 m_nFirstPageID;
125 };
126
127
128} // namespace svt::uno
129
130
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool advanceTo(const sal_Int16 i_nPageId)
Definition: wizardshell.hxx:65
virtual bool leaveState(WizardState i_nState) override
WizardState impl_pageIdToState(const sal_Int16 i_nPageId) const
css::uno::Reference< css::ui::dialogs::XWizardPage > getCurrentWizardPage() const
virtual vcl::IWizardPageController * getPageController(BuilderPage *pCurrentPage) const override
virtual std::unique_ptr< BuilderPage > createPage(WizardState i_nState) override
bool goBackTo(const sal_Int16 i_nPageId)
Definition: wizardshell.hxx:69
virtual OUString getStateDisplayName(WizardState i_nState) const override
sal_Int16 getCurrentPage() const
Definition: wizardshell.hxx:84
const css::uno::Reference< css::ui::dialogs::XWizardController > m_xController
std::map< BuilderPage *, PWizardPageController > Page2ControllerMap
virtual WizardState getStateFromPageIdent(const OUString &rIdent) const override
Definition: wizardshell.cxx:91
virtual bool onFinish() override
Page2ControllerMap m_aPageControllers
virtual OUString getPageIdentForState(WizardState nState) const override
Definition: wizardshell.cxx:86
const sal_Int16 m_nFirstPageID
sal_Int16 impl_stateToPageId(const WizardState i_nState) const
Definition: wizardshell.hxx:97
PWizardPageController impl_getController(BuilderPage *i_pPage) const
virtual void enterState(WizardState i_nState) override
WizardShell(weld::Window *pParent, const css::uno::Reference< css::ui::dialogs::XWizardController > &i_rController, const css::uno::Sequence< css::uno::Sequence< sal_Int16 > > &i_rPaths)
Definition: wizardshell.cxx:54
virtual short run() override
Definition: wizardshell.cxx:80
void activatePath(const sal_Int16 i_nPathID, const bool i_bFinal)
Definition: wizardshell.hxx:76
void enablePage(const sal_Int16 i_PageID, const bool i_Enable)
static sal_Int16 convertCommitReasonToTravelType(const CommitPageReason i_eReason)
Definition: wizardshell.cxx:96
bool knowsPage(const sal_Int16 i_nPageID) const
Definition: wizardshell.hxx:91
virtual bool canAdvance() const override
void activatePath(RoadmapWizardTypes::PathId _nPathId, bool _bDecideForIt=false)
bool knowsState(WizardTypes::WizardState nState) const
bool skipBackwardUntil(WizardTypes::WizardState nTargetState)
bool skipUntil(WizardTypes::WizardState nTargetState)
WizardTypes::WizardState getCurrentState() const
sal_Int32 nState
Definition: embedhlp.cxx:75
::vcl::RoadmapWizardMachine WizardShell_Base
Definition: wizardshell.hxx:40
std::shared_ptr< WizardPageController > PWizardPageController
Definition: wizardshell.hxx:34
sal_Int16 WizardState