summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-23 17:54:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-23 20:21:21 +0100
commitd5e1fee5af79b462cb0dd9b18ebc0604b6d3ea9c (patch)
tree605ecda2cb2a892033d7c7af65f88d0c16325a18
parentea6cbf9e42c772e0cb8814142dc8a0eeae14e2fa (diff)
use more concrete types in chart2, BaseCoordinateSystem
Change-Id: I780b391ffbff7cb79201eb2895702a7a9a07f89d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128829 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/inc/BaseCoordinateSystem.hxx3
-rw-r--r--chart2/source/inc/ChartTypeTemplate.hxx17
-rw-r--r--chart2/source/model/main/BaseCoordinateSystem.cxx10
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx76
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx24
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.hxx6
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx31
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.hxx10
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx42
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.hxx6
10 files changed, 79 insertions, 146 deletions
diff --git a/chart2/source/inc/BaseCoordinateSystem.hxx b/chart2/source/inc/BaseCoordinateSystem.hxx
index 922d4047b02e..2241c8490b83 100644
--- a/chart2/source/inc/BaseCoordinateSystem.hxx
+++ b/chart2/source/inc/BaseCoordinateSystem.hxx
@@ -88,7 +88,7 @@ public:
const css::uno::Reference< css::chart2::XChartType >& aChartType ) override;
virtual css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > SAL_CALL getChartTypes() override;
virtual void SAL_CALL setChartTypes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aChartTypes ) override;
+ const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aChartTypes ) final override;
// ____ XModifyBroadcaster ____
virtual void SAL_CALL addModifyListener(
@@ -96,6 +96,7 @@ public:
virtual void SAL_CALL removeModifyListener(
const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
+ void setChartTypes( const std::vector< rtl::Reference< ::chart::ChartType > >& aChartTypes );
const std::vector< rtl::Reference<::chart::ChartType > > & getChartTypes2() const { return m_aChartTypes; }
protected:
diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx
index e4484981895a..ce78429f0135 100644
--- a/chart2/source/inc/ChartTypeTemplate.hxx
+++ b/chart2/source/inc/ChartTypeTemplate.hxx
@@ -116,7 +116,7 @@ public:
/// @throws css::uno::RuntimeException
void applyStyles(
- const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
+ const rtl::Reference< ::chart::Diagram >& xDiagram );
// ____ XServiceName ____
virtual OUString SAL_CALL getServiceName() override;
@@ -167,7 +167,7 @@ public:
<p>Called by FillDiagram.</p>
*/
virtual void adaptScales(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories );
/** create a data series tree, that fits the requirements of the chart type.
@@ -200,9 +200,9 @@ public:
css::uno::Sequence<
css::uno::Reference<
css::chart2::XDataSeries > > > & aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
);
@@ -215,8 +215,6 @@ public:
requesting a secondary axes a secondary y axes is added</p>
*/
void createAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys );
- void createAxes(
const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
/** Give the number of requested axis per dimension here. Default is one
@@ -227,7 +225,7 @@ public:
/** adapt properties of existing axes and remove superfluous axes
*/
virtual void adaptAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys );
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys );
const css::uno::Reference< css::uno::XComponentContext >&
GetComponentContext() const { return m_xContext;}
@@ -249,8 +247,7 @@ private:
private:
/** modifies the given diagram
*/
- void FillDiagram( const css::uno::Reference<
- css::chart2::XDiagram > & xDiagram,
+ void FillDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram,
const css::uno::Sequence<
css::uno::Sequence<
css::uno::Reference<
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 6717c3005047..bc02bf753561 100644
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -294,6 +294,16 @@ void SAL_CALL BaseCoordinateSystem::setChartTypes( const Sequence< Reference< ch
fireModifyEvent();
}
+void BaseCoordinateSystem::setChartTypes( const std::vector< rtl::Reference< ChartType > >& aChartTypes )
+{
+ for (auto const & aChartType : m_aChartTypes)
+ aChartType->removeModifyListener( m_xModifyEventForwarder );
+ m_aChartTypes = aChartTypes;
+ for (auto const & aChartType : m_aChartTypes)
+ aChartType->addModifyListener( m_xModifyEventForwarder );
+ fireModifyEvent();
+}
+
// ____ XModifyBroadcaster ____
void SAL_CALL BaseCoordinateSystem::addModifyListener( const Reference< util::XModifyListener >& aListener )
{
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index c1d91453016b..af0a48ab6511 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -396,7 +396,7 @@ void ChartTypeTemplate::applyStyle(
}
}
-void ChartTypeTemplate::applyStyles( const Reference< chart2::XDiagram >& xDiagram )
+void ChartTypeTemplate::applyStyles( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
// apply chart-type specific styles, like "symbols on" for example
Sequence< Sequence< Reference< XDataSeries > > > aNewSeriesSeq(
@@ -554,18 +554,15 @@ void ChartTypeTemplate::createCoordinateSystems(
}
void ChartTypeTemplate::adaptScales(
- const Sequence< Reference< chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq,
const Reference< data::XLabeledDataSequence > & xCategories //@todo: in future there may be more than one sequence of categories (e.g. charttype with categories at x and y axis )
)
{
bool bSupportsCategories( supportsCategories() );
- for( Reference< XCoordinateSystem > const & xCooSys : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : aCooSysSeq )
{
try
{
- if( !xCooSys.is() )
- continue;
-
// attach categories to first axis
sal_Int32 nDim( xCooSys->getDimension());
if( nDim > 0 )
@@ -634,39 +631,6 @@ void ChartTypeTemplate::adaptScales(
void ChartTypeTemplate::adaptDiagram( const Reference< XDiagram > & /* xDiagram */ )
{
- }
-
-void ChartTypeTemplate::createAxes(
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
-{
- //create missing axes
- if( !rCoordSys.hasElements() )
- return;
-
- Reference< XCoordinateSystem > xCooSys( rCoordSys[0] );
- if(!xCooSys.is())
- return;
-
- //create main axis in first coordinate system
- sal_Int32 nDimCount = xCooSys->getDimension();
- sal_Int32 nDim=0;
- for( nDim=0; nDim<nDimCount; ++nDim )
- {
- sal_Int32 nAxisCount = getAxisCountByDimension( nDim );
- if( nDim == 1 &&
- nAxisCount < 2 && AxisHelper::isSecondaryYAxisNeeded( xCooSys ))
- nAxisCount = 2;
- for( sal_Int32 nAxisIndex = 0; nAxisIndex < nAxisCount; ++nAxisIndex )
- {
- Reference< XAxis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys );
- if( !xAxis.is())
- {
- // create and add axis
- xAxis.set( AxisHelper::createAxis(
- nDim, nAxisIndex, xCooSys, GetComponentContext() ));
- }
- }
- }
}
void ChartTypeTemplate::createAxes(
@@ -703,14 +667,14 @@ void ChartTypeTemplate::createAxes(
}
void ChartTypeTemplate::adaptAxes(
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys )
{
//adapt properties of existing axes and remove superfluous axes
- if( !rCoordSys.hasElements() )
+ if( rCoordSys.empty() )
return;
- for( Reference< XCoordinateSystem > const & xCooSys : rCoordSys )
+ for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : rCoordSys )
{
if( !xCooSys.is() )
continue;
@@ -750,7 +714,7 @@ sal_Int32 ChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
}
void ChartTypeTemplate::FillDiagram(
- const Reference< XDiagram >& xDiagram,
+ const rtl::Reference< ::chart::Diagram >& xDiagram,
const Sequence< Sequence< Reference< XDataSeries > > >& aSeriesSeq,
const Reference< data::XLabeledDataSequence >& xCategories,
const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
@@ -760,9 +724,8 @@ void ChartTypeTemplate::FillDiagram(
try
{
// create coordinate systems and scales
- Reference< XCoordinateSystemContainer > xCoordSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- createCoordinateSystems( xCoordSysCnt );
- Sequence< Reference< XCoordinateSystem > > aCoordinateSystems( xCoordSysCnt->getCoordinateSystems());
+ createCoordinateSystems( xDiagram );
+ std::vector< rtl::Reference< BaseCoordinateSystem > > aCoordinateSystems( xDiagram->getBaseCoordinateSystems());
createAxes( aCoordinateSystems );
adaptAxes( aCoordinateSystems );
adaptScales( aCoordinateSystems, xCategories );
@@ -779,11 +742,10 @@ void ChartTypeTemplate::FillDiagram(
void ChartTypeTemplate::createChartTypes(
const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
@@ -794,8 +756,7 @@ void ChartTypeTemplate::createChartTypes(
{
// we need a new chart type
xCT = getChartTypeForNewSeries( aOldChartTypesSeq );
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes({ xCT });
+ rCoordSys[nCooSysIdx]->setChartTypes(std::vector{ xCT });
}
else
{
@@ -805,15 +766,14 @@ void ChartTypeTemplate::createChartTypes(
{
// we need a new chart type
xCT = getChartTypeForNewSeries( aOldChartTypesSeq );
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes());
- if( aCTSeq.hasElements())
+ std::vector< rtl::Reference< ChartType > > aCTSeq( rCoordSys[nCooSysIdx]->getChartTypes2());
+ if( !aCTSeq.empty())
{
- aCTSeq.getArray()[0] = xCT;
- xCTCnt->setChartTypes( aCTSeq );
+ aCTSeq[0] = xCT;
+ rCoordSys[nCooSysIdx]->setChartTypes( aCTSeq );
}
else
- xCTCnt->addChartType( xCT );
+ rCoordSys[nCooSysIdx]->addChartType( xCT );
xCT->setDataSeries( aSeriesSeq[nSeriesIdx] );
}
@@ -831,7 +791,7 @@ void ChartTypeTemplate::createChartTypes(
}
// spread the series over the available coordinate systems
- if( rCoordSys.getLength() > (nCooSysIdx + 1) )
+ if( static_cast<sal_Int32>(rCoordSys.size()) > (nCooSysIdx + 1) )
++nCooSysIdx;
}
}
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 26ba46b7afa9..03a5f07f0fbe 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -164,17 +164,14 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnLineChartTypeTemplate::
void ColumnLineChartTypeTemplate::createChartTypes(
const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > >& aOldChartTypesSeq )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
const Sequence< Reference< XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
sal_Int32 nNumberOfSeries = aFlatSeriesSeq.getLength();
sal_Int32 nNumberOfLines = 0;
@@ -200,38 +197,33 @@ void ColumnLineChartTypeTemplate::createChartTypes(
// Columns
- Reference< XChartType > xCT(
- xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new ColumnChartType();
ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aOldChartTypesSeq, xCT );
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
+ rCoordSys[ 0 ]->setChartTypes( std::vector{xCT} );
if( nNumberOfColumns > 0 )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns );
std::copy( aFlatSeriesSeq.begin(),
aFlatSeriesSeq.begin() + nNumberOfColumns,
aColumnSeq.getArray());
- xDSCnt->setDataSeries( aColumnSeq );
+ xCT->setDataSeries( aColumnSeq );
}
// Lines
- xCT.set( xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
- xCTCnt.set( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->addChartType( xCT );
+ xCT = new LineChartType();
+ rCoordSys[ 0 ]->addChartType( xCT );
if( nNumberOfLines > 0 )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
std::copy( aFlatSeriesSeq.begin() + nNumberOfColumns,
aFlatSeriesSeq.end(),
aLineSeq.getArray());
- xDSCnt->setDataSeries( aLineSeq );
+ xCT->setDataSeries( aLineSeq );
}
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
index a8854a779d9d..167c63cc11fe 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx
@@ -75,9 +75,9 @@ protected:
css::uno::Sequence<
css::uno::Reference<
css::chart2::XDataSeries > > > & aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 5d8eef9da195..f2ff4ec5f863 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -217,14 +217,14 @@ sal_Int32 PieChartTypeTemplate::getAxisCountByDimension( sal_Int32 /*nDimension*
}
void PieChartTypeTemplate::adaptAxes(
- const uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > & /*rCoordSys*/ )
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & /*rCoordSys*/ )
{
// hide existing axes
//hhhh todo
}
void PieChartTypeTemplate::adaptScales(
- const Sequence< Reference< chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysSeq,
const Reference< chart2::data::XLabeledDataSequence > & xCategories //@todo: in future there may be more than one sequence of categories (e.g. charttype with categories at x and y axis )
)
{
@@ -233,7 +233,7 @@ void PieChartTypeTemplate::adaptScales(
//remove explicit scalings from radius axis
//and ensure correct orientation of scales for donuts
- for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+ for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
{
try
{
@@ -278,34 +278,23 @@ void PieChartTypeTemplate::adaptScales(
void PieChartTypeTemplate::createChartTypes(
const Sequence< Sequence< Reference< chart2::XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > >& /* aOldChartTypesSeq */ )
{
- if( ! rCoordSys.hasElements() ||
- ! rCoordSys[0].is() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
-
- Reference< chart2::XChartType > xCT(
- xFact->createInstance( CHART2_SERVICE_NAME_CHARTTYPE_PIE ), uno::UNO_QUERY_THROW );
- Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue(
- "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
- }
- Reference< chart2::XChartTypeContainer > xCTCnt( rCoordSys[0], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 ));
+ rtl::Reference< ChartType > xCT = new PieChartType();
+ xCT->setPropertyValue(
+ "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ));
+ rCoordSys[0]->setChartTypes( std::vector{xCT} );
if( aSeriesSeq.hasElements() )
{
- Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
Sequence< Reference< chart2::XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq ));
- xDSCnt->setDataSeries( aFlatSeriesSeq );
+ xCT->setDataSeries( aFlatSeriesSeq );
DataSeriesHelper::setStackModeAtSeries(
aFlatSeriesSeq, rCoordSys[0], getStackMode( 0 ));
diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx
index 022acfaed2e9..ea2aeff07cc7 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.hxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.hxx
@@ -80,10 +80,10 @@ protected:
virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension ) override;
virtual void adaptAxes(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & rCoordSys ) override;
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys ) override;
virtual void adaptScales(
- const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > & aCooSysSeq,
+ const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq,
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories ) override;
virtual void createChartTypes(
@@ -91,9 +91,9 @@ protected:
css::uno::Sequence<
css::uno::Reference<
css::chart2::XDataSeries > > >& aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 2daad8200977..f55ee2b038e2 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -278,16 +278,14 @@ rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForIndex( sal_In
void StockChartTypeTemplate::createChartTypes(
const Sequence< Sequence< Reference< XDataSeries > > > & aSeriesSeq,
- const Sequence< Reference< XCoordinateSystem > > & rCoordSys,
+ const std::vector< rtl::Reference< BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > >& /* aOldChartTypesSeq */ )
{
- if( !rCoordSys.hasElements() )
+ if( rCoordSys.empty() )
return;
try
{
- Reference< lang::XMultiServiceFactory > xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW );
bool bHasVolume = false;
bool bShowFirst = false;
bool bJapaneseStyle = false;
@@ -300,43 +298,33 @@ void StockChartTypeTemplate::createChartTypes(
sal_Int32 nSeriesIndex = 0;
- std::vector< Reference< chart2::XChartType > > aChartTypeVec;
+ std::vector< rtl::Reference< ChartType > > aChartTypeVec;
// Bars (Volume)
if( bHasVolume )
{
// chart type
- Reference< XChartType > xCT(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new ColumnChartType();
aChartTypeVec.push_back( xCT );
if( aSeriesSeq.getLength() > nSeriesIndex &&
aSeriesSeq[nSeriesIndex].hasElements() )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
++nSeriesIndex;
}
- Reference< XChartType > xCT(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ), uno::UNO_QUERY_THROW );
+ rtl::Reference< ChartType > xCT = new CandleStickChartType();
aChartTypeVec.push_back( xCT );
- Reference< beans::XPropertySet > xCTProp( xCT, uno::UNO_QUERY );
- if( xCTProp.is())
- {
- xCTProp->setPropertyValue( "Japanese", uno::Any( bJapaneseStyle ));
- xCTProp->setPropertyValue( "ShowFirst", uno::Any( bShowFirst ));
- xCTProp->setPropertyValue( "ShowHighLow", uno::Any( bShowHighLow ));
- }
+ xCT->setPropertyValue( "Japanese", uno::Any( bJapaneseStyle ));
+ xCT->setPropertyValue( "ShowFirst", uno::Any( bShowFirst ));
+ xCT->setPropertyValue( "ShowHighLow", uno::Any( bShowHighLow ));
if( aSeriesSeq.getLength() > nSeriesIndex &&
aSeriesSeq[ nSeriesIndex ].hasElements() )
{
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
++nSeriesIndex;
@@ -344,17 +332,13 @@ void StockChartTypeTemplate::createChartTypes(
if( aSeriesSeq.getLength() > nSeriesIndex &&
aSeriesSeq[ nSeriesIndex ].hasElements() )
{
- xCT.set(
- xFact->createInstance(
- CHART2_SERVICE_NAME_CHARTTYPE_LINE ), uno::UNO_QUERY_THROW );
+ xCT = new LineChartType();
aChartTypeVec.push_back( xCT );
- Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW );
- xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
+ xCT->setDataSeries( aSeriesSeq[ nSeriesIndex ] );
}
- Reference< XChartTypeContainer > xCTCnt( rCoordSys[ 0 ], uno::UNO_QUERY_THROW );
- xCTCnt->setChartTypes( comphelper::containerToSequence(aChartTypeVec) );
+ rCoordSys[ 0 ]->setChartTypes( aChartTypeVec );
}
catch( const uno::Exception & )
{
diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx
index fe7ba2272680..f09c89208df4 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.hxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.hxx
@@ -94,9 +94,9 @@ protected:
css::uno::Sequence<
css::uno::Reference<
css::chart2::XDataSeries > > >& aSeriesSeq,
- const css::uno::Sequence<
- css::uno::Reference<
- css::chart2::XCoordinateSystem > > & rCoordSys,
+ const std::vector<
+ rtl::Reference<
+ ::chart::BaseCoordinateSystem > > & rCoordSys,
const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq
) override;