move getChartTypes inside chart2::Diagram
Change-Id: I43fd96feb1e3d34a5f3327b2e6398ca4b5e9f928
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149049
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
index 925c858..65be479 100644
--- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -157,8 +157,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropert
void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue )
{
rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
const std::vector< rtl::Reference< ChartType > > & aTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
const std::vector< rtl::Reference< ChartType > > & aTypes = xDiagram->getChartTypes();
for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
@@ -189,8 +188,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const OUString& rProperty
rtl::Reference< DataSeries > xPropSet;
rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
const std::vector< rtl::Reference< ChartType > > aTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
const std::vector< rtl::Reference< ChartType > > aTypes = xDiagram->getChartTypes();
for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
index febfa344..143d0123 100644
--- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
@@ -165,8 +165,8 @@ void SAL_CALL UpDownBarWrapper::setPropertyValue( const OUString& rPropertyName,
{
Reference< beans::XPropertySet > xPropSet;
const std::vector< rtl::Reference< ChartType > > aTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) );
const std::vector< rtl::Reference< ChartType > > aTypes =
m_spChart2ModelContact->getDiagram()->getChartTypes();
for( rtl::Reference< ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
@@ -183,8 +183,8 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const OUString& rPropertyN
Reference< beans::XPropertySet > xPropSet;
const std::vector< rtl::Reference< ChartType > > aTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) );
const std::vector< rtl::Reference< ChartType > > aTypes =
m_spChart2ModelContact->getDiagram()->getChartTypes();
for( rtl::Reference<ChartType > const & xType : aTypes )
{
if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
index 7be1af1..3c0cbb3 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
@@ -78,7 +78,7 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue,
if( m_nDimensionIndex!=1 )
return;
const std::vector< rtl::Reference< ChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
const std::vector< rtl::Reference< ChartType > > aChartTypeList( xDiagram->getChartTypes() );
for( rtl::Reference< ChartType > const & chartType : aChartTypeList )
{
try
@@ -117,7 +117,7 @@ Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::X
if( m_nDimensionIndex==1 )
{
std::vector< rtl::Reference< ChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
std::vector< rtl::Reference< ChartType > > aChartTypeList = xDiagram->getChartTypes();
for( std::size_t nN = 0; nN < aChartTypeList.size() && !bInnerValueDetected; nN++ )
{
try
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index 62242a9..89a4f6e 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -62,10 +62,12 @@ public:
bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
{
bool bHasDetectableInnerValue = false;
rHasAmbiguousValue = false;
std::vector< rtl::Reference< ChartType > > aChartTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) );
rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram();
if (!xDiagram)
return false;
bool bHasDetectableInnerValue = false;
std::vector< rtl::Reference< ChartType > > aChartTypes = xDiagram->getChartTypes();
for( sal_Int32 nN = aChartTypes.size(); nN--; )
{
try
@@ -112,8 +114,8 @@ public:
if( !(bHasAmbiguousValue || aNewValue != aOldValue) )
return;
std::vector< rtl::Reference< ChartType > > aChartTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) );
std::vector< rtl::Reference< ChartType > > aChartTypes =
m_spChart2ModelContact->getDiagram()->getChartTypes();
for( sal_Int32 nN = aChartTypes.size(); nN--; )
{
try
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 36015c5..aa9663e 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -245,8 +245,8 @@ rtl::Reference< ::chart::DataSeries > lcl_CreateNewSeries(
std::size_t nGroupIndex=0;
if( xChartType.is())
{
std::vector< rtl::Reference< ::chart::ChartType > > aCTs(
::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ));
std::vector< rtl::Reference< ::chart::ChartType > > aCTs =
xDiagram->getChartTypes();
for( ; nGroupIndex < aCTs.size(); ++nGroupIndex)
if( aCTs[nGroupIndex] == xChartType )
break;
diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx
index 4c1d40d..534403b 100644
--- a/chart2/source/inc/Diagram.hxx
+++ b/chart2/source/inc/Diagram.hxx
@@ -220,6 +220,8 @@ public:
const rtl::Reference< DataSeries >& xGivenDataSeries,
bool bForward );
std::vector< rtl::Reference< ChartType > > getChartTypes();
private:
// ____ XModifyListener ____
virtual void SAL_CALL modified(
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index 3e4a8ea..908a6f8 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -215,10 +215,6 @@ public:
static rtl::Reference< ChartType >
getChartTypeByIndex( const rtl::Reference< ::chart::Diagram >& xDiagram, sal_Int32 nIndex );
static std::vector< rtl::Reference< ChartType > >
getChartTypesFromDiagram(
const rtl::Reference< ::chart::Diagram > & xDiagram );
SAL_DLLPRIVATE static bool areChartTypesCompatible(
const rtl::Reference< ::chart::ChartType >& xFirstType,
const rtl::Reference< ::chart::ChartType >& xSecondType );
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index aced36a..6576141 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -828,8 +828,7 @@ bool Diagram::isSupportingFloorAndWall()
//todo: allow this in future again, if fileversion is available for OLE objects (metastream)
//thus the wrong bottom can be removed on import
const std::vector< rtl::Reference< ChartType > > aTypes(
::chart::DiagramHelper::getChartTypesFromDiagram( this ) );
const std::vector< rtl::Reference< ChartType > > aTypes = getChartTypes();
for( rtl::Reference< ChartType > const & xType : aTypes )
{
OUString sChartType = xType->getChartType();
@@ -1023,6 +1022,25 @@ bool Diagram::moveSeries( const rtl::Reference< DataSeries >& xGivenDataSeries,
return bMoved;
}
std::vector< rtl::Reference< ChartType > > Diagram::getChartTypes()
{
std::vector< rtl::Reference< ChartType > > aResult;
try
{
for( rtl::Reference< BaseCoordinateSystem > const & coords : getBaseCoordinateSystems() )
{
const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2());
aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() );
}
}
catch( const uno::Exception & )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
return aResult;
}
} // namespace chart
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 1e49054..17ae7dc 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -224,7 +224,7 @@ void ChartTypeTemplate::changeDiagram( const rtl::Reference< Diagram >& xDiagram
// remove charttype groups from all coordinate systems
std::vector< rtl::Reference< ChartType > > aOldChartTypesSeq =
DiagramHelper::getChartTypesFromDiagram(xDiagram);
xDiagram->getChartTypes();
for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
@@ -274,7 +274,7 @@ void ChartTypeTemplate::changeDiagramData(
DiagramHelper::setCategoriesToDiagram( aData.Categories, xDiagram, true, supportsCategories() );
std::vector< rtl::Reference< ChartType > > aChartTypes =
DiagramHelper::getChartTypesFromDiagram( xDiagram );
xDiagram->getChartTypes();
sal_Int32 nMax = std::min( aChartTypes.size(), aData.Series.size());
for( sal_Int32 i=0; i<nMax; ++i )
{
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index cfbb0cc..09f1872 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1092,30 +1092,6 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF
return nRet;
}
std::vector< rtl::Reference< ChartType > >
DiagramHelper::getChartTypesFromDiagram(
const rtl::Reference< Diagram > & xDiagram )
{
if(!xDiagram)
return {};
std::vector< rtl::Reference< ChartType > > aResult;
try
{
for( rtl::Reference< BaseCoordinateSystem > const & coords : xDiagram->getBaseCoordinateSystems() )
{
const std::vector< rtl::Reference< ChartType > > & aChartTypeSeq( coords->getChartTypes2());
aResult.insert( aResult.end(), aChartTypeSeq.begin(), aChartTypeSeq.end() );
}
}
catch( const uno::Exception & )
{
DBG_UNHANDLED_EXCEPTION("chart2");
}
return aResult;
}
bool DiagramHelper::areChartTypesCompatible( const rtl::Reference< ChartType >& xFirstType,
const rtl::Reference< ChartType >& xSecondType )
{