summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-22 19:21:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-23 10:18:01 +0100
commit0f64a9ade726880c945047b590134910775e5845 (patch)
treef607e48e92cec2b25557e2d53ac046979bb63120
parent162017cd9abd9c1ca63a6b671a084464b896e85c (diff)
use more concrete types in chart2, ChartType
Change-Id: Idd81f73e1352118f25102542effc8a3287e244cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128790 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/inc/ChartTypeTemplate.hxx10
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx25
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.hxx8
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx26
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.hxx8
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx30
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.hxx7
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx16
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx30
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.hxx8
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx55
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.hxx7
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx34
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.hxx7
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx39
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.hxx8
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx55
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.hxx8
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx53
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.hxx9
20 files changed, 163 insertions, 280 deletions
diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx
index ce32ba0e19e0..123fec2c8f6a 100644
--- a/chart2/source/inc/ChartTypeTemplate.hxx
+++ b/chart2/source/inc/ChartTypeTemplate.hxx
@@ -98,9 +98,9 @@ public:
const css::uno::Reference<
css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties );
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) = 0;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) = 0;
virtual css::uno::Reference< css::chart2::XDataInterpreter > getDataInterpreter();
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
@@ -132,7 +132,7 @@ public:
*/
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) = 0;
virtual bool isSwapXAndY() const;
@@ -252,8 +252,6 @@ private:
const css::uno::Reference<
css::chart2::data::XLabeledDataSequence >& xCategories,
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq);
-
- rtl::Reference< ChartType > getChartTypeForNewSeries( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes );
};
} // namespace chart
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 35310754f693..f72f610f24ae 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "AreaChartTypeTemplate.hxx"
+#include "AreaChartType.hxx"
#include <servicenames_charttypes.hxx>
#include <DiagramHelper.hxx>
#include <DataSeriesHelper.hxx>
@@ -205,29 +206,15 @@ void AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xD
}
}
-Reference< chart2::XChartType > AreaChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_AREA ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ return new AreaChartType();
}
-Reference< chart2::XChartType > AreaChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx
index ffbcda3d22be..e288fd234340 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.hxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx
@@ -56,9 +56,9 @@ protected:
getPropertySetInfo() override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -68,7 +68,7 @@ protected:
const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index dc109e845696..84d1f06a5cbe 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "BarChartTypeTemplate.hxx"
+#include "ColumnChartType.hxx"
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <DataSeriesHelper.hxx>
@@ -199,29 +200,16 @@ bool BarChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > BarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
-{
- Reference< chart2::XChartType > xResult;
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+{
+ return new ColumnChartType();
}
-Reference< chart2::XChartType > BarChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx
index 0ab70f4acc00..fc12eb94b685 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.hxx
@@ -66,9 +66,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -78,7 +78,7 @@ protected:
const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
index 66945af4a1ed..029e3c9b24c8 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "BubbleChartTypeTemplate.hxx"
+#include "BubbleChartType.hxx"
#include "BubbleDataInterpreter.hxx"
#include <servicenames_charttypes.hxx>
#include <DataSeriesHelper.hxx>
@@ -156,36 +157,19 @@ bool BubbleChartTypeTemplate::supportsCategories()
return false;
}
-Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ return new BubbleChartType();
}
-Reference< chart2::XChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ), uno::UNO_QUERY_THROW );
+ xResult = new BubbleChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
index 806ccea95fa3..c0dcd6bb36b9 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.hxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx
@@ -53,8 +53,9 @@ protected:
// ____ ChartTypeTemplate ____
virtual bool supportsCategories() override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual css::uno::Reference< css::chart2::XDataInterpreter > getDataInterpreter() override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
@@ -63,7 +64,7 @@ protected:
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index c5119e9570f5..38c8466e49e7 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -323,7 +323,7 @@ bool ChartTypeTemplate::matchesTemplate(
bResult = aCooSysSeq.hasElements();
if( bResult )
{
- Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
+ std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes;
Reference<XChartType> xOldCT = getChartTypeForNewSeries(aFormerlyUsedChartTypes);
if (!xOldCT.is())
return false;
@@ -527,8 +527,8 @@ void ChartTypeTemplate::createCoordinateSystems(
{
if( ! xOutCooSysCnt.is())
return;
- Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
- Reference< XChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes));
+ std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes;
+ rtl::Reference< ChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes));
if( ! xChartType.is())
return;
Reference< XCoordinateSystem > xCooSys( xChartType->createCoordinateSystem( getDimension()));
@@ -615,7 +615,7 @@ void ChartTypeTemplate::adaptScales(
aData.Categories = xCategories;
if(bSupportsCategories)
{
- Reference< XChartType > xChartType(getChartTypeForNewSeries(Sequence< Reference< XChartType > >()));
+ rtl::Reference< ChartType > xChartType = getChartTypeForNewSeries({});
if( aData.AxisType == AxisType::CATEGORY )
{
aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close");
@@ -750,14 +750,6 @@ sal_Int32 ChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
return (nDimension < getDimension()) ? 1 : 0;
}
-rtl::Reference< ChartType > ChartTypeTemplate::getChartTypeForNewSeries( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
-{
- uno::Reference<XChartType> xChartType = getChartTypeForNewSeries(comphelper::containerToSequence<uno::Reference<XChartType>>(aFormerlyUsedChartTypes));
- auto pChartType = dynamic_cast<ChartType*>(xChartType.get());
- assert(!xChartType || pChartType);
- return pChartType;
-}
-
void ChartTypeTemplate::FillDiagram(
const Reference< XDiagram >& xDiagram,
const Sequence< Sequence< Reference< XDataSeries > > >& aSeriesSeq,
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 6ed0bf845657..9d5ef9274ace 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -18,6 +18,8 @@
*/
#include "ColumnLineChartTypeTemplate.hxx"
+#include "ColumnChartType.hxx"
+#include "LineChartType.hxx"
#include <CommonConverters.hxx>
#include <DiagramHelper.hxx>
#include <DataSeriesHelper.hxx>
@@ -350,32 +352,22 @@ bool ColumnLineChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
+rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
{
- Reference< chart2::XChartType > xCT;
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
- if(xFact.is())
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
- return xCT;
+ if( nChartTypeIndex == 0 )
+ return new ColumnChartType();
+ else
+ return new LineChartType();
}
-Reference< XChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
index 893b67f2743d..31d7b2bc9b16 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
@@ -59,9 +59,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -81,7 +81,7 @@ protected:
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 889c9d81b801..be8a81ad17bb 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "LineChartTypeTemplate.hxx"
+#include "LineChartType.hxx"
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <DataSeriesHelper.hxx>
@@ -285,27 +286,20 @@ bool LineChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
-
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult = new LineChartType();
+
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -315,30 +309,23 @@ Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal
return xResult;
}
-Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx
index 878c53807793..976c878328a3 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.hxx
@@ -60,8 +60,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -69,7 +70,7 @@ protected:
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index c2b5501030ba..4cfffb66b838 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -18,6 +18,8 @@
*/
#include "NetChartTypeTemplate.hxx"
+#include "FilledNetChartType.hxx"
+#include "NetChartType.hxx"
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
#include <DataSeriesHelper.hxx>
@@ -160,34 +162,18 @@ bool NetChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
-
- try
- {
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
-
- if( m_bHasFilledArea )
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW );
- else
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW );
- }
- catch( const uno::Exception & )
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- return xResult;
+ if( m_bHasFilledArea )
+ return new FilledNetChartType();
+ else
+ return new NetChartType();
}
-Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) );
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
return xResult;
}
diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx
index a9dd49eab6e1..7643cd7d5efe 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.hxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.hxx
@@ -42,8 +42,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -51,7 +52,7 @@ protected:
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index fcda6c10f218..49f92d14dfc3 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "PieChartTypeTemplate.hxx"
+#include "PieChartType.hxx"
#include <CommonConverters.hxx>
#include <ChartType.hxx>
#include <DiagramHelper.hxx>
@@ -405,23 +406,15 @@ bool PieChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
-
+ xResult = new PieChartType();
+ xResult->setPropertyValue(
+ "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
}
catch( const uno::Exception & )
{
@@ -431,25 +424,17 @@ Reference< chart2::XChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_
return xResult;
}
-Reference< chart2::XChartType > PieChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
+ xResult = new PieChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
-
+ xResult->setPropertyValue(
+ "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx
index c8698e1c23d9..62d28c293a45 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.hxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.hxx
@@ -60,9 +60,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
::sal_Int32 nChartTypeGroupIndex,
@@ -97,7 +97,7 @@ protected:
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
};
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index 8ee9a0a2254a..533908daf0e1 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -18,6 +18,7 @@
*/
#include "ScatterChartTypeTemplate.hxx"
+#include "ScatterChartType.hxx"
#include "XYDataInterpreter.hxx"
#include <ChartType.hxx>
#include <DiagramHelper.hxx>
@@ -314,27 +315,20 @@ bool ScatterChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
+rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForIndex( sal_Int32 /*nChartTypeIndex*/ )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ), uno::UNO_QUERY_THROW );
-
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult = new ScatterChartType();
+
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
@@ -344,30 +338,23 @@ Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex(
return xResult;
}
-Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ), uno::UNO_QUERY_THROW );
+ xResult = new ScatterChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
- Reference< beans::XPropertySet > xCTProp( xResult, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
- xCTProp->setPropertyValue(
- CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
- }
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ xResult->setPropertyValue(
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
index c693c8700f0b..5d5f8189af9e 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx
@@ -59,9 +59,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual css::uno::Reference< css::chart2::XDataInterpreter > getDataInterpreter() override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
@@ -70,7 +70,7 @@ protected:
::sal_Int32 nSeriesCount ) override;
// ____ ChartTypeTemplate ____
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
virtual sal_Int32 getDimension() const override;
virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const override;
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index b476c53fc18a..58db1062100c 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -18,6 +18,9 @@
*/
#include "StockChartTypeTemplate.hxx"
+#include "ColumnChartType.hxx"
+#include "CandleStickChartType.hxx"
+#include "LineChartType.hxx"
#include <DataSeriesHelper.hxx>
#include "StockDataInterpreter.hxx"
#include <DiagramHelper.hxx>
@@ -249,31 +252,26 @@ void StockChartTypeTemplate::resetStyles(
DiagramHelper::setVertical( xDiagram, false );
}
-Reference< XChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
+rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_Int32 nChartTypeIndex )
{
- Reference< XChartType > xCT;
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY );
- if(xFact.is())
+ rtl::Reference< ChartType > xCT;
+ bool bHasVolume = false;
+ getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
+ if( bHasVolume )
{
- bool bHasVolume = false;
- getFastPropertyValue( PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME ) >>= bHasVolume;
- if( bHasVolume )
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY );
- else if( nChartTypeIndex == 1 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
+ if( nChartTypeIndex == 0 )
+ xCT = new ColumnChartType();
+ else if( nChartTypeIndex == 1 )
+ xCT = new CandleStickChartType();
else
- {
- if( nChartTypeIndex == 0 )
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY );
- else
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY );
- }
+ xCT = new LineChartType();
+ }
+ else
+ {
+ if( nChartTypeIndex == 0 )
+ xCT = new CandleStickChartType();
+ else
+ xCT = new LineChartType();
}
return xCT;
}
@@ -439,17 +437,14 @@ bool StockChartTypeTemplate::matchesTemplate(
return bResult;
}
-Reference< XChartType > StockChartTypeTemplate::getChartTypeForNewSeries(
- const uno::Sequence< Reference< chart2::XChartType > >& aFormerlyUsedChartTypes )
+rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForNewSeries(
+ const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes )
{
- Reference< chart2::XChartType > xResult;
+ rtl::Reference< ChartType > xResult;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
- xResult.set( xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xResult = new LineChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult );
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx
index e92e07b54d83..f0a6d73b0883 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.hxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.hxx
@@ -73,10 +73,9 @@ protected:
virtual bool matchesTemplate(
const css::uno::Reference< css::chart2::XDiagram >& xDiagram,
bool bAdaptProperties ) override;
- virtual css::uno::Reference< css::chart2::XChartType >
- getChartTypeForNewSeries( const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override;
+ virtual rtl::Reference< ::chart::ChartType >
+ getChartTypeForNewSeries( const std::vector<
+ rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override;
virtual css::uno::Reference< css::chart2::XDataInterpreter > getDataInterpreter() override;
virtual void applyStyle(
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
@@ -101,7 +100,7 @@ protected:
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
- virtual css::uno::Reference< css::chart2::XChartType >
+ virtual rtl::Reference< ::chart::ChartType >
getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override;
private: