LibreOffice Module vcl (master) 1
wizdlg.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 <memory>
25#include <vcl/roadmapwizard.hxx>
26#include <vcl/tabpage.hxx>
27
29{
32};
33
34namespace vcl
35{
36 struct RoadmapWizardImpl;
37 class RoadmapWizard;
38
39 namespace RoadmapWizardTypes
40 {
42 };
43
44 //= RoadmapWizard
45
64 class RoadmapWizard final : public Dialog
65 {
66 private:
75 sal_uInt16 mnCurLevel;
78
79 DECL_LINK( ImplHandleWizardLayoutTimerHdl, Timer*, void );
80
81 // IMPORTANT:
82 // traveling pages should not be done by calling these base class member, some mechanisms of this class
83 // here (e.g. committing page data) depend on having full control over page traveling.
84 // So use the travelXXX methods if you need to travel
85
86 tools::Long LogicalCoordinateToPixel(int iCoordinate) const;
91 void SetLeftAlignedButtonCount( sal_Int16 _nCount );
92
93 void CalcAndSetSize();
94
95 public:
101
102 private:
103 std::unique_ptr<WizardMachineImplData> m_xWizardImpl;
104 // hold members in this structure to allow keeping compatible when members are added
105 std::unique_ptr<RoadmapWizardImpl> m_xRoadmapImpl;
106
107 public:
109 virtual ~RoadmapWizard( ) override;
110 virtual void dispose() override;
111
112 virtual void Resize() override;
113 virtual void StateChanged( StateChangedType nStateChange ) override;
114 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
115
116 void ActivatePage();
117
118 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
119
120 bool ShowPage( sal_uInt16 nLevel );
121 void Finish( tools::Long nResult = 0 );
122 sal_uInt16 GetCurLevel() const { return mnCurLevel; }
123
124 void AddPage( TabPage* pPage );
125 void RemovePage( TabPage* pPage );
126 void SetPage( sal_uInt16 nLevel, TabPage* pPage );
127 TabPage* GetPage( sal_uInt16 nLevel ) const;
128
129 void AddButton( Button* pButton, tools::Long nOffset = 0 );
130 void RemoveButton( Button* pButton );
131
132 void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
133 const Size& GetPageSizePixel() const { return maPageSize; }
134
135 void SetRoadmapHelpId( const OUString& _rId );
136 void SetRoadmapBitmap( const BitmapEx& maBitmap );
137
138 void InsertRoadmapItem(int nIndex, const OUString& rLabel, int nId, bool bEnabled);
139 void DeleteRoadmapItems();
140 int GetCurrentRoadmapItemID() const;
141 void SelectRoadmapItemByID(int nId, bool bGrabFocus = true);
142 void SetItemSelectHdl( const Link<LinkParamNone*,void>& _rHdl );
143 void ShowRoadmap(bool bShow);
144
145 FactoryFunction GetUITestFactory() const override;
146
147 private:
148
151
154
164
166 void travelNext();
167
169 void travelPrevious();
170
174
189 bool skipUntil(WizardTypes::WizardState nTargetState);
190
208
214
222 OUString getStateDisplayName(WizardTypes::WizardState nState) const;
223
224 DECL_LINK( OnRoadmapItemSelected, LinkParamNone*, void );
225
229 void implUpdateRoadmap( );
230
231 public:
233 {
235 private:
237 };
238
239 void suspendTraveling( AccessGuard );
240 void resumeTraveling( AccessGuard );
241 bool isTravelingSuspended() const;
242
243 private:
244 void GetOrCreatePage(const WizardTypes::WizardState i_nState);
245
246 void ImplCalcSize( Size& rSize );
247 void ImplPosCtrls();
248 void ImplPosTabPage();
249 void ImplShowTabPage( TabPage* pPage );
250 TabPage* ImplGetPage( sal_uInt16 nLevel ) const;
251
252
253 DECL_LINK(OnNextPage, Button*, void);
254 DECL_LINK(OnPrevPage, Button*, void);
255 DECL_LINK(OnFinish, Button*, void);
256
257 void implConstruct( const WizardButtonFlags _nButtonFlags );
258
259 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
260 };
261
264 {
265 public:
267 : m_pOWizard(&rWizard)
268 {
269 m_pOWizard->suspendTraveling(RoadmapWizard::AccessGuard());
270 }
271
273 {
274 if (m_pOWizard)
275 m_pOWizard->resumeTraveling(RoadmapWizard::AccessGuard());
276 }
277
278 private:
280 };
281
282} // namespace vcl
283/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
InitFlag
Definition: dialog.hxx:44
@ Default
Use given parent or get a default one using GetDefaultParent(...)
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
Definition: timer.hxx:27
helper class to temporarily suspend any traveling in the wizard
Definition: wizdlg.hxx:264
RoadmapWizardTravelSuspension(RoadmapWizard &rWizard)
Definition: wizdlg.hxx:266
VclPtr< RoadmapWizard > m_pOWizard
Definition: wizdlg.hxx:279
wizard for a roadmap
Definition: wizdlg.hxx:65
VclPtr< OKButton > m_pFinish
Definition: wizdlg.hxx:96
bool ShowPage(sal_uInt16 nLevel)
sal_uInt16 GetCurLevel() const
Definition: wizdlg.hxx:122
void enterState(WizardTypes::WizardState _nState)
will be called when a new page is about to be displayed
ImplWizPageData * mpFirstPage
Definition: wizdlg.hxx:69
std::unique_ptr< WizardMachineImplData > m_xWizardImpl
Definition: wizdlg.hxx:103
virtual void StateChanged(StateChangedType nStateChange) override
void SetRoadmapHelpId(const OUString &_rId)
void GetOrCreatePage(const WizardTypes::WizardState i_nState)
Idle maWizardLayoutIdle
Definition: wizdlg.hxx:67
void ShowRoadmap(bool bShow)
DECL_LINK(OnPrevPage, Button *, void)
DECL_LINK(ImplHandleWizardLayoutTimerHdl, Timer *, void)
tools::Long LogicalCoordinateToPixel(int iCoordinate) const
DECL_LINK(OnRoadmapItemSelected, LinkParamNone *, void)
void SetItemSelectHdl(const Link< LinkParamNone *, void > &_rHdl)
bool isTravelingSuspended() const
std::unique_ptr< RoadmapWizardImpl > m_xRoadmapImpl
Definition: wizdlg.hxx:105
void AddPage(TabPage *pPage)
virtual void Resize() override
void implUpdateRoadmap()
updates the roadmap control to show the given path, as far as possible (modulo conflicts with other p...
VclPtr< TabPage > createPage(WizardTypes::WizardState nState)
to override to create new pages
VclPtr< PushButton > mpNextBtn
Definition: wizdlg.hxx:73
RoadmapWizard(vcl::Window *pParent, WinBits nStyle=WB_STDDIALOG, InitFlag eFlag=InitFlag::Default)
VclPtr< TabPage > mpCurTabPage
Definition: wizdlg.hxx:71
int GetCurrentRoadmapItemID() const
sal_Int16 mnLeftAlignCount
Definition: wizdlg.hxx:76
void SetLeftAlignedButtonCount(sal_Int16 _nCount)
sets the number of buttons which should be left-aligned.
DECL_LINK(OnFinish, Button *, void)
void InsertRoadmapItem(int nIndex, const OUString &rLabel, int nId, bool bEnabled)
TabPage * ImplGetPage(sal_uInt16 nLevel) const
virtual void DumpAsPropertyTree(tools::JsonWriter &rJsonWriter) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
void AddButton(Button *pButton, tools::Long nOffset=0)
ImplWizButtonData * mpFirstBtn
Definition: wizdlg.hxx:70
const Size & GetPageSizePixel() const
Definition: wizdlg.hxx:133
void RemoveButton(Button *pButton)
void Finish(tools::Long nResult=0)
void ImplCalcSize(Size &rSize)
VclPtr< CancelButton > m_pCancel
Definition: wizdlg.hxx:97
void SetRoadmapBitmap(const BitmapEx &maBitmap)
void SetPage(sal_uInt16 nLevel, TabPage *pPage)
bool mbEmptyViewMargin
Definition: wizdlg.hxx:77
WizardTypes::WizardState getCurrentState() const
returns the current state of the machine
Definition: wizdlg.hxx:213
virtual bool EventNotify(NotifyEvent &rNEvt) override
void travelNext()
travel to the next state
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
VclPtr< vcl::Window > mpViewWindow
Definition: wizdlg.hxx:74
FactoryFunction GetUITestFactory() const override
void SelectRoadmapItemByID(int nId, bool bGrabFocus=true)
void travelPrevious()
travel to the previous state
bool skipBackwardUntil(WizardTypes::WizardState nTargetState)
moves back one or more states, until a given state is reached
void ImplShowTabPage(TabPage *pPage)
VclPtr< PushButton > mpPrevBtn
Definition: wizdlg.hxx:72
void removePageFromHistory(WizardTypes::WizardState nToRemove)
removes a page from the history.
bool skipUntil(WizardTypes::WizardState nTargetState)
skips one or more states, until a given state is reached
void SetPageSizePixel(const Size &rSize)
Definition: wizdlg.hxx:132
VclPtr< PushButton > m_pNextPage
Definition: wizdlg.hxx:98
void resumeTraveling(AccessGuard)
WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const
determine the next state to travel from the given one
void RemovePage(TabPage *pPage)
sal_uInt16 mnCurLevel
Definition: wizdlg.hxx:75
VclPtr< PushButton > m_pPrevPage
Definition: wizdlg.hxx:99
DECL_LINK(OnNextPage, Button *, void)
void suspendTraveling(AccessGuard)
VclPtr< HelpButton > m_pHelp
Definition: wizdlg.hxx:100
OUString getStateDisplayName(WizardTypes::WizardState nState) const
returns a human readable name for a given state
virtual ~RoadmapWizard() override
TabPage * GetPage(sal_uInt16 nLevel) const
void implConstruct(const WizardButtonFlags _nButtonFlags)
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
long Long
VclPtr< TabPage >(* RoadmapPageFactory)(RoadmapWizard &)
Definition: wizdlg.hxx:41
sal_Int16 WizardState
ImplWizPageData * mpNext
Definition: wizdlg.hxx:30
VclPtr< TabPage > mpPage
Definition: wizdlg.hxx:31
WizardButtonFlags
Definition: vclenum.hxx:250
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_STDDIALOG
Definition: wintypes.hxx:216