summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-03-07 16:48:24 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-03-30 23:52:43 +0200
commitc21bf93b90c89999e9983137ae3abe505ed89f9c (patch)
tree2c83e1fb0f77b4a4f8ed5a0a6629443998c2081a
parentf86ad69293fac563b497c42910f8b45b2599746c (diff)
clean-up code in chart creation wizard
Change-Id: I990dba44d4ce3d3f0538b6038133c289980fa315
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx60
-rw-r--r--chart2/source/controller/inc/dlg_CreationWizard.hxx37
2 files changed, 51 insertions, 46 deletions
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index 501272f5c486..07a03b06e733 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -33,10 +33,10 @@
#define CHART_WIZARD_PAGEWIDTH 250
#define CHART_WIZARD_PAGEHEIGHT 170
+using namespace css;
+
namespace chart
{
-using namespace ::com::sun::star;
-
#define PATH_FULL 1
#define STATE_FIRST 0
#define STATE_CHARTTYPE STATE_FIRST
@@ -45,41 +45,45 @@ using namespace ::com::sun::star;
#define STATE_OBJECTS 3
#define STATE_LAST STATE_OBJECTS
-CreationWizard::CreationWizard( vcl::Window* pParent, const uno::Reference< frame::XModel >& xChartModel
- , const uno::Reference< uno::XComponentContext >& xContext )
- : svt::RoadmapWizard( pParent )
+CreationWizard::CreationWizard(vcl::Window* pParent, const uno::Reference<frame::XModel>& xChartModel,
+ const uno::Reference<uno::XComponentContext>& xContext)
+ : svt::RoadmapWizard(pParent)
, m_xChartModel(xChartModel,uno::UNO_QUERY)
- , m_xCC( xContext )
+ , m_xComponentContext(xContext)
, m_pTemplateProvider(nullptr)
, m_nLastState(STATE_LAST)
- , m_aTimerTriggeredControllerLock( xChartModel )
- , m_bCanTravel( true )
+ , m_aTimerTriggeredControllerLock(xChartModel)
+ , m_bCanTravel(true)
{
- m_pDialogModel.reset( new DialogModel( m_xChartModel, m_xCC ));
- defaultButton( WizardButtonFlags::FINISH );
+ m_pDialogModel.reset(new DialogModel(m_xChartModel, m_xComponentContext));
+ defaultButton(WizardButtonFlags::FINISH);
this->setTitleBase(SCH_RESSTR(STR_DLG_CHART_WIZARD));
- declarePath( PATH_FULL
- , {STATE_CHARTTYPE
- , STATE_SIMPLE_RANGE
- , STATE_DATA_SERIES
- , STATE_OBJECTS}
- );
- this->SetRoadmapHelpId( HID_SCH_WIZARD_ROADMAP );
- this->SetRoadmapInteractive( true );
- Size aAdditionalRoadmapSize( LogicToPixel( Size( 85, 0 ), MapUnit::MapAppFont ) );
+ WizardPath aPath = {
+ STATE_CHARTTYPE,
+ STATE_SIMPLE_RANGE,
+ STATE_DATA_SERIES,
+ STATE_OBJECTS
+ };
+
+ declarePath(PATH_FULL, aPath);
+
+ this->SetRoadmapHelpId(HID_SCH_WIZARD_ROADMAP);
+ this->SetRoadmapInteractive(true);
+
+ Size aAdditionalRoadmapSize(LogicToPixel(Size(85, 0), MapUnit::MapAppFont));
Size aSize(LogicToPixel(Size(CHART_WIZARD_PAGEWIDTH, CHART_WIZARD_PAGEHEIGHT), MapUnit::MapAppFont));
aSize.Width() += aAdditionalRoadmapSize.Width();
- this->SetSizePixel( aSize );
+ this->SetSizePixel(aSize);
- uno::Reference< chart2::XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY );
+ uno::Reference<chart2::XChartDocument> xChartDoc(m_xChartModel, uno::UNO_QUERY);
bool bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
- if( bHasOwnData )
+ if(bHasOwnData)
{
- this->enableState( STATE_SIMPLE_RANGE, false );
- this->enableState( STATE_DATA_SERIES, false );
+ enableState(STATE_SIMPLE_RANGE, false);
+ enableState(STATE_DATA_SERIES, false);
}
// Call ActivatePage, to create and activate the first page
@@ -117,15 +121,17 @@ VclPtr<TabPage> CreationWizard::createPage(WizardState nState)
break;
case STATE_OBJECTS:
{
- pRet = VclPtr<TitlesAndObjectsTabPage>::Create(this,m_xChartModel,m_xCC);
+ pRet = VclPtr<TitlesAndObjectsTabPage>::Create(this,m_xChartModel, m_xComponentContext);
m_aTimerTriggeredControllerLock.startTimer();
}
break;
default:
break;
}
- if(pRet)
- pRet->SetText(OUString());//remove title of pages to not get them in the wizard title
+
+ if (pRet)
+ pRet->SetText(OUString()); //remove title of pages to not get them in the wizard title
+
return pRet;
}
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index fed019004716..a1fed3c8ae55 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -24,57 +24,56 @@
#include "TabPageNotifiable.hxx"
#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <svtools/roadmapwizard.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <svtools/roadmapwizard.hxx>
+
#include <memory>
namespace chart
{
-class RangeChooserTabPage;
-class DataSourceTabPage;
class DialogModel;
class ChartTypeTemplateProvider;
class CreationWizard : public svt::RoadmapWizard, public TabPageNotifiable
{
public:
- CreationWizard( vcl::Window* pParent,
- const css::uno::Reference< css::frame::XModel >& xChartModel
- , const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ CreationWizard(vcl::Window* pParent,
+ const css::uno::Reference<css::frame::XModel>& xChartModel,
+ const css::uno::Reference<css::uno::XComponentContext>& xContext);
CreationWizard() = delete;
virtual ~CreationWizard() override;
// TabPageNotifiable
- virtual void setInvalidPage( TabPage * pTabPage ) override;
- virtual void setValidPage( TabPage * pTabPage ) override;
+ virtual void setInvalidPage(TabPage * pTabPage) override;
+ virtual void setValidPage(TabPage * pTabPage) override;
protected:
- virtual bool leaveState( WizardState _nState ) override;
- virtual WizardState determineNextState(WizardState nCurrentState) const override;
- virtual void enterState(WizardState nState) override;
+ virtual bool leaveState( WizardState _nState ) override;
+ virtual WizardState determineNextState(WizardState nCurrentState) const override;
+ virtual void enterState(WizardState nState) override;
- virtual OUString getStateDisplayName( WizardState nState ) const override;
+ virtual OUString getStateDisplayName(WizardState nState) const override;
private:
virtual VclPtr<TabPage> createPage(WizardState nState) override;
- css::uno::Reference< css::chart2::XChartDocument > m_xChartModel;
- css::uno::Reference< css::uno::XComponentContext> m_xCC;
- ChartTypeTemplateProvider* m_pTemplateProvider;
+ css::uno::Reference<css::chart2::XChartDocument> m_xChartModel;
+ css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
+ ChartTypeTemplateProvider* m_pTemplateProvider;
std::unique_ptr<DialogModel> m_pDialogModel;
WizardState m_nLastState;
- TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
+ TimerTriggeredControllerLock m_aTimerTriggeredControllerLock;
-// RangeChooserTabPage * m_pRangeChooserTabPage;
-// DataSourceTabPage * m_pDataSourceTabPage;
- bool m_bCanTravel;
+ bool m_bCanTravel;
};
+
} //namespace chart
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */