diff options
29 files changed, 476 insertions, 134 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index eefed59e3e6a..7b911fbd3820 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -1195,7 +1195,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( DiagramHelper::tTemplateWithServiceName aTemplateWithService( DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager )); if( aTemplateWithService.xChartTypeTemplate.is()) - aTemplateWithService.xChartTypeTemplate->resetStyles( xDiagram );//#i109371# + aTemplateWithService.xChartTypeTemplate->resetStyles2( xDiagram );//#i109371# xTemplate->changeDiagram( xDiagram ); if( AllSettings::GetMathLayoutRTL() ) AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) ); diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 4c157611f21b..72c51a30d6d0 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -318,7 +318,7 @@ void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame DiagramHelper::tTemplateWithServiceName aTemplateWithService( DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager )); if( aTemplateWithService.xChartTypeTemplate.is()) - aTemplateWithService.xChartTypeTemplate->resetStyles( xDiagram ); + aTemplateWithService.xChartTypeTemplate->resetStyles2( xDiagram ); xTemplate->changeDiagram( xDiagram ); if( AllSettings::GetMathLayoutRTL() ) AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) ); diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 248a44087004..564343c62671 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -253,7 +253,7 @@ rtl::Reference< ::chart::DataSeries > lcl_CreateNewSeries( if( nGroupIndex == aCTs.size()) nGroupIndex = 0; } - xTemplate->applyStyle( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup ); + xTemplate->applyStyle2( xResult, nGroupIndex, nNewSeriesIndex, nTotalNumberOfSeriesInCTGroup ); } if( bCreateDataCachedSequences ) @@ -270,7 +270,7 @@ rtl::Reference< ::chart::DataSeries > lcl_CreateNewSeries( //special handling for candlestick type if( xTemplate.is()) { - rtl::Reference< ::chart::DataInterpreter > xInterpreter( xTemplate->getDataInterpreter()); + rtl::Reference< ::chart::DataInterpreter > xInterpreter( xTemplate->getDataInterpreter2()); if( xInterpreter.is()) { sal_Int32 nStockVariant; @@ -704,7 +704,7 @@ void DialogModel::setData( xDataProvider->createDataSource( rArguments ) ); rtl::Reference< ::chart::DataInterpreter > xInterpreter( - m_xTemplate->getDataInterpreter()); + m_xTemplate->getDataInterpreter2()); if( xInterpreter.is()) { rtl::Reference< Diagram > xDiagram( m_xChartDocument->getFirstChartDiagram() ); @@ -795,7 +795,7 @@ void DialogModel::applyInterpretedData( aSeries[nSeries]->setPropertyValue( "Color" , uno::Any( xColorScheme->getColorByIndex( nSeriesCounter ))); } - m_xTemplate->applyStyle( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup ); + m_xTemplate->applyStyle2( aSeries[nSeries], nGroup, nNewSeriesIndex++, nSeriesInGroup ); } } } diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx index 79f03325fa9c..b22165e79fa9 100644 --- a/chart2/source/inc/ChartTypeTemplate.hxx +++ b/chart2/source/inc/ChartTypeTemplate.hxx @@ -19,7 +19,9 @@ #pragma once #include <cppuhelper/implbase.hxx> +#include "DataInterpreter.hxx" #include "StackMode.hxx" +#include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/lang/XServiceName.hpp> #include "charttoolsdllapi.hxx" #include <rtl/ref.hxx> @@ -39,7 +41,6 @@ namespace chart { class BaseCoordinateSystem; class ChartType; -class DataInterpreter; class DataSeries; class Diagram; class LabeledDataSequence; @@ -78,7 +79,8 @@ class LabeledDataSequence; * create an XLegend via the global service factory, set it at the diagram. */ -class SAL_DLLPUBLIC_RTTI ChartTypeTemplate : public ::cppu::WeakImplHelper< +class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeTemplate : public ::cppu::WeakImplHelper< + css::chart2::XChartTypeTemplate, css::lang::XServiceName > { public: @@ -86,34 +88,55 @@ public: OUString aServiceName ); virtual ~ChartTypeTemplate() override; - OOO_DLLPUBLIC_CHARTTOOLS - rtl::Reference< ::chart::Diagram > createDiagramByDataSource( + rtl::Reference< ::chart::Diagram > createDiagramByDataSource2( const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, const css::uno::Sequence< css::beans::PropertyValue >& aArguments ); + // ____ XChartTypeTemplate ____ + virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final; /// denotes if the chart needs categories at the first scale - virtual bool supportsCategories(); + virtual sal_Bool SAL_CALL supportsCategories() override; + virtual void SAL_CALL changeDiagram( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final; + virtual void SAL_CALL changeDiagramData( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final; + virtual sal_Bool SAL_CALL matchesTemplate( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + sal_Bool bAdaptProperties ) override final; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getDataInterpreter() override final; + virtual css::uno::Reference< ::css::chart2::XChartType > SAL_CALL getChartTypeForNewSeries( + const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override final; + virtual void SAL_CALL applyStyle( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + ::sal_Int32 nChartTypeIndex, + ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount ) override final; + virtual void SAL_CALL resetStyles( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final; - OOO_DLLPUBLIC_CHARTTOOLS void changeDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram ); void changeDiagramData( const rtl::Reference< ::chart::Diagram >& xDiagram, const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, const css::uno::Sequence< css::beans::PropertyValue >& aArguments ); - virtual bool matchesTemplate( + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ); virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) = 0; - virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter(); - virtual void applyStyle( + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2(); + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ); - virtual void resetStyles( + virtual void resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ); /// @throws css::uno::RuntimeException diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index e91df2e705a5..3572f1fa4288 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -402,7 +402,7 @@ void ChartModel::insertDefaultChart() beans::PropertyState_DIRECT_VALUE ) }; } - rtl::Reference< Diagram > xDiagram( xTemplate->createDiagramByDataSource( xDataSource, aParam ) ); + rtl::Reference< Diagram > xDiagram( xTemplate->createDiagramByDataSource2( xDataSource, aParam ) ); setFirstDiagram( xDiagram ); diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index a6fa518ee52e..a8ddca69627b 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -395,7 +395,7 @@ void SAL_CALL Diagram::setDiagramData( xTemplate = xChartTypeManager->createTemplate( "com.sun.star.chart2.template.Column" ); if(!xTemplate.is()) return; - xTemplate->changeDiagramData( this, xDataSource, aArguments ); + xTemplate->changeDiagramData( rtl::Reference< ::chart::Diagram >(this), xDataSource, aArguments ); } // ____ XTitled ____ diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx index 4b0a6a7ff52c..e3011816153c 100644 --- a/chart2/source/model/template/AreaChartTypeTemplate.cxx +++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx @@ -175,19 +175,19 @@ StackMode AreaChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) } // ____ ChartTypeTemplate ____ -void AreaChartTypeTemplate::applyStyle( +void AreaChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) ); } -void AreaChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& xDiagram ) +void AreaChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) { - ChartTypeTemplate::resetStyles( xDiagram ); + ChartTypeTemplate::resetStyles2( xDiagram ); std::vector< rtl::Reference< ::chart::DataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); uno::Any aLineStyleAny( drawing::LineStyle_NONE ); @@ -205,7 +205,7 @@ rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForIndex( sal_Int return new AreaChartType(); } -rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > AreaChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) ); diff --git a/chart2/source/model/template/AreaChartTypeTemplate.hxx b/chart2/source/model/template/AreaChartTypeTemplate.hxx index e3fec3b1e457..3116c0d59a99 100644 --- a/chart2/source/model/template/AreaChartTypeTemplate.hxx +++ b/chart2/source/model/template/AreaChartTypeTemplate.hxx @@ -57,14 +57,14 @@ protected: // ____ ChartTypeTemplate ____ virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - virtual void resetStyles( + virtual void resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) override; // ____ ChartTypeTemplate ____ diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx index 7daceacab9dc..9cebf6fa6cfe 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.cxx +++ b/chart2/source/model/template/BarChartTypeTemplate.cxx @@ -160,11 +160,11 @@ bool BarChartTypeTemplate::isSwapXAndY() const } // ____ ChartTypeTemplate ____ -bool BarChartTypeTemplate::matchesTemplate( +bool BarChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { - bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); + bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties ); //check BarDirection if( bResult ) @@ -202,7 +202,7 @@ rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForIndex( sal_Int3 return new ColumnChartType(); } -rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > BarChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) ); @@ -232,13 +232,13 @@ Reference< beans::XPropertySetInfo > SAL_CALL BarChartTypeTemplate::getPropertyS return *StaticBarChartTypeTemplateInfo::get(); } -void BarChartTypeTemplate::applyStyle( +void BarChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) ); if( getDimension() != 3 ) return; @@ -256,10 +256,10 @@ void BarChartTypeTemplate::applyStyle( } } -void BarChartTypeTemplate::resetStyles( +void BarChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) { - ChartTypeTemplate::resetStyles( xDiagram ); + ChartTypeTemplate::resetStyles2( xDiagram ); std::vector< rtl::Reference< DataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); uno::Any aLineStyleAny( drawing::LineStyle_NONE ); diff --git a/chart2/source/model/template/BarChartTypeTemplate.hxx b/chart2/source/model/template/BarChartTypeTemplate.hxx index c17c5148c3c2..62188279ea29 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.hxx +++ b/chart2/source/model/template/BarChartTypeTemplate.hxx @@ -63,21 +63,19 @@ protected: getPropertySetInfo() override; // ____ ChartTypeTemplate ____ - virtual bool matchesTemplate( + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - virtual void resetStyles( + virtual void resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) override; - - // ____ ChartTypeTemplate ____ virtual rtl::Reference< ::chart::ChartType > getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override; virtual sal_Int32 getDimension() const override; diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx index cba67168d38d..21956ca78bd7 100644 --- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx +++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx @@ -139,18 +139,18 @@ StackMode BubbleChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ return StackMode::NONE; } -void BubbleChartTypeTemplate::applyStyle( +void BubbleChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) ); } -// ____ ChartTypeTemplate ____ -bool BubbleChartTypeTemplate::supportsCategories() +// ____ XChartTypeTemplate ____ +sal_Bool SAL_CALL BubbleChartTypeTemplate::supportsCategories() { return false; } @@ -160,7 +160,7 @@ rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForIndex( sal_I return new BubbleChartType(); } -rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -179,7 +179,7 @@ rtl::Reference< ChartType > BubbleChartTypeTemplate::getChartTypeForNewSeries( return xResult; } -rtl::Reference< DataInterpreter > BubbleChartTypeTemplate::getDataInterpreter() +rtl::Reference< DataInterpreter > BubbleChartTypeTemplate::getDataInterpreter2() { if( ! m_xDataInterpreter.is()) m_xDataInterpreter.set( new BubbleDataInterpreter ); diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.hxx b/chart2/source/model/template/BubbleChartTypeTemplate.hxx index 0649a57bb0b5..f4e5c9b3c790 100644 --- a/chart2/source/model/template/BubbleChartTypeTemplate.hxx +++ b/chart2/source/model/template/BubbleChartTypeTemplate.hxx @@ -52,12 +52,12 @@ protected: getPropertySetInfo() override; // ____ ChartTypeTemplate ____ - virtual bool supportsCategories() override; + virtual sal_Bool SAL_CALL supportsCategories() override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter() override; - virtual void applyStyle( + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override; + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 6dfff2b39d57..1e49054f5b8b 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -137,7 +137,7 @@ ChartTypeTemplate::~ChartTypeTemplate() {} // ____ ChartTypeTemplate ____ -rtl::Reference< Diagram > ChartTypeTemplate::createDiagramByDataSource( +rtl::Reference< Diagram > ChartTypeTemplate::createDiagramByDataSource2( const uno::Reference< data::XDataSource >& xDataSource, const uno::Sequence< beans::PropertyValue >& aArguments ) { @@ -149,7 +149,7 @@ rtl::Reference< Diagram > ChartTypeTemplate::createDiagramByDataSource( xDia = new Diagram(GetComponentContext()); // modify diagram - rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter()); + rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2()); InterpretedData aData( xInterpreter->interpretDataSource( xDataSource, aArguments, {} )); @@ -170,7 +170,7 @@ rtl::Reference< Diagram > ChartTypeTemplate::createDiagramByDataSource( return xDia; } -bool ChartTypeTemplate::supportsCategories() +sal_Bool SAL_CALL ChartTypeTemplate::supportsCategories() { return true; } @@ -188,7 +188,7 @@ void ChartTypeTemplate::changeDiagram( const rtl::Reference< Diagram >& xDiagram const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size(); // chart-type specific interpretation of existing data series - rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter()); + rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2()); InterpretedData aData; aData.Series = aSeriesSeq; aData.Categories = DiagramHelper::getCategoriesFromDiagram( xDiagram ); @@ -254,7 +254,7 @@ void ChartTypeTemplate::changeDiagramData( std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq = DiagramHelper::getDataSeriesFromDiagram( xDiagram ); const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size(); - rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter()); + rtl::Reference< DataInterpreter > xInterpreter( getDataInterpreter2()); InterpretedData aData = xInterpreter->interpretDataSource( xDataSource, aArguments, aFlatSeriesSeq ); @@ -266,7 +266,7 @@ void ChartTypeTemplate::changeDiagramData( if( nIndex >= nFormerSeriesCount ) { lcl_applyDefaultStyle( aData.Series[i][j], nIndex, xDiagram ); - applyStyle( aData.Series[i][j], i, j, aData.Series[i].size() ); + applyStyle2( aData.Series[i][j], i, j, aData.Series[i].size() ); } } @@ -287,7 +287,7 @@ void ChartTypeTemplate::changeDiagramData( } } -bool ChartTypeTemplate::matchesTemplate( +bool ChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool /* bAdaptProperties */ ) { @@ -306,7 +306,7 @@ bool ChartTypeTemplate::matchesTemplate( if( bResult ) { std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes; - rtl::Reference<ChartType> xOldCT = getChartTypeForNewSeries(aFormerlyUsedChartTypes); + rtl::Reference<ChartType> xOldCT = getChartTypeForNewSeries2(aFormerlyUsedChartTypes); if (!xOldCT.is()) return false; @@ -342,7 +342,7 @@ bool ChartTypeTemplate::matchesTemplate( return bResult; } -rtl::Reference< DataInterpreter > ChartTypeTemplate::getDataInterpreter() +rtl::Reference< DataInterpreter > ChartTypeTemplate::getDataInterpreter2() { if( ! m_xDataInterpreter.is()) m_xDataInterpreter.set( new DataInterpreter ); @@ -350,7 +350,7 @@ rtl::Reference< DataInterpreter > ChartTypeTemplate::getDataInterpreter() return m_xDataInterpreter; } -void ChartTypeTemplate::applyStyle( +void ChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 /* nSeriesIndex */, @@ -399,14 +399,14 @@ void ChartTypeTemplate::applyStyles( const rtl::Reference< ::chart::Diagram >& x { const sal_Int32 nNumSeries = aNewSeriesSeq[i].size(); for( sal_Int32 j=0; j<nNumSeries; ++j ) - applyStyle( aNewSeriesSeq[i][j], i, j, nNumSeries ); + applyStyle2( aNewSeriesSeq[i][j], i, j, nNumSeries ); } //ensure valid empty cell handling (for first chart type...) lcl_ensureCorrectMissingValueTreatment( xDiagram, getChartTypeForIndex( 0 ) ); } -void ChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& xDiagram ) +void ChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) { // reset number format if we had percent stacking on bool bPercent = (getStackMode(0) == StackMode::YStackedPercent); @@ -479,7 +479,7 @@ void ChartTypeTemplate::createCoordinateSystems( if( ! xDiagram.is()) return; std::vector< rtl::Reference< ChartType > > aFormerlyUsedChartTypes; - rtl::Reference< ChartType > xChartType( getChartTypeForNewSeries(aFormerlyUsedChartTypes)); + rtl::Reference< ChartType > xChartType( getChartTypeForNewSeries2(aFormerlyUsedChartTypes)); if( ! xChartType.is()) return; rtl::Reference< BaseCoordinateSystem > xCooSys = xChartType->createCoordinateSystem2( getDimension()); @@ -563,7 +563,7 @@ void ChartTypeTemplate::adaptScales( aData.Categories = xCategories; if(bSupportsCategories) { - rtl::Reference< ChartType > xChartType = getChartTypeForNewSeries({}); + rtl::Reference< ChartType > xChartType = getChartTypeForNewSeries2({}); if( aData.AxisType == AxisType::CATEGORY ) { aData.ShiftedCategoryPosition = m_aServiceName.indexOf("Column") != -1 || m_aServiceName.indexOf("Bar") != -1 || m_aServiceName.endsWith("Close"); @@ -736,7 +736,7 @@ void ChartTypeTemplate::createChartTypes( if( aSeriesSeq.empty() ) { // we need a new chart type - xCT = getChartTypeForNewSeries( aOldChartTypesSeq ); + xCT = getChartTypeForNewSeries2( aOldChartTypesSeq ); rCoordSys[nCooSysIdx]->setChartTypes(std::vector{ xCT }); } else @@ -746,7 +746,7 @@ void ChartTypeTemplate::createChartTypes( if( nSeriesIdx == nCooSysIdx ) { // we need a new chart type - xCT = getChartTypeForNewSeries( aOldChartTypesSeq ); + xCT = getChartTypeForNewSeries2( aOldChartTypesSeq ); std::vector< rtl::Reference< ChartType > > aCTSeq( rCoordSys[nCooSysIdx]->getChartTypes2()); if( !aCTSeq.empty()) { @@ -806,6 +806,57 @@ void ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( comphelper::copyProperties( xSource, xNewChartType ); } +css::uno::Reference< css::uno::XInterface > ChartTypeTemplate::getDataInterpreter() +{ + return static_cast<cppu::OWeakObject*>(getDataInterpreter2().get()); +} +css::uno::Reference< css::chart2::XDiagram > ChartTypeTemplate::createDiagramByDataSource( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) +{ + return createDiagramByDataSource2(xDataSource, aArguments); +} +void ChartTypeTemplate::changeDiagram( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) +{ + changeDiagram(rtl::Reference<Diagram>(dynamic_cast<Diagram*>(xDiagram.get()))); +} +void ChartTypeTemplate::changeDiagramData( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) +{ + changeDiagramData(rtl::Reference<Diagram>(dynamic_cast<Diagram*>(xDiagram.get())), xDataSource, aArguments); +} +sal_Bool ChartTypeTemplate::matchesTemplate( + const css::uno::Reference<css::chart2::XDiagram >& xDiagram, + sal_Bool bAdaptProperties ) +{ + return matchesTemplate2(dynamic_cast<Diagram*>(xDiagram.get()), static_cast<bool>(bAdaptProperties)); +} +css::uno::Reference< ::css::chart2::XChartType > ChartTypeTemplate::getChartTypeForNewSeries( + const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) +{ + std::vector< rtl::Reference< ::chart::ChartType > > aTmp; + aTmp.reserve(aFormerlyUsedChartTypes.getLength()); + for (auto const & rxChartType : aFormerlyUsedChartTypes) + aTmp.push_back(dynamic_cast<ChartType*>(rxChartType.get())); + return getChartTypeForNewSeries2(aTmp); +} +void ChartTypeTemplate::applyStyle( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + ::sal_Int32 nChartTypeIndex, + ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount ) +{ + applyStyle2(dynamic_cast<DataSeries*>(xSeries.get()), nChartTypeIndex, nSeriesIndex, nSeriesCount); +} +void ChartTypeTemplate::resetStyles( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) +{ + resetStyles2(dynamic_cast<Diagram*>(xDiagram.get())); +} + } // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx index 992db10553ba..3a39424de5fe 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx @@ -203,13 +203,13 @@ void ColumnLineChartTypeTemplate::createChartTypes( } } -void ColumnLineChartTypeTemplate::applyStyle( +void ColumnLineChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); if( nChartTypeIndex==0 ) // columns { @@ -231,7 +231,7 @@ StackMode ColumnLineChartTypeTemplate::getStackMode( sal_Int32 nChartTypeIndex ) } // ____ XChartTypeTemplate ____ -bool ColumnLineChartTypeTemplate::matchesTemplate( +bool ColumnLineChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { @@ -312,7 +312,7 @@ rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForIndex( s return new LineChartType(); } -rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -330,7 +330,7 @@ rtl::Reference< ChartType > ColumnLineChartTypeTemplate::getChartTypeForNewSerie return xResult; } -rtl::Reference< DataInterpreter > ColumnLineChartTypeTemplate::getDataInterpreter() +rtl::Reference< DataInterpreter > ColumnLineChartTypeTemplate::getDataInterpreter2() { if( ! m_xDataInterpreter.is()) { diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx index e28ed68d9566..f76f329a1a4f 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.hxx @@ -55,19 +55,19 @@ protected: virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; - // ____ XChartTypeTemplate ____ - virtual bool matchesTemplate( + // ____ ChartTypeTemplate ____ + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter() override; + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override; // ____ ChartTypeTemplate ____ virtual void createChartTypes( diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx index 7143bee56999..128f8b73a4cb 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.cxx +++ b/chart2/source/model/template/LineChartTypeTemplate.cxx @@ -167,11 +167,11 @@ StackMode LineChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) } // ____ ChartTypeTemplate ____ -bool LineChartTypeTemplate::matchesTemplate( +bool LineChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { - bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); + bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties ); // check symbol-style and line-style // for a template with symbols (or with lines) it is ok, if there is at least one series @@ -275,7 +275,7 @@ rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForIndex( sal_Int return xResult; } -rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -301,13 +301,13 @@ rtl::Reference< ChartType > LineChartTypeTemplate::getChartTypeForNewSeries( return xResult; } -void LineChartTypeTemplate::applyStyle( +void LineChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { diff --git a/chart2/source/model/template/LineChartTypeTemplate.hxx b/chart2/source/model/template/LineChartTypeTemplate.hxx index 7dc454c1e714..88ad1a7da3ef 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.hxx +++ b/chart2/source/model/template/LineChartTypeTemplate.hxx @@ -56,20 +56,18 @@ protected: virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; - // ____ XChartTypeTemplate ____ - virtual bool matchesTemplate( + // ____ ChartTypeTemplate ____ + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - - // ____ ChartTypeTemplate ____ virtual rtl::Reference< ::chart::ChartType > getChartTypeForIndex( sal_Int32 nChartTypeIndex ) override; virtual sal_Int32 getDimension() const override; diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index d264dbc9ea84..8366487cbd35 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -61,13 +61,13 @@ StackMode NetChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex */ ) return m_eStackMode; } -void NetChartTypeTemplate::applyStyle( +void NetChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { @@ -82,11 +82,11 @@ void NetChartTypeTemplate::applyStyle( } // ____ ChartTypeTemplate ____ -bool NetChartTypeTemplate::matchesTemplate( +bool NetChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { - bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); + bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties ); if( bResult ) { @@ -162,7 +162,7 @@ rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_Int3 return new NetChartType(); } -rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > NetChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult( getChartTypeForIndex( 0 ) ); diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx index e7a9c407c31a..b1f5ac9dbd83 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.hxx +++ b/chart2/source/model/template/NetChartTypeTemplate.hxx @@ -39,13 +39,13 @@ public: protected: // ____ ChartTypeTemplate ____ - virtual bool matchesTemplate( + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 55cd07ce6a18..267dc6b8e6c9 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -272,11 +272,11 @@ void PieChartTypeTemplate::createChartTypes( } // ____ XChartTypeTemplate ____ -bool PieChartTypeTemplate::matchesTemplate( +bool PieChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { - bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); + bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties ); bool bTemplateUsesRings = false; getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS ) >>= bTemplateUsesRings; @@ -379,7 +379,7 @@ rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int3 return xResult; } -rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -399,13 +399,13 @@ rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries( return xResult; } -void PieChartTypeTemplate::applyStyle( +void PieChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { @@ -492,7 +492,7 @@ void PieChartTypeTemplate::applyStyle( } } -void PieChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& xDiagram ) +void PieChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) { // reset axes and grids if( xDiagram.is()) @@ -529,7 +529,7 @@ void PieChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram > } } - ChartTypeTemplate::resetStyles( xDiagram ); + ChartTypeTemplate::resetStyles2( xDiagram ); // vary colors by point, // line style diff --git a/chart2/source/model/template/PieChartTypeTemplate.hxx b/chart2/source/model/template/PieChartTypeTemplate.hxx index 425461afd35d..06e80bbb3b37 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.hxx +++ b/chart2/source/model/template/PieChartTypeTemplate.hxx @@ -56,19 +56,19 @@ protected: virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; - // ____ XChartTypeTemplate ____ - virtual bool matchesTemplate( + // ____ ChartTypeTemplate ____ + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual void applyStyle( + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - virtual void resetStyles( + virtual void resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) override; // ____ ChartTypeTemplate ____ diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index f209cbfb3d1c..6fae43023339 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -167,13 +167,13 @@ StackMode ScatterChartTypeTemplate::getStackMode( sal_Int32 /* nChartTypeIndex * return StackMode::NONE; } -void ScatterChartTypeTemplate::applyStyle( +void ScatterChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { @@ -189,17 +189,17 @@ void ScatterChartTypeTemplate::applyStyle( } } -// ____ ChartTypeTemplate ____ -bool ScatterChartTypeTemplate::supportsCategories() +// ____ XChartTypeTemplate ____ +sal_Bool SAL_CALL ScatterChartTypeTemplate::supportsCategories() { return false; } -bool ScatterChartTypeTemplate::matchesTemplate( +bool ScatterChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) { - bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); + bool bResult = ChartTypeTemplate::matchesTemplate2( xDiagram, bAdaptProperties ); // check symbol-style and line-style // for a template with symbols (or with lines) it is ok, if there is at least one series @@ -303,7 +303,7 @@ rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForIndex( sal_ return xResult; } -rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -329,7 +329,7 @@ rtl::Reference< ChartType > ScatterChartTypeTemplate::getChartTypeForNewSeries( return xResult; } -rtl::Reference< DataInterpreter > ScatterChartTypeTemplate::getDataInterpreter() +rtl::Reference< DataInterpreter > ScatterChartTypeTemplate::getDataInterpreter2() { if( ! m_xDataInterpreter.is()) m_xDataInterpreter.set( new XYDataInterpreter ); diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.hxx b/chart2/source/model/template/ScatterChartTypeTemplate.hxx index 02f2e84f7425..88441b84482f 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.hxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.hxx @@ -54,16 +54,16 @@ protected: virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; - // ____ XChartTypeTemplate ____ - virtual bool supportsCategories() override; - virtual bool matchesTemplate( + // ____ ChartTypeTemplate ____ + virtual sal_Bool SAL_CALL supportsCategories() override; + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter() override; - virtual void applyStyle( + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override; + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeGroupIndex, ::sal_Int32 nSeriesIndex, diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index 48cad7862f3e..3b46cb395290 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -186,13 +186,13 @@ sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension return bHasVolume ? 2 : 1; } -void StockChartTypeTemplate::applyStyle( +void StockChartTypeTemplate::applyStyle2( const rtl::Reference< DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) { - ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); + ChartTypeTemplate::applyStyle2( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount ); try { sal_Int32 nNewAxisIndex = 0; @@ -225,10 +225,10 @@ void StockChartTypeTemplate::applyStyle( } } -void StockChartTypeTemplate::resetStyles( +void StockChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) { - ChartTypeTemplate::resetStyles( xDiagram ); + ChartTypeTemplate::resetStyles2( xDiagram ); if( getDimension() == 3 ) { std::vector< rtl::Reference< DataSeries > > aSeriesVec = @@ -337,7 +337,7 @@ void StockChartTypeTemplate::createChartTypes( } // ____ ChartTypeTemplate ____ -bool StockChartTypeTemplate::matchesTemplate( +bool StockChartTypeTemplate::matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool /* bAdaptProperties */ ) { @@ -401,7 +401,7 @@ bool StockChartTypeTemplate::matchesTemplate( return bResult; } -rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForNewSeries( +rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForNewSeries2( const std::vector< rtl::Reference< ChartType > >& aFormerlyUsedChartTypes ) { rtl::Reference< ChartType > xResult; @@ -419,7 +419,7 @@ rtl::Reference< ChartType > StockChartTypeTemplate::getChartTypeForNewSeries( return xResult; } -rtl::Reference< DataInterpreter > StockChartTypeTemplate::getDataInterpreter() +rtl::Reference< DataInterpreter > StockChartTypeTemplate::getDataInterpreter2() { if( ! m_xDataInterpreter.is()) m_xDataInterpreter.set( new StockDataInterpreter( m_eStockVariant ) ); diff --git a/chart2/source/model/template/StockChartTypeTemplate.hxx b/chart2/source/model/template/StockChartTypeTemplate.hxx index fe2a464f1bc4..78d6c02e11e4 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.hxx +++ b/chart2/source/model/template/StockChartTypeTemplate.hxx @@ -70,19 +70,19 @@ protected: getPropertySetInfo() override; // ____ XChartTypeTemplate ____ - virtual bool matchesTemplate( + virtual bool matchesTemplate2( const rtl::Reference< ::chart::Diagram >& xDiagram, bool bAdaptProperties ) override; virtual rtl::Reference< ::chart::ChartType > - getChartTypeForNewSeries( const std::vector< + getChartTypeForNewSeries2( const std::vector< rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) override; - virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter() override; - virtual void applyStyle( + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2() override; + virtual void applyStyle2( const rtl::Reference< ::chart::DataSeries >& xSeries, ::sal_Int32 nChartTypeIndex, ::sal_Int32 nSeriesIndex, ::sal_Int32 nSeriesCount ) override; - virtual void resetStyles( + virtual void resetStyles2( const rtl::Reference< ::chart::Diagram >& xDiagram ) override; // ChartTypeTemplate diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 0f6049ca4ae9..b509f9ec5db3 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -98,7 +98,7 @@ DiagramHelper::tTemplateWithServiceName rtl::Reference< ::chart::ChartTypeTemplate > xTempl = xChartTypeManager->createTemplate( aServiceNames[ i ] ); - if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true)) + if (xTempl.is() && xTempl->matchesTemplate2(xDiagram, true)) { aResult.xChartTypeTemplate = xTempl; aResult.sServiceName = aServiceNames[ i ]; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a64d2154bfd4..6d0b4c1b5954 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -641,6 +641,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/chart2,\ ChartDocumentWrapper \ ChartType \ ChartTypeManager \ + ChartTypeTemplate\ CoordinateSystem \ CoordinateSystemType \ DataPoint \ @@ -2030,6 +2031,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/chart2,\ XChartType \ XChartTypeContainer \ XChartTypeManager \ + XChartTypeTemplate \ XColorScheme \ XCoordinateSystem \ XCoordinateSystemContainer \ diff --git a/offapi/com/sun/star/chart2/ChartTypeTemplate.idl b/offapi/com/sun/star/chart2/ChartTypeTemplate.idl new file mode 100644 index 000000000000..e2f74c2ba532 --- /dev/null +++ b/offapi/com/sun/star/chart2/ChartTypeTemplate.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef com_sun_star_chart2_ChartTypeTemplate_idl +#define com_sun_star_chart2_ChartTypeTemplate_idl + +#include <com/sun/star/chart2/XChartTypeTemplate.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +service ChartTypeTemplate +{ + interface ::com::sun::star::chart2::XChartTypeTemplate; +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/chart2/XChartTypeTemplate.idl b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl new file mode 100644 index 000000000000..147343d4b685 --- /dev/null +++ b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef com_sun_star_chart2_XChartTypeTemplate_idl +#define com_sun_star_chart2_XChartTypeTemplate_idl + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/beans/PropertyValue.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> +#include <com/sun/star/chart2/XDiagram.idl> +#include <com/sun/star/chart2/data/XDataSource.idl> +#include <com/sun/star/chart2/XChartType.idl> +#include <com/sun/star/chart2/XDataInterpreter.idl> + +module com +{ +module sun +{ +module star +{ +module chart2 +{ + +interface XChartTypeTemplate : ::com::sun::star::uno::XInterface +{ + /** Creates a new diagram based upon the given data . + + @param xDataSource + This data source will be interpreted in a chart-type + specific way and appropriate DataSeries will + be created which serve as input for the new diagram. + + @param aArguments + Arguments that tell the template how to slice the given + range. The properties should be defined in a separate + service. + + <p>For standard parameters that may be used, see the + service StandardDiagramCreationParameters. + </p> + + @return + The new diagram which represents this + ChartTypeTemplate. + */ + XDiagram createDiagramByDataSource( + [in] com::sun::star::chart2::data::XDataSource xDataSource, + [in] sequence< com::sun::star::beans::PropertyValue > aArguments ); + + /** @return + `TRUE` if the template does support categories + */ + boolean supportsCategories(); + + /** Analyses the given diagram and reinterprets its + DataSeries and Categories and + creates a new diagram based on these series. + + <p>Note, that if matchesTemplate() returns + `TRUE` for the given XDiagram, the latter should + not be changed.</p> + + @param xDiagram + The diagram given will be modified such that it represents + this ChartTypeTemplate. + */ + void changeDiagram( [in] XDiagram xDiagram ); + + /** Changes the given diagram <code>xDiagram</code> by using the + new data given in <code>xDataSource</code>. + + <p>Note that the data is interpreted in a way that fits this + template, but not necessarily the chart-types of the diagram. + This method should only be called if the data-format of the + diagram is compatible with the data-format of this + template.</p> + + <p>Ideally a matchesTemplate() call for the + given diagram should return `TRUE` before this method is + called.</p> + + @param xDiagram + The diagram to be changed. + + @param xDataSource + This data source will be interpreted in a chart-type + specific way and the DataSeries found in + <code>xDiagram</code> will be adapted to the new data. + Missing data series will be created and unused ones will + be deleted in <code>xDiagram</code>. + + @param aArguments + Arguments that tell the template how to slice the given + range. The properties should be defined in a separate + service. + + <p>For standard parameters that may be used, see the + service StandardDiagramCreationParameters. + </p> + */ + void changeDiagramData( + [in] XDiagram xDiagram, + [in] com::sun::star::chart2::data::XDataSource xDataSource, + [in] sequence< com::sun::star::beans::PropertyValue > aArguments ); + + /** States whether the given diagram could have been created by + the template. + + <p>The template will parse the DataSeriesTree of + the diagram to determine if the structure matches the one + which would have been created by + createDiagramByDataSource().</p> + + <p>For analysis all parts of the diagram may be used, + e.g. also properties set at the data series (like symbols)./p> + + @param xDiagram + The diagram to be analyzed. + + @param bAdaptProperties + If `TRUE` the properties of the template are set, such + that the template matches more accurately. E.g. for a + line-chart with symbols the property "Symbol" would be set + to `TRUE`. If this parameter is `FALSE` the template + itself stays unmodified. + + @return + `TRUE` if the diagram given is structurally identical to + a diagram that was created using + createDiagramByDataSource() or + changeDiagram(). If `FALSE` is returned + the template stays unmodified even if + <code>bAdaptProperties</code> is `TRUE`. + */ + boolean matchesTemplate( [in] XDiagram xDiagram, + [in] boolean bAdaptProperties ); + + /** Provides a chart type object that can be used to create new + series. + + @param aFormerlyUsedChartTypes + The list can be used to copy some aspects from old chart types during the creation of a new chart type. + The list might be empty. + */ + XChartType getChartTypeForNewSeries( [in] sequence< XChartType > aFormerlyUsedChartTypes ); + + /** + This used to have a return type of XDataInterpreter. + Then I removed the whole XChartTypeTemplate interface in + commit 58766f997d59e4684f2887fd8cdeb12d2f8a9366. + Which turned out to be a bad idea, so I restored it. + I restored it in this form because I want to restore binary compatibily with vtable + layout, but I don't want to restore the XDataInterpreter stuff, which was not + useful for external use. + */ + com::sun::star::uno::XInterface getDataInterpreter(); + + /** Applies a chart-type specific style (e.g. symbols) to all series in the + sequence aSeries. + + @param xSeries + a single data series to which a style will be applied + + @param nChartTypeGroupIndex + Denotes in which chart-type group the series lies, such this method + can apply different styles for different chart-type groups + + @param nSeriesIndex + The index of the series inside the current chart-type group. + nSeriesIndex does not uniquely identify a data series alone, but + only together with nChartTypeGroupIndex + + @param nSeriesCount + The number of series in the current chart-type group. + + @todo In the future, this should only change the "Style" property and no + hard attributes. + */ + void applyStyle( [in] XDataSeries xSeries, + [in] long nChartTypeGroupIndex, + [in] long nSeriesIndex, + [in] long nSeriesCount ); + + /** Resets all styles that were changed from the default at any + object in the chart and have not been later modified. + + <p>In createDiagramByDataSource() or + changeDiagram() a template might e.g. change + the page background color or the line style of all data + series. This method should reset all objects that still have + the changed settings to the default.</p> + + <p>If for example the template changed the + com::sun::star::drawing::LineStyle of all + series to NONE, this method should reset all series with + LineStyle NONE back to SOLID. If a series has a style DASH, + it must not be changed.</p> + */ + void resetStyles( [in] XDiagram xDiagram ); +}; + +} ; // chart2 +} ; // com +} ; // sun +} ; // star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |