chart2/source/controller/dialogs/DataBrowser.cxx      |    9 -
 chart2/source/controller/dialogs/DataBrowserModel.cxx |  160 ++++++++----------
 chart2/source/controller/dialogs/DataBrowserModel.hxx |    5 
 chart2/source/view/inc/VDataSeries.hxx                |    3 
 chart2/source/view/main/VDataSeries.cxx               |    3 
 5 files changed, 90 insertions(+), 90 deletions(-)

New commits:
commit d48530c535574a827d7261ae8d9d1068fd53c5aa
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Jan 24 19:22:28 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Jan 25 16:25:41 2022 +0100

    use more concrete types in chart2, ChartType
    
    Change-Id: I5efd85ac51fbb8bd3cd9a9d2e07b345782d0fdc1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128882
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx 
b/chart2/source/controller/dialogs/DataBrowser.cxx
index 0fc400b740c9..1df9535a5713 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -31,6 +31,7 @@
 #include <bitmaps.hlst>
 #include <helpids.h>
 #include <ChartModel.hxx>
+#include <ChartType.hxx>
 
 #include <vcl/weld.hxx>
 #include <vcl/settings.hxx>
@@ -171,7 +172,7 @@ public:
     void SetColor( const Color & rCol );
     void SetPos();
     void SetWidth( sal_Int32 nWidth );
-    void SetChartType( const Reference< chart2::XChartType > & xChartType,
+    void SetChartType( const rtl::Reference< ::chart::ChartType > & xChartType,
                        bool bSwapXAndYAxis );
     void SetSeriesName( const OUString & rName );
     void SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol );
@@ -223,7 +224,7 @@ private:
     DECL_LINK( SeriesNameEdited, SeriesHeaderEdit&, void );
 
     static OUString GetChartTypeImage(
-        const Reference< chart2::XChartType > & xChartType,
+        const rtl::Reference< ::chart::ChartType > & xChartType,
         bool bSwapXAndYAxis
         );
 
@@ -324,7 +325,7 @@ void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
 }
 
 void SeriesHeader::SetChartType(
-    const Reference< chart2::XChartType > & xChartType,
+    const rtl::Reference< ChartType > & xChartType,
     bool bSwapXAndYAxis
 )
 {
@@ -382,7 +383,7 @@ bool SeriesHeader::HasFocus() const
 }
 
 OUString SeriesHeader::GetChartTypeImage(
-    const Reference< chart2::XChartType > & xChartType,
+    const rtl::Reference< ChartType > & xChartType,
     bool bSwapXAndYAxis
 )
 {
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx 
b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 0455adf3212f..6171c1c87242 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -464,8 +464,7 @@ void 
DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
         return;
     }
 
-    Reference<chart2::XDataSeriesContainer> xSeriesCnt(
-        getHeaderForSeries(xSeries).m_xChartType, uno::UNO_QUERY);
+    rtl::Reference<ChartType> 
xSeriesCnt(getHeaderForSeries(xSeries).m_xChartType);
     if (!xSeriesCnt.is())
     {
         // Unexpected happened.  Bail out.
@@ -804,101 +803,98 @@ void DataBrowserModel::updateFromModel()
     const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( 
xDiagram->getBaseCoordinateSystems());
     for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
     {
-        const Sequence< Reference< chart2::XChartType > > aChartTypes( 
coords->getChartTypes());
+        const std::vector< rtl::Reference< ChartType > > aChartTypes( 
coords->getChartTypes2());
         sal_Int32 nXAxisNumberFormat = 
DataSeriesHelper::getNumberFormatKeyFromAxis( nullptr, coords, 0, 0 );
 
-        for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+        for( sal_Int32 nCTIdx=0; nCTIdx < 
static_cast<sal_Int32>(aChartTypes.size()); ++nCTIdx )
         {
-            Reference< chart2::XDataSeriesContainer > xSeriesCnt( 
aChartTypes[nCTIdx], uno::UNO_QUERY );
-            if( xSeriesCnt.is())
-            {
-                OUString aRoleForDataLabelNumberFormat = 
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( 
aChartTypes[nCTIdx] );
+            rtl::Reference< ChartType > xSeriesCnt( aChartTypes[nCTIdx] );
+            OUString aRoleForDataLabelNumberFormat = 
ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( 
aChartTypes[nCTIdx] );
 
-                const Sequence< Reference< chart2::XDataSeries > > aSeries( 
xSeriesCnt->getDataSeries());
-                lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( 
aSeries ));
-                for (auto const& sharedSequence : aSharedSequences)
-                {
-                    tDataColumn aSharedSequence;
-                    aSharedSequence.m_xLabeledDataSequence = sharedSequence;
-                    aSharedSequence.m_aUIRoleName = 
lcl_getUIRoleName(sharedSequence);
-                    aSharedSequence.m_eCellType = NUMBER;
-                    // as the sequences are shared it should be ok to take the 
first series
-                    // @todo: dimension index 0 for x-values used here. This 
is just a guess.
-                    // Also, the axis index is 0, as there is usually only one 
x-axis
-                    aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
-                    m_aColumns.push_back( aSharedSequence );
-                    ++nHeaderStart;
-                }
-                for( Reference< chart2::XDataSeries > const & dataSeries : 
aSeries )
+            const Sequence< Reference< chart2::XDataSeries > > aSeries( 
xSeriesCnt->getDataSeries());
+            lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( 
aSeries ));
+            for (auto const& sharedSequence : aSharedSequences)
+            {
+                tDataColumn aSharedSequence;
+                aSharedSequence.m_xLabeledDataSequence = sharedSequence;
+                aSharedSequence.m_aUIRoleName = 
lcl_getUIRoleName(sharedSequence);
+                aSharedSequence.m_eCellType = NUMBER;
+                // as the sequences are shared it should be ok to take the 
first series
+                // @todo: dimension index 0 for x-values used here. This is 
just a guess.
+                // Also, the axis index is 0, as there is usually only one 
x-axis
+                aSharedSequence.m_nNumberFormatKey = nXAxisNumberFormat;
+                m_aColumns.push_back( aSharedSequence );
+                ++nHeaderStart;
+            }
+            for( Reference< chart2::XDataSeries > 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())
                 {
-                    tDataColumnVector::size_type nStartColIndex = 
m_aColumns.size();
-                    Reference< chart2::XDataSeries > xSeries( dataSeries );
-                    Reference< chart2::data::XDataSource > xSource( xSeries, 
uno::UNO_QUERY );
-                    if( xSource.is())
+                    Sequence< Reference< chart2::data::XLabeledDataSequence > 
> aLSeqs( xSource->getDataSequences());
+                    if( !aLSeqs.hasElements() )
+                        continue;
+                    nHeaderEnd = nHeaderStart;
+
+                    // @todo: dimension index 1 for y-values used here. This 
is just a guess
+                    sal_Int32 nYAxisNumberFormatKey =
+                        DataSeriesHelper::getNumberFormatKeyFromAxis(
+                            dataSeries, coords, 1 );
+
+                    sal_Int32 nSeqIdx=0;
+                    for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
                     {
-                        Sequence< Reference< 
chart2::data::XLabeledDataSequence > > aLSeqs( xSource->getDataSequences());
-                        if( !aLSeqs.hasElements() )
-                            continue;
-                        nHeaderEnd = nHeaderStart;
-
-                        // @todo: dimension index 1 for y-values used here. 
This is just a guess
-                        sal_Int32 nYAxisNumberFormatKey =
-                            DataSeriesHelper::getNumberFormatKeyFromAxis(
-                                dataSeries, coords, 1 );
-
-                        sal_Int32 nSeqIdx=0;
-                        for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx )
+                        sal_Int32 nSequenceNumberFormatKey = 
nYAxisNumberFormatKey;
+                        OUString aRole = 
DataSeriesHelper::getRole(aLSeqs[nSeqIdx]);
+
+                        if( aRole == aRoleForDataLabelNumberFormat )
                         {
-                            sal_Int32 nSequenceNumberFormatKey = 
nYAxisNumberFormatKey;
-                            OUString aRole = 
DataSeriesHelper::getRole(aLSeqs[nSeqIdx]);
-
-                            if( aRole == aRoleForDataLabelNumberFormat )
-                            {
-                                nSequenceNumberFormatKey = 
ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
-                                    Reference< beans::XPropertySet >( xSeries, 
uno::UNO_QUERY ));
-                            }
-                            else if( aRole == "values-x" )
-                                nSequenceNumberFormatKey = nXAxisNumberFormat;
-
-                            if( std::none_of( aSharedSequences.begin(), 
aSharedSequences.end(),
-                                             lcl_RepresentationsOfLSeqMatch( 
aLSeqs[nSeqIdx] )) )
-                            {
-                                // no shared sequence
-                                m_aColumns.emplace_back(
-                                        dataSeries,
-                                        lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
-                                        aLSeqs[nSeqIdx],
-                                        NUMBER,
-                                        nSequenceNumberFormatKey );
-                                ++nHeaderEnd;
-                            }
-                            // else skip
+                            nSequenceNumberFormatKey = 
ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+                                Reference< beans::XPropertySet >( xSeries, 
uno::UNO_QUERY ));
                         }
-                        bool bSwapXAndYAxis = false;
-                        try
+                        else if( aRole == "values-x" )
+                            nSequenceNumberFormatKey = nXAxisNumberFormat;
+
+                        if( std::none_of( aSharedSequences.begin(), 
aSharedSequences.end(),
+                                         lcl_RepresentationsOfLSeqMatch( 
aLSeqs[nSeqIdx] )) )
                         {
-                            coords->getPropertyValue( "SwapXAndYAxis" ) >>= 
bSwapXAndYAxis;
+                            // no shared sequence
+                            m_aColumns.emplace_back(
+                                    dataSeries,
+                                    lcl_getUIRoleName( aLSeqs[nSeqIdx] ),
+                                    aLSeqs[nSeqIdx],
+                                    NUMBER,
+                                    nSequenceNumberFormatKey );
+                            ++nHeaderEnd;
                         }
-                        catch( const beans::UnknownPropertyException & ) {}
+                        // else skip
+                    }
+                    bool bSwapXAndYAxis = false;
+                    try
+                    {
+                        coords->getPropertyValue( "SwapXAndYAxis" ) >>= 
bSwapXAndYAxis;
+                    }
+                    catch( const beans::UnknownPropertyException & ) {}
 
-                        // add ranges for error bars if present for a series
-                        if( StatisticsHelper::usesErrorBarRanges( dataSeries ))
-                            addErrorBarRanges( dataSeries, 
nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true );
+                    // add ranges for error bars if present for a series
+                    if( StatisticsHelper::usesErrorBarRanges( dataSeries ))
+                        addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, 
nSeqIdx, nHeaderEnd, true );
 
-                        if( StatisticsHelper::usesErrorBarRanges( dataSeries, 
/* bYError = */ false ))
-                            addErrorBarRanges( dataSeries, 
nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false );
+                    if( StatisticsHelper::usesErrorBarRanges( dataSeries, /* 
bYError = */ false ))
+                        addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, 
nSeqIdx, nHeaderEnd, false );
 
-                        m_aHeaders.emplace_back(
-                                dataSeries,
-                                aChartTypes[nCTIdx],
-                                bSwapXAndYAxis,
-                                nHeaderStart,
-                                nHeaderEnd - 1 );
+                    m_aHeaders.emplace_back(
+                            dataSeries,
+                            aChartTypes[nCTIdx],
+                            bSwapXAndYAxis,
+                            nHeaderStart,
+                            nHeaderEnd - 1 );
 
-                        nHeaderStart = nHeaderEnd;
+                    nHeaderStart = nHeaderEnd;
 
-                        std::sort( m_aColumns.begin() + nStartColIndex, 
m_aColumns.end(), implColumnLess() );
-                    }
+                    std::sort( m_aColumns.begin() + nStartColIndex, 
m_aColumns.end(), implColumnLess() );
                 }
             }
         }
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx 
b/chart2/source/controller/dialogs/DataBrowserModel.hxx
index d7c7be071f66..fe7faa53083d 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -37,6 +37,7 @@ namespace chart
 
 class DialogModel;
 class ChartModel;
+class ChartType;
 
 class DataBrowserModel final
 {
@@ -99,7 +100,7 @@ public:
     struct tDataHeader
     {
         css::uno::Reference< css::chart2::XDataSeries > m_xDataSeries;
-        css::uno::Reference< css::chart2::XChartType >  m_xChartType;
+        rtl::Reference< ::chart::ChartType >  m_xChartType;
         bool                                            m_bSwapXAndYAxis;
         sal_Int32                                       m_nStartColumn;
         sal_Int32                                       m_nEndColumn;
@@ -113,7 +114,7 @@ public:
         // "full" CTOR
         tDataHeader(
             css::uno::Reference< css::chart2::XDataSeries > const & 
xDataSeries,
-            css::uno::Reference< css::chart2::XChartType > const &xChartType,
+            rtl::Reference< ::chart::ChartType > const &xChartType,
             bool                                        bSwapXAndYAxis,
             sal_Int32                                   nStartColumn,
             sal_Int32                                   nEndColumn ) :
diff --git a/chart2/source/view/inc/VDataSeries.hxx 
b/chart2/source/view/inc/VDataSeries.hxx
index 11d916510961..a2162d7bc064 100644
--- a/chart2/source/view/inc/VDataSeries.hxx
+++ b/chart2/source/view/inc/VDataSeries.hxx
@@ -41,6 +41,7 @@ namespace com::sun::star::drawing { class XShapes; }
 
 namespace chart
 {
+class ChartType;
 
 class VDataSequence
 {
@@ -107,7 +108,7 @@ public:
     sal_Int32   detectNumberFormatKey( sal_Int32 nPointIndex ) const;
 
     sal_Int32 getLabelPlacement(
-        sal_Int32 nPointIndex, const 
css::uno::Reference<css::chart2::XChartType>& xChartType,
+        sal_Int32 nPointIndex, const rtl::Reference<::chart::ChartType>& 
xChartType,
         bool bSwapXAndY ) const;
 
     css::awt::Point getLabelPosition( css::awt::Point aTextShapePos, sal_Int32 
nPointIndex ) const;
diff --git a/chart2/source/view/main/VDataSeries.cxx 
b/chart2/source/view/main/VDataSeries.cxx
index a650adcef066..9b5813c56c4d 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -23,6 +23,7 @@
 #include <ObjectIdentifier.hxx>
 #include <CommonConverters.hxx>
 #include <LabelPositionHelper.hxx>
+#include <ChartType.hxx>
 #include <ChartTypeHelper.hxx>
 #include <RegressionCurveHelper.hxx>
 #include <unonames.hxx>
@@ -574,7 +575,7 @@ sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 
index ) const
     return nRet;
 }
 
-sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const 
uno::Reference< chart2::XChartType >& xChartType, bool bSwapXAndY ) const
+sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const 
rtl::Reference< ChartType >& xChartType, bool bSwapXAndY ) const
 {
     sal_Int32 nLabelPlacement=0;
     try

Reply via email to