chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx | 12 +++- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 6 +- chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 25 ++++++---- chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 14 ++--- chart2/source/controller/main/ChartController_Properties.cxx | 5 +- chart2/source/controller/main/ChartController_Window.cxx | 5 +- chart2/source/inc/DataSeriesHelper.hxx | 2 chart2/source/model/template/ChartTypeTemplate.cxx | 8 ++- chart2/source/model/template/PieChartTypeTemplate.cxx | 11 ++-- chart2/source/tools/DataSeriesHelper.cxx | 22 +++++--- chart2/source/tools/ReferenceSizeProvider.cxx | 8 ++- chart2/source/view/charttypes/PieChart.cxx | 16 ++++-- chart2/source/view/charttypes/VSeriesPlotter.cxx | 11 +++- chart2/source/view/main/VDataSeries.cxx | 15 +++--- 14 files changed, 102 insertions(+), 58 deletions(-)
New commits: commit 67cf6e0463c7538ebdd1ea7ba1b98c5e8cf8b7f9 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Mar 29 11:31:40 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Mar 29 19:02:34 2023 +0000 use more get/setFastPropertyValue in chart2 Change-Id: I4979cf5dab8b35ba35a46808cef76dc3f81c59b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149725 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 12449763df19..ed742df89d88 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -23,6 +23,7 @@ #include <ChartTypeHelper.hxx> #include <DiagramHelper.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <LinePropertiesHelper.hxx> #include <FillProperties.hxx> #include <CharacterProperties.hxx> @@ -59,6 +60,7 @@ using namespace ::com::sun::star; using namespace ::chart::wrapper; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -617,9 +619,10 @@ beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const OU { if( rPropertyName == "FillColor") { - rtl::Reference< DataSeries > xSeriesProp = getDataSeries(); + rtl::Reference< DataSeries > xSeries = getDataSeries(); bool bVaryColorsByPoint = false; - if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) + // "VaryColorsByPoint" + if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) return beans::PropertyState_DIRECT_VALUE; } @@ -836,9 +839,10 @@ Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const OUString& rProperty { if( rPropertyName == "FillColor" ) { - rtl::Reference< DataSeries > xSeriesProp = getDataSeries(); + rtl::Reference< DataSeries > xSeries = getDataSeries(); bool bVaryColorsByPoint = false; - if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) + // "VaryColorsByPoint" + if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) { uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY ); diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 314778deac4f..458c35830db0 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -27,6 +27,7 @@ #include <SeriesOptionsItemConverter.hxx> #include <DataSeries.hxx> #include <DataSeriesHelper.hxx> +#include <DataSeriesProperties.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ChartModel.hxx> @@ -62,6 +63,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; namespace chart::wrapper { @@ -253,7 +255,8 @@ DataPointItemConverter::DataPointItemConverter( return; uno::Sequence<sal_Int32> deletedLegendEntriesSeq; - xSeries->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; + // "DeletedLegendEntries" + xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq; for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq)) { if (nPointIndex == deletedLegendEntry) @@ -574,7 +577,8 @@ bool DataPointItemConverter::ApplySpecialItem( if (bHideLegendEntry != m_bHideLegendEntry) { uno::Sequence<sal_Int32> deletedLegendEntriesSeq; - m_xSeries->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; + // "DeletedLegendEntries" + m_xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq; std::vector<sal_Int32> deletedLegendEntries; for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq)) { @@ -583,7 +587,8 @@ bool DataPointItemConverter::ApplySpecialItem( } if (bHideLegendEntry) deletedLegendEntries.push_back(m_nPointIndex); - m_xSeries->setPropertyValue("DeletedLegendEntries", uno::Any(comphelper::containerToSequence(deletedLegendEntries))); + // "DeletedLegendEntries" + m_xSeries->setFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES, uno::Any(comphelper::containerToSequence(deletedLegendEntries))); } } break; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index b310178635b9..11d12bc77dbf 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -47,6 +47,7 @@ #include <ChartModel.hxx> #include <ColorPerPointHelper.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ControllerLockGuard.hxx> @@ -71,6 +72,7 @@ namespace chart { using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; namespace @@ -220,7 +222,8 @@ wrapper::ItemConverter* createItemConverter( nPointIndex = o3tl::toInt32(aParticleID); bool bVaryColorsByPoint = false; if( xSeries.is() && - (xSeries->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) && + // "VaryColorsByPoint" + (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) { if( !ColorPerPointHelper::hasPointOwnColor( xSeries, nPointIndex, xObjectProperties ) ) diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 88e9ab645f91..166245168d0b 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -485,7 +485,7 @@ void PieChartTypeTemplate::applyStyle2( DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) ); // vary colors by point - xSeries->setPropertyValue( "VaryColorsByPoint", uno::Any( true )); + xSeries->setFastPropertyValue( PROP_DATASERIES_VARY_COLORS_BY_POINT, uno::Any( true )); // "VaryColorsByPoint" } catch( const uno::Exception & ) { diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 5e8cb88bc910..1c5f15d7ec00 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -26,6 +26,8 @@ #include <CommonConverters.hxx> #include <ObjectIdentifier.hxx> #include <ChartType.hxx> +#include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart2/XColorScheme.hpp> @@ -41,6 +43,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; namespace chart { @@ -490,8 +493,8 @@ void PieChart::createTextLabelShape( } } - bool bShowLeaderLine = rSeries.getPropertiesOfSeries() - ->getPropertyValue("ShowCustomLeaderLines") + bool bShowLeaderLine = rSeries.getModel() + ->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) // "ShowCustomLeaderLines" .get<sal_Bool>(); if (m_bPieLabelsAllowToMove) { @@ -593,19 +596,20 @@ double PieChart::getMaxOffset() return m_fMaxOffset; VDataSeries* pSeries = rSeriesList.front().get(); - uno::Reference< beans::XPropertySet > xSeriesProp( pSeries->getPropertiesOfSeries() ); - if( !xSeriesProp.is() ) + rtl::Reference< DataSeries > xSeries( pSeries->getModel() ); + if( !xSeries.is() ) return m_fMaxOffset; double fExplodePercentage=0.0; - xSeriesProp->getPropertyValue( "Offset") >>= fExplodePercentage; + xSeries->getPropertyValue( "Offset") >>= fExplodePercentage; if(fExplodePercentage>m_fMaxOffset) m_fMaxOffset=fExplodePercentage; if(!m_bSizeExcludesLabelsAndExplodedSegments) { uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 35f13c7d3184..f9fa8fe0fea9 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -27,6 +27,7 @@ #include <Diagram.hxx> #include <BaseCoordinateSystem.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <CommonConverters.hxx> #include <ExplicitCategoriesProvider.hxx> @@ -95,6 +96,7 @@ namespace chart { using namespace ::com::sun::star; using namespace ::com::sun::star::chart; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -702,7 +704,8 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen { xTextShape->setPosition(aRelPos); if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) && - rDataSeries.getPropertiesOfSeries()->getPropertyValue( "ShowCustomLeaderLines" ).get<sal_Bool>()) + // "ShowCustomLeaderLines" + rDataSeries.getModel()->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ).get<sal_Bool>()) { sal_Int32 nX1 = rScreenPosition2D.X; sal_Int32 nY1 = rScreenPosition2D.Y; @@ -2451,7 +2454,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( if (!pSeries) continue; - if (!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>()) + // "ShowLegendEntry" + if (!pSeries->getModel()->getFastPropertyValue(PROP_DATASERIES_SHOW_LEGEND_ENTRY).get<sal_Bool>()) { continue; } @@ -2748,7 +2752,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( Sequence<sal_Int32> deletedLegendEntries; try { - rSeries.getPropertiesOfSeries()->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntries; + // "DeletedLegendEntries" + rSeries.getModel()->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntries; } catch (const uno::Exception&) { diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index feac68042af5..0ff045b5fde9 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -896,9 +896,8 @@ bool VDataSeries::isAttributedDataPoint( sal_Int32 index ) const bool VDataSeries::isVaryColorsByPoint() const { bool bVaryColorsByPoint = false; - Reference< beans::XPropertySet > xSeriesProp( getPropertiesOfSeries() ); - if( xSeriesProp.is() ) - xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint; + if( m_xDataSeries ) + m_xDataSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint; // "VaryColorsByPoint" return bVaryColorsByPoint; } commit 99463a6f7f25d53e806fb475a6d5e2ced13b10e6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Mar 29 10:34:05 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Mar 29 19:02:25 2023 +0000 use more get/setFastPropertyValue in chart2 Change-Id: I1471309e200c8eec21844658b873f817565f9604 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149693 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 8d71463263af..5e1c76958ab4 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -20,6 +20,7 @@ #include "DiagramWrapper.hxx" #include <servicenames_charttypes.hxx> #include "DataSeriesPointWrapper.hxx" +#include <DataSeriesProperties.hxx> #include "AxisWrapper.hxx" #include "Chart2ModelContact.hxx" #include "WallFloorWrapper.hxx" @@ -71,6 +72,7 @@ using namespace ::com::sun::star; using namespace ::chart::wrapper; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; @@ -1605,7 +1607,7 @@ void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterVal uno::Sequence< sal_Int32 > aSeq; aVal <<= aSeq; } - series->setPropertyValue( "AttributedDataPoints", aVal ); + series->setFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS, aVal ); // "AttributedDataPoints" ++i; } } @@ -1625,7 +1627,7 @@ Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< bean for (auto const& series : aSeriesVector) { uno::Any aVal( - series->getPropertyValue("AttributedDataPoints")); + series->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS)); // "AttributedDataPoints" uno::Sequence< sal_Int32 > aSeq; if( aVal >>= aSeq ) aResultRange[ i ] = aSeq; diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index f096ecd4e1f3..314778deac4f 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -133,7 +133,7 @@ bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSe uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) ); if( bOverwriteAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY); + rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) ); if( aValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) ) { @@ -181,7 +181,7 @@ bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxIte uno::Any aOldValue( xPropertySet->getPropertyValue(aPropertyName) ); if( bOverwriteAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( xPropertySet, uno::UNO_QUERY); + rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) ); if( aNewValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, aPropertyName, aOldValue ) ) { @@ -341,7 +341,7 @@ bool DataPointItemConverter::ApplySpecialItem( rValue = rItem.GetValue(); if( m_bOverwriteLabelsForAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if( bOldValue != bool(rValue) || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, CHART_UNONAME_LABEL , aOldValue ) ) { @@ -382,7 +382,7 @@ bool DataPointItemConverter::ApplySpecialItem( GetPropertySet()->getPropertyValue( "LabelSeparator" ) >>= aOldValue; if( m_bOverwriteLabelsForAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if( aOldValue != aNewValue || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelSeparator" , uno::Any( aOldValue ) ) ) { @@ -413,7 +413,7 @@ bool DataPointItemConverter::ApplySpecialItem( GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld; if( m_bOverwriteLabelsForAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if( bOld!=bNew || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) ) { @@ -445,7 +445,7 @@ bool DataPointItemConverter::ApplySpecialItem( GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld; if( m_bOverwriteLabelsForAttributedDataPointsAlso ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if( nOld!=nNew || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "LabelPlacement" , uno::Any( nOld ) ) ) { @@ -635,7 +635,7 @@ void DataPointItemConverter::FillSpecialItem( if( m_bOverwriteLabelsForAttributedDataPointsAlso ) { if( DataSeriesHelper::hasAttributedDataPointDifferentValue( - Reference< chart2::XDataSeries >( GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL , uno::Any(aLabel) ) ) + dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL , uno::Any(aLabel) ) ) { rOutItemSet.InvalidateItem(nWhichId); } diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 439820912a9d..df7c46a6b342 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -127,7 +127,7 @@ bool numberFormatFromItemToPropertySet( uno::Any aOldValue = xPropertySet->getPropertyValue(aPropertyName); if (bOverwriteDataPoints) { - Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) ); if (aValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue)) { @@ -177,7 +177,7 @@ bool useSourceFormatFromItemToPropertySet( uno::Any aOldValue(xPropertySet->getPropertyValue(aPropertyName)); if (bOverwriteDataPoints) { - Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(xPropertySet.get())); if (aNewValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue)) { @@ -289,7 +289,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte rValue = rItem.GetValue(); if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (bOldValue != bool(rValue) || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, CHART_UNONAME_LABEL, aOldValue)) { @@ -327,7 +327,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue; if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (aOldValue != aNewValue || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelSeparator", uno::Any(aOldValue))) { @@ -357,7 +357,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld; if( mbDataSeries ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) ); if( bOld!=bNew || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) ) { @@ -387,7 +387,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld; if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (nOld != nNew || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelPlacement", uno::Any(nOld))) { @@ -553,7 +553,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r if (mbDataSeries) { if (DataSeriesHelper::hasAttributedDataPointDifferentValue( - Reference<chart2::XDataSeries>(GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL, uno::Any(aLabel))) + dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL, uno::Any(aLabel))) { rOutItemSet.InvalidateItem(nWhichId); } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index e993cdeb80f2..81474c5295eb 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -48,6 +48,7 @@ #include <StatisticsHelper.hxx> #include <DataSeries.hxx> #include <DataSeriesHelper.hxx> +#include <DataSeriesProperties.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> #include <LegendHelper.hxx> @@ -97,6 +98,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; namespace chart @@ -1061,7 +1063,8 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( xSeries.is() ) { uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { if( aAttributedDataPointIndexList.hasElements() ) { diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index 474c49bb8277..2de09db7cd76 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -156,7 +156,7 @@ OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints( OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue( - const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const rtl::Reference< ::chart::DataSeries >& xSeries, const OUString& rPropertyName, const css::uno::Any& rPropertyValue ); diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index c99171e5432a..49c93766cd53 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -23,6 +23,7 @@ #include <ChartTypeHelper.hxx> #include <ChartType.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <DataSource.hxx> #include <GridProperties.hxx> @@ -47,6 +48,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; @@ -380,7 +382,8 @@ void ChartTypeTemplate::applyStyle2( lcl_ensureCorrectLabelPlacement( xSeries, aAvailablePlacements ); uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) lcl_ensureCorrectLabelPlacement( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), aAvailablePlacements ); } @@ -444,7 +447,8 @@ void ChartTypeTemplate::resetStyles2( const rtl::Reference< ::chart::Diagram >& lcl_resetLabelPlacementIfDefault( xSeries, nDefaultPlacement ); uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) lcl_resetLabelPlacementIfDefault( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), nDefaultPlacement ); } diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 021b3ab6c8f2..88e9ab645f91 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -26,6 +26,7 @@ #include <DiagramHelper.hxx> #include <DataSeries.hxx> #include <DataSeriesHelper.hxx> +#include <DataSeriesProperties.hxx> #include <Axis.hxx> #include <AxisHelper.hxx> #include <ThreeDHelper.hxx> @@ -41,6 +42,7 @@ #include <algorithm> using namespace ::com::sun::star; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::beans::Property; using ::com::sun::star::uno::Sequence; @@ -305,9 +307,9 @@ bool PieChartTypeTemplate::matchesTemplate2( rtl::Reference< DataSeries > xSeries( aSeriesVec[nOuterSeriesIndex] ); xSeries->getPropertyValue( "Offset") >>= fOffset; - //get AttributedDataPoints + // "AttributedDataPoints" uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { @@ -428,7 +430,8 @@ void PieChartTypeTemplate::applyStyle2( double fOffsetToSet = fDefaultOffset; uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList; + // "AttributedDataPoints" + xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList; // determine whether to set the new offset bool bSetOffset = ( ePieOffsetMode == chart2::PieChartOffsetMode_ALL_EXPLODED ); diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 9935aa0e5fd3..883b72f2908d 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -19,6 +19,7 @@ #include <DataSeriesHelper.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <DataSource.hxx> #include <ChartType.hxx> #include <unonames.hxx> @@ -49,6 +50,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -128,7 +130,8 @@ void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const rtl::Reference< ::c } xSeries->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabelAtSeries)); uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { @@ -486,7 +489,8 @@ void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::Da xSeries->setPropertyValue( rPropertyName, rPropertyValue ); uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { @@ -500,15 +504,15 @@ void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::Da } } -bool hasAttributedDataPointDifferentValue( const Reference< chart2::XDataSeries >& xSeries, +bool hasAttributedDataPointDifferentValue( const rtl::Reference< DataSeries >& xSeries, const OUString& rPropertyName, const uno::Any& rPropertyValue ) { - Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); - if( !xSeriesProperties.is() ) + if( !xSeries.is() ) return false; uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { @@ -590,7 +594,8 @@ bool hasDataLabelsAtPoints( const rtl::Reference< DataSeries >& xSeries ) if( xSeries.is() ) { uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { @@ -625,7 +630,8 @@ bool hasDataLabelAtPoint( const rtl::Reference< DataSeries >& xSeries, sal_Int32 if( xSeries.is() ) { uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { auto aIt = std::find( std::as_const(aAttributedDataPointIndexList).begin(), std::as_const(aAttributedDataPointIndexList).end(), nPointIndex ); if( aIt != std::as_const(aAttributedDataPointIndexList).end()) diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx index e67d4fbe4a57..ad71d4e72641 100644 --- a/chart2/source/tools/ReferenceSizeProvider.cxx +++ b/chart2/source/tools/ReferenceSizeProvider.cxx @@ -22,6 +22,7 @@ #include <ChartModelHelper.hxx> #include <ChartModel.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <Axis.hxx> @@ -32,6 +33,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -103,7 +105,8 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries() Sequence< sal_Int32 > aPointIndexes; try { - if( elem->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes ) + // "AttributedDataPoints" + if( elem->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= aPointIndexes ) { for( sal_Int32 idx : std::as_const(aPointIndexes) ) setValuesAtPropertySet( @@ -265,7 +268,8 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState Sequence< sal_Int32 > aPointIndexes; try { - if( elem->getPropertyValue( "AttributedDataPoints") >>= aPointIndexes ) + // "AttributedDataPoints" + if( elem->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= aPointIndexes ) { for( sal_Int32 idx : std::as_const(aPointIndexes) ) { diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 6b6df81dde54..feac68042af5 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -21,6 +21,7 @@ #include <memory> #include <VDataSeries.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <ObjectIdentifier.hxx> #include <CommonConverters.hxx> #include <LabelPositionHelper.hxx> @@ -47,6 +48,7 @@ namespace chart { using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; +using namespace ::chart::DataSeriesProperties; void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel ) { @@ -227,12 +229,12 @@ VDataSeries::VDataSeries( const rtl::Reference< DataSeries >& xDataSeries ) try { - //get AttributedDataPoints - xDataSeries->getPropertyValue("AttributedDataPoints") >>= m_aAttributedDataPointIndexList; + // "AttributedDataPoints" + xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= m_aAttributedDataPointIndexList; - xDataSeries->getPropertyValue("StackingDirection") >>= m_eStackingDirection; + xDataSeries->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION) >>= m_eStackingDirection; // "StackingDirection" - xDataSeries->getPropertyValue("AttachedAxisIndex") >>= m_nAxisIndex; + xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTACHED_AXIS_INDEX) >>= m_nAxisIndex; // "AttachedAxisIndex" if(m_nAxisIndex<0) m_nAxisIndex=0; }