summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-29 16:45:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 11:14:30 +0000
commitefbbc141b0db77510b41b452bf3931fc3c9ecc7e (patch)
treefaec036400d2a63cb0a81bd14e0e4d564b895315 /chart2
parent1c8d43d8a9062dbe2cff52b61414e8be6d3b646d (diff)
use more concrete types in chart2
Change-Id: Iaefad282d40c83f58758b41db9b14f6e95552354 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149742 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx2
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx2
-rw-r--r--chart2/source/inc/DataSeriesHelper.hxx20
-rw-r--r--chart2/source/inc/DiagramHelper.hxx2
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx70
-rw-r--r--chart2/source/tools/DiagramHelper.cxx2
6 files changed, 29 insertions, 69 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index ed742df89d88..ac9a53ce331f 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -295,7 +295,7 @@ Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XProp
{
Any aRet;
- uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+ rtl::Reference< ::chart::DataSeries > xDataSeries( dynamic_cast<::chart::DataSeries*>(xInnerPropertySet.get()) );
bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
if( bAttachedToMainAxis )
aRet <<= css::chart::ChartAxisAssign::PRIMARY_Y;
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index c0a89a2621d2..63ec6f31fc16 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -460,7 +460,7 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu
// Collect all the remaining data sequences in the same chart type. The
// deleted data series is already gone by this point.
std::vector<uno::Reference<chart2::data::XLabeledDataSequence> > aAllDataSeqs =
- DataSeriesHelper::getAllDataSequences(xSeriesCnt->getDataSeries());
+ DataSeriesHelper::getAllDataSequences(xSeriesCnt->getDataSeries2());
// Check if the sequences to be deleted are still referenced by any of
// the other data series. If not, mark them for deletion.
diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx
index 2de09db7cd76..16bd9d771973 100644
--- a/chart2/source/inc/DataSeriesHelper.hxx
+++ b/chart2/source/inc/DataSeriesHelper.hxx
@@ -85,10 +85,6 @@ OOO_DLLPUBLIC_CHARTTOOLS std::vector<
OOO_DLLPUBLIC_CHARTTOOLS
std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
getAllDataSequences(
- const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& aSeries );
-OOO_DLLPUBLIC_CHARTTOOLS
-std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
-getAllDataSequences(
const std::vector<rtl::Reference<::chart::DataSeries> >& aSeries );
/** Retrieves all data sequences found in the given data series and puts them
@@ -109,11 +105,11 @@ OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries(
StackMode eStackMode );
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries );
+ const rtl::Reference< ::chart::DataSeries > & xSeries );
/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex
OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
sal_Int32 nDimensionIndex,
sal_Int32 nAxisIndex = -1 );
@@ -121,7 +117,7 @@ OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis(
OOO_DLLPUBLIC_CHARTTOOLS
rtl::Reference< ::chart::BaseCoordinateSystem >
getCoordinateSystemOfSeries(
- const css::uno::Reference< css::chart2::XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
const rtl::Reference< ::chart::Diagram > & xDiagram );
OOO_DLLPUBLIC_CHARTTOOLS
@@ -135,21 +131,17 @@ OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries(
const rtl::Reference< ::chart::ChartType > & xChartType );
OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff(
- const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
bool bSymbolsOn, sal_Int32 nSeriesIndex );
OOO_DLLPUBLIC_CHARTTOOLS void switchLinesOnOrOff(
- const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
bool bLinesOn );
OOO_DLLPUBLIC_CHARTTOOLS
-void makeLinesThickOrThin( const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties, bool bThick );
+void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick );
OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(
- const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
- const OUString& rPropertyName,
- const css::uno::Any& rPropertyValue );
-OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints(
const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName,
const css::uno::Any& rPropertyValue );
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index 073d228e849c..c65bce883dd3 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -71,7 +71,7 @@ public:
);
static bool isSeriesAttachedToMainAxis(
- const css::uno::Reference< css::chart2::XDataSeries >& xDataSeries );
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries );
static css::uno::Sequence< OUString >
getExplicitSimpleCategories( ChartModel& rModel );
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 883b72f2908d..de88c37ecc96 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -229,27 +229,6 @@ std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
}
std::vector<uno::Reference<chart2::data::XLabeledDataSequence> >
-getAllDataSequences( const uno::Sequence<uno::Reference<chart2::XDataSeries> >& aSeries )
-{
- std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
-
- for( uno::Reference<chart2::XDataSeries> const & dataSeries : aSeries )
- {
- Reference< chart2::data::XDataSource > xSource( dataSeries, uno::UNO_QUERY );
- if( xSource.is())
- {
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
- for (const auto & i : aSeq)
- {
- aSeqVec.push_back(i);
- }
- }
- }
-
- return aSeqVec;
-}
-
-std::vector<uno::Reference<chart2::data::XLabeledDataSequence> >
getAllDataSequences( const std::vector<rtl::Reference<DataSeries> >& aSeries )
{
std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
@@ -332,15 +311,14 @@ void setStackModeAtSeries(
}
}
-sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries )
+sal_Int32 getAttachedAxisIndex( const rtl::Reference< DataSeries > & xSeries )
{
sal_Int32 nRet = 0;
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( xSeries.is() )
{
- xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nRet;
+ xSeries->getPropertyValue( "AttachedAxisIndex" ) >>= nRet;
}
}
catch( const uno::Exception & )
@@ -351,7 +329,7 @@ sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries
}
sal_Int32 getNumberFormatKeyFromAxis(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
sal_Int32 nDimensionIndex,
sal_Int32 nAxisIndex /* = -1 */ )
@@ -375,14 +353,12 @@ sal_Int32 getNumberFormatKeyFromAxis(
}
rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< Diagram > & xDiagram )
{
rtl::Reference< ::chart::BaseCoordinateSystem > xResult;
rtl::Reference< ::chart::ChartType > xDummy;
- rtl::Reference< DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(pSeries);
- lcl_getCooSysAndChartTypeOfSeries( pSeries, xDiagram, xResult, xDummy );
+ lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy );
return xResult;
}
@@ -418,14 +394,14 @@ void deleteSeries(
}
}
-void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties,
+void switchSymbolsOnOrOff( const rtl::Reference< DataSeries > & xSeries,
bool bSymbolsOn, sal_Int32 nSeriesIndex )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
chart2::Symbol aSymbProp;
- if( xSeriesProperties->getPropertyValue( "Symbol") >>= aSymbProp )
+ if( xSeries->getPropertyValue( "Symbol") >>= aSymbProp )
{
if( !bSymbolsOn )
aSymbProp.Style = chart2::SymbolStyle_NONE;
@@ -434,53 +410,45 @@ void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesPrope
aSymbProp.Style = chart2::SymbolStyle_STANDARD;
aSymbProp.StandardSymbol = nSeriesIndex;
}
- xSeriesProperties->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
+ xSeries->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
}
//todo: check attributed data points
}
-void switchLinesOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties, bool bLinesOn )
+void switchLinesOnOrOff( const rtl::Reference< DataSeries > & xSeries, bool bLinesOn )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
if( bLinesOn )
{
// keep line-styles that are not NONE
drawing::LineStyle eLineStyle;
- if( (xSeriesProperties->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
+ if( (xSeries->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
eLineStyle == drawing::LineStyle_NONE )
{
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
}
}
else
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
}
-void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesProperties, bool bThick )
+void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
sal_Int32 nNewValue = bThick ? 80 : 0;
sal_Int32 nOldValue = 0;
- if( (xSeriesProperties->getPropertyValue( "LineWidth") >>= nOldValue ) &&
+ if( (xSeries->getPropertyValue( "LineWidth") >>= nOldValue ) &&
nOldValue != nNewValue )
{
if( !(bThick && nOldValue>0))
- xSeriesProperties->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
+ xSeries->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
}
}
-void setPropertyAlsoToAllAttributedDataPoints( const Reference< chart2::XDataSeries >& xSeries,
- const OUString& rPropertyName, const uno::Any& rPropertyValue )
-{
- rtl::Reference<DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(!xSeries || pSeries);
- setPropertyAlsoToAllAttributedDataPoints(pSeries, rPropertyName, rPropertyValue);
-}
-
void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName, const uno::Any& rPropertyValue )
{
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index aca376cbb45b..79a99688fd7a 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -156,7 +156,7 @@ StackMode DiagramHelper::getStackModeFromChartType(
}
bool DiagramHelper::isSeriesAttachedToMainAxis(
- const uno::Reference< chart2::XDataSeries >& xDataSeries )
+ const rtl::Reference< ::chart::DataSeries >& xDataSeries )
{
sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
return (nAxisIndex==0);