fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / WrappedStatisticProperties.cxx
blob6a4e118e165ec6d02f3072bdffceb086d5c9c3b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "WrappedStatisticProperties.hxx"
21 #include "WrappedSeriesOrDiagramProperty.hxx"
22 #include "macros.hxx"
23 #include "FastPropertyIdRanges.hxx"
24 #include "RegressionCurveHelper.hxx"
25 #include "DiagramHelper.hxx"
26 #include "ErrorBar.hxx"
27 #include "StatisticsHelper.hxx"
28 #include <unonames.hxx>
30 #include <com/sun/star/beans/PropertyAttribute.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/XDataProvider.hpp>
36 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
38 using namespace ::com::sun::star;
39 using ::com::sun::star::uno::Any;
40 using ::com::sun::star::uno::Reference;
41 using ::com::sun::star::uno::Sequence;
42 using ::com::sun::star::beans::Property;
44 namespace chart
46 namespace wrapper
49 namespace
52 Any lcl_getRegressionDefault()
54 Any aRet;
55 aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
56 return aRet;
59 ::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType(SvxChartRegress eRegressionType)
61 ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
62 switch(eRegressionType)
64 case CHREGRESS_LINEAR:
65 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
66 break;
67 case CHREGRESS_LOG:
68 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
69 break;
70 case CHREGRESS_EXP:
71 eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
72 break;
73 case CHREGRESS_POWER:
74 eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
75 break;
76 case CHREGRESS_POLYNOMIAL:
77 eRet = ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL;
78 break;
79 /*case CHREGRESS_MOVING_AVERAGE:
80 eRet = ::com::sun::star::chart::ChartRegressionCurveType_MOVING_AVERAGE;
81 break;*/
82 default:
83 eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
84 break;
86 return eRet;
89 SvxChartRegress lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
91 SvxChartRegress eRet;
92 switch (eRegressionCurveType)
94 case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
95 eRet = CHREGRESS_LINEAR;
96 break;
97 case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
98 eRet = CHREGRESS_LOG;
99 break;
100 case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
101 eRet = CHREGRESS_EXP;
102 break;
103 case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
104 //case ::com::sun::star::chart::ChartRegressionCurveType_MOVING_AVERAGE:
105 case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
106 eRet = CHREGRESS_POWER;
107 break;
108 default:
109 eRet = CHREGRESS_NONE;
110 break;
112 return eRet;
115 sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
117 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
118 if(xErrorBarProperties.is())
119 xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nStyle;
120 return nStyle;
123 uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
124 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
126 uno::Reference< chart2::data::XDataProvider > xResult;
127 if( spChart2ModelContact.get())
129 uno::Reference< chart2::XChartDocument > xChartDoc(
130 spChart2ModelContact->getChart2Document());
131 if( xChartDoc.is())
132 xResult.set( xChartDoc->getDataProvider());
134 return xResult;
137 void lcl_ConvertRangeFromXML(
138 OUString & rInOutRange,
139 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
141 if( !rInOutRange.isEmpty())
143 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
144 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
145 if( xConverter.is())
147 OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
148 rInOutRange = aResult;
153 void lcl_ConvertRangeToXML(
154 OUString & rInOutRange,
155 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
157 if( !rInOutRange.isEmpty())
159 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
160 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
161 if( xConverter.is())
163 OUString aResult = xConverter->convertRangeToXML( rInOutRange );
164 rInOutRange = aResult;
169 }//anonymous namespace
171 template< typename PROPERTYTYPE >
172 class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
174 public:
175 explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
176 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
177 , tSeriesOrDiagramPropertyType ePropertyType )
178 : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
180 virtual ~WrappedStatisticProperty() {};
182 protected:
183 static uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet )
185 if(!xSeriesPropertySet.is())
186 return 0;
187 uno::Reference< beans::XPropertySet > xErrorBarProperties;
188 xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties;
189 if( !xErrorBarProperties.is() )
191 // todo: use a valid context
192 xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
193 //default in new and old api are different
194 xErrorBarProperties->setPropertyValue( "ShowPositiveError" , uno::makeAny(false) );
195 xErrorBarProperties->setPropertyValue( "ShowNegativeError" , uno::makeAny(false) );
196 xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
197 xSeriesPropertySet->setPropertyValue( CHART_UNONAME_ERRORBAR_Y , uno::makeAny( xErrorBarProperties ) );
199 return xErrorBarProperties;
204 //PROP_CHART_STATISTIC_CONST_ERROR_LOW
205 class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
207 public:
208 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
209 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
211 explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
212 tSeriesOrDiagramPropertyType ePropertyType );
213 virtual ~WrappedConstantErrorLowProperty();
215 private:
216 mutable Any m_aOuterValue;
219 WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
220 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
221 tSeriesOrDiagramPropertyType ePropertyType )
222 : WrappedStatisticProperty< double >( "ConstantErrorLow"
223 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
226 WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
230 double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
232 double aRet = 0.0;
233 m_aDefaultValue >>= aRet;
234 uno::Reference< beans::XPropertySet > xErrorBarProperties;
235 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
237 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
238 xErrorBarProperties->getPropertyValue( "NegativeError" ) >>= aRet;
239 else
240 m_aOuterValue >>= aRet;
242 return aRet;
245 void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
247 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
248 if( xErrorBarProperties.is() )
250 m_aOuterValue = uno::makeAny( aNewValue );
251 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
253 xErrorBarProperties->setPropertyValue( "NegativeError", m_aOuterValue );
258 //PROP_CHART_STATISTIC_CONST_ERROR_HIGH
259 class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
261 public:
262 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
263 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
265 explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
266 tSeriesOrDiagramPropertyType ePropertyType );
267 virtual ~WrappedConstantErrorHighProperty();
269 private:
270 mutable Any m_aOuterValue;
273 WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
274 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
275 tSeriesOrDiagramPropertyType ePropertyType )
276 : WrappedStatisticProperty< double >( "ConstantErrorHigh"
277 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
280 WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
284 double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
286 double aRet = 0.0;
287 m_aDefaultValue >>= aRet;
288 uno::Reference< beans::XPropertySet > xErrorBarProperties;
289 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
291 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
292 xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
293 else
294 m_aOuterValue >>= aRet;
296 return aRet;
299 void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
301 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
302 if( xErrorBarProperties.is() )
304 m_aOuterValue = uno::makeAny( aNewValue );
305 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
307 xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
312 //PROP_CHART_STATISTIC_MEAN_VALUE
313 class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
315 public:
316 virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
317 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Bool& aNewValue ) const SAL_OVERRIDE;
319 explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
320 tSeriesOrDiagramPropertyType ePropertyType );
321 virtual ~WrappedMeanValueProperty();
324 WrappedMeanValueProperty::WrappedMeanValueProperty(
325 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
326 tSeriesOrDiagramPropertyType ePropertyType )
327 : WrappedStatisticProperty< sal_Bool >( "MeanValue", uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType )
330 WrappedMeanValueProperty::~WrappedMeanValueProperty()
334 sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
336 bool bRet = false;
337 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
338 if( xRegCnt.is() )
339 bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
340 return bRet;
343 void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Bool& aNewValue ) const
345 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
346 if( xRegCnt.is() )
348 if(aNewValue)
349 RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
350 else
351 RegressionCurveHelper::removeMeanValueLine( xRegCnt );
355 //PROP_CHART_STATISTIC_ERROR_CATEGORY
356 // deprecated, replaced by ErrorBarStyle
357 class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
359 public:
360 virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
361 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorCategory& aNewValue ) const SAL_OVERRIDE;
363 explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
364 tSeriesOrDiagramPropertyType ePropertyType );
365 virtual ~WrappedErrorCategoryProperty();
368 WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
369 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
370 tSeriesOrDiagramPropertyType ePropertyType )
371 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( "ErrorCategory"
372 , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType )
375 WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
379 ::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
381 ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
382 m_aDefaultValue >>= aRet;
383 uno::Reference< beans::XPropertySet > xErrorBarProperties;
384 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
386 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
387 xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nStyle;
388 switch(nStyle)
390 case ::com::sun::star::chart::ErrorBarStyle::NONE:
391 aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
392 break;
393 case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
394 aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
395 break;
396 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
397 aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
398 break;
399 case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
400 aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
401 break;
402 case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
403 aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
404 break;
405 case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
406 aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
407 break;
408 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
409 break;
410 case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
411 break;
412 default:
413 break;
416 return aRet;
418 void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorCategory& aNewValue ) const
420 if( !xSeriesPropertySet.is() )
421 return;
423 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
424 if( xErrorBarProperties.is() )
426 sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
427 switch(aNewValue)
429 case ::com::sun::star::chart::ChartErrorCategory_NONE:
430 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
431 break;
432 case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
433 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
434 break;
435 case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
436 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
437 break;
438 case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
439 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
440 break;
441 case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
442 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
443 break;
444 case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
445 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
446 break;
447 default:
448 break;
450 xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny(nNewStyle) );
454 //PROP_CHART_STATISTIC_PERCENT_ERROR
455 class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
457 public:
458 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
459 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
461 explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
462 tSeriesOrDiagramPropertyType ePropertyType );
463 virtual ~WrappedPercentageErrorProperty();
465 private:
466 mutable Any m_aOuterValue;
469 WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
470 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
471 tSeriesOrDiagramPropertyType ePropertyType )
472 : WrappedStatisticProperty< double >( "PercentageError"
473 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
476 WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
480 double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
482 double aRet = 0.0;
483 m_aDefaultValue >>= aRet;
484 uno::Reference< beans::XPropertySet > xErrorBarProperties;
485 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
487 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
488 xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
489 else
490 m_aOuterValue >>= aRet;
492 return aRet;
494 void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
496 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
497 if( xErrorBarProperties.is() )
499 m_aOuterValue = uno::makeAny( aNewValue );
500 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
502 xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
503 xErrorBarProperties->setPropertyValue( "NegativeError" , m_aOuterValue );
508 //PROP_CHART_STATISTIC_ERROR_MARGIN
509 class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
511 public:
512 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
513 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
515 explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
516 tSeriesOrDiagramPropertyType ePropertyType );
517 virtual ~WrappedErrorMarginProperty();
519 private:
520 mutable Any m_aOuterValue;
523 WrappedErrorMarginProperty::WrappedErrorMarginProperty(
524 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
525 tSeriesOrDiagramPropertyType ePropertyType )
526 : WrappedStatisticProperty< double >( "ErrorMargin"
527 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
530 WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
534 double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
536 double aRet = 0.0;
537 m_aDefaultValue >>= aRet;
538 uno::Reference< beans::XPropertySet > xErrorBarProperties;
539 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
541 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
542 xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
543 else
544 m_aOuterValue >>= aRet;
546 return aRet;
548 void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
550 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
551 if( xErrorBarProperties.is() )
553 m_aOuterValue = uno::makeAny( aNewValue );
554 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
556 xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
557 xErrorBarProperties->setPropertyValue( "NegativeError" , m_aOuterValue );
562 //PROP_CHART_STATISTIC_ERROR_INDICATOR
563 class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
565 public:
566 virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
567 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorIndicatorType& aNewValue ) const SAL_OVERRIDE;
569 explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
570 tSeriesOrDiagramPropertyType ePropertyType );
571 virtual ~WrappedErrorIndicatorProperty();
574 WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
575 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
576 tSeriesOrDiagramPropertyType ePropertyType )
577 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( "ErrorIndicator"
578 , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType )
581 WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
585 ::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
587 ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
588 m_aDefaultValue >>= aRet;
589 uno::Reference< beans::XPropertySet > xErrorBarProperties;
590 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
592 bool bPositive = false;
593 bool bNegative = false;
594 xErrorBarProperties->getPropertyValue( "ShowPositiveError" ) >>= bPositive;
595 xErrorBarProperties->getPropertyValue( "ShowNegativeError" ) >>= bNegative;
597 if( bPositive && bNegative )
598 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
599 else if( bPositive && !bNegative )
600 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
601 else if( !bPositive && bNegative )
602 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
604 return aRet;
606 void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorIndicatorType& aNewValue ) const
608 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
609 if( xErrorBarProperties.is() )
611 bool bPositive = false;
612 bool bNegative = false;
613 switch( aNewValue )
615 case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
616 bPositive = true;
617 bNegative = true;
618 break;
619 case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
620 bPositive = true;
621 break;
622 case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
623 bNegative = true;
624 break;
625 default:
626 break;
629 xErrorBarProperties->setPropertyValue( "ShowPositiveError" , uno::makeAny(bPositive) );
630 xErrorBarProperties->setPropertyValue( "ShowNegativeError" , uno::makeAny(bNegative) );
634 //PROP_CHART_STATISTIC_ERROR_BAR_STYLE
635 // this is the new constant group that replaces the deprecated enum ChartErrorCategory
636 class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
638 public:
639 virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
640 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Int32& nNewValue ) const SAL_OVERRIDE;
642 explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
643 tSeriesOrDiagramPropertyType ePropertyType );
644 virtual ~WrappedErrorBarStyleProperty();
647 WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
648 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
649 tSeriesOrDiagramPropertyType ePropertyType )
650 : WrappedStatisticProperty< sal_Int32 >( "ErrorBarStyle"
651 , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType )
654 WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
658 sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
660 sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
661 m_aDefaultValue >>= nRet;
662 uno::Reference< beans::XPropertySet > xErrorBarProperties;
663 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
665 xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nRet;
667 return nRet;
669 void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Int32& nNewValue ) const
671 if( !xSeriesPropertySet.is() )
672 return;
674 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
675 if( xErrorBarProperties.is() )
677 xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny( nNewValue ));
681 //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
682 class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
684 public:
685 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
686 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const SAL_OVERRIDE;
688 explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
689 tSeriesOrDiagramPropertyType ePropertyType );
690 virtual ~WrappedErrorBarRangePositiveProperty();
692 private:
693 mutable Any m_aOuterValue;
696 WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
697 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
698 tSeriesOrDiagramPropertyType ePropertyType )
699 : WrappedStatisticProperty< OUString >( "ErrorBarRangePositive"
700 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
703 WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
707 OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
709 OUString aRet;
710 m_aDefaultValue >>= aRet;
711 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
712 if( xSeriesPropertySet.is() &&
713 ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarDataSource ) &&
714 xErrorBarDataSource.is())
716 uno::Reference< chart2::data::XDataSequence > xSeq(
717 StatisticsHelper::getErrorDataSequenceFromDataSource(
718 xErrorBarDataSource, true /* positive */, true /* y-error */ ));
719 if( xSeq.is())
720 aRet = xSeq->getSourceRangeRepresentation();
721 else
722 m_aOuterValue >>= aRet;
724 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
725 return aRet;
728 void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const
730 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
731 if( xErrorBarProperties.is() )
733 uno::Reference< chart2::data::XDataProvider > xDataProvider(
734 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
735 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
736 if( xDataSource.is() && xDataProvider.is())
738 OUString aTmp( aNewValue );
739 OUString aXMLRange( aNewValue );
740 lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact );
741 StatisticsHelper::setErrorDataSequence(
742 xDataSource, xDataProvider, aTmp, true /* positive */, true /* y-error */, &aXMLRange );
743 m_aOuterValue <<= aTmp;
748 //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
749 class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
751 public:
752 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
753 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const SAL_OVERRIDE;
755 explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
756 tSeriesOrDiagramPropertyType ePropertyType );
757 virtual ~WrappedErrorBarRangeNegativeProperty();
759 private:
760 mutable Any m_aOuterValue;
763 WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
764 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
765 tSeriesOrDiagramPropertyType ePropertyType )
766 : WrappedStatisticProperty< OUString >( "ErrorBarRangeNegative"
767 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
770 WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
774 OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
776 OUString aRet;
777 m_aDefaultValue >>= aRet;
778 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
779 if( xSeriesPropertySet.is() &&
780 ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarDataSource ) &&
781 xErrorBarDataSource.is())
783 uno::Reference< chart2::data::XDataSequence > xSeq(
784 StatisticsHelper::getErrorDataSequenceFromDataSource(
785 xErrorBarDataSource, false /* positive */, true /* y-error */ ));
786 if( xSeq.is())
787 aRet = xSeq->getSourceRangeRepresentation();
788 else
789 m_aOuterValue >>= aRet;
791 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
792 return aRet;
795 void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const
797 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
798 if( xErrorBarProperties.is() )
800 uno::Reference< chart2::data::XDataProvider > xDataProvider(
801 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
802 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
803 if( xDataSource.is() && xDataProvider.is())
805 OUString aTmp( aNewValue );
806 OUString aXMLRange( aNewValue );
807 lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact );
808 StatisticsHelper::setErrorDataSequence(
809 xDataSource, xDataProvider, aTmp, false /* positive */, true /* y-error */, &aXMLRange );
810 m_aOuterValue <<= aTmp;
815 //PROP_CHART_STATISTIC_REGRESSION_CURVES
816 class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
818 public:
819 virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
820 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartRegressionCurveType & aNewValue ) const SAL_OVERRIDE;
822 explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
823 tSeriesOrDiagramPropertyType ePropertyType );
824 virtual ~WrappedRegressionCurvesProperty();
827 WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
828 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
829 tSeriesOrDiagramPropertyType ePropertyType )
830 : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( "RegressionCurves"
831 , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType )
835 WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
839 ::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
841 ::com::sun::star::chart::ChartRegressionCurveType aRet;
842 m_aDefaultValue >>= aRet;
843 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
844 if( xRegCnt.is() )
846 aRet = lcl_getRegressionCurveType(
847 RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
849 return aRet;
851 void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartRegressionCurveType& aNewValue ) const
853 uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xSeriesPropertySet, uno::UNO_QUERY );
854 uno::Reference< chart2::XRegressionCurve > xRegressionCurve( xSeriesPropertySet, uno::UNO_QUERY );
856 if( xRegressionCurveContainer.is() && xRegressionCurve.is() )
858 SvxChartRegress eNewRegressionType = lcl_getRegressionType( aNewValue );
860 RegressionCurveHelper::changeRegressionCurveType(
861 eNewRegressionType,
862 xRegressionCurveContainer,
863 xRegressionCurve,
864 uno::Reference< uno::XComponentContext >());
868 //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
869 //PROP_CHART_STATISTIC_ERROR_PROPERTIES
870 //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
871 class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
873 public:
874 virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
875 // properties are read-only, so this method should never be called
876 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const Reference< beans::XPropertySet > & xNewValue ) const SAL_OVERRIDE;
878 enum PropertySetType
880 PROPERTY_SET_TYPE_REGRESSION,
881 PROPERTY_SET_TYPE_ERROR_BAR,
882 PROPERTY_SET_TYPE_MEAN_VALUE
885 explicit WrappedStatisticPropertySetProperty(
886 PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
887 tSeriesOrDiagramPropertyType ePropertyType );
888 virtual ~WrappedStatisticPropertySetProperty();
890 private:
891 PropertySetType m_eType;
894 WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
895 PropertySetType ePropertySetType
896 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
897 , tSeriesOrDiagramPropertyType ePropertyType )
898 : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
899 (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
900 ? OUString("DataRegressionProperties")
901 : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
902 ? OUString("DataErrorProperties")
903 : OUString("DataMeanValueProperties")
904 , uno::Any(), spChart2ModelContact, ePropertyType )
905 , m_eType( ePropertySetType )
908 WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
912 Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
914 Reference< beans::XPropertySet > xResult;
915 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
917 switch( m_eType )
919 case PROPERTY_SET_TYPE_REGRESSION:
920 if( xRegCnt.is() )
921 xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
922 break;
923 case PROPERTY_SET_TYPE_ERROR_BAR:
924 if( xSeriesPropertySet.is())
925 xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xResult;
926 break;
927 case PROPERTY_SET_TYPE_MEAN_VALUE:
928 if( xRegCnt.is() )
929 xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
930 break;
933 return xResult;
936 void WrappedStatisticPropertySetProperty::setValueToSeries(
937 const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
938 , const Reference< beans::XPropertySet >& /* xNewValue */ ) const
942 namespace
944 enum
946 //statistic properties
947 PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
948 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
949 PROP_CHART_STATISTIC_MEAN_VALUE,
950 PROP_CHART_STATISTIC_ERROR_CATEGORY,
951 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
952 PROP_CHART_STATISTIC_PERCENT_ERROR,
953 PROP_CHART_STATISTIC_ERROR_MARGIN,
954 PROP_CHART_STATISTIC_ERROR_INDICATOR,
955 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
956 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
957 PROP_CHART_STATISTIC_REGRESSION_CURVES,
958 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
959 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
960 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
963 /** @parameter bDataSeriesProperty if true, this property is for a single data
964 series, if false, it is for the whole diagram, i.e. for all
965 series
967 void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
968 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
969 , tSeriesOrDiagramPropertyType ePropertyType )
971 rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
972 rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
973 rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
974 rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
975 rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
976 rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
977 rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
978 rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
979 rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
980 rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
981 rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
982 rList.push_back( new WrappedStatisticPropertySetProperty(
983 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
984 rList.push_back( new WrappedStatisticPropertySetProperty(
985 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
986 rList.push_back( new WrappedStatisticPropertySetProperty(
987 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
990 }//anonymous namespace
992 void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
994 rOutProperties.push_back(
995 Property( "ConstantErrorLow",
996 PROP_CHART_STATISTIC_CONST_ERROR_LOW,
997 cppu::UnoType<double>::get(),
998 beans::PropertyAttribute::BOUND
999 | beans::PropertyAttribute::MAYBEDEFAULT ));
1000 rOutProperties.push_back(
1001 Property( "ConstantErrorHigh",
1002 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
1003 cppu::UnoType<double>::get(),
1004 beans::PropertyAttribute::BOUND
1005 | beans::PropertyAttribute::MAYBEDEFAULT ));
1006 rOutProperties.push_back(
1007 Property( "MeanValue",
1008 PROP_CHART_STATISTIC_MEAN_VALUE,
1009 cppu::UnoType<bool>::get(),
1010 beans::PropertyAttribute::BOUND
1011 | beans::PropertyAttribute::MAYBEDEFAULT ));
1012 rOutProperties.push_back(
1013 Property( "ErrorCategory",
1014 PROP_CHART_STATISTIC_ERROR_CATEGORY,
1015 cppu::UnoType<com::sun::star::chart::ChartErrorCategory>::get(),
1016 beans::PropertyAttribute::BOUND
1017 | beans::PropertyAttribute::MAYBEDEFAULT ));
1018 rOutProperties.push_back(
1019 Property( "ErrorBarStyle",
1020 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
1021 cppu::UnoType<sal_Int32>::get(),
1022 beans::PropertyAttribute::BOUND
1023 | beans::PropertyAttribute::MAYBEDEFAULT ));
1024 rOutProperties.push_back(
1025 Property( "PercentageError",
1026 PROP_CHART_STATISTIC_PERCENT_ERROR,
1027 cppu::UnoType<double>::get(),
1028 beans::PropertyAttribute::BOUND
1029 | beans::PropertyAttribute::MAYBEDEFAULT ));
1030 rOutProperties.push_back(
1031 Property( "ErrorMargin",
1032 PROP_CHART_STATISTIC_ERROR_MARGIN,
1033 cppu::UnoType<double>::get(),
1034 beans::PropertyAttribute::BOUND
1035 | beans::PropertyAttribute::MAYBEDEFAULT ));
1036 rOutProperties.push_back(
1037 Property( "ErrorIndicator",
1038 PROP_CHART_STATISTIC_ERROR_INDICATOR,
1039 cppu::UnoType<com::sun::star::chart::ChartErrorIndicatorType>::get(),
1040 beans::PropertyAttribute::BOUND
1041 | beans::PropertyAttribute::MAYBEDEFAULT ));
1042 rOutProperties.push_back(
1043 Property( "ErrorBarRangePositive",
1044 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
1045 cppu::UnoType<OUString>::get(),
1046 beans::PropertyAttribute::BOUND
1047 | beans::PropertyAttribute::MAYBEDEFAULT ));
1048 rOutProperties.push_back(
1049 Property( "ErrorBarRangeNegative",
1050 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1051 cppu::UnoType<OUString>::get(),
1052 beans::PropertyAttribute::BOUND
1053 | beans::PropertyAttribute::MAYBEDEFAULT ));
1054 rOutProperties.push_back(
1055 Property( "RegressionCurves",
1056 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1057 cppu::UnoType<com::sun::star::chart::ChartRegressionCurveType>::get(),
1058 beans::PropertyAttribute::BOUND
1059 | beans::PropertyAttribute::MAYBEDEFAULT ));
1061 rOutProperties.push_back(
1062 Property( "DataRegressionProperties",
1063 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1064 cppu::UnoType<beans::XPropertySet>::get(),
1065 beans::PropertyAttribute::BOUND
1066 | beans::PropertyAttribute::READONLY
1067 | beans::PropertyAttribute::MAYBEVOID ));
1068 rOutProperties.push_back(
1069 Property( "DataErrorProperties",
1070 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1071 cppu::UnoType<beans::XPropertySet>::get(),
1072 beans::PropertyAttribute::BOUND
1073 | beans::PropertyAttribute::READONLY
1074 | beans::PropertyAttribute::MAYBEVOID ));
1075 rOutProperties.push_back(
1076 Property( "DataMeanValueProperties",
1077 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
1078 cppu::UnoType<beans::XPropertySet>::get(),
1079 beans::PropertyAttribute::BOUND
1080 | beans::PropertyAttribute::READONLY
1081 | beans::PropertyAttribute::MAYBEVOID ));
1084 void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
1085 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1087 lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
1090 void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
1091 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1093 lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
1096 } //namespace wrapper
1097 } //namespace chart
1099 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */