21#include <officecfg/Office/Common.hxx>
34#define WIZARDDIALOG_BUTTON_OFFSET_Y 6
35#define WIZARDDIALOG_BUTTON_DLGOFFSET_X 6
36#define WIZARDDIALOG_VIEW_DLGOFFSET_X 6
37#define WIZARDDIALOG_VIEW_DLGOFFSET_Y 6
43 :
BuilderPage(pPage, pController, rUIXMLDescription, rID)
95 nBarWidth += nBtnWidth;
98 if ( nBtnHeight > nMaxHeight )
99 nMaxHeight = nBtnHeight;
100 pBtnData = pBtnData->
mpNext;
114 if (nBarWidth > rSize.
Width())
148 if ( nBtnHeight > nMaxHeight )
149 nMaxHeight = nBtnHeight;
150 nBtnWidth += aBtnSize.
Width();
153 pBtnData = pBtnData->
mpNext;
170 Point aPos( nOffX, nOffY+((nMaxHeight-aBtnSize.
Height())/2) );
172 nOffX += aBtnSize.
Width();
177 Point aPos( nOffLeftAlignX, nOffY+((nMaxHeight-aBtnSize.
Height())/2) );
179 nOffLeftAlignX += aBtnSize.
Width();
180 nOffLeftAlignX += pBtnData->
mnOffset;
183 pBtnData = pBtnData->
mpNext;
205 nViewHeight = nDlgHeight;
216 nViewWidth, nViewHeight,
223 int iPixelCoordinate = aLocSize.
Width();
224 return iPixelCoordinate;
246 if ( nBtnHeight > nMaxHeight )
247 nMaxHeight = nBtnHeight;
248 pBtnData = pBtnData->
mpNext;
263 nOffX += aViewSize.
Width() + nViewOffset;
266 Point aPos( nOffX, nOffY );
290 sal_uInt16 nTempLevel = 0;
294 if ( (nTempLevel == nLevel) || !pPageData->
mpNext )
298 pPageData = pPageData->
mpNext;
405 pPageData = pPageData->
mpNext;
436 sal_uInt16 nKeyCode = aKeyCode.
GetCode();
476 if (
nullptr !=
GetPage( i_nState ) )
480 DBG_ASSERT( pNewPage,
"RoadmapWizard::GetOrCreatePage: invalid new page (NULL)!" );
527 pNewPageData->
mpNext =
nullptr;
528 pNewPageData->
mpPage = pPage;
536 while ( pPageData->
mpNext )
537 pPageData = pPageData->
mpNext;
538 pPageData->
mpNext = pNewPageData;
548 if ( pPageData->
mpPage == pPage )
560 pPrevPageData = pPageData;
561 pPageData = pPageData->
mpNext;
564 OSL_FAIL(
"RoadmapWizard::RemovePage() - Page not in list" );
569 sal_uInt16 nTempLevel = 0;
573 if ( (nTempLevel == nLevel) || !pPageData->
mpNext )
577 pPageData = pPageData->
mpNext;
584 pPageData->
mpPage = pPage;
590 sal_uInt16 nTempLevel = 0;
593 pPageData = pPageData->
mpNext)
595 if ( nTempLevel == nLevel )
596 return pPageData->mpPage;
606 pNewBtnData->
mpNext =
nullptr;
615 while ( pBtnData->
mpNext )
616 pBtnData = pBtnData->
mpNext;
617 pBtnData->
mpNext = pNewBtnData;
627 if ( pBtnData->
mpButton == pButton )
637 pPrevBtnData = pBtnData;
638 pBtnData = pBtnData->
mpNext;
641 OSL_FAIL(
"RoadmapWizard::RemoveButton() - Button not in list" );
646 if ( isTravelingSuspended() )
655 std::stack< WizardTypes::WizardState > aTravelVirtually =
m_xWizardImpl->aStateHistory;
656 std::stack< WizardTypes::WizardState > aOldStateHistory =
m_xWizardImpl->aStateHistory;
659 while ( nCurrentRollbackState != _nTargetState )
661 DBG_ASSERT( !aTravelVirtually.empty(),
"RoadmapWizard::skipBackwardUntil: this target state does not exist in the history!" );
662 nCurrentRollbackState = aTravelVirtually.top();
663 aTravelVirtually.pop();
679 std::stack< WizardTypes::WizardState > aTravelVirtually =
m_xWizardImpl->aStateHistory;
680 std::stack< WizardTypes::WizardState > aOldStateHistory =
m_xWizardImpl->aStateHistory;
681 while ( nCurrentState != _nTargetState )
686 OSL_FAIL(
"RoadmapWizard::skipUntil: the given target state does not exist!" );
691 aTravelVirtually.push( nCurrentState );
694 nCurrentState = nNextState;
702 OSL_FAIL(
"RoadmapWizard::skipUntil: very unpolite..." );
747 std::stack< WizardTypes::WizardState > aTemp;
752 if(nPreviousState != nToRemove)
753 aTemp.push( nPreviousState );
757 while(!aTemp.empty())
766 if ( isTravelingSuspended() )
774 if ( isTravelingSuspended() )
798 : AssistantController(pParent,
"vcl/ui/wizard.ui",
"Wizard")
799 , m_pCurTabPage(nullptr)
801 , m_pFirstPage(nullptr)
802 , m_xFinish(m_xAssistant->weld_widget_for_response(
RET_OK))
803 , m_xCancel(m_xAssistant->weld_widget_for_response(
RET_CANCEL))
804 , m_xNextPage(m_xAssistant->weld_widget_for_response(
RET_YES))
805 , m_xPrevPage(m_xAssistant->weld_widget_for_response(
RET_NO))
806 , m_xHelp(m_xAssistant->weld_widget_for_response(
RET_HELP))
817 officecfg::Office::Common::Help::HelpRootURL::get().isEmpty();
879 OUString sCompleteTitle(
m_pImpl->sTitleBase);
883 if ( pCurrentPage && !pCurrentPage->
GetPageTitle().isEmpty() )
893 m_pImpl->sTitleBase = _rTitleBase;
899 return OUString::number(
nState);
904 return rIdent.toInt32();
909 if (
nullptr ==
GetPage( i_nState ) )
911 std::unique_ptr<BuilderPage> xNewPage =
createPage( i_nState );
912 DBG_ASSERT( xNewPage,
"WizardMachine::GetOrCreatePage: invalid new page (NULL)!" );
915 while (
m_pImpl->nFirstUnknownPage < i_nState )
921 if (
m_pImpl->nFirstUnknownPage == i_nState )
929 SetPage(i_nState, std::move(xNewPage));
971 m_xAssistant->change_default_widget(
nullptr, _pNewDefButton);
983 m_xHelp->set_sensitive(_bEnable);
992 OSL_ENSURE( pController,
"WizardMachine::enterState: no controller for the given page!" );
994 pController->initializePage();
1021 if ( isTravelingSuspended() )
1044 return _nCurrentState + 1;
1050 ENSURE_OR_RETURN( pController !=
nullptr,
"WizardMachine::prepareLeaveCurrentState: no controller for the current page!",
true );
1051 return pController->commitPage( _eReason );
1061 std::stack< WizardTypes::WizardState > aTravelVirtually =
m_pImpl->aStateHistory;
1062 std::stack< WizardTypes::WizardState > aOldStateHistory =
m_pImpl->aStateHistory;
1065 while ( nCurrentRollbackState != _nTargetState )
1067 DBG_ASSERT( !aTravelVirtually.empty(),
"WizardMachine::skipBackwardUntil: this target state does not exist in the history!" );
1068 nCurrentRollbackState = aTravelVirtually.top();
1069 aTravelVirtually.pop();
1071 m_pImpl->aStateHistory = aTravelVirtually;
1074 m_pImpl->aStateHistory = aOldStateHistory;
1089 std::stack< WizardTypes::WizardState > aTravelVirtually =
m_pImpl->aStateHistory;
1090 std::stack< WizardTypes::WizardState > aOldStateHistory =
m_pImpl->aStateHistory;
1091 while ( nCurrentState != _nTargetState )
1096 OSL_FAIL(
"WizardMachine::skipUntil: the given target state does not exist!" );
1101 aTravelVirtually.push( nCurrentState );
1104 nCurrentState = nNextState;
1106 m_pImpl->aStateHistory = aTravelVirtually;
1112 OSL_FAIL(
"WizardMachine::skipUntil: very unpolite..." );
1113 m_pImpl->aStateHistory = aOldStateHistory;
1132 m_pImpl->aStateHistory.push(nCurrentState);
1135 nCurrentState = nNextState;
1142 OSL_FAIL(
"RoadmapWizard::skip: very unpolite...");
1166 m_pImpl->aStateHistory.push(nCurrentState);
1212 DBG_ASSERT(!
m_pImpl->aStateHistory.empty(),
"WizardMachine::travelPrevious: have no previous page!");
1226 m_pImpl->aStateHistory.push(nPreviousState);
1238 std::stack< WizardTypes::WizardState > aTemp;
1239 while(!
m_pImpl->aStateHistory.empty())
1243 if(nPreviousState != nToRemove)
1244 aTemp.push( nPreviousState );
1248 while(!aTemp.empty())
1250 m_pImpl->aStateHistory.push( aTemp.top() );
1258 m_pImpl->m_bAutoNextButtonState =
true;
1264 return m_pImpl->m_bAutoNextButtonState;
1269 if ( isTravelingSuspended() )
1277 if ( isTravelingSuspended() )
1285 IWizardPageController* pController =
dynamic_cast<IWizardPageController*
>(pCurrentPage);
1291 std::stack< WizardTypes::WizardState > aHistoryCopy(
m_pImpl->aStateHistory );
1292 while ( !aHistoryCopy.empty() )
1294 _out_rHistory.push_back( aHistoryCopy.top() );
1307 OSL_ENSURE( pController !=
nullptr,
"RoadmapWizard::updateTravelUI: no controller for the current page!" );
1310 ( !pController || pController->canAdvance() )
1317 return m_pImpl->m_bTravelingSuspended;
1322 DBG_ASSERT( !
m_pImpl->m_bTravelingSuspended,
"WizardMachine::suspendTraveling: already suspended!" );
1323 m_pImpl->m_bTravelingSuspended =
true;
1331 DBG_ASSERT(
m_pImpl->m_bTravelingSuspended,
"WizardMachine::resumeTraveling: nothing to resume!" );
1332 m_pImpl->m_bTravelingSuspended =
false;
1352 pNewPageData->
mpNext =
nullptr;
1353 pNewPageData->
mxPage = std::move(xPage);
1360 while ( pPageData->
mpNext )
1361 pPageData = pPageData->
mpNext;
1362 pPageData->
mpNext = pNewPageData;
1372 if (pPageData->
mxPage.get() == pPage)
1384 pPrevPageData = pPageData;
1385 pPageData = pPageData->
mpNext;
1388 OSL_FAIL(
"WizardMachine::RemovePage() - Page not in list" );
1393 sal_uInt16 nTempLevel = 0;
1397 if ( (nTempLevel == nLevel) || !pPageData->
mpNext )
1401 pPageData = pPageData->
mpNext;
1408 pPageData->
mxPage = std::move(xPage);
1414 sal_uInt16 nTempLevel = 0;
1417 pPageData = pPageData->
mpNext)
1419 if ( nTempLevel == nLevel )
1420 return pPageData->mxPage.get();
virtual void Deactivate()
weld::DialogController * m_pDialogController
const OUString & GetPageTitle() const
virtual void SetText(const OUString &rStr) override
SAL_DLLPRIVATE bool IsInClose() const
virtual void Resize() override
void EndDialog(tools::Long nResult=RET_CANCEL)
virtual bool Close() override
virtual bool EventNotify(NotifyEvent &rNEvt) override
virtual void StateChanged(StateChangedType nStateChange) override
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
const vcl::KeyCode & GetKeyCode() const
const KeyEvent * GetKeyEvent() const
NotifyEventType GetType() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
virtual OUString GetText() const override
void SetMinOutputSizePixel(const Size &rSize)
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize) override
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
sal_uInt16 GetCode() const
virtual bool canAdvance() const override
virtual bool commitPage(WizardTypes::CommitPageReason _eReason) override
virtual ~OWizardPage() override
OWizardPage(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OUString &rID)
virtual void Activate() override
void updateDialogTravelUI()
updates the travel-related UI elements of the OWizardMachine we live in (if any)
virtual void initializePage() override
is - no, not a wizard for a roadmap, but the base class for wizards supporting a roadmap.
virtual void updateTravelUI() override
updates the user interface which deals with traveling in the wizard
helper class to temporarily suspend any traveling in the wizard
VclPtr< OKButton > m_pFinish
bool ShowPage(sal_uInt16 nLevel)
sal_uInt16 GetCurLevel() const
void enterState(WizardTypes::WizardState _nState)
will be called when a new page is about to be displayed
ImplWizPageData * mpFirstPage
std::unique_ptr< WizardMachineImplData > m_xWizardImpl
virtual void StateChanged(StateChangedType nStateChange) override
void GetOrCreatePage(const WizardTypes::WizardState i_nState)
tools::Long LogicalCoordinateToPixel(int iCoordinate) const
bool isTravelingSuspended() const
void AddPage(TabPage *pPage)
virtual void Resize() override
VclPtr< TabPage > createPage(WizardTypes::WizardState nState)
to override to create new pages
VclPtr< PushButton > mpNextBtn
VclPtr< TabPage > mpCurTabPage
sal_Int16 mnLeftAlignCount
void SetLeftAlignedButtonCount(sal_Int16 _nCount)
sets the number of buttons which should be left-aligned.
TabPage * ImplGetPage(sal_uInt16 nLevel) const
void AddButton(Button *pButton, tools::Long nOffset=0)
ImplWizButtonData * mpFirstBtn
const Size & GetPageSizePixel() const
void RemoveButton(Button *pButton)
void Finish(tools::Long nResult=0)
void ImplCalcSize(Size &rSize)
VclPtr< CancelButton > m_pCancel
void SetPage(sal_uInt16 nLevel, TabPage *pPage)
WizardTypes::WizardState getCurrentState() const
returns the current state of the machine
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
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
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
VclPtr< PushButton > m_pNextPage
void resumeTraveling(AccessGuard)
WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const
determine the next state to travel from the given one
void RemovePage(TabPage *pPage)
VclPtr< PushButton > m_pPrevPage
void suspendTraveling(AccessGuard)
VclPtr< HelpButton > m_pHelp
TabPage * GetPage(sal_uInt16 nLevel) const
void implConstruct(const WizardButtonFlags _nButtonFlags)
bool IsReallyVisible() const
bool IsInputEnabled() const
Point LogicToPixel(const Point &rLogicPt) const
virtual void SetSizePixel(const Size &rNewSize)
void set_id(const OUString &rID)
Sets an ID.
virtual void SetOutputSizePixel(const Size &rNewSize)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
bool IsReallyShown() const
bool IsInInitShow() const
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
virtual void SetPosPixel(const Point &rNewPos)
bool IsDefaultSize() const
void SetHelpId(const OUString &)
implements some kind of finite automata, where the states of the automata exactly correlate with tab ...
virtual void updateTravelUI()
updates the user interface which deals with traveling in the wizard
bool travelPrevious()
travel to the previous state
virtual WizardTypes::WizardState getStateFromPageIdent(const OUString &rIdent) const
bool Finish(short nResult=RET_CANCEL)
virtual bool leaveState(WizardTypes::WizardState nState)
will be called when the given state is left
virtual WizardTypes::WizardState determineNextState(WizardTypes::WizardState nCurrentState) const
determine the next state to travel from the given one
std::unique_ptr< weld::Button > m_xNextPage
std::unique_ptr< weld::Button > m_xCancel
virtual bool onFinish()
called when the finish button is pressed
WizardMachine(weld::Window *_pParent, WizardButtonFlags _nButtonFlags)
bool skipBackwardUntil(WizardTypes::WizardState nTargetState)
moves back one or more states, until a given state is reached
void defaultButton(WizardButtonFlags _nWizardButtonFlags)
set the default style for a button
void getStateHistory(std::vector< WizardTypes::WizardState > &out_rHistory)
retrieves a copy of the state history, i.e.
void SetPage(WizardTypes::WizardState nLevel, std::unique_ptr< BuilderPage > xPage)
void enableAutomaticNextButtonState()
enables the automatic enabled/disabled state of the "Next" button
VCL_DLLPRIVATE void implConstruct(const WizardButtonFlags _nButtonFlags)
bool skipUntil(WizardTypes::WizardState nTargetState)
skips one or more states, until a given state is reached
std::unique_ptr< weld::Button > m_xPrevPage
bool isTravelingSuspended() const
virtual OUString getPageIdentForState(WizardTypes::WizardState nState) const
virtual void ActivatePage()
void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable)
enable (or disable) buttons
std::unique_ptr< weld::Button > m_xHelp
bool ShowPage(WizardTypes::WizardState nState)
WizardTypes::WizardState m_nCurState
virtual bool prepareLeaveCurrentState(WizardTypes::CommitPageReason eReason)
will be called when the current state is about to be left for the given reason
bool isAutomaticNextButtonStateEnabled() const
virtual bool canAdvance() const
determines whether there is a next state to which we can advance
virtual bool DeactivatePage()
std::unique_ptr< weld::Button > m_xFinish
bool travelNext()
travel to the next state
std::unique_ptr< WizardMachineImplData > m_pImpl
void resumeTraveling(AccessGuard)
void RemovePage(const BuilderPage *pPage)
virtual IWizardPageController * getPageController(BuilderPage *pCurrentPage) const
BuilderPage * GetOrCreatePage(const WizardTypes::WizardState i_nState)
virtual ~WizardMachine() override
virtual std::unique_ptr< BuilderPage > createPage(WizardTypes::WizardState _nState)=0
to override to create new pages
VCL_DLLPRIVATE void implUpdateTitle()
WizPageData * m_pFirstPage
void AddPage(std::unique_ptr< BuilderPage > xPage)
virtual void enterState(WizardTypes::WizardState _nState)
will be called when a new page is about to be displayed
WizardTypes::WizardState getCurrentState() const
returns the current state of the machine
void setTitleBase(const OUString &_rTitleBase)
set the base of the title to use - the title of the current page is appended
BuilderPage * m_pCurTabPage
void suspendTraveling(AccessGuard)
void removePageFromHistory(WizardTypes::WizardState nToRemove)
removes a page from the history.
BuilderPage * GetPage(WizardTypes::WizardState eState) const
helper class to temporarily suspend any traveling in the wizard
std::unique_ptr< weld::Assistant > m_xAssistant
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_RETURN(c, m, r)
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_PAGEUP
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(QuickSelectionEngine_Data, SearchStringTimeout, Timer *, void)
std::unique_ptr< BuilderPage > mxPage
OUString VclResId(TranslateId aId)
WinBits const WB_CLOSEABLE
#define WIZARDDIALOG_VIEW_DLGOFFSET_X
#define WIZARDDIALOG_BUTTON_DLGOFFSET_X
#define WIZARDDIALOG_VIEW_DLGOFFSET_Y
constexpr OUStringLiteral HID_WIZARD_PREVIOUS
#define WIZARDDIALOG_BUTTON_OFFSET_Y
constexpr OUStringLiteral HID_WIZARD_NEXT
#define WIZARDDIALOG_BUTTON_STDOFFSET_X
#define WZS_INVALID_STATE
#define WIZARDDIALOG_BUTTON_SMALLSTDOFFSET_X