summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/dialogs/dlg_CreationWizard.cxx')
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx51
1 files changed, 30 insertions, 21 deletions
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index db54937be38c..58a744980556 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -22,6 +22,7 @@
#include <strings.hrc>
#include <helpids.h>
#include <ChartModel.hxx>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include "tp_ChartType.hxx"
#include "tp_RangeChooser.hxx"
@@ -30,9 +31,6 @@
#include "ChartTypeTemplateProvider.hxx"
#include "DialogModel.hxx"
-#define CHART_WIZARD_PAGEWIDTH 250
-#define CHART_WIZARD_PAGEHEIGHT 170
-
using namespace css;
namespace chart
@@ -45,14 +43,14 @@ namespace chart
#define STATE_OBJECTS 3
#define STATE_LAST STATE_OBJECTS
-CreationWizard::CreationWizard(vcl::Window* pParent, const uno::Reference<frame::XModel>& xChartModel,
+CreationWizard::CreationWizard(weld::Window* pParent, const uno::Reference<frame::XModel>& xChartModel,
const uno::Reference<uno::XComponentContext>& xContext)
- : vcl::RoadmapWizard(pParent)
- , m_xChartModel(xChartModel,uno::UNO_QUERY)
- , m_xComponentContext(xContext)
- , m_pTemplateProvider(nullptr)
- , m_aTimerTriggeredControllerLock(xChartModel)
- , m_bCanTravel(true)
+ : vcl::RoadmapWizardMachine(pParent)
+ , m_xChartModel(xChartModel,uno::UNO_QUERY)
+ , m_xComponentContext(xContext)
+ , m_pTemplateProvider(nullptr)
+ , m_aTimerTriggeredControllerLock(xChartModel)
+ , m_bCanTravel(true)
{
m_pDialogModel.reset(new DialogModel(m_xChartModel, m_xComponentContext));
defaultButton(WizardButtonFlags::FINISH);
@@ -69,12 +67,6 @@ CreationWizard::CreationWizard(vcl::Window* pParent, const uno::Reference<frame:
declarePath(PATH_FULL, aPath);
SetRoadmapHelpId(HID_SCH_WIZARD_ROADMAP);
- SetRoadmapInteractive(true);
-
- Size aAdditionalRoadmapSize(LogicToPixel(Size(85, 0), MapMode(MapUnit::MapAppFont)));
- Size aSize(LogicToPixel(Size(CHART_WIZARD_PAGEWIDTH, CHART_WIZARD_PAGEHEIGHT), MapMode(MapUnit::MapAppFont)));
- aSize.AdjustWidth(aAdditionalRoadmapSize.Width() );
- SetSizePixel(aSize);
if (!m_pDialogModel->getModel().isDataFromSpreadsheet())
{
@@ -84,6 +76,16 @@ CreationWizard::CreationWizard(vcl::Window* pParent, const uno::Reference<frame:
// Call ActivatePage, to create and activate the first page
ActivatePage();
+
+ m_xAssistant->set_current_page(0);
+}
+
+short CreationWizard::run()
+{
+ int nRet = vcl::RoadmapWizardMachine::run();
+ if (nRet == static_cast<int>(WizardButtonFlags::FINISH))
+ return ui::dialogs::ExecutableDialogResults::OK;
+ return ui::dialogs::ExecutableDialogResults::CANCEL;
}
CreationWizard::~CreationWizard() = default;
@@ -91,12 +93,18 @@ CreationWizard::~CreationWizard() = default;
VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
{
VclPtr<vcl::OWizardPage> pRet;
+
+ OString sIdent(OString::number(nState));
+ weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
+ // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent
+ TabPageParent aParent(pPageContainer, this);
+
switch( nState )
{
case STATE_CHARTTYPE:
{
m_aTimerTriggeredControllerLock.startTimer();
- VclPtrInstance<ChartTypeTabPage> pChartTypeTabPage(this,m_xChartModel);
+ VclPtrInstance<ChartTypeTabPage> pChartTypeTabPage(aParent, m_xChartModel);
pRet = pChartTypeTabPage;
m_pTemplateProvider = pChartTypeTabPage;
if (m_pDialogModel)
@@ -106,18 +114,18 @@ VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
case STATE_SIMPLE_RANGE:
{
m_aTimerTriggeredControllerLock.startTimer();
- pRet = VclPtr<RangeChooserTabPage>::Create(this, *m_pDialogModel, m_pTemplateProvider, this);
+ pRet = VclPtr<RangeChooserTabPage>::Create(aParent, *m_pDialogModel, m_pTemplateProvider, this);
}
break;
case STATE_DATA_SERIES:
{
m_aTimerTriggeredControllerLock.startTimer();
- pRet = VclPtr<DataSourceTabPage>::Create(this, *m_pDialogModel, m_pTemplateProvider, this);
+ pRet = VclPtr<DataSourceTabPage>::Create(aParent, *m_pDialogModel, m_pTemplateProvider, this);
}
break;
case STATE_OBJECTS:
{
- pRet = VclPtr<TitlesAndObjectsTabPage>::Create(this,m_xChartModel, m_xComponentContext);
+ pRet = VclPtr<TitlesAndObjectsTabPage>::Create(aParent, m_xChartModel, m_xComponentContext);
m_aTimerTriggeredControllerLock.startTimer();
}
break;
@@ -147,13 +155,14 @@ vcl::WizardTypes::WizardState CreationWizard::determineNextState( WizardState nC
++nNextState;
return (nNextState==STATE_LAST+1) ? WZS_INVALID_STATE : nNextState;
}
+
void CreationWizard::enterState(WizardState nState)
{
m_aTimerTriggeredControllerLock.startTimer();
enableButtons( WizardButtonFlags::PREVIOUS, nState > STATE_FIRST );
enableButtons( WizardButtonFlags::NEXT, nState < STATE_LAST );
if( isStateEnabled( nState ))
- vcl::RoadmapWizard::enterState(nState);
+ vcl::RoadmapWizardMachine::enterState(nState);
}
void CreationWizard::setInvalidPage( TabPage * /* pTabPage */ )