diff options
Diffstat (limited to 'chart2/source/view/main/VDataSeries.cxx')
-rw-r--r-- | chart2/source/view/main/VDataSeries.cxx | 248 |
1 files changed, 134 insertions, 114 deletions
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index a650adcef066..4527d4368b2f 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -20,53 +20,58 @@ #include <limits> #include <memory> #include <VDataSeries.hxx> +#include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <ObjectIdentifier.hxx> #include <CommonConverters.hxx> #include <LabelPositionHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> +#include <RegressionCurveCalculator.hxx> #include <RegressionCurveHelper.hxx> #include <unonames.hxx> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/chart2/Symbol.hpp> -#include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/chart2/XRegressionCurveCalculator.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> +#include <o3tl/compare.hxx> #include <osl/diagnose.h> #include <tools/color.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> -#include <com/sun/star/chart2/data/XDataSource.hpp> 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 ) { - Model = xModel; - Doubles = DataSequenceToDoubleSequence( xModel ); + m_xModel = xModel; + m_aValues = DataSequenceToDoubleSequence( xModel ); } bool VDataSequence::is() const { - return Model.is(); + return m_xModel.is(); } void VDataSequence::clear() { - Model = nullptr; - Doubles.realloc(0); + m_xModel = nullptr; + m_aValues.realloc(0); } double VDataSequence::getValue( sal_Int32 index ) const { - if( 0<=index && index<Doubles.getLength() ) - return Doubles[index]; + if( 0<=index && index<m_aValues.getLength() ) + return m_aValues[index]; return std::numeric_limits<double>::quiet_NaN(); } @@ -75,10 +80,9 @@ sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const sal_Int32 nNumberFormatKey = -1; // -1 is allowed and means a key for the whole sequence - if( -1<=index && index<Doubles.getLength() && - Model.is()) + if( -1<=index && index<m_aValues.getLength() && m_xModel.is()) { - nNumberFormatKey = Model->getNumberFormatKeyByIndex( index ); + nNumberFormatKey = m_xModel->getNumberFormatKeyByIndex( index ); } return nNumberFormatKey; @@ -86,7 +90,7 @@ sal_Int32 VDataSequence::detectNumberFormatKey( sal_Int32 index ) const sal_Int32 VDataSequence::getLength() const { - return Doubles.getLength(); + return m_aValues.getLength(); } namespace @@ -98,7 +102,7 @@ struct lcl_LessXOfPoint { if( !first.empty() && !second.empty() ) { - return first[0]<second[0]; + return o3tl::strong_order(first[0], second[0]) < 0; } return false; } @@ -107,10 +111,10 @@ struct lcl_LessXOfPoint void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence ) { //#i71686#, #i101968#, #i102428# - sal_Int32 nCount = rData.Doubles.getLength(); + sal_Int32 nCount = rData.m_aValues.getLength(); for( sal_Int32 i = 0; i < nCount; ++i ) { - if( !std::isnan( rData.Doubles[i] ) ) + if( !std::isnan( rData.m_aValues[i] ) ) return; } //no double value is contained @@ -137,7 +141,7 @@ void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatm } -VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) +VDataSeries::VDataSeries( const rtl::Reference< DataSeries >& xDataSeries ) : m_nPolygonIndex(0) , m_fLogicMinX(0.0) , m_fLogicMaxX(0.0) @@ -159,17 +163,13 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) , mpOldSeries(nullptr) , mnPercent(0.0) { - m_xDataSeriesProps.set(m_xDataSeries, css::uno::UNO_QUERY); - uno::Reference<data::XDataSource> xDataSource( xDataSeries, uno::UNO_QUERY ); + m_xDataSeriesProps = m_xDataSeries; - uno::Sequence< uno::Reference< - chart2::data::XLabeledDataSequence > > aDataSequences = - xDataSource->getDataSequences(); + const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSequences = + m_xDataSeries->getDataSequences2(); - for(sal_Int32 nN = aDataSequences.getLength();nN--;) + for(sal_Int32 nN = aDataSequences.size();nN--;) { - if(!aDataSequences[nN].is()) - continue; uno::Reference<data::XDataSequence> xDataSequence( aDataSequences[nN]->getValues()); uno::Reference<beans::XPropertySet> xProp(xDataSequence, uno::UNO_QUERY ); if( xProp.is()) @@ -226,18 +226,17 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) m_nPointCount = m_aValues_Y_Last.getLength(); } - uno::Reference<beans::XPropertySet> xProp(xDataSeries, uno::UNO_QUERY ); - if( !xProp.is()) + if( !xDataSeries.is()) return; try { - //get AttributedDataPoints - xProp->getPropertyValue("AttributedDataPoints") >>= m_aAttributedDataPointIndexList; + // "AttributedDataPoints" + xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTRIBUTED_DATA_POINTS) >>= m_aAttributedDataPointIndexList; - xProp->getPropertyValue("StackingDirection") >>= m_eStackingDirection; + xDataSeries->getFastPropertyValue(PROP_DATASERIES_STACKING_DIRECTION) >>= m_eStackingDirection; // "StackingDirection" - xProp->getPropertyValue("AttachedAxisIndex") >>= m_nAxisIndex; + xDataSeries->getFastPropertyValue(PROP_DATASERIES_ATTACHED_AXIS_INDEX) >>= m_nAxisIndex; // "AttachedAxisIndex" if(m_nAxisIndex<0) m_nAxisIndex=0; } @@ -253,7 +252,7 @@ VDataSeries::~VDataSeries() void VDataSeries::doSortByXValues() { - if( !(m_aValues_X.is() && m_aValues_X.Doubles.hasElements()) ) + if( !(m_aValues_X.is() && m_aValues_X.m_aValues.hasElements()) ) return; //prepare a vector for sorting @@ -262,9 +261,9 @@ void VDataSeries::doSortByXValues() for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ ) { aTmp.push_back( - { ((nPointIndex < m_aValues_X.Doubles.getLength()) ? m_aValues_X.Doubles[nPointIndex] + { ((nPointIndex < m_aValues_X.m_aValues.getLength()) ? m_aValues_X.m_aValues[nPointIndex] : std::numeric_limits<double>::quiet_NaN()), - ((nPointIndex < m_aValues_Y.Doubles.getLength()) ? m_aValues_Y.Doubles[nPointIndex] + ((nPointIndex < m_aValues_Y.m_aValues.getLength()) ? m_aValues_Y.m_aValues[nPointIndex] : std::numeric_limits<double>::quiet_NaN()) } ); @@ -274,10 +273,10 @@ void VDataSeries::doSortByXValues() std::stable_sort( aTmp.begin(), aTmp.end(), lcl_LessXOfPoint() ); //fill the sorted points back to the members - m_aValues_X.Doubles.realloc( m_nPointCount ); - auto pDoublesX = m_aValues_X.Doubles.getArray(); - m_aValues_Y.Doubles.realloc( m_nPointCount ); - auto pDoublesY = m_aValues_Y.Doubles.getArray(); + m_aValues_X.m_aValues.realloc( m_nPointCount ); + auto pDoublesX = m_aValues_X.m_aValues.getArray(); + m_aValues_Y.m_aValues.realloc( m_nPointCount ); + auto pDoublesY = m_aValues_Y.m_aValues.getArray(); for( nPointIndex=0; nPointIndex < m_nPointCount; nPointIndex++ ) { @@ -288,18 +287,18 @@ void VDataSeries::doSortByXValues() void VDataSeries::releaseShapes() { - m_xGroupShape.set(nullptr); - m_xLabelsGroupShape.set(nullptr); - m_xErrorXBarsGroupShape.set(nullptr); - m_xErrorYBarsGroupShape.set(nullptr); - m_xFrontSubGroupShape.set(nullptr); - m_xBackSubGroupShape.set(nullptr); + m_xGroupShape.clear(); + m_xLabelsGroupShape.clear(); + m_xErrorXBarsGroupShape.clear(); + m_xErrorYBarsGroupShape.clear(); + m_xFrontSubGroupShape.clear(); + m_xBackSubGroupShape.clear(); m_aPolyPolygonShape3D.clear(); m_nPolygonIndex = 0; } -const uno::Reference<css::chart2::XDataSeries>& VDataSeries::getModel() const +const rtl::Reference<::chart::DataSeries>& VDataSeries::getModel() const { return m_xDataSeries; } @@ -426,10 +425,10 @@ double VDataSeries::getXValue( sal_Int32 index ) const { if( 0<=index && index<m_aValues_X.getLength() ) { - fRet = m_aValues_X.Doubles[index]; + fRet = m_aValues_X.m_aValues[index]; if(mpOldSeries && index < mpOldSeries->m_aValues_X.getLength()) { - double nOldVal = mpOldSeries->m_aValues_X.Doubles[index]; + double nOldVal = mpOldSeries->m_aValues_X.m_aValues[index]; fRet = nOldVal + (fRet - nOldVal) * mnPercent; } } @@ -451,10 +450,10 @@ double VDataSeries::getYValue( sal_Int32 index ) const { if( 0<=index && index<m_aValues_Y.getLength() ) { - fRet = m_aValues_Y.Doubles[index]; + fRet = m_aValues_Y.m_aValues[index]; if(mpOldSeries && index < mpOldSeries->m_aValues_Y.getLength()) { - double nOldVal = mpOldSeries->m_aValues_Y.Doubles[index]; + double nOldVal = mpOldSeries->m_aValues_Y.m_aValues[index]; fRet = nOldVal + (fRet - nOldVal) * mnPercent; } } @@ -528,7 +527,7 @@ double VDataSeries::getBubble_Size( sal_Int32 index ) const bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const { - OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : OUString(CHART_UNONAME_NUMFMT); + OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : CHART_UNONAME_NUMFMT; bool bHasNumberFormat = false; bool bLinkToSource = true; uno::Reference< beans::XPropertySet > xPointProp( getPropertiesOfPoint( nPointIndex )); @@ -542,7 +541,7 @@ bool VDataSeries::hasExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPerce } sal_Int32 VDataSeries::getExplicitNumberFormat( sal_Int32 nPointIndex, bool bForPercentage ) const { - OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : OUString(CHART_UNONAME_NUMFMT); + OUString aPropName = bForPercentage ? OUString("PercentageNumberFormat") : CHART_UNONAME_NUMFMT; sal_Int32 nNumberFormat = -1; uno::Reference< beans::XPropertySet > xPointProp( getPropertiesOfPoint( nPointIndex )); if( xPointProp.is() ) @@ -574,7 +573,7 @@ sal_Int32 VDataSeries::detectNumberFormatKey( sal_Int32 index ) const return nRet; } -sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Reference< chart2::XChartType >& xChartType, bool bSwapXAndY ) const +sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const rtl::Reference< ChartType >& xChartType, bool bSwapXAndY ) const { sal_Int32 nLabelPlacement=0; try @@ -648,6 +647,26 @@ bool VDataSeries::isLabelCustomPos(sal_Int32 nPointIndex) const return bCustom; } +awt::Size VDataSeries::getLabelCustomSize(sal_Int32 nPointIndex) const +{ + awt::Size aSize(-1, -1); + try + { + RelativeSize aCustomLabelSize; + const uno::Reference<beans::XPropertySet> xPointProps(getPropertiesOfPoint(nPointIndex)); + if (xPointProps.is() && (xPointProps->getPropertyValue("CustomLabelSize") >>= aCustomLabelSize)) + { + aSize.Width = static_cast<sal_Int32>(aCustomLabelSize.Primary * m_aReferenceSize.Width); + aSize.Height = static_cast<sal_Int32>(aCustomLabelSize.Secondary * m_aReferenceSize.Height); + } + } + catch (const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + return aSize; +} + double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const { double fMin = std::numeric_limits<double>::infinity(); @@ -724,12 +743,12 @@ uno::Sequence< double > const & VDataSeries::getAllX() const { //init x values from category indexes //first category (index 0) matches with real number 1.0 - m_aValues_X.Doubles.realloc( m_nPointCount ); - auto pDoubles = m_aValues_X.Doubles.getArray(); + m_aValues_X.m_aValues.realloc( m_nPointCount ); + auto pDoubles = m_aValues_X.m_aValues.getArray(); for(sal_Int32 nN=m_aValues_X.getLength();nN--;) pDoubles[nN] = nN+1; } - return m_aValues_X.Doubles; + return m_aValues_X.m_aValues; } uno::Sequence< double > const & VDataSeries::getAllY() const @@ -738,19 +757,19 @@ uno::Sequence< double > const & VDataSeries::getAllY() const { //init y values from indexes //first y-value (index 0) matches with real number 1.0 - m_aValues_Y.Doubles.realloc( m_nPointCount ); - auto pDoubles = m_aValues_Y.Doubles.getArray(); + m_aValues_Y.m_aValues.realloc( m_nPointCount ); + auto pDoubles = m_aValues_Y.m_aValues.getArray(); for(sal_Int32 nN=m_aValues_Y.getLength();nN--;) pDoubles[nN] = nN+1; } - return m_aValues_Y.Doubles; + return m_aValues_Y.m_aValues; } double VDataSeries::getXMeanValue() const { if( std::isnan( m_fXMeanValue ) ) { - uno::Reference< XRegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( u"com.sun.star.chart2.MeanValueRegressionCurve" ) ); + rtl::Reference< RegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( u"com.sun.star.chart2.MeanValueRegressionCurve" ) ); uno::Sequence< double > aXValuesDummy; xCalculator->recalculateRegression( aXValuesDummy, getAllX() ); m_fXMeanValue = xCalculator->getCurveValue( 1.0 ); @@ -762,7 +781,7 @@ double VDataSeries::getYMeanValue() const { if( std::isnan( m_fYMeanValue ) ) { - uno::Reference< XRegressionCurveCalculator > xCalculator( + rtl::Reference< RegressionCurveCalculator > xCalculator( RegressionCurveHelper::createRegressionCurveCalculatorByServiceName(u"com.sun.star.chart2.MeanValueRegressionCurve")); uno::Sequence< double > aXValuesDummy; xCalculator->recalculateRegression( aXValuesDummy, getAllY() ); @@ -771,26 +790,26 @@ double VDataSeries::getYMeanValue() const return m_fYMeanValue; } -static std::unique_ptr<Symbol> getSymbolPropertiesFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp ) +static std::optional<Symbol> getSymbolPropertiesFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp ) { - std::unique_ptr< Symbol > apSymbolProps( new Symbol() ); + Symbol aSymbolProps; try { - if( xProp->getPropertyValue("Symbol") >>= *apSymbolProps ) + if( xProp->getPropertyValue("Symbol") >>= aSymbolProps ) { //use main color to fill symbols - xProp->getPropertyValue("Color") >>= apSymbolProps->FillColor; + xProp->getPropertyValue("Color") >>= aSymbolProps.FillColor; // border of symbols always same as fill color - apSymbolProps->BorderColor = apSymbolProps->FillColor; + aSymbolProps.BorderColor = aSymbolProps.FillColor; } else - apSymbolProps.reset(); + return std::nullopt; } catch(const uno::Exception &) { TOOLS_WARN_EXCEPTION("chart2", "" ); } - return apSymbolProps; + return aSymbolProps; } Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const @@ -799,38 +818,38 @@ Symbol* VDataSeries::getSymbolProperties( sal_Int32 index ) const if( isAttributedDataPoint( index ) ) { adaptPointCache( index ); - if (!m_apSymbolProperties_AttributedPoint) - m_apSymbolProperties_AttributedPoint + if (!m_oSymbolProperties_AttributedPoint) + m_oSymbolProperties_AttributedPoint = getSymbolPropertiesFromPropertySet(getPropertiesOfPoint(index)); - pRet = m_apSymbolProperties_AttributedPoint.get(); + pRet = &*m_oSymbolProperties_AttributedPoint; //if a single data point does not have symbols but the dataseries itself has symbols //we create an invisible symbol shape to enable selection of that point if( !pRet || pRet->Style == SymbolStyle_NONE ) { - if (!m_apSymbolProperties_Series) - m_apSymbolProperties_Series + if (!m_oSymbolProperties_Series) + m_oSymbolProperties_Series = getSymbolPropertiesFromPropertySet(getPropertiesOfSeries()); - if( m_apSymbolProperties_Series && m_apSymbolProperties_Series->Style != SymbolStyle_NONE ) + if( m_oSymbolProperties_Series && m_oSymbolProperties_Series->Style != SymbolStyle_NONE ) { - if (!m_apSymbolProperties_InvisibleSymbolForSelection) + if (!m_oSymbolProperties_InvisibleSymbolForSelection) { - m_apSymbolProperties_InvisibleSymbolForSelection.reset(new Symbol); - m_apSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD; - m_apSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square - m_apSymbolProperties_InvisibleSymbolForSelection->Size = com::sun::star::awt::Size(0, 0);//tdf#126033 - m_apSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible - m_apSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible + m_oSymbolProperties_InvisibleSymbolForSelection.emplace(); + m_oSymbolProperties_InvisibleSymbolForSelection->Style = SymbolStyle_STANDARD; + m_oSymbolProperties_InvisibleSymbolForSelection->StandardSymbol = 0;//square + m_oSymbolProperties_InvisibleSymbolForSelection->Size = com::sun::star::awt::Size(0, 0);//tdf#126033 + m_oSymbolProperties_InvisibleSymbolForSelection->BorderColor = 0xff000000;//invisible + m_oSymbolProperties_InvisibleSymbolForSelection->FillColor = 0xff000000;//invisible } - pRet = m_apSymbolProperties_InvisibleSymbolForSelection.get(); + pRet = &*m_oSymbolProperties_InvisibleSymbolForSelection; } } } else { - if (!m_apSymbolProperties_Series) - m_apSymbolProperties_Series + if (!m_oSymbolProperties_Series) + m_oSymbolProperties_Series = getSymbolPropertiesFromPropertySet(getPropertiesOfSeries()); - pRet = m_apSymbolProperties_Series.get(); + pRet = &*m_oSymbolProperties_Series; } if( pRet && pRet->Style == SymbolStyle_AUTO ) @@ -899,9 +918,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; } @@ -912,14 +930,14 @@ uno::Reference< beans::XPropertySet > VDataSeries::getPropertiesOfPoint( sal_Int return getPropertiesOfSeries(); } -uno::Reference<beans::XPropertySet> VDataSeries::getPropertiesOfSeries() const +const uno::Reference<beans::XPropertySet> & VDataSeries::getPropertiesOfSeries() const { return m_xDataSeriesProps; } -static std::unique_ptr<DataPointLabel> getDataPointLabelFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp ) +static std::optional<DataPointLabel> getDataPointLabelFromPropertySet( const uno::Reference< beans::XPropertySet >& xProp ) { - std::unique_ptr< DataPointLabel > apLabel( new DataPointLabel() ); + std::optional< DataPointLabel > apLabel( std::in_place ); try { if( !(xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= *apLabel) ) @@ -936,10 +954,10 @@ void VDataSeries::adaptPointCache( sal_Int32 nNewPointIndex ) const { if( m_nCurrentAttributedPoint != nNewPointIndex ) { - m_apLabel_AttributedPoint.reset(); - m_apLabelPropNames_AttributedPoint.reset(); - m_apLabelPropValues_AttributedPoint.reset(); - m_apSymbolProperties_AttributedPoint.reset(); + m_oLabel_AttributedPoint.reset(); + m_oLabelPropNames_AttributedPoint.reset(); + m_oLabelPropValues_AttributedPoint.reset(); + m_oSymbolProperties_AttributedPoint.reset(); m_nCurrentAttributedPoint = nNewPointIndex; } } @@ -950,17 +968,19 @@ DataPointLabel* VDataSeries::getDataPointLabel( sal_Int32 index ) const if( isAttributedDataPoint( index ) ) { adaptPointCache( index ); - if (!m_apLabel_AttributedPoint) - m_apLabel_AttributedPoint + if (!m_oLabel_AttributedPoint) + m_oLabel_AttributedPoint = getDataPointLabelFromPropertySet(getPropertiesOfPoint(index)); - pRet = m_apLabel_AttributedPoint.get(); + if (m_oLabel_AttributedPoint) + pRet = &*m_oLabel_AttributedPoint; } else { - if (!m_apLabel_Series) - m_apLabel_Series + if (!m_oLabel_Series) + m_oLabel_Series = getDataPointLabelFromPropertySet(getPropertiesOfPoint(index)); - pRet = m_apLabel_Series.get(); + if (m_oLabel_Series) + pRet = &*m_oLabel_Series; } if( !m_bAllowPercentValueInDataLabel ) { @@ -989,33 +1009,33 @@ bool VDataSeries::getTextLabelMultiPropertyLists( sal_Int32 index if( isAttributedDataPoint( index ) ) { adaptPointCache( index ); - if (!m_apLabelPropValues_AttributedPoint) + if (!m_oLabelPropValues_AttributedPoint) { // Cache these properties for this point. - m_apLabelPropNames_AttributedPoint.reset(new tNameSequence); - m_apLabelPropValues_AttributedPoint.reset(new tAnySequence); + m_oLabelPropNames_AttributedPoint.emplace(); + m_oLabelPropValues_AttributedPoint.emplace(); xTextProp.set( getPropertiesOfPoint( index )); PropertyMapper::getTextLabelMultiPropertyLists( - xTextProp, *m_apLabelPropNames_AttributedPoint, *m_apLabelPropValues_AttributedPoint); + xTextProp, *m_oLabelPropNames_AttributedPoint, *m_oLabelPropValues_AttributedPoint); bDoDynamicFontResize = true; } - pPropNames = m_apLabelPropNames_AttributedPoint.get(); - pPropValues = m_apLabelPropValues_AttributedPoint.get(); + pPropNames = &*m_oLabelPropNames_AttributedPoint; + pPropValues = &*m_oLabelPropValues_AttributedPoint; } else { - if (!m_apLabelPropValues_Series) + if (!m_oLabelPropValues_Series) { // Cache these properties for the whole series. - m_apLabelPropNames_Series.reset(new tNameSequence); - m_apLabelPropValues_Series.reset(new tAnySequence); + m_oLabelPropNames_Series.emplace(); + m_oLabelPropValues_Series.emplace(); xTextProp.set( getPropertiesOfPoint( index )); PropertyMapper::getTextLabelMultiPropertyLists( - xTextProp, *m_apLabelPropNames_Series, *m_apLabelPropValues_Series); + xTextProp, *m_oLabelPropNames_Series, *m_oLabelPropValues_Series); bDoDynamicFontResize = true; } - pPropNames = m_apLabelPropNames_Series.get(); - pPropValues = m_apLabelPropValues_Series.get(); + pPropNames = &*m_oLabelPropNames_Series; + pPropValues = &*m_oLabelPropValues_Series; } if( bDoDynamicFontResize && @@ -1116,7 +1136,7 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN bool VDataSeries::hasPropertyMapping(const OUString& rPropName ) const { - return m_PropertyMap.find(rPropName) != m_PropertyMap.end(); + return m_PropertyMap.contains(rPropName); } } //namespace chart |