chart2/source/controller/dialogs/DataBrowser.cxx | 14 - chart2/source/controller/dialogs/DialogModel.cxx | 2 chart2/source/controller/dialogs/ObjectNameProvider.cxx | 4 chart2/source/controller/dialogs/tp_DataSource.cxx | 3 chart2/source/controller/main/ChartController_Tools.cxx | 2 chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 2 chart2/source/inc/DataSeries.hxx | 8 chart2/source/inc/DataSeriesHelper.hxx | 10 - chart2/source/inc/Diagram.hxx | 4 chart2/source/inc/RegressionCurveHelper.hxx | 5 chart2/source/model/main/DataSeries.cxx | 132 +++++++++++++++ chart2/source/model/main/Diagram.cxx | 19 ++ chart2/source/tools/DataSeriesHelper.cxx | 140 ---------------- chart2/source/tools/RegressionCurveHelper.cxx | 18 -- chart2/source/view/charttypes/VSeriesPlotter.cxx | 10 - 15 files changed, 180 insertions(+), 193 deletions(-)
New commits: commit 0f691fe670526c1c0ba5c9bab8dfe8209bfe698e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Mar 16 11:04:21 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Mar 21 17:25:46 2023 +0000 move getLabel inside chart2::DataSeries Change-Id: I38baff5980d8cae5f63ee9163d667385837d249b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149198 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index ce7687162eb1..ab82a772ad02 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -651,11 +651,10 @@ void DataBrowser::RenewTable() spHeader->SetColor( nColor ); spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis ); spHeader->SetSeriesName( - DataSeriesHelper::getDataSeriesLabel( - elemHeader.m_xDataSeries, - (elemHeader.m_xChartType.is() ? + elemHeader.m_xDataSeries->getLabelForRole( + elemHeader.m_xChartType.is() ? elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() : - OUString("values-y")))); + OUString("values-y"))); // index is 1-based, as 0 is for the column that contains the row-numbers spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 ); spHeader->SetGetFocusHdl( aFocusLink ); @@ -1276,11 +1275,10 @@ void DataBrowser::RenewSeriesHeaders() spHeader->SetColor( nColor ); spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis ); spHeader->SetSeriesName( - DataSeriesHelper::getDataSeriesLabel( - elemHeader.m_xDataSeries, - (elemHeader.m_xChartType.is() ? + elemHeader.m_xDataSeries->getLabelForRole( + elemHeader.m_xChartType.is() ? elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() : - OUString( "values-y")))); + OUString( "values-y"))); spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 ); spHeader->SetGetFocusHdl( aFocusLink ); spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink ); diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index f64e328f1d28..334fc0b1b0e2 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -434,7 +434,7 @@ std::vector< DialogModel::tSeriesWithChartTypeByName > { aResult.push_back( ::chart::DialogModel::tSeriesWithChartTypeByName( - ::chart::DataSeriesHelper::getDataSeriesLabel( dataSeries, aRole ), + dataSeries->getLabelForRole( aRole ), std::make_pair( dataSeries, rxChartType ))); } } diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index b1a023136706..2a2b2dcce89a 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -73,8 +73,8 @@ OUString lcl_getDataSeriesName( std::u16string_view rObjectCID, const rtl::Refer rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) ); if( xChartType.is() ) { - aRet = ::chart::DataSeriesHelper::getDataSeriesLabel( - xSeries, xChartType->getRoleOfSequenceForSeriesLabel() ) ; + aRet = xSeries->getLabelForRole( + xChartType->getRoleOfSequenceForSeriesLabel() ) ; } } diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index db35f80ec836..fe01fcea858d 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -72,8 +72,7 @@ bool lcl_UpdateCurrentSeriesName(weld::TreeView& rOutListBox) ::chart::SeriesEntry * pEntry = weld::fromId<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry)); if (pEntry->m_xDataSeries.is() && pEntry->m_xChartType.is()) { - OUString aLabel(::chart::DataSeriesHelper::getDataSeriesLabel( - pEntry->m_xDataSeries, + OUString aLabel(pEntry->m_xDataSeries->getLabelForRole( pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel())); if (!aLabel.isEmpty()) { diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 2b8417eaa48c..916cb030b5f3 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -239,7 +239,7 @@ OUString getSeriesLabel(const rtl::Reference<::chart::ChartModel>& xModel, std:: return OUString(); rtl::Reference<ChartType> xChartType = getChartType(xModel); - return DataSeriesHelper::getDataSeriesLabel(xSeries, xChartType->getRoleOfSequenceForSeriesLabel()); + return xSeries->getLabelForRole(xChartType->getRoleOfSequenceForSeriesLabel()); } OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel) diff --git a/chart2/source/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx index 6bf4e46007ef..fb8255d10f12 100644 --- a/chart2/source/inc/DataSeries.hxx +++ b/chart2/source/inc/DataSeries.hxx @@ -143,6 +143,14 @@ public: const tRegressionCurveContainerType & getRegressionCurves2() const { return m_aRegressionCurves; } + /** Get the label of a series (e.g. for the legend) + + @param rLabelSequenceRole + The data sequence contained in xSeries that has this role will be used + to take its label. + */ + OUString getLabelForRole( const OUString & rLabelSequenceRole ); + private: // late initialization to call after copy-constructing diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index 49ef078537bd..b07ff17b1e08 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -98,16 +98,6 @@ getAllDataSequences( OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference< ::chart::DataSource > getDataSource( const std::vector< rtl::Reference< ::chart::DataSeries > > & aSeries ); -/** Get the label of a series (e.g. for the legend) - - @param rLabelSequenceRole - The data sequence contained in xSeries that has this role will be used - to take its label. - */ -OOO_DLLPUBLIC_CHARTTOOLS OUString getDataSeriesLabel( - const rtl::Reference< ::chart::DataSeries > & xSeries, - const OUString & rLabelSequenceRole ); - /** Get the label of a labeled sequence including necessary automatic generation */ OOO_DLLPUBLIC_CHARTTOOLS OUString getLabelForLabeledDataSequence( diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx index 4ad4983ed18b..79f51fa8ab2e 100644 --- a/chart2/source/model/main/DataSeries.cxx +++ b/chart2/source/model/main/DataSeries.cxx @@ -27,11 +27,13 @@ #include <CloneHelper.hxx> #include <RegressionCurveModel.hxx> #include <ModifyListenerHelper.hxx> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/container/NoSuchElementException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <cppuhelper/supportsservice.hxx> #include <comphelper/diagnose_ex.hxx> #include <rtl/ref.hxx> +#include <rtl/ustrbuf.hxx> #include <algorithm> @@ -553,6 +555,136 @@ css::uno::Sequence< OUString > SAL_CALL DataSeries::getSupportedServiceNames() "com.sun.star.beans.PropertySet" }; } +static Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel( + const Sequence< Reference< chart2::data::XLabeledDataSequence > > & rDataSequences ) +{ + Reference< chart2::data::XLabeledDataSequence > xResult; + + for( auto const & labeledData : rDataSequences ) + { + OSL_ENSURE( labeledData.is(), "empty LabeledDataSequence" ); + // no values are set but a label exists + if( labeledData.is() && + ( ! labeledData->getValues().is() && + labeledData->getLabel().is())) + { + xResult.set( labeledData ); + break; + } + } + + return xResult; +} + +static OUString lcl_getDataSequenceLabel( const Reference< chart2::data::XDataSequence > & xSequence ) +{ + OUString aResult; + + Reference< chart2::data::XTextualDataSequence > xTextSeq( xSequence, uno::UNO_QUERY ); + if( xTextSeq.is()) + { + Sequence< OUString > aSeq( xTextSeq->getTextualData()); + + const sal_Int32 nMax = aSeq.getLength() - 1; + OUStringBuffer aBuf; + + for( sal_Int32 i = 0; i <= nMax; ++i ) + { + aBuf.append( aSeq[i] ); + if( i < nMax ) + aBuf.append( ' '); + } + aResult = aBuf.makeStringAndClear(); + } + else if( xSequence.is()) + { + Sequence< uno::Any > aSeq( xSequence->getData()); + + const sal_Int32 nMax = aSeq.getLength() - 1; + OUString aVal; + OUStringBuffer aBuf; + double fNum = 0; + + for( sal_Int32 i = 0; i <= nMax; ++i ) + { + if( aSeq[i] >>= aVal ) + { + aBuf.append( aVal ); + if( i < nMax ) + aBuf.append( ' '); + } + else if( aSeq[ i ] >>= fNum ) + { + aBuf.append( fNum ); + if( i < nMax ) + aBuf.append( ' '); + } + } + aResult = aBuf.makeStringAndClear(); + } + + return aResult; +} + +static OUString getLabelForLabeledDataSequence( + const Reference< chart2::data::XLabeledDataSequence > & xLabeledSeq ) +{ + OUString aResult; + if( xLabeledSeq.is()) + { + Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel()); + if( xSeq.is() ) + aResult = lcl_getDataSequenceLabel( xSeq ); + if( !xSeq.is() || aResult.isEmpty() ) + { + // no label set or label content is empty -> use auto-generated one + Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); + if( xValueSeq.is() ) + { + Sequence< OUString > aLabels( xValueSeq->generateLabel( + chart2::data::LabelOrigin_SHORT_SIDE ) ); + // no labels returned is interpreted as: auto-generation not + // supported by sequence + if( aLabels.hasElements() ) + aResult=aLabels[0]; + else + { + //todo?: maybe use the index of the series as name + //but as the index may change it would be better to have such a name persistent + //what is not possible at the moment + //--> maybe use the identifier as part of the name ... + aResult = lcl_getDataSequenceLabel( xValueSeq ); + } + } + } + } + return aResult; +} + +OUString DataSeries::getLabelForRole( const OUString & rLabelSequenceRole ) +{ + OUString aResult; + + Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( + ::chart::DataSeriesHelper::getDataSequenceByRole( this, rLabelSequenceRole )); + if( xLabeledSeq.is()) + aResult = getLabelForLabeledDataSequence( xLabeledSeq ); + else + { + // special case: labeled data series with only a label and no values may + // serve as label + xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( getDataSequences() )); + if( xLabeledSeq.is()) + { + Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel()); + if( xSeq.is()) + aResult = lcl_getDataSequenceLabel( xSeq ); + } + } + + return aResult; +} + } // namespace chart extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index a2c25366dd3a..e1212ae1fa72 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -86,28 +86,6 @@ private: bool m_bMatchPrefix; }; -Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel( - const Reference< chart2::data::XDataSource > & xDataSource ) -{ - Reference< chart2::data::XLabeledDataSequence > xResult; - const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); - - for( auto const & labeledData : aSequences ) - { - OSL_ENSURE( labeledData.is(), "empty LabeledDataSequence" ); - // no values are set but a label exists - if( labeledData.is() && - ( ! labeledData->getValues().is() && - labeledData->getLabel().is())) - { - xResult.set( labeledData ); - break; - } - } - - return xResult; -} - void lcl_getCooSysAndChartTypeOfSeries( const rtl::Reference< ::chart::DataSeries > & xSeries, const Reference< chart2::XDiagram > & xDiagram, @@ -289,124 +267,6 @@ rtl::Reference< DataSource > return new DataSource(getAllDataSequences(aSeries)); } -namespace -{ -OUString lcl_getDataSequenceLabel( const Reference< chart2::data::XDataSequence > & xSequence ) -{ - OUString aResult; - - Reference< chart2::data::XTextualDataSequence > xTextSeq( xSequence, uno::UNO_QUERY ); - if( xTextSeq.is()) - { - Sequence< OUString > aSeq( xTextSeq->getTextualData()); - - const sal_Int32 nMax = aSeq.getLength() - 1; - OUStringBuffer aBuf; - - for( sal_Int32 i = 0; i <= nMax; ++i ) - { - aBuf.append( aSeq[i] ); - if( i < nMax ) - aBuf.append( ' '); - } - aResult = aBuf.makeStringAndClear(); - } - else if( xSequence.is()) - { - Sequence< uno::Any > aSeq( xSequence->getData()); - - const sal_Int32 nMax = aSeq.getLength() - 1; - OUString aVal; - OUStringBuffer aBuf; - double fNum = 0; - - for( sal_Int32 i = 0; i <= nMax; ++i ) - { - if( aSeq[i] >>= aVal ) - { - aBuf.append( aVal ); - if( i < nMax ) - aBuf.append( ' '); - } - else if( aSeq[ i ] >>= fNum ) - { - aBuf.append( fNum ); - if( i < nMax ) - aBuf.append( ' '); - } - } - aResult = aBuf.makeStringAndClear(); - } - - return aResult; -} -} - -OUString getLabelForLabeledDataSequence( - const Reference< chart2::data::XLabeledDataSequence > & xLabeledSeq ) -{ - OUString aResult; - if( xLabeledSeq.is()) - { - Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel()); - if( xSeq.is() ) - aResult = lcl_getDataSequenceLabel( xSeq ); - if( !xSeq.is() || aResult.isEmpty() ) - { - // no label set or label content is empty -> use auto-generated one - Reference< chart2::data::XDataSequence > xValueSeq( xLabeledSeq->getValues() ); - if( xValueSeq.is() ) - { - Sequence< OUString > aLabels( xValueSeq->generateLabel( - chart2::data::LabelOrigin_SHORT_SIDE ) ); - // no labels returned is interpreted as: auto-generation not - // supported by sequence - if( aLabels.hasElements() ) - aResult=aLabels[0]; - else - { - //todo?: maybe use the index of the series as name - //but as the index may change it would be better to have such a name persistent - //what is not possible at the moment - //--> maybe use the identifier as part of the name ... - aResult = lcl_getDataSequenceLabel( xValueSeq ); - } - } - } - } - return aResult; -} - -OUString getDataSeriesLabel( - const rtl::Reference< DataSeries > & xSeries, - const OUString & rLabelSequenceRole ) -{ - OUString aResult; - - if( xSeries.is()) - { - Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( - ::chart::DataSeriesHelper::getDataSequenceByRole( xSeries, rLabelSequenceRole )); - if( xLabeledSeq.is()) - aResult = getLabelForLabeledDataSequence( xLabeledSeq ); - else - { - // special case: labeled data series with only a label and no values may - // serve as label - xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSeries )); - if( xLabeledSeq.is()) - { - Reference< chart2::data::XDataSequence > xSeq( xLabeledSeq->getLabel()); - if( xSeq.is()) - aResult = lcl_getDataSequenceLabel( xSeq ); - } - } - - } - - return aResult; -} - void setStackModeAtSeries( const std::vector< rtl::Reference< DataSeries > > & aSeries, const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem, diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 130bb300cb66..6b2659538b11 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -517,7 +517,7 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() ); - pTextList[i] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); + pTextList[i] = xSeries->getLabelForRole( aRole ); break; } case DataPointCustomLabelFieldType_PERCENTAGE: @@ -575,7 +575,7 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen if ( m_xChartTypeModel ) aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel(); const rtl::Reference< DataSeries >& xSeries( rDataSeries.getModel() ); - pTextList[1] = DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ); + pTextList[1] = xSeries->getLabelForRole( aRole ); } if( pLabel->ShowNumber ) @@ -2351,7 +2351,7 @@ uno::Sequence<OUString> VSeriesPlotter::getSeriesNames() const rtl::Reference< DataSeries > xSeries( pSeries ? pSeries->getModel() : nullptr ); if( xSeries.is() ) { - OUString aSeriesName( DataSeriesHelper::getDataSeriesLabel( xSeries, aRole ) ); + OUString aSeriesName( xSeries->getLabelForRole( aRole ) ); aRetVector.push_back( aSeriesName ); } } @@ -2372,7 +2372,7 @@ uno::Sequence<OUString> VSeriesPlotter::getAllSeriesNames() const { if (pSeries) { - OUString aSeriesName(DataSeriesHelper::getDataSeriesLabel(pSeries->getModel(), aRole)); + OUString aSeriesName(pSeries->getModel()->getLabelForRole(aRole)); aRetVector.push_back(aSeriesName); } } @@ -2812,7 +2812,7 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( } // label - aLabelText = DataSeriesHelper::getDataSeriesLabel( rSeries.getModel(), m_xChartTypeModel.is() ? m_xChartTypeModel->getRoleOfSequenceForSeriesLabel() : "values-y"); + aLabelText = rSeries.getModel()->getLabelForRole( m_xChartTypeModel.is() ? m_xChartTypeModel->getRoleOfSequenceForSeriesLabel() : "values-y"); aEntry.aLabel = FormattedStringHelper::createFormattedStringSequence( xContext, aLabelText, xTextProperties ); aResult.push_back(aEntry); commit 59361b4578d6bea5af618efd904b3243553d246b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Mar 16 10:39:05 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Mar 21 17:25:37 2023 +0000 move getAllRegressionCurvesNotMeanValueLine inside chart2::Diagram Change-Id: Ic01a886f575022fa106aa2e3b384e184683df6f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149197 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 8c1cdf6a3b92..20a0c2f6b3da 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -224,7 +224,7 @@ void ChartController::executeDispatch_NewArrangement() // regression curve equations std::vector< rtl::Reference< RegressionCurveModel > > aRegressionCurves = - RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( xDiagram ); + xDiagram->getAllRegressionCurvesNotMeanValueLine(); // reset equation position for( const auto& xCurve : aRegressionCurves ) diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx index 71816aa67f7e..526559d91b77 100644 --- a/chart2/source/inc/Diagram.hxx +++ b/chart2/source/inc/Diagram.hxx @@ -47,6 +47,7 @@ class ChartTypeTemplate; class DataSeries; class Legend; class DataTable; +class RegressionCurveModel; enum class StackMode; class Wall; @@ -333,6 +334,9 @@ public: tTemplateWithServiceName getTemplate(const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager); + std::vector<rtl::Reference<::chart::RegressionCurveModel> > + getAllRegressionCurvesNotMeanValueLine(); + private: // ____ XModifyListener ____ virtual void SAL_CALL modified( diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx index 2666b41d9bb9..6b2c4c4cc918 100644 --- a/chart2/source/inc/RegressionCurveHelper.hxx +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -34,7 +34,6 @@ namespace com::sun::star::chart2::data { class XDataSource; } namespace com::sun::star::frame { class XModel; } namespace chart { class ChartModel; } namespace chart { class DataSeries; } -namespace chart { class Diagram; } namespace chart { class RegressionCurveModel; } namespace chart::RegressionCurveHelper @@ -186,10 +185,6 @@ namespace chart::RegressionCurveHelper OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveSpecificName( const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); - OOO_DLLPUBLIC_CHARTTOOLS std::vector<rtl::Reference<::chart::RegressionCurveModel> > - getAllRegressionCurvesNotMeanValueLine( - const rtl::Reference<::chart::Diagram>& xDiagram ); - OOO_DLLPUBLIC_CHARTTOOLS void resetEquationPosition( const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 6b8f3b864f00..9d7477ddd341 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -25,6 +25,8 @@ #include <ChartType.hxx> #include <DataSeriesHelper.hxx> #include <PropertyHelper.hxx> +#include <RegressionCurveHelper.hxx> +#include <RegressionCurveModel.hxx> #include "Wall.hxx" #include <ModifyListenerHelper.hxx> #include <UserDefinedProperties.hxx> @@ -1659,6 +1661,23 @@ Diagram::tTemplateWithServiceName return aResult; } +std::vector< rtl::Reference< RegressionCurveModel > > + Diagram::getAllRegressionCurvesNotMeanValueLine() +{ + std::vector< rtl::Reference< RegressionCurveModel > > aResult; + std::vector< rtl::Reference< DataSeries > > aSeries( getDataSeries()); + for (auto const& elem : aSeries) + { + for( rtl::Reference< RegressionCurveModel > const & curve : elem->getRegressionCurves2() ) + { + if( ! RegressionCurveHelper::isMeanValueLine( curve )) + aResult.push_back( curve ); + } + } + + return aResult; +} + } // namespace chart extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 7ec09089c4cb..38da80f937ab 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -843,24 +843,6 @@ OUString RegressionCurveHelper::getRegressionCurveName( const Reference< XRegres return aResult; } -std::vector< rtl::Reference< RegressionCurveModel > > - RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( - const rtl::Reference< Diagram > & xDiagram ) -{ - std::vector< rtl::Reference< RegressionCurveModel > > aResult; - std::vector< rtl::Reference< DataSeries > > aSeries( xDiagram->getDataSeries()); - for (auto const& elem : aSeries) - { - for( rtl::Reference< RegressionCurveModel > const & curve : elem->getRegressionCurves2() ) - { - if( ! isMeanValueLine( curve )) - aResult.push_back( curve ); - } - } - - return aResult; -} - void RegressionCurveHelper::resetEquationPosition( const Reference< chart2::XRegressionCurve > & xCurve ) {