diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-18 15:49:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-18 20:45:02 +0100 |
commit | 3e7b2b12292537e5c6d8b3885ab672187c14e213 (patch) | |
tree | eb0f3b23e53f15cd7a8fbcd8c487abd0c010f8eb | |
parent | 0d97c05696fa6f9c0f1f754158622bc352752346 (diff) |
use more concrete types in chart2, ChartTypeTemplate
Change-Id: Ife0be0fde2f8d273411cbdbbafa2173ac80f80f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128560
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
15 files changed, 327 insertions, 345 deletions
diff --git a/chart2/inc/ChartTypeManager.hxx b/chart2/inc/ChartTypeManager.hxx index 45e571f7aab5..0ed5b3ef4812 100644 --- a/chart2/inc/ChartTypeManager.hxx +++ b/chart2/inc/ChartTypeManager.hxx @@ -23,11 +23,13 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/chart2/XChartTypeManager.hpp> #include <charttoolsdllapi.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::uno { class XComponentContext; } namespace chart { +class ChartTypeTemplate; class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeManager final : public ::cppu::WeakImplHelper< @@ -60,6 +62,8 @@ public: // ____ XChartTypeManager ____ // currently empty + rtl::Reference< ::chart::ChartTypeTemplate > createTemplate( const OUString& aServiceSpecifier ); + private: css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index a40eb57dc2f6..fc97499a30a5 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -20,6 +20,7 @@ #include <ChartDocumentWrapper.hxx> #include <ChartView.hxx> #include <ChartTypeManager.hxx> +#include <ChartTypeTemplate.hxx> #include <servicenames.hxx> #include <PropertyHelper.hxx> #include <TitleHelper.hxx> @@ -1071,102 +1072,92 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( if( aIt != rMap.end()) { bool bCreateDiagram = false; - rtl::Reference< ::chart::ChartTypeManager > xManagerFact = + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); - uno::Reference< chart2::XChartTypeTemplate > xTemplate; + rtl::Reference< ::chart::ChartTypeTemplate > xTemplate; switch( (*aIt).second ) { case SERVICE_NAME_AREA_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Area"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Area"); bCreateDiagram = true; } break; case SERVICE_NAME_BAR_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { // this is for bar and column (the latter is the default if // no "Vertical=false" property was set) - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Column"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Column"); bCreateDiagram = true; } break; case SERVICE_NAME_DONUT_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Donut"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Donut"); bCreateDiagram = true; } break; case SERVICE_NAME_LINE_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Line"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Line"); bCreateDiagram = true; } break; case SERVICE_NAME_NET_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Net"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Net"); bCreateDiagram = true; } break; case SERVICE_NAME_FILLED_NET_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.FilledNet"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.FilledNet"); bCreateDiagram = true; } break; case SERVICE_NAME_PIE_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Pie"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Pie"); bCreateDiagram = true; } break; case SERVICE_NAME_STOCK_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.StockLowHighClose"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.StockLowHighClose"); bCreateDiagram = true; } break; case SERVICE_NAME_XY_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.ScatterLineSymbol"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.ScatterLineSymbol"); bCreateDiagram = true; } break; case SERVICE_NAME_BUBBLE_DIAGRAM: - if( xManagerFact.is()) + if( xChartTypeManager.is()) { - xTemplate.set( - xManagerFact->createInstance("com.sun.star.chart2.template.Bubble"), - uno::UNO_QUERY ); + xTemplate = + xChartTypeManager->createTemplate("com.sun.star.chart2.template.Bubble"); bCreateDiagram = true; } break; diff --git a/chart2/source/model/template/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx index dcd62646a239..006eac7a03b9 100644 --- a/chart2/source/model/template/ChartTypeTemplate.hxx +++ b/chart2/source/inc/ChartTypeTemplate.hxx @@ -19,7 +19,7 @@ #pragma once #include <cppuhelper/implbase.hxx> -#include <StackMode.hxx> +#include "StackMode.hxx" #include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/lang/XServiceName.hpp> @@ -74,7 +74,6 @@ public: const OUString & rServiceName ); virtual ~ChartTypeTemplate() override; -protected: // ____ XChartTypeTemplate ____ virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource( const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx index 137b9e212fdb..6954513481e4 100644 --- a/chart2/source/model/template/AreaChartTypeTemplate.hxx +++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <StackMode.hxx> #include <OPropertySet.hxx> diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx index d27ac7836c2b..4146e2611c55 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.hxx +++ b/chart2/source/model/template/BarChartTypeTemplate.hxx @@ -22,7 +22,7 @@ #include <cppuhelper/basemutex.hxx> #include <comphelper/uno3.hxx> -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <StackMode.hxx> namespace chart diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx index 91561c981155..d04e09e38481 100644 --- a/chart2/source/model/template/BubbleChartTypeTemplate.hxx +++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <OPropertySet.hxx> #include <cppuhelper/basemutex.hxx> #include <comphelper/uno3.hxx> diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index c0bcc0a03d33..67e343498365 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -224,312 +224,300 @@ ChartTypeManager::~ChartTypeManager() uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance( const OUString& aServiceSpecifier ) { - uno::Reference< uno::XInterface > xResult; + return static_cast<cppu::OWeakObject*>(createTemplate(aServiceSpecifier).get()); +} + +rtl::Reference< ::chart::ChartTypeTemplate > ChartTypeManager::createTemplate( + const OUString& aServiceSpecifier ) +{ TemplateId nId = lcl_GetTemplateIdForService( aServiceSpecifier ); if( nId == TEMPLATE_NOT_FOUND ) { - try - { - xResult = m_xContext->getServiceManager()->createInstanceWithContext( - aServiceSpecifier, m_xContext ); - } -// catch( registry::InvalidValueException & ex ) - catch( const uno::Exception & ) - { - // couldn't create service via factory - - // As XMultiServiceFactory does not specify, what to do in case - // createInstance is called with an unknown service-name, this - // function will just return an empty XInterface. - DBG_UNHANDLED_EXCEPTION("chart2"); - SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier ); - xResult.set( nullptr ); - } + assert(false); + SAL_WARN("chart2", "Couldn't instantiate service: "<< aServiceSpecifier ); + return nullptr; } - else + + rtl::Reference< ::chart::ChartTypeTemplate > xTemplate; + switch( nId ) { - uno::Reference< chart2::XChartTypeTemplate > xTemplate; - switch( nId ) + // Point (category x axis) + case TEMPLATE_SYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, true, false )); + break; + case TEMPLATE_STACKEDSYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, true, false )); + break; + case TEMPLATE_PERCENTSTACKEDSYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, true, false )); + break; + // Line (category x axis) + case TEMPLATE_LINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, false )); + break; + case TEMPLATE_STACKEDLINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, false )); + break; + case TEMPLATE_PERCENTSTACKEDLINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, false )); + break; + case TEMPLATE_LINESYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, true )); + break; + case TEMPLATE_STACKEDLINESYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, true )); + break; + case TEMPLATE_PERCENTSTACKEDLINESYMBOL: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, true )); + break; + case TEMPLATE_THREEDLINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, false, true, 3 )); + break; + case TEMPLATE_STACKEDTHREEDLINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, false, true, 3 )); + break; + case TEMPLATE_PERCENTSTACKEDTHREEDLINE: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, false, true, 3 )); + break; + case TEMPLATE_THREEDLINEDEEP: + xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::ZStacked, false, true, 3 )); + break; + + // Bar/Column + case TEMPLATE_COLUMN: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, BarChartTypeTemplate::VERTICAL )); + break; + case TEMPLATE_STACKEDCOLUMN: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, BarChartTypeTemplate::VERTICAL )); + break; + case TEMPLATE_PERCENTSTACKEDCOLUMN: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL )); + break; + case TEMPLATE_BAR: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, BarChartTypeTemplate::HORIZONTAL )); + break; + case TEMPLATE_STACKEDBAR: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL )); + break; + case TEMPLATE_PERCENTSTACKEDBAR: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL )); + break; + case TEMPLATE_THREEDCOLUMNDEEP: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::ZStacked, BarChartTypeTemplate::VERTICAL, 3 )); + break; + case TEMPLATE_THREEDCOLUMNFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, BarChartTypeTemplate::VERTICAL, 3 )); + break; + case TEMPLATE_STACKEDTHREEDCOLUMNFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, BarChartTypeTemplate::VERTICAL, 3 )); + break; + case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL, 3 )); + break; + case TEMPLATE_THREEDBARDEEP: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::ZStacked, BarChartTypeTemplate::HORIZONTAL, 3 )); + break; + case TEMPLATE_THREEDBARFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, BarChartTypeTemplate::HORIZONTAL, 3 )); + break; + case TEMPLATE_STACKEDTHREEDBARFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL, 3 )); + break; + case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT: + xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL, 3 )); + break; + + // Combi-Chart Line/Column + case TEMPLATE_COLUMNWITHLINE: + case TEMPLATE_STACKEDCOLUMNWITHLINE: { - // Point (category x axis) - case TEMPLATE_SYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, true, false )); - break; - case TEMPLATE_STACKEDSYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, true, false )); - break; - case TEMPLATE_PERCENTSTACKEDSYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, true, false )); - break; - // Line (category x axis) - case TEMPLATE_LINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, false )); - break; - case TEMPLATE_STACKEDLINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, false )); - break; - case TEMPLATE_PERCENTSTACKEDLINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, false )); - break; - case TEMPLATE_LINESYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, true )); - break; - case TEMPLATE_STACKEDLINESYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, true )); - break; - case TEMPLATE_PERCENTSTACKEDLINESYMBOL: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, true )); - break; - case TEMPLATE_THREEDLINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, false, true, 3 )); - break; - case TEMPLATE_STACKEDTHREEDLINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, false, true, 3 )); - break; - case TEMPLATE_PERCENTSTACKEDTHREEDLINE: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, false, true, 3 )); - break; - case TEMPLATE_THREEDLINEDEEP: - xTemplate.set( new LineChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::ZStacked, false, true, 3 )); - break; - - // Bar/Column - case TEMPLATE_COLUMN: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, BarChartTypeTemplate::VERTICAL )); - break; - case TEMPLATE_STACKEDCOLUMN: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, BarChartTypeTemplate::VERTICAL )); - break; - case TEMPLATE_PERCENTSTACKEDCOLUMN: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL )); - break; - case TEMPLATE_BAR: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, BarChartTypeTemplate::HORIZONTAL )); - break; - case TEMPLATE_STACKEDBAR: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL )); - break; - case TEMPLATE_PERCENTSTACKEDBAR: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL )); - break; - case TEMPLATE_THREEDCOLUMNDEEP: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::ZStacked, BarChartTypeTemplate::VERTICAL, 3 )); - break; - case TEMPLATE_THREEDCOLUMNFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, BarChartTypeTemplate::VERTICAL, 3 )); - break; - case TEMPLATE_STACKEDTHREEDCOLUMNFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, BarChartTypeTemplate::VERTICAL, 3 )); - break; - case TEMPLATE_PERCENTSTACKEDTHREEDCOLUMNFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, BarChartTypeTemplate::VERTICAL, 3 )); - break; - case TEMPLATE_THREEDBARDEEP: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::ZStacked, BarChartTypeTemplate::HORIZONTAL, 3 )); - break; - case TEMPLATE_THREEDBARFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, BarChartTypeTemplate::HORIZONTAL, 3 )); - break; - case TEMPLATE_STACKEDTHREEDBARFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, BarChartTypeTemplate::HORIZONTAL, 3 )); - break; - case TEMPLATE_PERCENTSTACKEDTHREEDBARFLAT: - xTemplate.set( new BarChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, BarChartTypeTemplate::HORIZONTAL, 3 )); - break; - - // Combi-Chart Line/Column - case TEMPLATE_COLUMNWITHLINE: - case TEMPLATE_STACKEDCOLUMNWITHLINE: - { - StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE ) - ? StackMode::NONE - : StackMode::YStacked; + StackMode eMode = ( nId == TEMPLATE_COLUMNWITHLINE ) + ? StackMode::NONE + : StackMode::YStacked; - xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 )); - } + xTemplate.set( new ColumnLineChartTypeTemplate( m_xContext, aServiceSpecifier, eMode, 1 )); + } + break; + + // Area + case TEMPLATE_AREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::NONE )); + break; + case TEMPLATE_STACKEDAREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked )); + break; + case TEMPLATE_PERCENTSTACKEDAREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent )); + break; + case TEMPLATE_THREEDAREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::ZStacked, 3 )); + break; + case TEMPLATE_STACKEDTHREEDAREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked, 3 )); + break; + case TEMPLATE_PERCENTSTACKEDTHREEDAREA: + xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent, 3 )); + break; + + case TEMPLATE_PIE: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_NONE, false )); + break; + case TEMPLATE_PIEALLEXPLODED: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_ALL_EXPLODED, false )); + break; + case TEMPLATE_DONUT: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_NONE, true )); + break; + case TEMPLATE_DONUTALLEXPLODED: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_ALL_EXPLODED, true )); + break; + case TEMPLATE_THREEDPIE: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_NONE, false, 3 )); + break; + case TEMPLATE_THREEDPIEALLEXPLODED: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_ALL_EXPLODED, false, 3 )); + break; + case TEMPLATE_THREEDDONUT: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_NONE, true, 3 )); + break; + case TEMPLATE_THREEDDONUTALLEXPLODED: + xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, + chart2::PieChartOffsetMode_ALL_EXPLODED, true, 3 )); + break; + + case TEMPLATE_SCATTERLINESYMBOL: + xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true )); + break; + case TEMPLATE_SCATTERLINE: + xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false )); + break; + case TEMPLATE_SCATTERSYMBOL: + xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false )); + break; + case TEMPLATE_THREEDSCATTER: + xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 )); + break; + + // NetChart + case TEMPLATE_NET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, true )); + break; + case TEMPLATE_NETSYMBOL: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, true, false )); + break; + case TEMPLATE_NETLINE: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, false )); + break; + + case TEMPLATE_STACKEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, true )); + break; + case TEMPLATE_STACKEDNETSYMBOL: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, true, false )); + break; + case TEMPLATE_STACKEDNETLINE: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, false, true )); break; - // Area - case TEMPLATE_AREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::NONE )); - break; - case TEMPLATE_STACKEDAREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked )); - break; - case TEMPLATE_PERCENTSTACKEDAREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent )); - break; - case TEMPLATE_THREEDAREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::ZStacked, 3 )); - break; - case TEMPLATE_STACKEDTHREEDAREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStacked, 3 )); - break; - case TEMPLATE_PERCENTSTACKEDTHREEDAREA: - xTemplate.set( new AreaChartTypeTemplate( m_xContext, aServiceSpecifier, StackMode::YStackedPercent, 3 )); - break; - - case TEMPLATE_PIE: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_NONE, false )); - break; - case TEMPLATE_PIEALLEXPLODED: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_ALL_EXPLODED, false )); - break; - case TEMPLATE_DONUT: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_NONE, true )); - break; - case TEMPLATE_DONUTALLEXPLODED: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_ALL_EXPLODED, true )); - break; - case TEMPLATE_THREEDPIE: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_NONE, false, 3 )); - break; - case TEMPLATE_THREEDPIEALLEXPLODED: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_ALL_EXPLODED, false, 3 )); - break; - case TEMPLATE_THREEDDONUT: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_NONE, true, 3 )); - break; - case TEMPLATE_THREEDDONUTALLEXPLODED: - xTemplate.set( new PieChartTypeTemplate( m_xContext, aServiceSpecifier, - chart2::PieChartOffsetMode_ALL_EXPLODED, true, 3 )); - break; - - case TEMPLATE_SCATTERLINESYMBOL: - xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true )); - break; - case TEMPLATE_SCATTERLINE: - xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false )); - break; - case TEMPLATE_SCATTERSYMBOL: - xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ true, /* bHasLines */ false )); - break; - case TEMPLATE_THREEDSCATTER: - xTemplate.set( new ScatterChartTypeTemplate( m_xContext, aServiceSpecifier, /* bSymbols */ false, /* bHasLines */ true, 3 )); - break; - - // NetChart - case TEMPLATE_NET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, true )); - break; - case TEMPLATE_NETSYMBOL: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, true, false )); - break; - case TEMPLATE_NETLINE: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, false )); - break; - - case TEMPLATE_STACKEDNET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, true )); - break; - case TEMPLATE_STACKEDNETSYMBOL: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, true, false )); - break; - case TEMPLATE_STACKEDNETLINE: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, false, true )); - break; - - case TEMPLATE_PERCENTSTACKEDNET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, true )); - break; - case TEMPLATE_PERCENTSTACKEDNETSYMBOL: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, true, false )); - break; - case TEMPLATE_PERCENTSTACKEDNETLINE: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, false, true )); - break; - - case TEMPLATE_FILLEDNET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::NONE, false, false, true )); - break; - case TEMPLATE_STACKEDFILLEDNET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStacked, false, false, true )); - break; - case TEMPLATE_PERCENTSTACKEDFILLEDNET: - xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, - StackMode::YStackedPercent, false, false, true )); - break; - - case TEMPLATE_STOCKLOWHIGHCLOSE: - xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, - StockChartTypeTemplate::StockVariant::NONE, false )); - break; - case TEMPLATE_STOCKOPENLOWHIGHCLOSE: - xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, - StockChartTypeTemplate::StockVariant::Open, true )); - break; - case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE: - xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, - StockChartTypeTemplate::StockVariant::Volume, false )); - break; - case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE: - xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, - StockChartTypeTemplate::StockVariant::VolumeOpen, true )); - break; - - //BubbleChart - case TEMPLATE_BUBBLE: - xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier )); - break; - default: break; + case TEMPLATE_PERCENTSTACKEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, true )); + break; + case TEMPLATE_PERCENTSTACKEDNETSYMBOL: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, true, false )); + break; + case TEMPLATE_PERCENTSTACKEDNETLINE: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, false, true )); + break; + + case TEMPLATE_FILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::NONE, false, false, true )); + break; + case TEMPLATE_STACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStacked, false, false, true )); + break; + case TEMPLATE_PERCENTSTACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode::YStackedPercent, false, false, true )); + break; + + case TEMPLATE_STOCKLOWHIGHCLOSE: + xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, + StockChartTypeTemplate::StockVariant::NONE, false )); + break; + case TEMPLATE_STOCKOPENLOWHIGHCLOSE: + xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, + StockChartTypeTemplate::StockVariant::Open, true )); + break; + case TEMPLATE_STOCKVOLUMELOWHIGHCLOSE: + xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, + StockChartTypeTemplate::StockVariant::Volume, false )); + break; + case TEMPLATE_STOCKVOLUMEOPENLOWHIGHCLOSE: + xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, + StockChartTypeTemplate::StockVariant::VolumeOpen, true )); + break; + + //BubbleChart + case TEMPLATE_BUBBLE: + xTemplate.set( new BubbleChartTypeTemplate( m_xContext, aServiceSpecifier )); + break; + default: break; // case TEMPLATE_SURFACE: // case TEMPLATE_ADDIN: // break; - case TEMPLATE_NOT_FOUND: - OSL_ASSERT( false ); - break; - } - xResult.set( xTemplate, uno::UNO_QUERY ); + case TEMPLATE_NOT_FOUND: + assert( false ); + break; } - return xResult; + return xTemplate; } uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstanceWithArguments( diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 1f1b09cff89f..e6eb5e27e069 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include "DataInterpreter.hxx" #include <CommonConverters.hxx> #include <ChartTypeHelper.hxx> diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx index 2a38ca6dfb49..d112b81f58ad 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <StackMode.hxx> #include <OPropertySet.hxx> diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx index f952b940ee1e..84d87a32185c 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.hxx +++ b/chart2/source/model/template/LineChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <OPropertySet.hxx> #include <cppuhelper/basemutex.hxx> #include <StackMode.hxx> diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx index deef73ff2a48..ac0ee3aebf0b 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.hxx +++ b/chart2/source/model/template/NetChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <StackMode.hxx> namespace chart diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx index a23acbf33a83..c749be57447a 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.hxx +++ b/chart2/source/model/template/PieChartTypeTemplate.hxx @@ -22,7 +22,7 @@ #include <cppuhelper/basemutex.hxx> #include <comphelper/uno3.hxx> -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <com/sun/star/chart2/PieChartOffsetMode.hpp> namespace chart diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx index 502b5322ab71..f25d6ebcbf49 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.hxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <OPropertySet.hxx> #include <cppuhelper/basemutex.hxx> #include <comphelper/uno3.hxx> diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx index c064b8105111..99eb7da8c8cf 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.hxx +++ b/chart2/source/model/template/StockChartTypeTemplate.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include "ChartTypeTemplate.hxx" +#include <ChartTypeTemplate.hxx> #include <OPropertySet.hxx> #include <cppuhelper/basemutex.hxx> #include <comphelper/uno3.hxx> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index ccef2bf0bfff..10175a4c0422 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -1013,6 +1013,7 @@ chart2/source/inc/CachedDataSequence.hxx chart2/source/inc/CharacterProperties.hxx chart2/source/inc/ChartModelHelper.hxx chart2/source/inc/ChartTypeHelper.hxx +chart2/source/inc/ChartTypeTemplate.hxx chart2/source/inc/CloneHelper.hxx chart2/source/inc/ColorPerPointHelper.hxx chart2/source/inc/CommonConverters.hxx @@ -1128,7 +1129,6 @@ chart2/source/model/template/ChartType.cxx chart2/source/model/template/ChartType.hxx chart2/source/model/template/ChartTypeManager.cxx chart2/source/model/template/ChartTypeTemplate.cxx -chart2/source/model/template/ChartTypeTemplate.hxx chart2/source/model/template/ColumnChartType.cxx chart2/source/model/template/ColumnChartType.hxx chart2/source/model/template/ColumnLineChartTypeTemplate.cxx |