27#include <unonames.hxx>
29#include <com/sun/star/beans/PropertyAttribute.hpp>
30#include <com/sun/star/beans/XPropertySet.hpp>
31#include <com/sun/star/chart/ChartErrorCategory.hpp>
32#include <com/sun/star/chart/ErrorBarStyle.hpp>
33#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
34#include <com/sun/star/chart/ChartRegressionCurveType.hpp>
35#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
36#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
42using ::com::sun::star::uno::Any;
43using ::com::sun::star::uno::Reference;
44using ::com::sun::star::beans::Property;
52Any lcl_getRegressionDefault()
55 aRet <<= css::chart::ChartRegressionCurveType_NONE;
59css::chart::ChartRegressionCurveType lcl_getRegressionCurveType(
SvxChartRegress eRegressionType)
61 css::chart::ChartRegressionCurveType eRet = css::chart::ChartRegressionCurveType_NONE;
62 switch(eRegressionType)
64 case SvxChartRegress::Linear:
65 eRet = css::chart::ChartRegressionCurveType_LINEAR;
67 case SvxChartRegress::Log:
68 eRet = css::chart::ChartRegressionCurveType_LOGARITHM;
70 case SvxChartRegress::Exp:
71 eRet = css::chart::ChartRegressionCurveType_EXPONENTIAL;
73 case SvxChartRegress::Power:
74 eRet = css::chart::ChartRegressionCurveType_POWER;
76 case SvxChartRegress::Polynomial:
77 eRet = css::chart::ChartRegressionCurveType_POLYNOMIAL;
83 eRet = css::chart::ChartRegressionCurveType_NONE;
89SvxChartRegress lcl_getRegressionType( css::chart::ChartRegressionCurveType eRegressionCurveType )
92 switch (eRegressionCurveType)
94 case css::chart::ChartRegressionCurveType_LINEAR:
95 eRet = SvxChartRegress::Linear;
97 case css::chart::ChartRegressionCurveType_LOGARITHM:
98 eRet = SvxChartRegress::Log;
100 case css::chart::ChartRegressionCurveType_EXPONENTIAL:
101 eRet = SvxChartRegress::Exp;
103 case css::chart::ChartRegressionCurveType_POLYNOMIAL:
105 case css::chart::ChartRegressionCurveType_POWER:
106 eRet = SvxChartRegress::Power;
109 eRet = SvxChartRegress::NONE;
115sal_Int32 lcl_getErrorBarStyle(
const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
117 sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
118 if(xErrorBarProperties.is())
119 xErrorBarProperties->getPropertyValue(
"ErrorBarStyle" ) >>= nStyle;
123uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
124 const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
126 uno::Reference< chart2::data::XDataProvider > xResult;
127 if( spChart2ModelContact)
130 spChart2ModelContact->getDocumentModel());
132 xResult.set( xChartDoc->getDataProvider());
137void lcl_ConvertRangeFromXML(
138 OUString & rInOutRange,
139 const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
141 if( !rInOutRange.isEmpty())
143 uno::Reference< chart2::data::XRangeXMLConversion >
xConverter(
144 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
147 OUString aResult =
xConverter->convertRangeFromXML( rInOutRange );
148 rInOutRange = aResult;
153void lcl_ConvertRangeToXML(
154 OUString & rInOutRange,
155 const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
157 if( !rInOutRange.isEmpty())
159 uno::Reference< chart2::data::XRangeXMLConversion >
xConverter(
160 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
163 OUString aResult =
xConverter->convertRangeToXML( rInOutRange );
164 rInOutRange = aResult;
169template<
typename PROPERTYTYPE >
170class WrappedStatisticProperty :
public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
173 explicit WrappedStatisticProperty(
174 const OUString& rName,
const Any& rDefaulValue,
175 const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact,
177 : WrappedSeriesOrDiagramProperty<PROPERTYTYPE>(rName, rDefaulValue, spChart2ModelContact,
182 static uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
184 if(!xSeriesPropertySet.is())
186 uno::Reference< beans::XPropertySet > xErrorBarProperties;
188 if( !xErrorBarProperties.is() )
190 xErrorBarProperties = new ::chart::ErrorBar;
192 xErrorBarProperties->setPropertyValue(
"ShowPositiveError" ,
uno::Any(
false) );
193 xErrorBarProperties->setPropertyValue(
"ShowNegativeError" ,
uno::Any(
false) );
194 xErrorBarProperties->setPropertyValue(
"ErrorBarStyle" ,
uno::Any(css::chart::ErrorBarStyle::NONE) );
197 return xErrorBarProperties;
203class WrappedConstantErrorLowProperty :
public WrappedStatisticProperty< double >
206 virtual double getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
207 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const override;
209 explicit WrappedConstantErrorLowProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
218WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
219 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
221 : WrappedStatisticProperty< double >(
"ConstantErrorLow"
222 ,
uno::
Any( 0.0 ),
std::move(spChart2ModelContact), ePropertyType )
226double WrappedConstantErrorLowProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
230 uno::Reference< beans::XPropertySet > xErrorBarProperties;
231 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
233 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ABSOLUTE )
234 xErrorBarProperties->getPropertyValue(
"NegativeError" ) >>= aRet;
241void WrappedConstantErrorLowProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const
243 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
244 if( xErrorBarProperties.is() )
247 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ABSOLUTE )
249 xErrorBarProperties->setPropertyValue(
"NegativeError",
m_aOuterValue );
257class WrappedConstantErrorHighProperty :
public WrappedStatisticProperty< double >
260 virtual double getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
261 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const override;
263 explicit WrappedConstantErrorHighProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
272WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
273 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
275 : WrappedStatisticProperty< double >(
"ConstantErrorHigh"
276 ,
uno::
Any( 0.0 ),
std::move(spChart2ModelContact), ePropertyType )
280double WrappedConstantErrorHighProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
284 uno::Reference< beans::XPropertySet > xErrorBarProperties;
285 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
287 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ABSOLUTE )
288 xErrorBarProperties->getPropertyValue(
"PositiveError" ) >>= aRet;
295void WrappedConstantErrorHighProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const
297 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
298 if( xErrorBarProperties.is() )
301 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ABSOLUTE )
303 xErrorBarProperties->setPropertyValue(
"PositiveError" ,
m_aOuterValue );
311class WrappedMeanValueProperty :
public WrappedStatisticProperty< bool >
314 virtual bool getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
315 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const bool& aNewValue )
const override;
317 explicit WrappedMeanValueProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
323WrappedMeanValueProperty::WrappedMeanValueProperty(
324 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
326 : WrappedStatisticProperty< bool >(
"MeanValue",
uno::
Any( false ),
std::move(spChart2ModelContact), ePropertyType )
330bool WrappedMeanValueProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
333 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
339void WrappedMeanValueProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const bool& aNewValue )
const
341 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
355class WrappedErrorCategoryProperty :
public WrappedStatisticProperty< css::chart::ChartErrorCategory >
358 virtual css::chart::ChartErrorCategory getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
359 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartErrorCategory& aNewValue )
const override;
361 explicit WrappedErrorCategoryProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
367WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
368 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
370 : WrappedStatisticProperty< css::
chart::ChartErrorCategory >(
"ErrorCategory"
371 ,
uno::
Any( css::
chart::ChartErrorCategory_NONE ),
std::move(spChart2ModelContact), ePropertyType )
375css::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
377 css::chart::ChartErrorCategory aRet = css::chart::ChartErrorCategory_NONE;
379 uno::Reference< beans::XPropertySet > xErrorBarProperties;
380 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
382 sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
383 xErrorBarProperties->getPropertyValue(
"ErrorBarStyle" ) >>= nStyle;
386 case css::chart::ErrorBarStyle::NONE:
387 aRet = css::chart::ChartErrorCategory_NONE;
389 case css::chart::ErrorBarStyle::VARIANCE:
390 aRet = css::chart::ChartErrorCategory_VARIANCE;
392 case css::chart::ErrorBarStyle::STANDARD_DEVIATION:
393 aRet = css::chart::ChartErrorCategory_STANDARD_DEVIATION;
395 case css::chart::ErrorBarStyle::ABSOLUTE:
396 aRet = css::chart::ChartErrorCategory_CONSTANT_VALUE;
398 case css::chart::ErrorBarStyle::RELATIVE:
399 aRet = css::chart::ChartErrorCategory_PERCENT;
401 case css::chart::ErrorBarStyle::ERROR_MARGIN:
402 aRet = css::chart::ChartErrorCategory_ERROR_MARGIN;
404 case css::chart::ErrorBarStyle::STANDARD_ERROR:
406 case css::chart::ErrorBarStyle::FROM_DATA:
414void WrappedErrorCategoryProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartErrorCategory& aNewValue )
const
416 if( !xSeriesPropertySet.is() )
419 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
420 if( !xErrorBarProperties.is() )
423 sal_Int32 nNewStyle = css::chart::ErrorBarStyle::NONE;
426 case css::chart::ChartErrorCategory_NONE:
427 nNewStyle = css::chart::ErrorBarStyle::NONE;
429 case css::chart::ChartErrorCategory_VARIANCE:
430 nNewStyle = css::chart::ErrorBarStyle::VARIANCE;
432 case css::chart::ChartErrorCategory_STANDARD_DEVIATION:
433 nNewStyle = css::chart::ErrorBarStyle::STANDARD_DEVIATION;
435 case css::chart::ChartErrorCategory_CONSTANT_VALUE:
436 nNewStyle = css::chart::ErrorBarStyle::ABSOLUTE;
438 case css::chart::ChartErrorCategory_PERCENT:
439 nNewStyle = css::chart::ErrorBarStyle::RELATIVE;
441 case css::chart::ChartErrorCategory_ERROR_MARGIN:
442 nNewStyle = css::chart::ErrorBarStyle::ERROR_MARGIN;
447 xErrorBarProperties->setPropertyValue(
"ErrorBarStyle" ,
uno::Any(nNewStyle) );
453class WrappedPercentageErrorProperty :
public WrappedStatisticProperty< double >
456 virtual double getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
457 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const override;
459 explicit WrappedPercentageErrorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
468WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
469 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
471 : WrappedStatisticProperty< double >(
"PercentageError"
472 ,
uno::
Any( 0.0 ),
std::move(spChart2ModelContact), ePropertyType )
476double WrappedPercentageErrorProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
480 uno::Reference< beans::XPropertySet > xErrorBarProperties;
481 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
483 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::RELATIVE )
484 xErrorBarProperties->getPropertyValue(
"PositiveError" ) >>= aRet;
490void WrappedPercentageErrorProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const
492 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
493 if( xErrorBarProperties.is() )
496 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::RELATIVE )
498 xErrorBarProperties->setPropertyValue(
"PositiveError" ,
m_aOuterValue );
499 xErrorBarProperties->setPropertyValue(
"NegativeError" ,
m_aOuterValue );
507class WrappedErrorMarginProperty :
public WrappedStatisticProperty< double >
510 virtual double getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
511 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const override;
513 explicit WrappedErrorMarginProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
522WrappedErrorMarginProperty::WrappedErrorMarginProperty(
523 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
525 : WrappedStatisticProperty< double >(
"ErrorMargin"
526 ,
uno::
Any( 0.0 ),
std::move(spChart2ModelContact), ePropertyType )
530double WrappedErrorMarginProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
534 uno::Reference< beans::XPropertySet > xErrorBarProperties;
535 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
537 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ERROR_MARGIN )
538 xErrorBarProperties->getPropertyValue(
"PositiveError" ) >>= aRet;
544void WrappedErrorMarginProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const double& aNewValue )
const
546 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
547 if( xErrorBarProperties.is() )
550 if( lcl_getErrorBarStyle( xErrorBarProperties ) == css::chart::ErrorBarStyle::ERROR_MARGIN )
552 xErrorBarProperties->setPropertyValue(
"PositiveError" ,
m_aOuterValue );
553 xErrorBarProperties->setPropertyValue(
"NegativeError" ,
m_aOuterValue );
561class WrappedErrorIndicatorProperty :
public WrappedStatisticProperty< css::chart::ChartErrorIndicatorType >
564 virtual css::chart::ChartErrorIndicatorType getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
565 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartErrorIndicatorType& aNewValue )
const override;
567 explicit WrappedErrorIndicatorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
573WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
574 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
576 : WrappedStatisticProperty< css::
chart::ChartErrorIndicatorType >(
"ErrorIndicator"
577 ,
uno::
Any( css::
chart::ChartErrorIndicatorType_NONE ),
std::move(spChart2ModelContact), ePropertyType )
581css::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
583 css::chart::ChartErrorIndicatorType aRet = css::chart::ChartErrorIndicatorType_NONE;
585 uno::Reference< beans::XPropertySet > xErrorBarProperties;
586 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
588 bool bPositive =
false;
589 bool bNegative =
false;
590 xErrorBarProperties->getPropertyValue(
"ShowPositiveError" ) >>= bPositive;
591 xErrorBarProperties->getPropertyValue(
"ShowNegativeError" ) >>= bNegative;
593 if( bPositive && bNegative )
594 aRet = css::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
595 else if( bPositive && !bNegative )
596 aRet = css::chart::ChartErrorIndicatorType_UPPER;
597 else if( !bPositive && bNegative )
598 aRet = css::chart::ChartErrorIndicatorType_LOWER;
602void WrappedErrorIndicatorProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartErrorIndicatorType& aNewValue )
const
604 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
605 if( !xErrorBarProperties.is() )
608 bool bPositive =
false;
609 bool bNegative =
false;
612 case css::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
616 case css::chart::ChartErrorIndicatorType_UPPER:
619 case css::chart::ChartErrorIndicatorType_LOWER:
626 xErrorBarProperties->setPropertyValue(
"ShowPositiveError" ,
uno::Any(bPositive) );
627 xErrorBarProperties->setPropertyValue(
"ShowNegativeError" ,
uno::Any(bNegative) );
634class WrappedErrorBarStyleProperty :
public WrappedStatisticProperty< sal_Int32 >
637 virtual sal_Int32 getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
638 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const sal_Int32& nNewValue )
const override;
640 explicit WrappedErrorBarStyleProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
646WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
647 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
649 : WrappedStatisticProperty< sal_Int32 >(
"ErrorBarStyle"
650 ,
uno::
Any( css::
chart::ErrorBarStyle::
NONE ),
std::move(spChart2ModelContact), ePropertyType )
654sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
656 sal_Int32 nRet = css::chart::ErrorBarStyle::NONE;
658 uno::Reference< beans::XPropertySet > xErrorBarProperties;
659 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(
CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
661 xErrorBarProperties->getPropertyValue(
"ErrorBarStyle" ) >>= nRet;
665void WrappedErrorBarStyleProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const sal_Int32& nNewValue )
const
667 if( !xSeriesPropertySet.is() )
670 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
671 if( xErrorBarProperties.is() )
673 xErrorBarProperties->setPropertyValue(
"ErrorBarStyle" ,
uno::Any( nNewValue ));
680class WrappedErrorBarRangePositiveProperty :
public WrappedStatisticProperty< OUString >
683 virtual OUString getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
684 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const OUString& aNewValue )
const override;
686 explicit WrappedErrorBarRangePositiveProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
692WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
693 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
695 : WrappedStatisticProperty< OUString >(
"ErrorBarRangePositive"
696 ,
uno::
Any( OUString() ),
std::move(spChart2ModelContact), ePropertyType )
700OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
704 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
705 if( xSeriesPropertySet.is() &&
707 xErrorBarDataSource.is())
709 uno::Reference< chart2::data::XDataSequence > xSeq(
711 xErrorBarDataSource,
true ));
713 aRet = xSeq->getSourceRangeRepresentation();
721void WrappedErrorBarRangePositiveProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const OUString& aNewValue )
const
723 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
724 if( !xErrorBarProperties.is() )
727 uno::Reference< chart2::data::XDataProvider > xDataProvider(
729 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
730 if( xDataSource.is() && xDataProvider.is())
732 OUString aTmp( aNewValue );
733 OUString aXMLRange( aNewValue );
736 xDataSource, xDataProvider, aTmp,
true ,
true , &aXMLRange );
744class WrappedErrorBarRangeNegativeProperty :
public WrappedStatisticProperty< OUString >
747 virtual OUString getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
748 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const OUString& aNewValue )
const override;
750 explicit WrappedErrorBarRangeNegativeProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
756WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
757 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
759 : WrappedStatisticProperty< OUString >(
"ErrorBarRangeNegative"
760 ,
uno::
Any( OUString() ),
std::move(spChart2ModelContact), ePropertyType )
764OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
768 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
769 if( xSeriesPropertySet.is() &&
771 xErrorBarDataSource.is())
773 uno::Reference< chart2::data::XDataSequence > xSeq(
775 xErrorBarDataSource,
false ));
777 aRet = xSeq->getSourceRangeRepresentation();
785void WrappedErrorBarRangeNegativeProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const OUString& aNewValue )
const
787 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
788 if( !xErrorBarProperties.is() )
791 uno::Reference< chart2::data::XDataProvider > xDataProvider(
793 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
794 if( xDataSource.is() && xDataProvider.is())
796 OUString aTmp( aNewValue );
797 OUString aXMLRange( aNewValue );
800 xDataSource, xDataProvider, aTmp,
false ,
true , &aXMLRange );
808class WrappedRegressionCurvesProperty :
public WrappedStatisticProperty< css::chart::ChartRegressionCurveType >
811 virtual css::chart::ChartRegressionCurveType getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
812 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartRegressionCurveType & aNewValue )
const override;
814 explicit WrappedRegressionCurvesProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
820WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
821 std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
823 : WrappedStatisticProperty< css::
chart::ChartRegressionCurveType >(
"RegressionCurves"
824 , lcl_getRegressionDefault(),
std::move(spChart2ModelContact), ePropertyType )
828css::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
830 css::chart::ChartRegressionCurveType aRet;
832 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
835 aRet = lcl_getRegressionCurveType(
840void WrappedRegressionCurvesProperty::setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const css::chart::ChartRegressionCurveType& aNewValue )
const
842 uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xSeriesPropertySet, uno::UNO_QUERY );
843 if (!xRegressionCurveContainer)
846 if( xRegressionCurve.is() )
848 SvxChartRegress eNewRegressionType = lcl_getRegressionType( aNewValue );
852 xRegressionCurveContainer,
862class WrappedStatisticPropertySetProperty :
public WrappedStatisticProperty< Reference< beans::XPropertySet > >
865 virtual Reference< beans::XPropertySet > getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const override;
867 virtual void setValueToSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet,
const Reference< beans::XPropertySet > & xNewValue )
const override;
871 PROPERTY_SET_TYPE_REGRESSION,
872 PROPERTY_SET_TYPE_ERROR_BAR,
873 PROPERTY_SET_TYPE_MEAN_VALUE
876 explicit WrappedStatisticPropertySetProperty(
877 PropertySetType ePropertySetType, std::shared_ptr< Chart2ModelContact > spChart2ModelContact,
886WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
887 PropertySetType ePropertySetType
888 , std::shared_ptr< Chart2ModelContact > spChart2ModelContact
891 (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
892 ? OUString(
"DataRegressionProperties")
893 : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
894 ? OUString(
"DataErrorProperties")
895 : OUString(
"DataMeanValueProperties")
896 ,
uno::
Any(),
std::move(spChart2ModelContact), ePropertyType )
901Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries(
const Reference< beans::XPropertySet >& xSeriesPropertySet )
const
903 Reference< beans::XPropertySet > xResult;
904 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
908 case PROPERTY_SET_TYPE_REGRESSION:
912 case PROPERTY_SET_TYPE_ERROR_BAR:
913 if( xSeriesPropertySet.is())
916 case PROPERTY_SET_TYPE_MEAN_VALUE:
925void WrappedStatisticPropertySetProperty::setValueToSeries(
926 const Reference< beans::XPropertySet >&
927 ,
const Reference< beans::XPropertySet >& )
const
937 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
938 PROP_CHART_STATISTIC_MEAN_VALUE,
939 PROP_CHART_STATISTIC_ERROR_CATEGORY,
940 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
941 PROP_CHART_STATISTIC_PERCENT_ERROR,
942 PROP_CHART_STATISTIC_ERROR_MARGIN,
943 PROP_CHART_STATISTIC_ERROR_INDICATOR,
944 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
945 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
946 PROP_CHART_STATISTIC_REGRESSION_CURVES,
947 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
948 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
949 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
956void lcl_addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList
957 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact
960 rList.emplace_back(
new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
961 rList.emplace_back(
new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
962 rList.emplace_back(
new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
963 rList.emplace_back(
new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
964 rList.emplace_back(
new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
965 rList.emplace_back(
new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
966 rList.emplace_back(
new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
967 rList.emplace_back(
new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
968 rList.emplace_back(
new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
969 rList.emplace_back(
new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
970 rList.emplace_back(
new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
971 rList.emplace_back(
new WrappedStatisticPropertySetProperty(
972 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
973 rList.emplace_back(
new WrappedStatisticPropertySetProperty(
974 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
975 rList.emplace_back(
new WrappedStatisticPropertySetProperty(
976 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
981void WrappedStatisticProperties::addProperties( std::vector< Property > & rOutProperties )
983 rOutProperties.emplace_back(
"ConstantErrorLow",
984 PROP_CHART_STATISTIC_CONST_ERROR_LOW,
986 beans::PropertyAttribute::BOUND
987 | beans::PropertyAttribute::MAYBEDEFAULT );
988 rOutProperties.emplace_back(
"ConstantErrorHigh",
989 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
991 beans::PropertyAttribute::BOUND
992 | beans::PropertyAttribute::MAYBEDEFAULT );
993 rOutProperties.emplace_back(
"MeanValue",
994 PROP_CHART_STATISTIC_MEAN_VALUE,
996 beans::PropertyAttribute::BOUND
997 | beans::PropertyAttribute::MAYBEDEFAULT );
998 rOutProperties.emplace_back(
"ErrorCategory",
999 PROP_CHART_STATISTIC_ERROR_CATEGORY,
1001 beans::PropertyAttribute::BOUND
1002 | beans::PropertyAttribute::MAYBEDEFAULT );
1003 rOutProperties.emplace_back(
"ErrorBarStyle",
1004 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
1006 beans::PropertyAttribute::BOUND
1007 | beans::PropertyAttribute::MAYBEDEFAULT );
1008 rOutProperties.emplace_back(
"PercentageError",
1009 PROP_CHART_STATISTIC_PERCENT_ERROR,
1011 beans::PropertyAttribute::BOUND
1012 | beans::PropertyAttribute::MAYBEDEFAULT );
1013 rOutProperties.emplace_back(
"ErrorMargin",
1014 PROP_CHART_STATISTIC_ERROR_MARGIN,
1016 beans::PropertyAttribute::BOUND
1017 | beans::PropertyAttribute::MAYBEDEFAULT );
1018 rOutProperties.emplace_back(
"ErrorIndicator",
1019 PROP_CHART_STATISTIC_ERROR_INDICATOR,
1021 beans::PropertyAttribute::BOUND
1022 | beans::PropertyAttribute::MAYBEDEFAULT );
1023 rOutProperties.emplace_back(
"ErrorBarRangePositive",
1024 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
1026 beans::PropertyAttribute::BOUND
1027 | beans::PropertyAttribute::MAYBEDEFAULT );
1028 rOutProperties.emplace_back(
"ErrorBarRangeNegative",
1029 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1031 beans::PropertyAttribute::BOUND
1032 | beans::PropertyAttribute::MAYBEDEFAULT );
1033 rOutProperties.emplace_back(
"RegressionCurves",
1034 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1036 beans::PropertyAttribute::BOUND
1037 | beans::PropertyAttribute::MAYBEDEFAULT );
1039 rOutProperties.emplace_back(
"DataRegressionProperties",
1040 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1042 beans::PropertyAttribute::BOUND
1043 | beans::PropertyAttribute::READONLY
1044 | beans::PropertyAttribute::MAYBEVOID );
1045 rOutProperties.emplace_back(
"DataErrorProperties",
1046 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1048 beans::PropertyAttribute::BOUND
1049 | beans::PropertyAttribute::READONLY
1050 | beans::PropertyAttribute::MAYBEVOID );
1051 rOutProperties.emplace_back(
"DataMeanValueProperties",
1052 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
1054 beans::PropertyAttribute::BOUND
1055 | beans::PropertyAttribute::READONLY
1056 | beans::PropertyAttribute::MAYBEVOID );
1059void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< std::unique_ptr<WrappedProperty> >& rList
1060 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
1062 lcl_addWrappedProperties( rList, spChart2ModelContact,
DATA_SERIES );
1065void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< std::unique_ptr<WrappedProperty> >& rList
1066 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
1068 lcl_addWrappedProperties( rList, spChart2ModelContact,
DIAGRAM );
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
css::uno::Any m_aDefaultValue
Reference< XTypeConverter > xConverter
OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getFirstRegressTypeNotMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xCurveContainer)
Returns the type of the first regression curve found that is not of type mean-value line.
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > getFirstCurveNotMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xCurveContainer)
Returns the first regression curve found that is not of type mean-value line.
OOO_DLLPUBLIC_CHARTTOOLS bool hasMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xRegCnt)
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > changeRegressionCurveType(SvxChartRegress eType, css::uno::Reference< css::chart2::XRegressionCurveContainer > const &xRegressionCurveContainer, css::uno::Reference< css::chart2::XRegressionCurve > const &xRegressionCurve)
OOO_DLLPUBLIC_CHARTTOOLS rtl::Reference<::chart::RegressionCurveModel > getMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurveContainer > &xRegCnt)
OOO_DLLPUBLIC_CHARTTOOLS void removeMeanValueLine(css::uno::Reference< css::chart2::XRegressionCurveContainer > const &xRegCnt)
OOO_DLLPUBLIC_CHARTTOOLS void addMeanValueLine(css::uno::Reference< css::chart2::XRegressionCurveContainer > const &xRegCnt, const css::uno::Reference< css::beans::XPropertySet > &xSeriesProp)
creates a mean-value line and adds it to the container.
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSequence > getErrorDataSequenceFromDataSource(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, bool bPositiveValue, bool bYError=true)
OOO_DLLPUBLIC_CHARTTOOLS void setErrorDataSequence(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource, const css::uno::Reference< css::chart2::data::XDataProvider > &xDataProvider, const OUString &rNewRange, bool bPositiveValue, bool bYError=true, OUString const *pXMLRange=nullptr)
tSeriesOrDiagramPropertyType
@ FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP
class SAL_NO_VTABLE XPropertySet
constexpr OUStringLiteral CHART_UNONAME_ERRORBAR_Y