chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx |    2 
 chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx      |   27 +-
 chart2/source/controller/dialogs/DataBrowser.cxx                    |   20 --
 chart2/source/controller/dialogs/DataBrowserModel.cxx               |   92 
++++------
 chart2/source/controller/dialogs/DataBrowserModel.hxx               |    7 
 chart2/source/controller/dialogs/DialogModel.cxx                    |   19 +-
 chart2/source/controller/dialogs/DialogModel.hxx                    |    2 
 chart2/source/controller/dialogs/ObjectNameProvider.cxx             |   11 -
 chart2/source/controller/dialogs/tp_DataSource.cxx                  |   56 
++----
 chart2/source/controller/dialogs/tp_DataSource.hxx                  |    3 
 chart2/source/controller/inc/DataPointItemConverter.hxx             |    5 
 chart2/source/controller/inc/TextLabelItemConverter.hxx             |    5 
 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx  |   19 --
 chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx  |   11 -
 chart2/source/controller/main/ChartController_Insert.cxx            |   16 -
 chart2/source/controller/main/ChartController_Tools.cxx             |    2 
 chart2/source/controller/main/ChartController_Window.cxx            |    4 
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx               |   12 -
 chart2/source/inc/ExplicitCategoriesProvider.hxx                    |   10 -
 chart2/source/model/template/ChartTypeTemplate.cxx                  |   18 -
 chart2/source/model/template/ColumnLineChartTypeTemplate.cxx        |    8 
 chart2/source/tools/AxisHelper.cxx                                  |   22 --
 chart2/source/tools/DataSeriesHelper.cxx                            |   23 +-
 chart2/source/tools/DataSourceHelper.cxx                            |    9 
 chart2/source/tools/DiagramHelper.cxx                               |   77 
++++----
 chart2/source/tools/ExplicitCategoriesProvider.cxx                  |   34 ++-
 chart2/source/tools/InternalDataProvider.cxx                        |    6 
 chart2/source/tools/ObjectIdentifier.cxx                            |   30 +--
 chart2/source/view/charttypes/VSeriesPlotter.cxx                    |    2 
 29 files changed, 269 insertions(+), 283 deletions(-)

New commits:
commit b314b5a0612c9dc7279039dae44a250d4d3ec6b1
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Feb 7 18:41:30 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 8 08:52:11 2022 +0100

    use more concrete types in chart2, DataSeries
    
    Change-Id: I80bc8961832a20c29b31f7618b9d2609f15ab3c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129642
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git 
a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index c9ef38c82460..51c917751fbd 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -571,7 +571,7 @@ Reference< beans::XPropertySet > 
DataSeriesPointWrapper::getDataPointProperties(
 {
     Reference< beans::XPropertySet > xPointProp;
 
-    Reference< chart2::XDataSeries > xSeries( getDataSeries() );
+    rtl::Reference< DataSeries > xSeries( getDataSeries() );
 
     // may throw an IllegalArgumentException
     if( xSeries.is() )
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx 
b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
index e14993312dbb..8678d743957d 100644
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -28,7 +28,7 @@
 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
 #include <com/sun/star/drawing/LineJoint.hpp>
 #include <comphelper/sequence.hxx>
-
+#include <DataSeries.hxx>
 #include <LinePropertiesHelper.hxx>
 #include <UserDefinedProperties.hxx>
 #include <tools/diagnose_ex.h>
@@ -155,8 +155,6 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL 
MinMaxLineWrapper::getPropert
 
 void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& 
rPropertyName, const uno::Any& rValue )
 {
-    Reference< beans::XPropertySet > xPropSet;
-
     rtl::Reference< ::chart::Diagram > xDiagram( 
m_spChart2ModelContact->getDiagram() );
     const std::vector< rtl::Reference< ChartType > > & aTypes(
             ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
@@ -164,20 +162,19 @@ void SAL_CALL MinMaxLineWrapper::setPropertyValue( const 
OUString& rPropertyName
     {
         if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK 
)
         {
-            Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( 
xType->getDataSeries() );
-            if(aSeriesSeq.hasElements())
+            const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq( 
xType->getDataSeries2() );
+            if(!aSeriesSeq.empty())
             {
-                xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY);
-                if(xPropSet.is())
+                if(aSeriesSeq[0].is())
                 {
                     if( rPropertyName == "LineColor" )
-                        xPropSet->setPropertyValue( "Color", rValue );
+                        aSeriesSeq[0]->setPropertyValue( "Color", rValue );
                     else if( rPropertyName == "LineTransparence" )
-                        xPropSet->setPropertyValue( "Transparency", rValue );
+                        aSeriesSeq[0]->setPropertyValue( "Transparency", 
rValue );
                     else if( rPropertyName == 
m_aWrappedLineJointProperty.getOuterName() )
-                        m_aWrappedLineJointProperty.setPropertyValue( rValue, 
xPropSet );
+                        m_aWrappedLineJointProperty.setPropertyValue( rValue, 
aSeriesSeq[0] );
                     else
-                        xPropSet->setPropertyValue( rPropertyName, rValue );
+                        aSeriesSeq[0]->setPropertyValue( rPropertyName, rValue 
);
                     return;
                 }
             }
@@ -188,7 +185,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( 
const OUString& rProperty
 {
     Any aRet;
 
-    Reference< beans::XPropertySet > xPropSet;
+    rtl::Reference< DataSeries > xPropSet;
 
     rtl::Reference< ::chart::Diagram > xDiagram( 
m_spChart2ModelContact->getDiagram() );
     const std::vector< rtl::Reference< ChartType > > aTypes(
@@ -197,10 +194,10 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( 
const OUString& rProperty
     {
         if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK 
)
         {
-            Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( 
xType->getDataSeries() );
-            if(aSeriesSeq.hasElements())
+            const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq( 
xType->getDataSeries2() );
+            if(!aSeriesSeq.empty())
             {
-                xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY);
+                xPropSet = aSeriesSeq[0];
                 break;
             }
         }
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx 
b/chart2/source/controller/dialogs/DataBrowser.cxx
index ca8e5a1564a0..0e5bcb50d166 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -22,6 +22,7 @@
 #include "DataBrowser.hxx"
 #include "DataBrowserModel.hxx"
 #include <strings.hrc>
+#include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <DiagramHelper.hxx>
 #include <CommonConverters.hxx>
@@ -647,11 +648,10 @@ void DataBrowser::RenewTable()
     for (auto const& elemHeader : aHeaders)
     {
         auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, 
m_pColorsWin );
-        Reference< beans::XPropertySet > xSeriesProp( 
elemHeader.m_xDataSeries, uno::UNO_QUERY );
         Color nColor;
         // @todo: Set "DraftColor", i.e. interpolated colors for gradients, 
bitmaps, etc.
-        if( xSeriesProp.is() &&
-            ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
+        if( elemHeader.m_xDataSeries.is() &&
+            ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor 
))
             spHeader->SetColor( nColor );
         spHeader->SetChartType( elemHeader.m_xChartType, 
elemHeader.m_bSwapXAndYAxis );
         spHeader->SetSeriesName(
@@ -1275,10 +1275,9 @@ void DataBrowser::RenewSeriesHeaders()
     for (auto const& elemHeader : aHeaders)
     {
         auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, 
m_pColorsWin );
-        Reference< beans::XPropertySet > xSeriesProp(elemHeader.m_xDataSeries, 
uno::UNO_QUERY);
         Color nColor;
-        if( xSeriesProp.is() &&
-            ( xSeriesProp->getPropertyValue( "Color" ) >>= nColor ))
+        if( elemHeader.m_xDataSeries.is() &&
+            ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor 
))
             spHeader->SetColor( nColor );
         spHeader->SetChartType( elemHeader.m_xChartType, 
elemHeader.m_bSwapXAndYAxis );
         spHeader->SetSeriesName(
@@ -1363,10 +1362,9 @@ IMPL_LINK( DataBrowser, SeriesHeaderGotFocus, 
impl::SeriesHeaderEdit&, rEdit, vo
 
 IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit&, rEdit, 
void )
 {
-    Reference< chart2::XDataSeries > xSeries(
-        m_apDataBrowserModel->getDataSeriesByColumn( rEdit.getStartColumn() - 
1 ));
-    Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
-    if( !xSource.is())
+    rtl::Reference< DataSeries > xSeries =
+        m_apDataBrowserModel->getDataSeriesByColumn( rEdit.getStartColumn() - 
1 );
+    if( !xSeries.is())
         return;
 
     rtl::Reference< ChartType > xChartType(
@@ -1374,7 +1372,7 @@ IMPL_LINK( DataBrowser, SeriesHeaderChanged, 
impl::SeriesHeaderEdit&, rEdit, voi
     if( xChartType.is())
     {
         uno::Reference< chart2::data::XLabeledDataSequence > xLabeledSeq =
-            DataSeriesHelper::getDataSequenceByRole( xSource, 
xChartType->getRoleOfSequenceForSeriesLabel());
+            DataSeriesHelper::getDataSequenceByRole( xSeries, 
xChartType->getRoleOfSequenceForSeriesLabel());
         if( xLabeledSeq.is())
         {
             Reference< container::XIndexReplace > xIndexReplace( 
xLabeledSeq->getLabel(), uno::UNO_QUERY );
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx 
b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 8890da8eaa79..a0beacaa4955 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -101,7 +101,7 @@ void lcl_copyDataSequenceProperties(
 }
 
 bool lcl_SequenceOfSeriesIsShared(
-    const Reference< chart2::XDataSeries > & xSeries,
+    const rtl::Reference< ::chart::DataSeries > & xSeries,
     const Reference< chart2::data::XDataSequence > & xValues )
 {
     bool bResult = false;
@@ -111,9 +111,8 @@ bool lcl_SequenceOfSeriesIsShared(
     {
         OUString aValuesRole( lcl_getRole( xValues ));
         OUString aValuesRep( xValues->getSourceRangeRepresentation());
-        Reference< chart2::data::XDataSource > xSource( xSeries, 
uno::UNO_QUERY_THROW );
-        const Sequence< Reference< chart2::data::XLabeledDataSequence > > 
aLSeq( xSource->getDataSequences());
-        for( Reference< chart2::data::XLabeledDataSequence > const & 
labeledDataSeq : aLSeq )
+        const std::vector< uno::Reference< chart2::data::XLabeledDataSequence 
> > & aLSeq( xSeries->getDataSequences2());
+        for( uno::Reference< chart2::data::XLabeledDataSequence > const & 
labeledDataSeq : aLSeq )
             if (labeledDataSeq.is() && 
DataSeriesHelper::getRole(labeledDataSeq) == aValuesRole)
             {
                 // getValues().is(), because lcl_getRole checked that already
@@ -131,22 +130,20 @@ bool lcl_SequenceOfSeriesIsShared(
 
 typedef std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > 
lcl_tSharedSeqVec;
 
-lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< 
chart2::XDataSeries > > & rSeries )
+lcl_tSharedSeqVec lcl_getSharedSequences( const std::vector< rtl::Reference< 
DataSeries > > & rSeries )
 {
     // @todo: if only some series share a sequence, those have to be duplicated
     // and made unshared for all series
     lcl_tSharedSeqVec aResult;
     // if we have only one series, we don't want any shared sequences
-    if( rSeries.getLength() <= 1 )
+    if( rSeries.size() <= 1 )
         return aResult;
 
-    Reference< chart2::data::XDataSource > xSource( rSeries[0], uno::UNO_QUERY 
);
-    const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( 
xSource->getDataSequences());
-    for( Reference< chart2::data::XLabeledDataSequence >  const & 
labeledDataSeq : aLSeq )
+    for( uno::Reference< chart2::data::XLabeledDataSequence >  const & 
labeledDataSeq : rSeries[0]->getDataSequences2() )
     {
         Reference< chart2::data::XDataSequence > xValues( 
labeledDataSeq->getValues());
         bool bShared = true;
-        for( sal_Int32 nSeriesIdx=1; nSeriesIdx<rSeries.getLength(); 
++nSeriesIdx )
+        for( sal_Int32 nSeriesIdx=1; 
nSeriesIdx<static_cast<sal_Int32>(rSeries.size()); ++nSeriesIdx )
         {
             bShared = lcl_SequenceOfSeriesIsShared( rSeries[nSeriesIdx], 
xValues );
             if( !bShared )
@@ -215,7 +212,7 @@ bool lcl_ShowCategoriesAsDataLabel( const rtl::Reference< 
::chart::Diagram > & x
 
 struct DataBrowserModel::tDataColumn
 {
-    uno::Reference<chart2::XDataSeries>  m_xDataSeries;
+    rtl::Reference<DataSeries>  m_xDataSeries;
     OUString                             m_aUIRoleName;
     uno::Reference<chart2::data::XLabeledDataSequence> m_xLabeledDataSequence;
     eCellType                                          m_eCellType;
@@ -225,7 +222,7 @@ struct DataBrowserModel::tDataColumn
     tDataColumn() : m_eCellType( TEXT ), m_nNumberFormatKey( 0 ) {}
     // "full" CTOR
     tDataColumn(
-        const uno::Reference<chart2::XDataSeries> & xDataSeries,
+        const rtl::Reference<DataSeries> & xDataSeries,
         const OUString& aUIRoleName,
         const uno::Reference<chart2::data::XLabeledDataSequence>& 
xLabeledDataSequence,
         eCellType aCellType,
@@ -268,7 +265,7 @@ namespace
 struct lcl_DataSeriesOfHeaderMatches
 {
     explicit lcl_DataSeriesOfHeaderMatches(
-        const Reference< chart2::XDataSeries > & xSeriesToCompareWith ) :
+        const rtl::Reference< ::chart::DataSeries > & xSeriesToCompareWith ) :
             m_xSeries( xSeriesToCompareWith )
     {}
     bool operator() ( const ::chart::DataBrowserModel::tDataHeader & rHeader )
@@ -276,7 +273,7 @@ struct lcl_DataSeriesOfHeaderMatches
         return (m_xSeries == rHeader.m_xDataSeries);
     }
 private:
-    Reference< chart2::XDataSeries  > m_xSeries;
+    rtl::Reference< ::chart::DataSeries  > m_xSeries;
 };
 }
 
@@ -296,10 +293,10 @@ void DataBrowserModel::insertDataSeries( sal_Int32 
nAfterColumnIndex )
     sal_Int32 nStartCol = 0;
     rtl::Reference< Diagram > xDiagram = 
ChartModelHelper::findDiagram(m_xChartDocument);
     rtl::Reference<ChartType> xChartType;
-    Reference<chart2::XDataSeries> xSeries;
+    rtl::Reference<DataSeries> xSeries;
     if (o3tl::make_unsigned(nAfterColumnIndex) < m_aColumns.size())
         // Get the data series at specific column position (if available).
-        xSeries.set( m_aColumns[nAfterColumnIndex].m_xDataSeries );
+        xSeries = m_aColumns[nAfterColumnIndex].m_xDataSeries;
 
     sal_Int32 nSeriesNumberFormat = 0;
     if( xSeries.is())
@@ -316,9 +313,8 @@ void DataBrowserModel::insertDataSeries( sal_Int32 
nAfterColumnIndex )
             nStartCol = aIt->m_nEndColumn;
 
         // Get the number format too.
-        Reference< beans::XPropertySet > xSeriesProps( xSeries, uno::UNO_QUERY 
);
-        if( xSeriesProps.is() )
-            xSeriesProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= 
nSeriesNumberFormat;
+        if( xSeries.is() )
+            xSeries->getPropertyValue(CHART_UNONAME_NUMFMT) >>= 
nSeriesNumberFormat;
     }
     else
     {
@@ -332,7 +328,7 @@ void DataBrowserModel::insertDataSeries( sal_Int32 
nAfterColumnIndex )
 
     // Get shared sequences of current series.  Normally multiple data series
     // only share "values-x" sequences. (TODO: simplify this logic).
-    lcl_tSharedSeqVec aSharedSequences = lcl_getSharedSequences( 
xChartType->getDataSeries());
+    lcl_tSharedSeqVec aSharedSequences = lcl_getSharedSequences( 
xChartType->getDataSeries2());
 
     rtl::Reference<::chart::DataSeries> xNewSeries =
         m_apDialogModel->insertSeriesAfter(xSeries, xChartType, true);
@@ -443,7 +439,7 @@ void 
DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
         return;
     }
 
-    const Reference<chart2::XDataSeries>& xSeries = 
m_aColumns[nAtColumnIndex].m_xDataSeries;
+    const rtl::Reference<DataSeries>& xSeries = 
m_aColumns[nAtColumnIndex].m_xDataSeries;
 
     m_apDialogModel->deleteSeries(xSeries, 
getHeaderForSeries(xSeries).m_xChartType);
 
@@ -451,8 +447,7 @@ void 
DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
     //but do not delete sequences that are still in use by the remaining series
 
     Reference< chart2::XInternalDataProvider > xDataProvider( 
m_apDialogModel->getDataProvider(), uno::UNO_QUERY );
-    Reference< chart2::data::XDataSource > xSourceOfDeleted( xSeries, 
uno::UNO_QUERY );
-    if (!xDataProvider.is() || !xSourceOfDeleted.is())
+    if (!xDataProvider.is() || !xSeries.is())
     {
         // Something went wrong.  Bail out.
         updateFromModel();
@@ -475,7 +470,7 @@ void 
DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
     // Check if the sequences to be deleted are still referenced by any of
     // the other data series.  If not, mark them for deletion.
     std::vector<sal_Int32> aSequenceIndexesToDelete;
-    const Sequence<Reference<chart2::data::XLabeledDataSequence> > 
aSequencesOfDeleted = xSourceOfDeleted->getDataSequences();
+    const std::vector<uno::Reference<chart2::data::XLabeledDataSequence> > & 
aSequencesOfDeleted = xSeries->getDataSequences2();
     for (auto const & labeledDataSeq : aSequencesOfDeleted)
     {
         // if not used by the remaining series this sequence can be deleted
@@ -503,7 +498,7 @@ void DataBrowserModel::swapDataSeries( sal_Int32 
nFirstColumnIndex )
     OSL_ASSERT(m_apDialogModel);
     if( o3tl::make_unsigned( nFirstColumnIndex ) < m_aColumns.size() - 1 )
     {
-        Reference< chart2::XDataSeries > xSeries( 
m_aColumns[nFirstColumnIndex].m_xDataSeries );
+        rtl::Reference< DataSeries > xSeries( 
m_aColumns[nFirstColumnIndex].m_xDataSeries );
         if( xSeries.is())
         {
             m_apDialogModel->moveSeries( xSeries, 
DialogModel::MoveDirection::Down );
@@ -549,15 +544,17 @@ void DataBrowserModel::removeDataPointForAllSeries( 
sal_Int32 nAtIndex )
 DataBrowserModel::tDataHeader DataBrowserModel::getHeaderForSeries(
     const Reference< chart2::XDataSeries > & xSeries ) const
 {
+    rtl::Reference<DataSeries> pSeries = 
dynamic_cast<DataSeries*>(xSeries.get());
+    assert(!xSeries || pSeries);
     for (auto const& elemHeader : m_aHeaders)
     {
-        if( elemHeader.m_xDataSeries == xSeries )
+        if( elemHeader.m_xDataSeries == pSeries )
             return elemHeader;
     }
     return tDataHeader();
 }
 
-Reference< chart2::XDataSeries >
+rtl::Reference< DataSeries >
     DataBrowserModel::getDataSeriesByColumn( sal_Int32 nColumn ) const
 {
     tDataColumnVector::size_type nIndex( nColumn );
@@ -773,16 +770,16 @@ void DataBrowserModel::updateFromModel()
     {
         ExplicitCategoriesProvider aExplicitCategoriesProvider( 
ChartModelHelper::getFirstCoordinateSystem(m_xChartDocument), *m_xChartDocument 
);
 
-        const Sequence< Reference< chart2::data::XLabeledDataSequence> >& 
rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
-        sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+        const std::vector< rtl::Reference< LabeledDataSequence> >& 
rSplitCategoriesList = aExplicitCategoriesProvider.getSplitCategoriesList();
+        sal_Int32 nLevelCount = rSplitCategoriesList.size();
         for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
         {
-            Reference< chart2::data::XLabeledDataSequence > xCategories( 
rSplitCategoriesList[nL] );
+            rtl::Reference< LabeledDataSequence > xCategories( 
rSplitCategoriesList[nL] );
             if( !xCategories.is() )
                 continue;
 
             tDataColumn aCategories;
-            aCategories.m_xLabeledDataSequence.set( xCategories );
+            aCategories.m_xLabeledDataSequence = xCategories;
             if( lcl_ShowCategoriesAsDataLabel( xDiagram ))
                 aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel();
             else
@@ -806,7 +803,7 @@ void DataBrowserModel::updateFromModel()
             rtl::Reference< ChartType > xSeriesCnt( aChartTypes[nCTIdx] );
             OUString aRoleForDataLabelNumberFormat = 
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( 
aChartTypes[nCTIdx] );
 
-            const Sequence< Reference< chart2::XDataSeries > > aSeries( 
xSeriesCnt->getDataSeries());
+            const std::vector< rtl::Reference< DataSeries > > & aSeries( 
xSeriesCnt->getDataSeries2());
             lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( 
aSeries ));
             for (auto const& sharedSequence : aSharedSequences)
             {
@@ -821,15 +818,14 @@ void DataBrowserModel::updateFromModel()
                 m_aColumns.push_back( aSharedSequence );
                 ++nHeaderStart;
             }
-            for( Reference< chart2::XDataSeries > const & dataSeries : aSeries 
)
+            for( rtl::Reference< DataSeries > const & dataSeries : aSeries )
             {
                 tDataColumnVector::size_type nStartColIndex = 
m_aColumns.size();
-                Reference< chart2::XDataSeries > xSeries( dataSeries );
-                Reference< chart2::data::XDataSource > xSource( xSeries, 
uno::UNO_QUERY );
-                if( xSource.is())
+                rtl::Reference< DataSeries > xSeries( dataSeries );
+                if( xSeries.is())
                 {
-                    Sequence< Reference< chart2::data::XLabeledDataSequence > 
> aLSeqs( xSource->getDataSequences());
-                    if( !aLSeqs.hasElements() )
+                    const std::vector< uno::Reference< 
chart2::data::XLabeledDataSequence > > & aLSeqs( xSeries->getDataSequences2());
+                    if( aLSeqs.empty() )
                         continue;
                     nHeaderEnd = nHeaderStart;
 
@@ -839,7 +835,7 @@ void DataBrowserModel::updateFromModel()
                             dataSeries, coords, 1 );
 
                     sal_Int32 nSeqIdx=0;
-                    for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
+                    for( ; nSeqIdx<static_cast<sal_Int32>(aLSeqs.size()); 
++nSeqIdx )
                     {
                         sal_Int32 nSequenceNumberFormatKey = 
nYAxisNumberFormatKey;
                         OUString aRole = 
DataSeriesHelper::getRole(aLSeqs[nSeqIdx]);
@@ -847,7 +843,7 @@ void DataBrowserModel::updateFromModel()
                         if( aRole == aRoleForDataLabelNumberFormat )
                         {
                             nSequenceNumberFormatKey = 
ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
-                                Reference< beans::XPropertySet >( xSeries, 
uno::UNO_QUERY ));
+                                xSeries);
                         }
                         else if( aRole == "values-x" )
                             nSequenceNumberFormatKey = nXAxisNumberFormat;
@@ -904,30 +900,32 @@ void DataBrowserModel::addErrorBarRanges(
 {
     try
     {
-        std::vector< Reference< chart2::data::XLabeledDataSequence > > 
aSequences;
+        std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > 
aSequences;
 
         Reference< chart2::data::XDataSource > xErrorSource(
             StatisticsHelper::getErrorBars( xDataSeries, bYError ), 
uno::UNO_QUERY );
 
-        Reference< chart2::data::XLabeledDataSequence > xErrorLSequence(
+        uno::Reference< chart2::data::XLabeledDataSequence > xErrorLSequence =
             StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
                 xErrorSource,
                 /* bPositiveValue = */ true,
-                bYError ));
+                bYError );
         if( xErrorLSequence.is())
             aSequences.push_back( xErrorLSequence );
 
-        xErrorLSequence.set(
+        xErrorLSequence =
             StatisticsHelper::getErrorLabeledDataSequenceFromDataSource(
                 xErrorSource,
                 /* bPositiveValue = */ false,
-                bYError ));
+                bYError );
         if( xErrorLSequence.is())
             aSequences.push_back( xErrorLSequence );
 
-        for (Reference<chart2::data::XLabeledDataSequence> const & 
rDataSequence : aSequences)
+        for (uno::Reference<chart2::data::XLabeledDataSequence> const & 
rDataSequence : aSequences)
         {
-            m_aColumns.emplace_back(xDataSeries, 
lcl_getUIRoleName(rDataSequence),
+            rtl::Reference<DataSeries> pDataSeries = 
dynamic_cast<DataSeries*>(xDataSeries.get());
+            assert(pDataSeries || !xDataSeries);
+            m_aColumns.emplace_back(pDataSeries, 
lcl_getUIRoleName(rDataSequence),
                                              rDataSequence, NUMBER, 
nNumberFormatKey);
             ++rInOutSequenceIndex;
             ++rInOutHeaderEnd;
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx 
b/chart2/source/controller/dialogs/DataBrowserModel.hxx
index fe7faa53083d..c44ad65b84f4 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -38,6 +38,7 @@ namespace chart
 class DialogModel;
 class ChartModel;
 class ChartType;
+class DataSeries;
 
 class DataBrowserModel final
 {
@@ -99,7 +100,7 @@ public:
 
     struct tDataHeader
     {
-        css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
+        rtl::Reference< ::chart::DataSeries > m_xDataSeries;
         rtl::Reference< ::chart::ChartType >  m_xChartType;
         bool                                            m_bSwapXAndYAxis;
         sal_Int32                                       m_nStartColumn;
@@ -113,7 +114,7 @@ public:
         {}
         // "full" CTOR
         tDataHeader(
-            css::uno::Reference< css::chart2::XDataSeries > const & 
xDataSeries,
+            rtl::Reference< ::chart::DataSeries > const & xDataSeries,
             rtl::Reference< ::chart::ChartType > const &xChartType,
             bool                                        bSwapXAndYAxis,
             sal_Int32                                   nStartColumn,
@@ -133,7 +134,7 @@ public:
     tDataHeader getHeaderForSeries(
         const css::uno::Reference< css::chart2::XDataSeries > &xSeries ) const;
 
-    css::uno::Reference< css::chart2::XDataSeries >
+    rtl::Reference< ::chart::DataSeries >
         getDataSeriesByColumn( sal_Int32 nColumn ) const;
 
 private:
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx 
b/chart2/source/controller/dialogs/DialogModel.cxx
index 1e60e59f6dd4..cc20fc0bfd5a 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -435,9 +435,9 @@ std::vector< DialogModel::tSeriesWithChartTypeByName >
     {
         try
         {
-            const Sequence< Reference< XDataSeries > > aSeq( 
rxChartType->getDataSeries());
+            const std::vector< rtl::Reference< DataSeries > > & aSeq = 
rxChartType->getDataSeries2();
             OUString aRole = rxChartType->getRoleOfSequenceForSeriesLabel();
-            for( Reference< XDataSeries > const & dataSeries : aSeq )
+            for( rtl::Reference< DataSeries > const & dataSeries : aSeq )
             {
                 aResult.push_back(
                     ::chart::DialogModel::tSeriesWithChartTypeByName(
@@ -476,13 +476,12 @@ void addMissingRoles(DialogModel::tRolesWithRanges& 
rResult, const uno::Sequence
  */
 void addNewSeriesToContainer(
     const rtl::Reference<ChartType>& xChartType,
-    const Reference<XDataSeries>& xSeries,
-    const Reference<XDataSeries>& xNewSeries )
+    const rtl::Reference<DataSeries>& xSeries,
+    const rtl::Reference<DataSeries>& xNewSeries )
 {
-    auto aSeries = 
comphelper::sequenceToContainer<std::vector<Reference<XDataSeries> 
>>(xChartType->getDataSeries());
+    auto aSeries = xChartType->getDataSeries2();
 
-    std::vector<Reference<XDataSeries> >::iterator aIt =
-        std::find( aSeries.begin(), aSeries.end(), xSeries);
+    auto aIt = std::find( aSeries.begin(), aSeries.end(), xSeries);
 
     if( aIt == aSeries.end())
         // if we have no series we insert at the first position.
@@ -492,7 +491,7 @@ void addNewSeriesToContainer(
         ++aIt;
 
     aSeries.insert(aIt, xNewSeries);
-    xChartType->setDataSeries(comphelper::containerToSequence(aSeries));
+    xChartType->setDataSeries(aSeries);
 }
 
 }
@@ -543,13 +542,15 @@ void DialogModel::moveSeries(
 }
 
 rtl::Reference< ::chart::DataSeries > DialogModel::insertSeriesAfter(
-    const Reference< XDataSeries > & xSeries,
+    const Reference< XDataSeries > & xUnoSeries,
     const rtl::Reference< ::chart::ChartType > & xChartType,
     bool bCreateDataCachedSequences /* = false */ )
 {
     m_aTimerTriggeredControllerLock.startTimer();
     ControllerLockGuardUNO aLockedControllers( m_xChartDocument );
     rtl::Reference< ::chart::DataSeries > xNewSeries;
+    rtl::Reference<DataSeries> xSeries = 
dynamic_cast<DataSeries*>(xUnoSeries.get());
+    assert(xSeries || !xUnoSeries);
 
     try
     {
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx 
b/chart2/source/controller/dialogs/DialogModel.hxx
index 66e7994d318a..b8dde584c1a6 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -71,7 +71,7 @@ public:
 
     typedef std::pair<
                 OUString,
-                std::pair< css::uno::Reference< css::chart2::XDataSeries >,
+                std::pair< rtl::Reference< ::chart::DataSeries >,
                              rtl::Reference< ::chart::ChartType > > >
         tSeriesWithChartTypeByName;
 
diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx 
b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
index d9c36482256b..8ffb67543473 100644
--- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx
+++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx
@@ -34,6 +34,7 @@
 #include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <TitleHelper.hxx>
+#include <LabeledDataSequence.hxx>
 #include <ExplicitCategoriesProvider.hxx>
 #include <CommonConverters.hxx>
 #include <NumberFormatterWrapper.hxx>
@@ -100,19 +101,17 @@ void lcl_addText( OUString& rOut, std::u16string_view 
rSeparator, std::u16string
         rOut+=rNext;
 }
 
-OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, 
sal_Int32 nPointIndex,
+OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& 
xSeries, sal_Int32 nPointIndex,
                                     const rtl::Reference< BaseCoordinateSystem 
>& xCooSys,
                                     const Reference< frame::XModel >& 
xChartModel )
 {
 
     OUString aRet;
 
-    Reference<data::XDataSource> xDataSource(
-            uno::Reference<data::XDataSource>( xSeries, uno::UNO_QUERY ) );
-    if(!xDataSource.is())
+    if(!xSeries.is())
         return aRet;
 
-    Sequence< Reference< data::XLabeledDataSequence > > aDataSequences( 
xDataSource->getDataSequences() );
+    const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > 
& aDataSequences = xSeries->getDataSequences2();
 
     OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size;
     double fValue = 0;
@@ -122,7 +121,7 @@ OUString lcl_getDataPointValueText( const Reference< 
XDataSeries >& xSeries, sal
     Color nLabelColor;//dummy
     bool bColorChanged;//dummy
 
-    for(sal_Int32 nN = aDataSequences.getLength();nN--;)
+    for(sal_Int32 nN = aDataSequences.size();nN--;)
     {
         uno::Reference<data::XDataSequence>  xDataSequence( 
aDataSequences[nN]->getValues());
         if( !xDataSequence.is() )
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx 
b/chart2/source/controller/dialogs/tp_DataSource.cxx
index ef4ba8e50569..90295c310ad9 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -129,32 +129,29 @@ void lcl_enableRangeChoosing(bool bEnable, 
weld::DialogController* pDialog)
 }
 
 void lcl_addLSequenceToDataSource(
-    const Reference< chart2::data::XLabeledDataSequence > & xLSequence,
-    const Reference< chart2::data::XDataSource > & xSource )
+    const uno::Reference< chart2::data::XLabeledDataSequence > & xLSequence,
+    const Reference< ::chart::DataSeries > & xSource )
 {
-    Reference< data::XDataSink > xSink( xSource, uno::UNO_QUERY );
-    if( xSink.is())
+    if( xSource.is())
     {
-        Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( 
xSource->getDataSequences());
-        aData.realloc( aData.getLength() + 1 );
-        aData.getArray()[ aData.getLength() - 1 ] = xLSequence;
-        xSink->setData( aData );
+        std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > 
aData = xSource->getDataSequences2();
+        aData.push_back( xLSequence );
+        xSource->setData( aData );
     }
 }
 
-Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
-    const Reference< chart2::data::XDataSource > & xDataSource )
+uno::Reference< chart2::data::XLabeledDataSequence > 
lcl_findLSequenceWithOnlyLabel(
+    const rtl::Reference< ::chart::DataSeries > & xDataSource )
 {
-    Reference< chart2::data::XLabeledDataSequence > xResult;
-    const Sequence< Reference< chart2::data::XLabeledDataSequence > > 
aSequences( xDataSource->getDataSequences());
+    uno::Reference< chart2::data::XLabeledDataSequence > xResult;
 
-    for( Reference< chart2::data::XLabeledDataSequence > const & 
labeledDataSeq : aSequences )
+    for( uno::Reference< chart2::data::XLabeledDataSequence > const & 
labeledDataSeq : xDataSource->getDataSequences2() )
     {
         // no values are set but a label exists
         if( ! labeledDataSeq->getValues().is() &&
             labeledDataSeq->getLabel().is())
         {
-            xResult.set( labeledDataSeq );
+            xResult = labeledDataSeq;
             break;
         }
     }
@@ -330,13 +327,13 @@ void DataSourceTabPage::updateControlsFromDialogModel()
 
 void DataSourceTabPage::fillSeriesListBox()
 {
-    Reference< XDataSeries > xSelected;
+    rtl::Reference< DataSeries > xSelected;
     SeriesEntry* pEntry = nullptr;
     int nEntry = m_xLB_SERIES->get_selected_index();
     if (nEntry != -1)
     {
         pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
-        xSelected.set(pEntry->m_xDataSeries);
+        xSelected = pEntry->m_xDataSeries;
     }
 
     bool bHasSelectedEntry = (pEntry != nullptr);
@@ -375,7 +372,7 @@ void DataSourceTabPage::fillSeriesListBox()
 
         m_aEntries.emplace_back(new SeriesEntry);
         pEntry = m_aEntries.back().get();
-        pEntry->m_xDataSeries.set(series.second.first);
+        pEntry->m_xDataSeries = series.second.first;
         pEntry->m_xChartType = series.second.second;
         m_xLB_SERIES->append(weld::toId(pEntry), aLabel);
         if (bHasSelectedEntry && series.second.first == xSelected)
@@ -562,7 +559,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, AddButtonClickedHdl, 
weld::Button&, void)
 {
     m_rDialogModel.startControllerLockTimer();
     int nEntry = m_xLB_SERIES->get_selected_index();
-    Reference< XDataSeries > xSeriesToInsertAfter;
+    rtl::Reference< DataSeries > xSeriesToInsertAfter;
     rtl::Reference< ChartType > xChartTypeForNewSeries;
     if( m_pTemplateProvider )
             m_rDialogModel.setTemplate( 
m_pTemplateProvider->getCurrentTemplate());
@@ -570,7 +567,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, AddButtonClickedHdl, 
weld::Button&, void)
     if (nEntry != -1)
     {
         ::chart::SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
-        xSeriesToInsertAfter.set(pEntry->m_xDataSeries);
+        xSeriesToInsertAfter = pEntry->m_xDataSeries;
         xChartTypeForNewSeries = pEntry->m_xChartType;
     }
     else
@@ -606,14 +603,14 @@ IMPL_LINK_NOARG(DataSourceTabPage, 
RemoveButtonClickedHdl, weld::Button&, void)
         return;
 
     SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
-    Reference< XDataSeries > xNewSelSeries;
+    rtl::Reference< DataSeries > xNewSelSeries;
     SeriesEntry * pNewSelEntry = nullptr;
     if (nEntry + 1 < m_xLB_SERIES->n_children())
         pNewSelEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1));
     else if (nEntry > 0)
         pNewSelEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1));
     if (pNewSelEntry)
-        xNewSelSeries.set(pNewSelEntry->m_xDataSeries);
+        xNewSelSeries = pNewSelEntry->m_xDataSeries;
 
     m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
     setDirty();
@@ -805,9 +802,8 @@ bool DataSourceTabPage::updateModelFromControl(const 
weld::Entry* pField)
                 if( bIsLabel )
                     aSequenceRole = aSequenceNameForLabel;
 
-                Reference< data::XDataSource > xSource( 
pSeriesEntry->m_xDataSeries, uno::UNO_QUERY_THROW );
-                Reference< data::XLabeledDataSequence > xLabeledSeq(
-                    DataSeriesHelper::getDataSequenceByRole( xSource, 
aSequenceRole ));
+                uno::Reference< chart2::data::XLabeledDataSequence > 
xLabeledSeq =
+                    DataSeriesHelper::getDataSequenceByRole( 
pSeriesEntry->m_xDataSeries, aSequenceRole );
 
                 if( xDataProvider.is())
                 {
@@ -816,12 +812,12 @@ bool DataSourceTabPage::updateModelFromControl(const 
weld::Entry* pField)
                         if( ! xLabeledSeq.is())
                         {
                             // check if there is already an "orphan" label 
sequence
-                            xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( 
xSource ));
+                            xLabeledSeq = lcl_findLSequenceWithOnlyLabel( 
pSeriesEntry->m_xDataSeries );
                             if( ! xLabeledSeq.is())
                             {
                                 // no corresponding labeled data sequence for 
label found
-                                xLabeledSeq.set( 
DataSourceHelper::createLabeledDataSequence() );
-                                lcl_addLSequenceToDataSource( xLabeledSeq, 
xSource );
+                                xLabeledSeq = 
DataSourceHelper::createLabeledDataSequence();
+                                lcl_addLSequenceToDataSource( xLabeledSeq, 
pSeriesEntry->m_xDataSeries );
                             }
                         }
                         if( xLabeledSeq.is())
@@ -884,11 +880,11 @@ bool DataSourceTabPage::updateModelFromControl(const 
weld::Entry* pField)
                                 if( !xLabeledSeq.is())
                                 {
                                     if( aSelectedRole == aSequenceNameForLabel 
)
-                                        xLabeledSeq.set( 
lcl_findLSequenceWithOnlyLabel( xSource ));
+                                        xLabeledSeq = 
lcl_findLSequenceWithOnlyLabel( pSeriesEntry->m_xDataSeries );
                                     if( ! xLabeledSeq.is())
                                     {
-                                        xLabeledSeq.set( 
DataSourceHelper::createLabeledDataSequence() );
-                                        lcl_addLSequenceToDataSource( 
xLabeledSeq, xSource );
+                                        xLabeledSeq = 
DataSourceHelper::createLabeledDataSequence();
+                                        lcl_addLSequenceToDataSource( 
xLabeledSeq, pSeriesEntry->m_xDataSeries );
                                     }
                                 }
                                 xLabeledSeq->setValues( xNewSeq );
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx 
b/chart2/source/controller/dialogs/tp_DataSource.hxx
index dfd3f42728b4..913354f6a198 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -31,6 +31,7 @@ namespace chart
 {
 class ChartType;
 class ChartTypeTemplateProvider;
+class DataSeries;
 class DialogModel;
 
 class SeriesEntry
@@ -39,7 +40,7 @@ public:
     OUString m_sRole;
 
     /// the corresponding data series
-    css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
+    rtl::Reference< ::chart::DataSeries > m_xDataSeries;
 
     /// the chart type that contains the series (via XDataSeriesContainer)
     rtl::Reference< ::chart::ChartType > m_xChartType;
diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx 
b/chart2/source/controller/inc/DataPointItemConverter.hxx
index 1cba4854d890..3c6e276ff763 100644
--- a/chart2/source/controller/inc/DataPointItemConverter.hxx
+++ b/chart2/source/controller/inc/DataPointItemConverter.hxx
@@ -32,6 +32,7 @@ namespace com::sun::star::chart2 { class XDataSeries; }
 namespace com::sun::star::frame { class XModel; }
 namespace com::sun::star::uno { class XComponentContext; }
 namespace chart { class ChartModel; }
+namespace chart { class DataSeries; }
 class SdrModel;
 
 namespace chart::wrapper {
@@ -43,7 +44,7 @@ public:
         const rtl::Reference<::chart::ChartModel>& xChartModel,
         const css::uno::Reference<css::uno::XComponentContext>& xContext,
         const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
-        const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
+        const rtl::Reference<::chart::DataSeries>& xSeries,
         SfxItemPool& rItemPool,
         SdrModel& rDrawModel,
         const css::uno::Reference<css::lang::XMultiServiceFactory>& 
xNamedPropertyContainerFactory,
@@ -81,7 +82,7 @@ private:
     bool                                m_bForbidPercentValue;
     bool                                m_bHideLegendEntry;
     sal_Int32                           m_nPointIndex;
-    css::uno::Reference<css::chart2::XDataSeries> m_xSeries;
+    rtl::Reference<::chart::DataSeries> m_xSeries;
 };
 
 }
diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx 
b/chart2/source/controller/inc/TextLabelItemConverter.hxx
index d44138332798..9df2a65e1696 100644
--- a/chart2/source/controller/inc/TextLabelItemConverter.hxx
+++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx
@@ -28,6 +28,7 @@ namespace com::sun::star::awt { struct Size; }
 namespace com::sun::star::chart2 { class XDataSeries; }
 namespace com::sun::star::frame { class XModel; }
 namespace chart { class ChartModel; }
+namespace chart { class DataSeries; }
 
 namespace chart::wrapper {
 
@@ -37,7 +38,7 @@ public:
     TextLabelItemConverter(
         const rtl::Reference<::chart::ChartModel>& xChartModel,
         const css::uno::Reference<css::beans::XPropertySet>& rPropertySet,
-        const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
+        const rtl::Reference<::chart::DataSeries>& xSeries,
         SfxItemPool& rItemPool,
         const css::awt::Size* pRefSize,
         bool bDataSeries,
@@ -65,7 +66,7 @@ private:
     bool mbDataSeries:1;
     bool mbForbidPercentValue:1;
 
-    css::uno::Reference<css::chart2::XDataSeries> m_xSeries;
+    rtl::Reference<::chart::DataSeries> m_xSeries;
 };
 
 }
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index e06cc392ac86..c3eb1d40f4e0 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -25,6 +25,7 @@
 #include <CharacterPropertyItemConverter.hxx>
 #include <StatisticsItemConverter.hxx>
 #include <SeriesOptionsItemConverter.hxx>
+#include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <DiagramHelper.hxx>
 #include <Diagram.hxx>
@@ -204,7 +205,7 @@ DataPointItemConverter::DataPointItemConverter(
     const rtl::Reference<::chart::ChartModel> & xChartModel,
     const uno::Reference< uno::XComponentContext > & xContext,
     const uno::Reference< beans::XPropertySet > & rPropertySet,
-    const uno::Reference< XDataSeries > & xSeries,
+    const rtl::Reference< DataSeries > & xSeries,
     SfxItemPool& rItemPool,
     SdrModel& rDrawModel,
     const uno::Reference<lang::XMultiServiceFactory>& 
xNamedPropertyContainerFactory,
@@ -250,9 +251,8 @@ DataPointItemConverter::DataPointItemConverter(
     if (bDataSeries)
         return;
 
-    uno::Reference<beans::XPropertySet> xSeriesProp(xSeries, uno::UNO_QUERY);
     uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
-    xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= 
deletedLegendEntriesSeq;
+    xSeries->getPropertyValue("DeletedLegendEntries") >>= 
deletedLegendEntriesSeq;
     for (const auto& deletedLegendEntry : 
std::as_const(deletedLegendEntriesSeq))
     {
         if (nPointIndex == deletedLegendEntry)
@@ -573,8 +573,7 @@ bool DataPointItemConverter::ApplySpecialItem(
             if (bHideLegendEntry != m_bHideLegendEntry)
             {
                 uno::Sequence<sal_Int32> deletedLegendEntriesSeq;
-                Reference<beans::XPropertySet> xSeriesProp(m_xSeries, 
uno::UNO_QUERY);
-                xSeriesProp->getPropertyValue("DeletedLegendEntries") >>= 
deletedLegendEntriesSeq;
+                m_xSeries->getPropertyValue("DeletedLegendEntries") >>= 
deletedLegendEntriesSeq;
                 std::vector<sal_Int32> deletedLegendEntries;
                 for (const auto& deletedLegendEntry : 
std::as_const(deletedLegendEntriesSeq))
                 {
@@ -583,7 +582,7 @@ bool DataPointItemConverter::ApplySpecialItem(
                 }
                 if (bHideLegendEntry)
                     deletedLegendEntries.push_back(m_nPointIndex);
-                xSeriesProp->setPropertyValue("DeletedLegendEntries", 
uno::makeAny(comphelper::containerToSequence(deletedLegendEntries)));
+                m_xSeries->setPropertyValue("DeletedLegendEntries", 
uno::makeAny(comphelper::containerToSequence(deletedLegendEntries)));
             }
         }
         break;
@@ -594,10 +593,9 @@ bool DataPointItemConverter::ApplySpecialItem(
             {
                 bool bNew = static_cast<const 
SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
                 bool bOld = true;
-                Reference<beans::XPropertySet> xSeriesProp(m_xSeries, 
uno::UNO_QUERY);
-                if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") 
>>= bOld) && bOld != bNew )
+                if( (m_xSeries->getPropertyValue("ShowCustomLeaderLines") >>= 
bOld) && bOld != bNew )
                 {
-                    xSeriesProp->setPropertyValue("ShowCustomLeaderLines", 
uno::Any(bNew));
+                    m_xSeries->setPropertyValue("ShowCustomLeaderLines", 
uno::Any(bNew));
                     bChanged = true;
                 }
             }
@@ -761,8 +759,7 @@ void DataPointItemConverter::FillSpecialItem(
             try
             {
                 bool bValue = true;
-                Reference<beans::XPropertySet> xSeriesProp(m_xSeries, 
uno::UNO_QUERY);
-                if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) 
>>= bValue )
+                if( m_xSeries->getPropertyValue( "ShowCustomLeaderLines" ) >>= 
bValue )
                     rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
             }
             catch (const uno::Exception&)
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index b73a1770c767..bcea179b7585 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -23,6 +23,7 @@
 #include <ChartModelHelper.hxx>
 #include <ChartType.hxx>
 #include <ChartTypeHelper.hxx>
+#include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <DiagramHelper.hxx>
 #include <Diagram.hxx>
@@ -199,7 +200,7 @@ bool useSourceFormatFromItemToPropertySet(
 TextLabelItemConverter::TextLabelItemConverter(
     const rtl::Reference<::chart::ChartModel>& xChartModel,
     const uno::Reference<beans::XPropertySet>& rPropertySet,
-    const uno::Reference<XDataSeries>& xSeries,
+    const rtl::Reference<DataSeries>& xSeries,
     SfxItemPool& rItemPool, const awt::Size* pRefSize,
     bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat 
) :
     ItemConverter(rPropertySet, rItemPool),
@@ -513,10 +514,9 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 
nWhichId, const SfxIte
             {
                 bool bNew = static_cast<const 
SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue();
                 bool bOld = true;
-                Reference<beans::XPropertySet> xSeriesProp(m_xSeries, 
uno::UNO_QUERY);
-                if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") 
>>= bOld) && bOld != bNew )
+                if( (m_xSeries->getPropertyValue("ShowCustomLeaderLines") >>= 
bOld) && bOld != bNew )
                 {
-                    xSeriesProp->setPropertyValue("ShowCustomLeaderLines", 
uno::Any(bNew));
+                    m_xSeries->setPropertyValue("ShowCustomLeaderLines", 
uno::Any(bNew));
                     bChanged = true;
                 }
             }
@@ -670,8 +670,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 
nWhichId, SfxItemSet& r
             try
             {
                 bool bValue = true;
-                Reference<beans::XPropertySet> xSeriesProp(m_xSeries, 
uno::UNO_QUERY);
-                if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) 
>>= bValue )
+                if( m_xSeries->getPropertyValue( "ShowCustomLeaderLines" ) >>= 
bValue )
                     rOutItemSet.Put(SfxBoolItem(nWhichId, bValue));
             }
             catch (const uno::Exception&)
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx 
b/chart2/source/controller/main/ChartController_Insert.cxx
index ae33e372b29c..44195bb102a7 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -341,7 +341,7 @@ void 
ChartController::executeDispatch_InsertMenu_Trendlines()
 {
     OUString aCID = m_aSelection.getSelectedCID();
 
-    uno::Reference< chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() );
 
     if( !xSeries.is() )
@@ -410,7 +410,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool 
bYError )
     ObjectType objType = bYError ? OBJECTTYPE_DATA_ERRORS_Y : 
OBJECTTYPE_DATA_ERRORS_X;
 
     //if a series is selected insert error bars for that series only:
-    uno::Reference< chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
 
     if( xSeries.is())
@@ -614,8 +614,8 @@ void 
ChartController::executeDispatch_DeleteTrendlineEquation()
 
 void ChartController::executeDispatch_DeleteErrorBars( bool bYError )
 {
-    uno::Reference< chart2::XDataSeries > xDataSeries(
-        ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() ));
+    rtl::Reference< DataSeries > xDataSeries =
+        ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xDataSeries.is())
     {
         UndoGuard aUndoGuard(
@@ -629,7 +629,7 @@ void ChartController::executeDispatch_DeleteErrorBars( bool 
bYError )
 
 void ChartController::executeDispatch_InsertDataLabels()
 {
-    uno::Reference< chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xSeries.is() )
     {
@@ -652,7 +652,7 @@ void ChartController::executeDispatch_InsertDataLabel()
 
 void ChartController::executeDispatch_DeleteDataLabels()
 {
-    uno::Reference< chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xSeries.is() )
     {
@@ -678,7 +678,7 @@ void ChartController::executeDispatch_ResetAllDataPoints()
     UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( 
ActionDescriptionProvider::ActionType::Format,
         SchResId( STR_OBJECT_DATAPOINTS )),
         m_xUndoManager );
-    uno::Reference< chart2::XDataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
+    rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xSeries.is() )
         xSeries->resetAllDataPoints();
     aUndoGuard.commit();
@@ -688,7 +688,7 @@ void ChartController::executeDispatch_ResetDataPoint()
     UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( 
ActionDescriptionProvider::ActionType::Format,
         SchResId( STR_OBJECT_DATAPOINT )),
         m_xUndoManager );
-    uno::Reference< chart2::XDataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
+    rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xSeries.is() )
     {
         sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( 
m_aSelection.getSelectedCID() );
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx 
b/chart2/source/controller/main/ChartController_Tools.cxx
index 9c8e2f02cbec..ccf18ae37d15 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -759,7 +759,7 @@ bool ChartController::executeDispatch_Delete()
                     aLabel.ShowSeriesName = false;
                     if( aObjectType == OBJECTTYPE_DATA_LABELS )
                     {
-                        uno::Reference< chart2::XDataSeries > xSeries( 
ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() ));
+                        rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( aCID, getChartModel() );
                         
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, 
CHART_UNONAME_LABEL, uno::Any(aLabel) );
                         
DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, 
CHART_UNONAME_CUSTOM_LABEL_FIELDS, uno::Any() );
                     }
diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index 5eb195b90643..ebe904fba7a2 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -1864,8 +1864,8 @@ bool ChartController::impl_DragDataPoint( const OUString 
& rCID, double fAdditio
         return bResult;
 
     sal_Int32 nDataPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( 
rCID );
-    uno::Reference< chart2::XDataSeries > xSeries(
-        ObjectIdentifier::getDataSeriesForCID( rCID, getChartModel() ));
+    rtl::Reference< DataSeries > xSeries =
+        ObjectIdentifier::getDataSeriesForCID( rCID, getChartModel() );
     if( xSeries.is())
     {
         try
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx 
b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index f6ce403a8bc8..80036fad36d0 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -65,7 +65,7 @@ bool isDataLabelVisible(const 
rtl::Reference<::chart::ChartModel>& xModel, const
 
 void setDataLabelVisible(const rtl::Reference<::chart::ChartModel>& xModel, 
const OUString& rCID, bool bVisible)
 {
-    css::uno::Reference< css::chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xSeries.is())
@@ -175,7 +175,7 @@ void setTrendlineVisible(const 
rtl::Reference<::chart::ChartModel>&
 bool isErrorBarVisible(const rtl::Reference<::chart::ChartModel>& xModel,
                        const OUString& rCID, bool bYError)
 {
-    css::uno::Reference< css::chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xSeries.is())
@@ -187,7 +187,7 @@ bool isErrorBarVisible(const 
rtl::Reference<::chart::ChartModel>& xModel,
 void setErrorBarVisible(const rtl::Reference<::chart::ChartModel>&
         xModel, const OUString& rCID, bool bYError, bool bVisible)
 {
-    css::uno::Reference< css::chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xSeries.is())
@@ -208,7 +208,7 @@ void setErrorBarVisible(const 
rtl::Reference<::chart::ChartModel>&
 bool isPrimaryAxis(const rtl::Reference<::chart::ChartModel>&
         xModel, const OUString& rCID)
 {
-    css::uno::Reference< css::chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xSeries.is())
@@ -220,7 +220,7 @@ bool isPrimaryAxis(const 
rtl::Reference<::chart::ChartModel>&
 void setAttachedAxisType(const rtl::Reference<::chart::ChartModel>&
         xModel, const OUString& rCID, bool bPrimary)
 {
-    const uno::Reference<chart2::XDataSeries>& xDataSeries = 
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
+    const rtl::Reference<DataSeries> xDataSeries = 
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xDataSeries.is())
         return;
@@ -239,7 +239,7 @@ rtl::Reference<ChartType> getChartType(
 
 OUString getSeriesLabel(const rtl::Reference<::chart::ChartModel>& xModel, 
const OUString& rCID)
 {
-    css::uno::Reference< css::chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
 
     if (!xSeries.is())
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx 
b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index e8d1ebf50664..56a637dbb91f 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -34,6 +34,7 @@ namespace com::sun::star::uno { class Any; }
 namespace chart
 {
 class BaseCoordinateSystem;
+class LabeledDataSequence;
 
 struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
 {
@@ -83,8 +84,8 @@ public:
     bool hasComplexCategories() const;
     sal_Int32 getCategoryLevelCount() const;
 
-    const css::uno::Sequence< css::uno::Reference<
-        css::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() 
const { return m_aSplitCategoriesList;}
+    const std::vector< rtl::Reference<
+        ::chart::LabeledDataSequence> >& getSplitCategoriesList() const { 
return m_aSplitCategoriesList;}
 
     bool isDateAxis();
     const std::vector< double >&  getDateCategories();
@@ -96,13 +97,12 @@ private:
     bool volatile m_bDirty;
     unotools::WeakReference< ::chart::BaseCoordinateSystem >   m_xCooSysModel;
     ChartModel& mrModel;
-    css::uno::Reference< css::chart2::data::XLabeledDataSequence> 
m_xOriginalCategories;
+    rtl::Reference< ::chart::LabeledDataSequence> m_xOriginalCategories;
 
     bool m_bIsExplicitCategoriesInited;
     css::uno::Sequence< OUString >  m_aExplicitCategories;
     std::vector< std::vector< ComplexCategory > >   m_aComplexCats;
-    css::uno::Sequence< css::uno::Reference<
-        css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
+    std::vector< rtl::Reference< ::chart::LabeledDataSequence> > 
m_aSplitCategoriesList;
 
     bool m_bIsDateAxis;
     bool m_bIsAutoDate;
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx 
b/chart2/source/model/template/ChartTypeTemplate.cxx
index 126c902728b3..362706a68a66 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -58,7 +58,7 @@ namespace
 {
 
 void lcl_applyDefaultStyle(
-    const Reference< XDataSeries > & xSeries,
+    const rtl::Reference< ::chart::DataSeries > & xSeries,
     sal_Int32 nIndex,
     const rtl::Reference< ::chart::Diagram > & xDiagram )
 {
@@ -66,10 +66,9 @@ void lcl_applyDefaultStyle(
     // setting color as hard attribute
     if( xSeries.is() && xDiagram.is())
     {
-        Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY 
);
         Reference< chart2::XColorScheme > xColorScheme( 
xDiagram->getDefaultColorScheme());
-        if( xSeriesProp.is() && xColorScheme.is() )
-            xSeriesProp->setPropertyValue(
+        if( xColorScheme.is() )
+            xSeries->setPropertyValue(
                 "Color",
                 uno::Any( xColorScheme->getColorByIndex( nIndex )));
     }
@@ -436,13 +435,8 @@ void ChartTypeTemplate::resetStyles( const rtl::Reference< 
::chart::Diagram >& x
         for( rtl::Reference< ChartType > const & xChartType : 
xCooSys->getChartTypes2() )
         {
             //iterate through all series in this chart type
-            const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( 
xChartType->getDataSeries() );
-            for( Reference< XDataSeries > const & xSeries : aSeriesList )
+            for( rtl::Reference< DataSeries > const & xSeries : 
xChartType->getDataSeries2() )
             {
-                Reference< beans::XPropertySet > xSeriesProp( xSeries, 
uno::UNO_QUERY );
-                if(!xSeries.is() || !xSeriesProp.is() )
-                    continue;
-
                 uno::Sequence < sal_Int32 > aAvailablePlacements( 
ChartTypeHelper::getSupportedLabelPlacements(
                     xChartType, isSwapXAndY(), xSeries ) );
                 if(!aAvailablePlacements.hasElements())
@@ -450,10 +444,10 @@ void ChartTypeTemplate::resetStyles( const 
rtl::Reference< ::chart::Diagram >& x
 
                 sal_Int32 nDefaultPlacement = aAvailablePlacements[0];
 
-                lcl_resetLabelPlacementIfDefault( xSeriesProp, 
nDefaultPlacement );
+                lcl_resetLabelPlacementIfDefault( xSeries, nDefaultPlacement );
 
                 uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
-                if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) 
>>= aAttributedDataPointIndexList )
+                if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= 
aAttributedDataPointIndexList )
                     for(sal_Int32 
nN=aAttributedDataPointIndexList.getLength();nN--;)
                         lcl_resetLabelPlacementIfDefault( 
xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), 
nDefaultPlacement );
             }
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx 
b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 460cd2a583c8..1f3bd9c9a538 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -206,10 +206,10 @@ void ColumnLineChartTypeTemplate::createChartTypes(
 
         if( nNumberOfColumns > 0 )
         {
-            Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns 
);
+            std::vector< rtl::Reference< DataSeries > > aColumnSeq( 
nNumberOfColumns );
             std::copy( aFlatSeriesSeq.begin(),
                          aFlatSeriesSeq.begin() + nNumberOfColumns,
-                         aColumnSeq.getArray());
+                         aColumnSeq.begin());
             xCT->setDataSeries( aColumnSeq );
         }
 
@@ -220,10 +220,10 @@ void ColumnLineChartTypeTemplate::createChartTypes(
 
         if( nNumberOfLines > 0 )
         {
-            Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
+            std::vector< rtl::Reference< DataSeries > > aLineSeq( 
nNumberOfLines );
             std::copy( aFlatSeriesSeq.begin() + nNumberOfColumns,
                          aFlatSeriesSeq.end(),
-                         aLineSeq.getArray());
+                         aLineSeq.begin());
             xCT->setDataSeries( aLineSeq );
         }
     }
diff --git a/chart2/source/tools/AxisHelper.cxx 
b/chart2/source/tools/AxisHelper.cxx
index b8e8ca37c11f..258f8d384dc2 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -260,11 +260,8 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
                 {
                     if( nDimensionIndex != 0 )
                         aRoleToMatch = 
ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( chartType );
-                    const Sequence< Reference< XDataSeries > > aDataSeriesSeq( 
chartType->getDataSeries());
-                    for( Reference< chart2::XDataSeries > const & xDataSeries 
: aDataSeriesSeq )
+                    for( rtl::Reference< DataSeries > const & xDataSeries : 
chartType->getDataSeries2() )
                     {
-                        Reference< data::XDataSource > xSource( xDataSeries, 
uno::UNO_QUERY_THROW );
-
                         if( nDimensionIndex == 1 )
                         {
                             //only take those series into account that are 
attached to this axis
@@ -274,7 +271,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
                         }
 
                         Reference< data::XLabeledDataSequence > xLabeledSeq(
-                            DataSeriesHelper::getDataSequenceByRole( xSource, 
aRoleToMatch ) );
+                            DataSeriesHelper::getDataSequenceByRole( 
xDataSeries, aRoleToMatch ) );
 
                         if( !xLabeledSeq.is() && nDimensionIndex==0 )
                         {
@@ -958,16 +955,13 @@ bool AxisHelper::isSecondaryYAxisNeeded( const 
rtl::Reference< BaseCoordinateSys
     const std::vector< rtl::Reference< ChartType > > & aChartTypes( 
xCooSys->getChartTypes2() );
     for( rtl::Reference< ChartType > const & chartType : aChartTypes )
     {
-        Sequence< Reference< XDataSeries > > aSeriesList( 
chartType->getDataSeries() );
-        for( sal_Int32 nS = aSeriesList.getLength(); nS-- ; )
+        const std::vector< rtl::Reference< DataSeries > > & aSeriesList = 
chartType->getDataSeries2();
+        for( sal_Int32 nS = aSeriesList.size(); nS-- ; )
         {
-            Reference< beans::XPropertySet > xProp( aSeriesList[nS], 
uno::UNO_QUERY );
-            if(xProp.is())
-            {
-                sal_Int32 nAttachedAxisIndex = 0;
-                if( ( xProp->getPropertyValue( "AttachedAxisIndex" ) >>= 
nAttachedAxisIndex ) && nAttachedAxisIndex>0 )
-                    return true;
-            }
+            sal_Int32 nAttachedAxisIndex = 0;
+            if( ( aSeriesList[nS]->getPropertyValue( "AttachedAxisIndex" ) >>= 
nAttachedAxisIndex ) &&
+                    nAttachedAxisIndex>0 )
+                return true;
         }
     }
     return false;
diff --git a/chart2/source/tools/DataSeriesHelper.cxx 
b/chart2/source/tools/DataSeriesHelper.cxx
index 5f7ae4fcef5b..df7bef5e1de5 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -112,7 +112,7 @@ Reference< chart2::data::XLabeledDataSequence > 
lcl_findLSequenceWithOnlyLabel(
 }
 
 void lcl_getCooSysAndChartTypeOfSeries(
-    const Reference< chart2::XDataSeries > & xSeries,
+    const rtl::Reference< ::chart::DataSeries > & xSeries,
     const Reference< chart2::XDiagram > & xDiagram,
     rtl::Reference< ::chart::BaseCoordinateSystem > & xOutCooSys,
     rtl::Reference< ::chart::ChartType > & xOutChartType )
@@ -125,8 +125,7 @@ void lcl_getCooSysAndChartTypeOfSeries(
     {
         for( rtl::Reference< ::chart::ChartType > const & chartType : 
coords->getChartTypes2() )
         {
-            const Sequence< Reference< chart2::XDataSeries > > aSeries( 
chartType->getDataSeries());
-            for( Reference< chart2::XDataSeries > const & dataSeries : aSeries 
)
+            for( rtl::Reference< ::chart::DataSeries > const & dataSeries : 
chartType->getDataSeries2() )
             {
                 if( dataSeries == xSeries )
                 {
@@ -628,7 +627,9 @@ rtl::Reference< ::chart::BaseCoordinateSystem > 
getCoordinateSystemOfSeries(
 {
     rtl::Reference< ::chart::BaseCoordinateSystem > xResult;
     rtl::Reference< ::chart::ChartType > xDummy;
-    lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy );
+    rtl::Reference< DataSeries> pSeries = 
dynamic_cast<DataSeries*>(xSeries.get());
+    assert(pSeries);
+    lcl_getCooSysAndChartTypeOfSeries( pSeries, xDiagram, xResult, xDummy );
 
     return xResult;
 }
@@ -639,7 +640,9 @@ rtl::Reference< ::chart::ChartType > getChartTypeOfSeries(
 {
     rtl::Reference< ::chart::ChartType > xResult;
     rtl::Reference< ::chart::BaseCoordinateSystem > xDummy;
-    lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xDummy, xResult );
+    rtl::Reference< DataSeries> pSeries = 
dynamic_cast<DataSeries*>(xSeries.get());
+    assert(pSeries);
+    lcl_getCooSysAndChartTypeOfSeries( pSeries, xDiagram, xDummy, xResult );
 
     return xResult;
 }
@@ -650,14 +653,14 @@ void deleteSeries(
 {
     try
     {
-        auto aSeries(
-            comphelper::sequenceToContainer<std::vector< Reference< 
chart2::XDataSeries > > >( xChartType->getDataSeries()));
-        std::vector< Reference< chart2::XDataSeries > >::iterator aIt =
-              std::find( aSeries.begin(), aSeries.end(), xSeries );
+        rtl::Reference<DataSeries> pSeries = 
dynamic_cast<DataSeries*>(xSeries.get());
+        assert(pSeries);
+        std::vector< rtl::Reference< DataSeries > > aSeries = 
xChartType->getDataSeries2();
+        auto aIt = std::find( aSeries.begin(), aSeries.end(), pSeries );
         if( aIt != aSeries.end())
         {
             aSeries.erase( aIt );
-            xChartType->setDataSeries( comphelper::containerToSequence( 
aSeries ));
+            xChartType->setDataSeries( aSeries );
         }
     }
     catch( const uno::Exception & )
diff --git a/chart2/source/tools/DataSourceHelper.cxx 
b/chart2/source/tools/DataSourceHelper.cxx
index c2680446e1b8..dc13e7f8e29d 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -76,16 +76,15 @@ void lcl_addDataSourceRanges(
 
 void lcl_addErrorBarRanges(
     std::vector< OUString > & rOutResult,
-    const uno::Reference< XDataSeries > & xDataSeries )
+    const rtl::Reference< DataSeries > & xDataSeries )
 {
-    uno::Reference< beans::XPropertySet > xSeriesProp( xDataSeries, 
uno::UNO_QUERY );
-    if( !xSeriesProp.is())
+    if( !xDataSeries.is())
         return;
 
     try
     {
         uno::Reference< beans::XPropertySet > xErrorBarProp;
-        if( ( xSeriesProp->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= 
xErrorBarProp ) &&
+        if( ( xDataSeries->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= 
xErrorBarProp ) &&
             xErrorBarProp.is())
         {
             sal_Int32 eStyle = css::chart::ErrorBarStyle::NONE;
@@ -98,7 +97,7 @@ void lcl_addErrorBarRanges(
             }
         }
 
-        if( ( xSeriesProp->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= 
xErrorBarProp ) && xErrorBarProp.is())
+        if( ( xDataSeries->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= 
xErrorBarProp ) && xErrorBarProp.is())
         {
             sal_Int32 eStyle = css::chart::ErrorBarStyle::NONE;
             if( ( xErrorBarProp->getPropertyValue("ErrorBarStyle") >>= eStyle 
) &&
diff --git a/chart2/source/tools/DiagramHelper.cxx 
b/chart2/source/tools/DiagramHelper.cxx
index 463e059c7b9a..867e047ca1dd 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -266,12 +266,9 @@ void DiagramHelper::setStackMode(
             rtl::Reference< ChartType > xChartType( aChartTypeList[0] );
 
             //iterate through all series in this chart type
-            const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( 
xChartType->getDataSeries() );
-            for( uno::Reference< XDataSeries > const & dataSeries : 
aSeriesList )
+            for( rtl::Reference< DataSeries > const & dataSeries : 
xChartType->getDataSeries2() )
             {
-                Reference< beans::XPropertySet > xProp( dataSeries, 
uno::UNO_QUERY );
-                if(xProp.is())
-                    xProp->setPropertyValue( "StackingDirection", 
aNewDirection );
+                dataSeries->setPropertyValue( "StackingDirection", 
aNewDirection );
             }
         }
     }
@@ -327,22 +324,21 @@ StackMode DiagramHelper::getStackModeFromChartType(
 
     try
     {
-        Sequence< Reference< chart2::XDataSeries > > aSeries( 
xChartType->getDataSeries());
+        const std::vector< rtl::Reference< DataSeries > > & aSeries = 
xChartType->getDataSeries2();
 
         chart2::StackingDirection eCommonDirection = 
chart2::StackingDirection_NO_STACKING;
         bool bDirectionInitialized = false;
 
         // first series is irrelevant for stacking, start with second, unless
         // there is only one series
-        const sal_Int32 nSeriesCount = aSeries.getLength();
+        const sal_Int32 nSeriesCount = aSeries.size();
         sal_Int32 i = (nSeriesCount == 1) ? 0: 1;
         for( ; i<nSeriesCount; ++i )
         {
             rbFound = true;
-            Reference< beans::XPropertySet > xProp( aSeries[i], 
uno::UNO_QUERY_THROW );
             chart2::StackingDirection eCurrentDirection = eCommonDirection;
             // property is not MAYBEVOID
-            bool bSuccess = ( xProp->getPropertyValue( "StackingDirection" ) 
>>= eCurrentDirection );
+            bool bSuccess = ( aSeries[i]->getPropertyValue( 
"StackingDirection" ) >>= eCurrentDirection );
             OSL_ASSERT( bSuccess );
             if( ! bDirectionInitialized )
             {
@@ -579,6 +575,8 @@ rtl::Reference< ChartType > 
DiagramHelper::getChartTypeOfSeries(
         return nullptr;
     if(!xDiagram.is())
         return nullptr;
+    rtl::Reference pGivenDataSeries = 
dynamic_cast<DataSeries*>(xGivenDataSeries.get());
+    assert(pGivenDataSeries);
 
     //iterate through the model to find the given xSeries
     //the found parent indicates the charttype
@@ -592,10 +590,9 @@ rtl::Reference< ChartType > 
DiagramHelper::getChartTypeOfSeries(
         for( rtl::Reference< ChartType > const & xChartType : aChartTypeList )
         {
             //iterate through all series in this chart type
-            const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( 
xChartType->getDataSeries() );
-            for( uno::Reference< XDataSeries > const & dataSeries : 
aSeriesList )
+            for( rtl::Reference< DataSeries > const & dataSeries : 
xChartType->getDataSeries2() )
             {
-                if( xGivenDataSeries==dataSeries )
+                if( pGivenDataSeries==dataSeries )
                     return xChartType;
             }
         }
@@ -834,14 +831,11 @@ static void lcl_generateAutomaticCategoriesFromChartType(
         return;
     OUString aMainSeq( xChartType->getRoleOfSequenceForSeriesLabel() );
 
-    const Sequence< Reference< XDataSeries > > aSeriesSeq( 
xChartType->getDataSeries() );
-    for( Reference< XDataSeries > const & dataSeries : aSeriesSeq )
+    const std::vector< rtl::Reference< DataSeries > > & aSeriesSeq = 
xChartType->getDataSeries2();
+    for( rtl::Reference< DataSeries > const & dataSeries : aSeriesSeq )
     {
-        Reference< data::XDataSource > xDataSource( dataSeries, uno::UNO_QUERY 
);
-        if( !xDataSource.is() )
-            continue;
-        Reference< chart2::data::XLabeledDataSequence > xLabeledSeq(
-            ::chart::DataSeriesHelper::getDataSequenceByRole( xDataSource, 
aMainSeq ));
+        uno::Reference< data::XLabeledDataSequence > xLabeledSeq =
+            ::chart::DataSeriesHelper::getDataSequenceByRole( dataSeries, 
aMainSeq );
         if( !xLabeledSeq.is() )
             continue;
         Reference< chart2::data::XDataSequence > xValueSeq( 
xLabeledSeq->getValues() );
@@ -1173,7 +1167,7 @@ namespace
 
 bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
     const rtl::Reference< Diagram >& xDiagram,
-    const Reference< XDataSeries >& xGivenDataSeries,
+    const rtl::Reference< DataSeries >& xGivenDataSeries,
     bool bForward,
     bool bDoMove )
 {
@@ -1201,10 +1195,9 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
 
                     //iterate through all series in this chart type
 
-                    uno::Sequence< uno::Reference< XDataSeries > > 
aSeriesList( xCurrentChartType->getDataSeries() );
-                    auto aSeriesListRange = asNonConstRange(aSeriesList);
+                    std::vector< rtl::Reference< DataSeries > > aSeriesList = 
xCurrentChartType->getDataSeries2();
 
-                    for( sal_Int32 nS = 0; !bFound && nS < 
aSeriesList.getLength(); ++nS )
+                    for( sal_Int32 nS = 0; !bFound && nS < 
static_cast<sal_Int32>(aSeriesList.size()); ++nS )
                     {
 
                         // We found the series we are interested in!
@@ -1223,14 +1216,14 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
                                 else
                                     nNewSeriesIndex++;
 
-                                if( nNewSeriesIndex >= 0 && nNewSeriesIndex < 
aSeriesList.getLength() )
+                                if( nNewSeriesIndex >= 0 && nNewSeriesIndex < 
static_cast<sal_Int32>(aSeriesList.size()) )
                                 {
                                     //move series in the same charttype
                                     bMovedOrMoveAllowed = true;
                                     if( bDoMove )
                                     {
-                                        aSeriesListRange[ nOldSeriesIndex ] = 
aSeriesList[ nNewSeriesIndex ];
-                                        aSeriesListRange[ nNewSeriesIndex ] = 
xGivenDataSeries;
+                                        aSeriesList[ nOldSeriesIndex ] = 
aSeriesList[ nNewSeriesIndex ];
+                                        aSeriesList[ nNewSeriesIndex ] = 
xGivenDataSeries;
                                         xCurrentChartType->setDataSeries( 
aSeriesList );
                                     }
                                 }
@@ -1242,15 +1235,15 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
                                         bMovedOrMoveAllowed = true;
                                         if( bDoMove )
                                         {
-                                            uno::Sequence< uno::Reference< 
XDataSeries > > aOtherSeriesList( xFormerChartType->getDataSeries() );
-                                            sal_Int32 nOtherSeriesIndex = 
aOtherSeriesList.getLength()-1;
-                                            if( nOtherSeriesIndex >= 0 && 
nOtherSeriesIndex < aOtherSeriesList.getLength() )
+                                            std::vector< rtl::Reference< 
DataSeries > > aOtherSeriesList = xFormerChartType->getDataSeries2();
+                                            sal_Int32 nOtherSeriesIndex = 
aOtherSeriesList.size()-1;
+                                            if( nOtherSeriesIndex >= 0 && 
nOtherSeriesIndex < static_cast<sal_Int32>(aOtherSeriesList.size()) )
                                             {
-                                                uno::Reference< XDataSeries > 
xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
-                                                
aOtherSeriesList.getArray()[nOtherSeriesIndex] = xGivenDataSeries;
+                                                rtl::Reference< DataSeries > 
xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
+                                                
aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
                                                 
xFormerChartType->setDataSeries(aOtherSeriesList);
 
-                                                
aSeriesListRange[nOldSeriesIndex]=xExchangeSeries;
+                                                
aSeriesList[nOldSeriesIndex]=xExchangeSeries;
                                                 
xCurrentChartType->setDataSeries(aSeriesList);
                                             }
                                         }
@@ -1265,14 +1258,14 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed(
                                         bMovedOrMoveAllowed = true;
                                         if( bDoMove )
                                         {
-                                            uno::Sequence< uno::Reference< 
XDataSeries > > aOtherSeriesList( xOtherChartType->getDataSeries() );
-                                            if( aOtherSeriesList.hasElements() 
)
+                                            std::vector< rtl::Reference< 
DataSeries > > aOtherSeriesList = xOtherChartType->getDataSeries2();
+                                            if( !aOtherSeriesList.empty() )
                                             {
-                                                uno::Reference< XDataSeries > 
xExchangeSeries( aOtherSeriesList[0] );
-                                                aOtherSeriesList.getArray()[0] 
= xGivenDataSeries;
+                                                rtl::Reference< DataSeries > 
xExchangeSeries( aOtherSeriesList[0] );
+                                                aOtherSeriesList[0] = 
xGivenDataSeries;
                                                 
xOtherChartType->setDataSeries(aOtherSeriesList);
 
-                                                
aSeriesListRange[nOldSeriesIndex]=xExchangeSeries;
+                                                
aSeriesList[nOldSeriesIndex]=xExchangeSeries;
                                                 
xCurrentChartType->setDataSeries(aSeriesList);
                                             }
                                         }
@@ -1309,8 +1302,11 @@ bool DiagramHelper::isSeriesMoveable(
 {
     const bool bDoMove = false;
 
+    rtl::Reference pGivenDataSeries = 
dynamic_cast<DataSeries*>(xGivenDataSeries.get());
+    assert(pGivenDataSeries || !xGivenDataSeries);
+
     bool bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed(
-        xDiagram, xGivenDataSeries, bForward, bDoMove );
+        xDiagram, pGivenDataSeries, bForward, bDoMove );
 
     return bIsMoveable;
 }
@@ -1319,8 +1315,11 @@ bool DiagramHelper::moveSeries( const rtl::Reference< 
Diagram >& xDiagram, const
 {
     const bool bDoMove = true;
 
+    rtl::Reference pGivenDataSeries = 
dynamic_cast<DataSeries*>(xGivenDataSeries.get());
+    assert(pGivenDataSeries || !xGivenDataSeries);
+
     bool bMoved = lcl_moveSeriesOrCheckIfMoveIsAllowed(
-        xDiagram, xGivenDataSeries, bForward, bDoMove );
+        xDiagram, pGivenDataSeries, bForward, bDoMove );
 
     return bMoved;
 }
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx 
b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index 9def633272b3..4f2a4aa35787 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -30,6 +30,7 @@
 #include <unonames.hxx>
 #include <BaseCoordinateSystem.hxx>
 #include <DataSeries.hxx>
+#include <LabeledDataSequence.hxx>
 
 #include <com/sun/star/chart2/AxisType.hpp>
 #include <com/sun/star/chart2/XDataSeries.hpp>
@@ -48,6 +49,17 @@ using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Sequence;
 using std::vector;
 
+static std::vector< rtl::Reference< LabeledDataSequence> > 
lcl_toLabeledDataSequence(const Sequence< Reference< 
data::XLabeledDataSequence> > & rSeq)
+{
+    std::vector<rtl::Reference< LabeledDataSequence>> aRes(rSeq.getLength());
+    for (sal_Int32 i=0; i<rSeq.getLength(); ++i)
+    {
+        aRes[i] = dynamic_cast<LabeledDataSequence*>(rSeq[i].get());
+        assert(aRes[i]);
+    }
+    return aRes;
+}
+
 ExplicitCategoriesProvider::ExplicitCategoriesProvider( const rtl::Reference< 
BaseCoordinateSystem >& xCooSysModel
                                                        , ChartModel& rModel )
     : m_bDirty(true)
@@ -66,7 +78,8 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const 
rtl::Reference< Ba
             if( xAxis.is() )
             {
                 ScaleData aScale( xAxis->getScaleData() );
-                m_xOriginalCategories = aScale.Categories;
+                m_xOriginalCategories = 
dynamic_cast<LabeledDataSequence*>(aScale.Categories.get());
+                assert(m_xOriginalCategories || !aScale.Categories);
                 m_bIsAutoDate = (aScale.AutoDateAxis && 
aScale.AxisType==chart2::AxisType::CATEGORY);
                 m_bIsDateAxis = (aScale.AxisType == chart2::AxisType::DATE || 
m_bIsAutoDate);
             }
@@ -115,13 +128,13 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( 
const rtl::Reference< Ba
                                     aStringDummy, aSeqDummy, 
bSeriesUsesColumns, bDummy, bDummy );
                         }
                         if( bSeriesUsesColumns )
-                            m_aSplitCategoriesList=aColumns;
+                            m_aSplitCategoriesList = 
lcl_toLabeledDataSequence(aColumns);
                         else
-                            m_aSplitCategoriesList=aRows;
+                            m_aSplitCategoriesList = 
lcl_toLabeledDataSequence(aRows);
                     }
                 }
             }
-            if( !m_aSplitCategoriesList.hasElements() )
+            if( m_aSplitCategoriesList.empty() )
             {
                 m_aSplitCategoriesList = { m_xOriginalCategories };
             }
@@ -146,12 +159,12 @@ Reference< chart2::data::XDataSequence > 
ExplicitCategoriesProvider::getOriginal
 
 bool ExplicitCategoriesProvider::hasComplexCategories() const
 {
-    return m_aSplitCategoriesList.getLength() > 1;
+    return m_aSplitCategoriesList.size() > 1;
 }
 
 sal_Int32 ExplicitCategoriesProvider::getCategoryLevelCount() const
 {
-    sal_Int32 nCount = m_aSplitCategoriesList.getLength();
+    sal_Int32 nCount = m_aSplitCategoriesList.size();
     if(!nCount)
         nCount = 1;
     return nCount;
@@ -224,8 +237,8 @@ class SplitCategoriesProvider_ForLabeledDataSequences : 
public SplitCategoriesPr
 public:
 
     explicit SplitCategoriesProvider_ForLabeledDataSequences(
-        const css::uno::Sequence<
-            css::uno::Reference< css::chart2::data::XLabeledDataSequence> >& 
rSplitCategoriesList
+        const std::vector<
+            rtl::Reference< LabeledDataSequence> >& rSplitCategoriesList
         , ChartModel& rModel )
         : m_rSplitCategoriesList( rSplitCategoriesList )
         , mrModel( rModel )
@@ -235,8 +248,7 @@ public:
     virtual uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) 
const override;
 
 private:
-    const css::uno::Sequence< css::uno::Reference<
-        css::chart2::data::XLabeledDataSequence> >& m_rSplitCategoriesList;
+    const std::vector< rtl::Reference< LabeledDataSequence> >& 
m_rSplitCategoriesList;
 
     ChartModel& mrModel;
 };
@@ -245,7 +257,7 @@ private:
 
 sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() 
const
 {
-    return m_rSplitCategoriesList.getLength();
+    return m_rSplitCategoriesList.size();
 }
 uno::Sequence< OUString > 
SplitCategoriesProvider_ForLabeledDataSequences::getStringsForLevel( sal_Int32 
nLevel ) const
 {
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index 91e09b5ef303..9bab0b5ddd64 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -339,11 +339,11 @@ InternalDataProvider::InternalDataProvider(
                 {
                     ExplicitCategoriesProvider 
aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(xModel), 
*xModel);
 
-                    const Sequence< Reference< 
chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( 
aExplicitCategoriesProvider.getSplitCategoriesList() );
-                    sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
+                    const std::vector< rtl::Reference< LabeledDataSequence> >& 
rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
+                    sal_Int32 nLevelCount = rSplitCategoriesList.size();
                     for( sal_Int32 nL = 0; nL<nLevelCount; nL++ )
                     {
-                        Reference< chart2::data::XLabeledDataSequence > xLDS( 
rSplitCategoriesList[nL] );
+                        rtl::Reference< LabeledDataSequence > xLDS( 
rSplitCategoriesList[nL] );
                         if( !xLDS.is() )
                             continue;
                         Sequence< uno::Any > aDataSeq;
diff --git a/chart2/source/tools/ObjectIdentifier.cxx 
b/chart2/source/tools/ObjectIdentifier.cxx
index a34c3a33d13e..058314eae395 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -1171,8 +1171,8 @@ Reference< beans::XPropertySet > 
ObjectIdentifier::getObjectPropertySet(
             case OBJECTTYPE_DATA_LABEL:
             case OBJECTTYPE_DATA_POINT:
                 {
-                    Reference< XDataSeries > xSeries( 
ObjectIdentifier::getDataSeriesForCID(
-                        rObjectCID, xChartModel ) );
+                    rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID(
+                        rObjectCID, xChartModel );
                     if(xSeries.is())
                     {
                         sal_Int32 nIndex = aParticleID.toInt32();
@@ -1184,26 +1184,22 @@ Reference< beans::XPropertySet > 
ObjectIdentifier::getObjectPropertySet(
             case OBJECTTYPE_DATA_ERRORS_Y:
             case OBJECTTYPE_DATA_ERRORS_Z:
                 {
-                    Reference< XDataSeries > xSeries( 
ObjectIdentifier::getDataSeriesForCID(
-                        rObjectCID, xChartModel ) );
+                    rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID(
+                        rObjectCID, xChartModel );
                     if(xSeries.is())
                     {
-                        Reference< beans::XPropertySet > xSeriesProp( xSeries, 
uno::UNO_QUERY );
                         Reference< beans::XPropertySet > xErrorBarProp;
-                        if( xSeriesProp.is() )
-                        {
-                            OUString errorBar;
+                        OUString errorBar;
 
-                            if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
-                                errorBar = CHART_UNONAME_ERRORBAR_X;
-                            else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
-                                errorBar = CHART_UNONAME_ERRORBAR_Y;
-                            else
-                                errorBar = "ErrorBarZ";
+                        if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
+                            errorBar = CHART_UNONAME_ERRORBAR_X;
+                        else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
+                            errorBar = CHART_UNONAME_ERRORBAR_Y;
+                        else
+                            errorBar = "ErrorBarZ";
 
-                            xSeriesProp->getPropertyValue( errorBar ) >>= 
xErrorBarProp;
-                            xObjectProperties = xErrorBarProp;
-                        }
+                        xSeries->getPropertyValue( errorBar ) >>= 
xErrorBarProp;
+                        xObjectProperties = xErrorBarProp;
                     }
                     break;
                 }
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 0c236b1ff3d6..e2a4d07cd3c7 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -2307,7 +2307,7 @@ uno::Sequence< OUString > 
VSeriesPlotter::getSeriesNames() const
             if (!rSeriesGroup.m_aSeriesVector.empty())
             {
                 VDataSeries const * pSeries = 
rSeriesGroup.m_aSeriesVector[0].get();
-                uno::Reference< XDataSeries > xSeries( pSeries ? 
pSeries->getModel() : nullptr );
+                rtl::Reference< DataSeries > xSeries( pSeries ? 
pSeries->getModel() : nullptr );
                 if( xSeries.is() )
                 {
                     OUString aSeriesName( 
DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ) );

Reply via email to