summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-30 20:59:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-31 10:39:29 +0100
commit47bbacb2b170c156fa0be751bc5213d412db8cff (patch)
tree26c84c1bc35c300fca32b270c408a5caa9b85854 /chart2/source/model
parent4537886ec1de8beed02c7aea34a50727bc058bbd (diff)
use more concrete types in chart2, DataSeries
Change-Id: Ib07ed6ec3321dc617cfec872d16683cf5de60907 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129181 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model')
-rw-r--r--chart2/source/model/main/DataSeries.cxx21
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx11
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx17
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx16
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.hxx2
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx7
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.cxx2
-rw-r--r--chart2/source/model/template/ColumnLineDataInterpreter.hxx9
-rw-r--r--chart2/source/model/template/DataInterpreter.cxx70
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx10
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx10
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx30
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx10
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx9
-rw-r--r--chart2/source/model/template/StockDataInterpreter.cxx15
-rw-r--r--chart2/source/model/template/StockDataInterpreter.hxx2
-rw-r--r--chart2/source/model/template/XYDataInterpreter.cxx16
-rw-r--r--chart2/source/model/template/XYDataInterpreter.hxx2
18 files changed, 165 insertions, 94 deletions
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 509fa3423f71..4407367e9fab 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -405,6 +405,27 @@ void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data:
fireModifyEvent();
}
+void DataSeries::setData( const std::vector< Reference< chart2::data::XLabeledDataSequence > >& aData )
+{
+ tDataSequenceContainer aOldDataSequences;
+ tDataSequenceContainer aNewDataSequences;
+ Reference< util::XModifyListener > xModifyEventForwarder;
+ Reference< lang::XEventListener > xListener;
+ {
+ MutexGuard aGuard( m_aMutex );
+ xModifyEventForwarder = m_xModifyEventForwarder;
+ xListener = this;
+ std::swap( aOldDataSequences, m_aDataSequences );
+ aNewDataSequences = aData;
+ m_aDataSequences = aNewDataSequences;
+ }
+ ModifyListenerHelper::removeListenerFromAllElements( aOldDataSequences, xModifyEventForwarder );
+ EventListenerHelper::removeListenerFromAllElements( aOldDataSequences, xListener );
+ EventListenerHelper::addListenerToAllElements( aNewDataSequences, xListener );
+ ModifyListenerHelper::addListenerToAllElements( aNewDataSequences, xModifyEventForwarder );
+ fireModifyEvent();
+}
+
// ____ XDataSource ____
Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL DataSeries::getDataSequences()
{
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 5b6ef6c4d0d2..1812671f962b 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -22,6 +22,7 @@
#include <servicenames_charttypes.hxx>
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -191,18 +192,14 @@ void AreaChartTypeTemplate::applyStyle(
void AreaChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& xDiagram )
{
ChartTypeTemplate::resetStyles( xDiagram );
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xState.is() &&
- xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- xState->setPropertyToDefault( "BorderStyle");
+ series->setPropertyToDefault( "BorderStyle");
}
}
}
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index 4a46b502a2d0..5e9ccd0c84d1 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -22,6 +22,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -265,22 +266,16 @@ void BarChartTypeTemplate::resetStyles(
const rtl::Reference< ::chart::Diagram >& xDiagram )
{
ChartTypeTemplate::resetStyles( xDiagram );
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- if( xState.is())
+ if( getDimension() == 3 )
+ series->setPropertyToDefault( "Geometry3D");
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- if( getDimension() == 3 )
- xState->setPropertyToDefault( "Geometry3D");
- Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
- if( xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
- {
- xState->setPropertyToDefault( "BorderStyle");
- }
+ series->setPropertyToDefault( "BorderStyle");
}
}
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
index 863126fa48ce..b0196bdd050e 100644
--- a/chart2/source/model/template/BubbleDataInterpreter.cxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -47,7 +47,7 @@ BubbleDataInterpreter::~BubbleDataInterpreter()
chart2::InterpretedData BubbleDataInterpreter::interpretDataSource(
const Reference< chart2::data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
@@ -135,15 +135,13 @@ chart2::InterpretedData BubbleDataInterpreter::interpretDataSource(
aNewData.push_back( aYValuesVector[nN] );
aNewData.push_back(aSizeValuesVector[nN]);
- Reference< XDataSeries > xSeries;
- if( nSeriesIndex < aSeriesToReUse.getLength())
- xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < static_cast<sal_Int32>(aSeriesToReUse.size()))
+ xSeries = aSeriesToReUse[nSeriesIndex];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- OSL_ASSERT( xSink.is() );
- xSink->setData( comphelper::containerToSequence( aNewData ) );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
aSeriesVec.push_back( xSeries );
}
diff --git a/chart2/source/model/template/BubbleDataInterpreter.hxx b/chart2/source/model/template/BubbleDataInterpreter.hxx
index 7c33251790db..f4bb71f8beb4 100644
--- a/chart2/source/model/template/BubbleDataInterpreter.hxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.hxx
@@ -34,7 +34,7 @@ protected:
virtual css::chart2::InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
virtual css::chart2::InterpretedData reinterpretDataSeries(
const css::chart2::InterpretedData& aInterpretedData ) override;
virtual bool isDataCompatible(
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 79aab231d265..f3c84f853385 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -22,6 +22,7 @@
#include <CommonConverters.hxx>
#include <ChartTypeHelper.hxx>
#include <ChartType.hxx>
+#include <DataSeries.hxx>
#include <AxisHelper.hxx>
#include <Diagram.hxx>
@@ -253,9 +254,9 @@ void ChartTypeTemplate::changeDiagramData(
try
{
// interpret new data and re-use existing series
- Sequence< Reference< XDataSeries > > aFlatSeriesSeq(
- comphelper::containerToSequence( DiagramHelper::getDataSeriesFromDiagram( xDiagram )));
- const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.getLength();
+ std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
+ const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size();
rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter());
chart2::InterpretedData aData =
xInterpreter->interpretDataSource( xDataSource, aArguments, aFlatSeriesSeq );
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.cxx b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
index 8f34411ccb72..c548b8c8eacb 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.cxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.cxx
@@ -45,7 +45,7 @@ ColumnLineDataInterpreter::~ColumnLineDataInterpreter()
InterpretedData ColumnLineDataInterpreter::interpretDataSource(
const Reference< data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
InterpretedData aResult( DataInterpreter::interpretDataSource( xSource, aArguments, aSeriesToReUse ));
diff --git a/chart2/source/model/template/ColumnLineDataInterpreter.hxx b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
index f7f4d0f36dec..d6318367bc00 100644
--- a/chart2/source/model/template/ColumnLineDataInterpreter.hxx
+++ b/chart2/source/model/template/ColumnLineDataInterpreter.hxx
@@ -30,11 +30,10 @@ public:
protected:
// ____ DataInterpreter ____
- virtual css::chart2::InterpretedData
- interpretDataSource(const css::uno::Reference<css::chart2::data::XDataSource>& xSource,
- const css::uno::Sequence<css::beans::PropertyValue>& aArguments,
- const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries>>&
- aSeriesToReUse) override;
+ virtual css::chart2::InterpretedData interpretDataSource(
+ const css::uno::Reference<css::chart2::data::XDataSource>& xSource,
+ const css::uno::Sequence<css::beans::PropertyValue>& aArguments,
+ const std::vector<rtl::Reference<::chart::DataSeries>>& aSeriesToReUse) override;
private:
sal_Int32 m_nNumberOfLines;
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index 2e0981b191ad..a206a448871e 100644
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -126,6 +126,76 @@ InterpretedData DataInterpreter::interpretDataSource(
return InterpretedData( { comphelper::containerToSequence( aSeriesVec ) }, xCategories );
}
+InterpretedData DataInterpreter::interpretDataSource(
+ const Reference< data::XDataSource >& xSource,
+ const Sequence< beans::PropertyValue >& aArguments,
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
+{
+ if( ! xSource.is())
+ return InterpretedData();
+
+#ifdef DEBUG_CHART2_TEMPLATE
+ lcl_ShowDataSource( xSource );
+#endif
+
+ const Sequence< Reference< data::XLabeledDataSequence > > aData( xSource->getDataSequences() );
+
+ Reference< data::XLabeledDataSequence > xCategories;
+ vector< Reference< data::XLabeledDataSequence > > aSequencesVec;
+
+ // check if we should use categories
+
+ bool bHasCategories( HasCategories( aArguments, aData ));
+
+ // parse data
+ bool bCategoriesUsed = false;
+ for( Reference< data::XLabeledDataSequence > const & labeledData : aData )
+ {
+ try
+ {
+ if( bHasCategories && ! bCategoriesUsed )
+ {
+ xCategories.set( labeledData );
+ if( xCategories.is())
+ SetRole( xCategories->getValues(), "categories");
+ bCategoriesUsed = true;
+ }
+ else
+ {
+ aSequencesVec.push_back( labeledData );
+ if( labeledData.is())
+ SetRole( labeledData->getValues(), "values-y");
+ }
+ }
+ catch( const uno::Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+
+ // create DataSeries
+ sal_Int32 nSeriesIndex = 0;
+ vector< Reference< XDataSeries > > aSeriesVec;
+ aSeriesVec.reserve( aSequencesVec.size());
+
+ for (auto const& elem : aSequencesVec)
+ {
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( &elem, 1 );
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < static_cast<sal_Int32>(aSeriesToReUse.size()))
+ xSeries = aSeriesToReUse[nSeriesIndex];
+ else
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
+
+ aSeriesVec.push_back( xSeries );
+ ++nSeriesIndex;
+ }
+
+ return InterpretedData( { comphelper::containerToSequence( aSeriesVec ) }, xCategories );
+}
+
InterpretedData DataInterpreter::reinterpretDataSeries(
const InterpretedData& aInterpretedData )
{
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 9629ab9e471b..25d5226664f2 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -22,6 +22,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <ChartType.hxx>
@@ -215,8 +216,8 @@ bool LineChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
for (auto const& series : aSeriesVec)
{
@@ -224,9 +225,8 @@ bool LineChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -238,7 +238,7 @@ bool LineChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index 222456629783..49d4e7d8d5bc 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -23,6 +23,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <ChartType.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -108,8 +109,8 @@ bool NetChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
for (auto const& series : aSeriesVec)
{
@@ -117,9 +118,8 @@ bool NetChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -131,7 +131,7 @@ bool NetChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index d89230a7f90e..9b7ef05323fc 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -25,6 +25,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <AxisHelper.hxx>
#include <ThreeDHelper.hxx>
@@ -327,8 +328,8 @@ bool PieChartTypeTemplate::matchesTemplate(
bool bAllOffsetsEqual = true;
sal_Int32 nOuterSeriesIndex = 0;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
//tdf#108067 The outer series is the last series in OOXML-heavy environments
if( !officecfg::Office::Compatibility::View::ReverseXAxisOrientationDoughnutChart::get() )
@@ -338,13 +339,12 @@ bool PieChartTypeTemplate::matchesTemplate(
if( !aSeriesVec.empty() )
{
//@todo in future this will depend on Orientation of the radius axis scale
- Reference< chart2::XDataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] );
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
- xProp->getPropertyValue( "Offset") >>= fOffset;
+ rtl::Reference< DataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] );
+ xSeries->getPropertyValue( "Offset") >>= fOffset;
//get AttributedDataPoints
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
{
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
{
@@ -352,7 +352,7 @@ bool PieChartTypeTemplate::matchesTemplate(
if(xPointProp.is())
{
double fPointOffset=0.0;
- if( xProp->getPropertyValue( "Offset") >>= fPointOffset )
+ if( xSeries->getPropertyValue( "Offset") >>= fPointOffset )
{
if( ! ::rtl::math::approxEqual( fPointOffset, fOffset ) )
{
@@ -571,21 +571,15 @@ void PieChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >
// vary colors by point,
// line style
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
- if( xState.is())
+ series->setPropertyToDefault( "VaryColorsByPoint");
+ if( series->getPropertyValue( "BorderStyle") == aLineStyleAny )
{
- xState->setPropertyToDefault( "VaryColorsByPoint");
- Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
- if( xProp.is() &&
- xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
- {
- xState->setPropertyToDefault( "BorderStyle");
- }
+ series->setPropertyToDefault( "BorderStyle");
}
}
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index b6ebf646e7e4..d77e99e8615a 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -24,6 +24,7 @@
#include <Diagram.hxx>
#include <DiagramHelper.hxx>
#include <servicenames_charttypes.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include <PropertyHelper.hxx>
#include <unonames.hxx>
@@ -244,8 +245,8 @@ bool ScatterChartTypeTemplate::matchesTemplate(
bool bSymbolFound = false;
bool bLineFound = false;
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
for (auto const& series : aSeriesVec)
{
@@ -253,9 +254,8 @@ bool ScatterChartTypeTemplate::matchesTemplate(
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
- bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
+ bool bCurrentHasSymbol = (series->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
if( bCurrentHasSymbol )
@@ -267,7 +267,7 @@ bool ScatterChartTypeTemplate::matchesTemplate(
break;
}
- bool bCurrentHasLine = (xProp->getPropertyValue( "LineStyle") >>= eLineStyle) &&
+ bool bCurrentHasLine = (series->getPropertyValue( "LineStyle") >>= eLineStyle) &&
( eLineStyle != drawing::LineStyle_NONE );
if( bCurrentHasLine )
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index c437270bc678..9a3fce7ca9c2 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -21,6 +21,7 @@
#include "ColumnChartType.hxx"
#include "CandleStickChartType.hxx"
#include "LineChartType.hxx"
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
#include "StockDataInterpreter.hxx"
#include <DiagramHelper.hxx>
@@ -239,13 +240,11 @@ void StockChartTypeTemplate::resetStyles(
ChartTypeTemplate::resetStyles( xDiagram );
if( getDimension() == 3 )
{
- std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ std::vector< rtl::Reference< DataSeries > > aSeriesVec =
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram );
for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
- if( xProp.is() )
- xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) );
+ series->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) );
}
}
diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx
index 3e82715dd3eb..9860f91927d6 100644
--- a/chart2/source/model/template/StockDataInterpreter.cxx
+++ b/chart2/source/model/template/StockDataInterpreter.cxx
@@ -46,7 +46,7 @@ StockDataInterpreter::~StockDataInterpreter()
InterpretedData StockDataInterpreter::interpretDataSource(
const Reference< data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& rArguments,
- const Sequence< Reference< XDataSeries > >& rSeriesToReUse )
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& rSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
@@ -233,14 +233,13 @@ InterpretedData StockDataInterpreter::interpretDataSource(
{
try
{
- Reference< XDataSeries > xSeries;
- if( nReUsedSeriesIdx < rSeriesToReUse.getLength())
- xSeries.set( rSeriesToReUse[nReUsedSeriesIdx] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nReUsedSeriesIdx < static_cast<sal_Int32>(rSeriesToReUse.size()))
+ xSeries = rSeriesToReUse[nReUsedSeriesIdx];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY_THROW );
- xSink->setData( aSequences[nGroupIndex][nSeriesIdx] );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aSequences[nGroupIndex][nSeriesIdx] );
pResultSerie[nSeriesIdx].set( xSeries );
}
catch( const uno::Exception & )
diff --git a/chart2/source/model/template/StockDataInterpreter.hxx b/chart2/source/model/template/StockDataInterpreter.hxx
index f5a9678f53f8..805c7f8c34b2 100644
--- a/chart2/source/model/template/StockDataInterpreter.hxx
+++ b/chart2/source/model/template/StockDataInterpreter.hxx
@@ -37,7 +37,7 @@ protected:
virtual css::chart2::InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
virtual bool isDataCompatible(
const css::chart2::InterpretedData& aInterpretedData ) override;
virtual css::chart2::InterpretedData reinterpretDataSeries(
diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx
index 82f5a547a68b..962ea1008d44 100644
--- a/chart2/source/model/template/XYDataInterpreter.cxx
+++ b/chart2/source/model/template/XYDataInterpreter.cxx
@@ -48,7 +48,7 @@ XYDataInterpreter::~XYDataInterpreter()
chart2::InterpretedData XYDataInterpreter::interpretDataSource(
const Reference< chart2::data::XDataSource >& xSource,
const Sequence< beans::PropertyValue >& aArguments,
- const Sequence< Reference< XDataSeries > >& aSeriesToReUse )
+ const std::vector< rtl::Reference< DataSeries > >& aSeriesToReUse )
{
if( ! xSource.is())
return InterpretedData();
@@ -118,15 +118,13 @@ chart2::InterpretedData XYDataInterpreter::interpretDataSource(
aNewData.push_back(elem);
- Reference< XDataSeries > xSeries;
- if( nSeriesIndex < aSeriesToReUse.getLength())
- xSeries.set( aSeriesToReUse[nSeriesIndex] );
+ rtl::Reference< DataSeries > xSeries;
+ if( nSeriesIndex < static_cast<sal_Int32>(aSeriesToReUse.size()))
+ xSeries = aSeriesToReUse[nSeriesIndex];
else
- xSeries.set( new DataSeries );
- OSL_ASSERT( xSeries.is() );
- Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY );
- OSL_ASSERT( xSink.is() );
- xSink->setData( comphelper::containerToSequence( aNewData ) );
+ xSeries = new DataSeries;
+ assert( xSeries.is() );
+ xSeries->setData( aNewData );
aSeriesVec.push_back( xSeries );
++nSeriesIndex;
diff --git a/chart2/source/model/template/XYDataInterpreter.hxx b/chart2/source/model/template/XYDataInterpreter.hxx
index 1e7d93216110..f93f47dba947 100644
--- a/chart2/source/model/template/XYDataInterpreter.hxx
+++ b/chart2/source/model/template/XYDataInterpreter.hxx
@@ -34,7 +34,7 @@ protected:
virtual css::chart2::InterpretedData interpretDataSource(
const css::uno::Reference< css::chart2::data::XDataSource >& xSource,
const css::uno::Sequence< css::beans::PropertyValue >& aArguments,
- const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aSeriesToReUse ) override;
+ const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ) override;
virtual css::chart2::InterpretedData reinterpretDataSeries(
const css::chart2::InterpretedData& aInterpretedData ) override;
virtual bool isDataCompatible(