summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-31 14:23:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-09-02 10:12:04 +0200
commit4a95ae505d48e6d1096889150a01f5c756889752 (patch)
tree305e155d33b82104fc8e407d67beecdddc0547c2 /vcl/source
parent00b3c2240bb2f86299e3ddeea75a16e8e9877489 (diff)
weld cluster of database form wizards
Change-Id: If40eec5ec00ad96088c0dda96c4733d2a1134f68 Reviewed-on: https://gerrit.libreoffice.org/78368 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/salvtables.cxx2
-rw-r--r--vcl/source/control/roadmapwizard.cxx6
-rw-r--r--vcl/source/control/wizardmachine.cxx44
-rw-r--r--vcl/source/control/wizdlg.cxx44
4 files changed, 74 insertions, 22 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 29fba041d41e..ebc53e330bff 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1704,6 +1704,8 @@ IMPL_LINK_NOARG(SalInstanceAssistant, UpdateRoadmap_Hdl, Timer*, void)
m_xWizard->SelectRoadmapItemByID(m_aIds[get_current_page()]);
+ m_xWizard->ShowRoadmap(nPos != 0);
+
enable_notify_events();
}
diff --git a/vcl/source/control/roadmapwizard.cxx b/vcl/source/control/roadmapwizard.cxx
index 396a7cffdb3d..04d11bc3f7d5 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -150,6 +150,12 @@ namespace vcl
m_pImpl->pRoadmap->Show();
}
+ void RoadmapWizard::ShowRoadmap(bool bShow)
+ {
+ m_pImpl->pRoadmap->Show(bShow);
+ CalcAndSetSize();
+ }
+
RoadmapWizard::~RoadmapWizard()
{
disposeOnce();
diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 49dc3b47e6ec..0b8544bfd915 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -705,9 +705,9 @@ namespace vcl
// create the buttons according to the wizard button flags
// the help button
if (nButtonFlags & WizardButtonFlags::HELP)
- {
m_xHelp->show();
- }
+ else
+ m_xHelp->hide();
// the previous button
if (nButtonFlags & WizardButtonFlags::PREVIOUS)
@@ -717,6 +717,8 @@ namespace vcl
m_xPrevPage->connect_clicked( LINK( this, WizardMachine, OnPrevPage ) );
}
+ else
+ m_xPrevPage->hide();
// the next button
if (nButtonFlags & WizardButtonFlags::NEXT)
@@ -726,6 +728,8 @@ namespace vcl
m_xNextPage->connect_clicked( LINK( this, WizardMachine, OnNextPage ) );
}
+ else
+ m_xNextPage->hide();
// the finish button
if (nButtonFlags & WizardButtonFlags::FINISH)
@@ -734,6 +738,8 @@ namespace vcl
m_xFinish->connect_clicked( LINK( this, WizardMachine, OnFinish ) );
}
+ else
+ m_xFinish->hide();
// the cancel button
if (nButtonFlags & WizardButtonFlags::CANCEL)
@@ -741,6 +747,8 @@ namespace vcl
m_xCancel->show();
m_xCancel->connect_clicked( LINK( this, WizardMachine, OnCancel ) );
}
+ else
+ m_xCancel->hide();
}
WizardMachine::~WizardMachine()
@@ -991,6 +999,38 @@ namespace vcl
return true;
}
+ void WizardMachine::skip()
+ {
+ // allowed to leave the current page?
+ if ( !prepareLeaveCurrentState( eTravelForward ) )
+ return;
+
+ WizardState nCurrentState = getCurrentState();
+ WizardState nNextState = determineNextState(nCurrentState);
+
+ if (WZS_INVALID_STATE == nNextState)
+ return;
+
+ // remember the skipped state in the history
+ m_pImpl->aStateHistory.push(nCurrentState);
+
+ // get the next state
+ nCurrentState = nNextState;
+
+ // show the (n+1)th page
+ if (!ShowPage(nCurrentState))
+ {
+ // TODO: this leaves us in a state where we have no current page and an inconsistent state history.
+ // Perhaps we should rollback the skipping here ....
+ OSL_FAIL("OWizardMachine::skip: very unpolite ....");
+ // if somebody does a skip and then does not allow to leave ...
+ // (can't be a commit error, as we've already committed the current page. So if ShowPage fails here,
+ // somebody behaves really strange ...)
+ return;
+ }
+
+ // all fine
+ }
bool WizardMachine::travelNext()
{
diff --git a/vcl/source/control/wizdlg.cxx b/vcl/source/control/wizdlg.cxx
index be909bbdd92f..54b0e1f3df8a 100644
--- a/vcl/source/control/wizdlg.cxx
+++ b/vcl/source/control/wizdlg.cxx
@@ -374,6 +374,29 @@ void WizardDialog::Resize()
Dialog::Resize();
}
+void WizardDialog::CalcAndSetSize()
+{
+ Size aDlgSize = GetPageSizePixel();
+ if ( !aDlgSize.Width() || !aDlgSize.Height() )
+ {
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( pPageData->mpPage )
+ {
+ Size aPageSize = pPageData->mpPage->GetSizePixel();
+ if ( aPageSize.Width() > aDlgSize.Width() )
+ aDlgSize.setWidth( aPageSize.Width() );
+ if ( aPageSize.Height() > aDlgSize.Height() )
+ aDlgSize.setHeight( aPageSize.Height() );
+ }
+
+ pPageData = pPageData->mpNext;
+ }
+ }
+ ImplCalcSize( aDlgSize );
+ SetOutputSizePixel( aDlgSize );
+}
void WizardDialog::StateChanged( StateChangedType nType )
{
@@ -381,26 +404,7 @@ void WizardDialog::StateChanged( StateChangedType nType )
{
if ( IsDefaultSize() )
{
- Size aDlgSize = GetPageSizePixel();
- if ( !aDlgSize.Width() || !aDlgSize.Height() )
- {
- ImplWizPageData* pPageData = mpFirstPage;
- while ( pPageData )
- {
- if ( pPageData->mpPage )
- {
- Size aPageSize = pPageData->mpPage->GetSizePixel();
- if ( aPageSize.Width() > aDlgSize.Width() )
- aDlgSize.setWidth( aPageSize.Width() );
- if ( aPageSize.Height() > aDlgSize.Height() )
- aDlgSize.setHeight( aPageSize.Height() );
- }
-
- pPageData = pPageData->mpNext;
- }
- }
- ImplCalcSize( aDlgSize );
- SetOutputSizePixel( aDlgSize );
+ CalcAndSetSize();
}
ImplPosCtrls();