merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / WrappedStatisticProperties.cxx
blob1c7b495bd5661aab2715e9ecbcb66adcf9fa3c10
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
31 #include "WrappedStatisticProperties.hxx"
32 #include "WrappedSeriesOrDiagramProperty.hxx"
33 #include "macros.hxx"
34 #include "FastPropertyIdRanges.hxx"
35 #include "RegressionCurveHelper.hxx"
36 #include "DiagramHelper.hxx"
37 #include "ErrorBar.hxx"
38 #include "StatisticsHelper.hxx"
40 #include <com/sun/star/beans/PropertyAttribute.hpp>
41 #include <com/sun/star/chart/ChartErrorCategory.hpp>
42 #include <com/sun/star/chart/ErrorBarStyle.hpp>
43 #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
44 #include <com/sun/star/chart/ChartRegressionCurveType.hpp>
45 #include <com/sun/star/chart2/data/XDataProvider.hpp>
46 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
48 using namespace ::com::sun::star;
49 using ::com::sun::star::uno::Any;
50 using ::com::sun::star::uno::Reference;
51 using ::com::sun::star::uno::Sequence;
52 using ::com::sun::star::beans::Property;
53 using ::rtl::OUString;
55 //.............................................................................
56 namespace chart
58 namespace wrapper
61 namespace
64 Any lcl_getRegressionDefault()
66 Any aRet;
67 aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
68 return aRet;
71 //-----------------------------------------------------------------------------
72 //-----------------------------------------------------------------------------
74 ::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType( RegressionCurveHelper::tRegressionType eRegressionType )
76 ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
77 switch(eRegressionType)
79 case RegressionCurveHelper::REGRESSION_TYPE_LINEAR:
80 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
81 break;
82 case RegressionCurveHelper::REGRESSION_TYPE_LOG:
83 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
84 break;
85 case RegressionCurveHelper::REGRESSION_TYPE_EXP:
86 eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
87 break;
88 case RegressionCurveHelper::REGRESSION_TYPE_POWER:
89 eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
90 break;
91 default:
92 eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
93 break;
95 return eRet;
98 //-----------------------------------------------------------------------------
99 //-----------------------------------------------------------------------------
101 RegressionCurveHelper::tRegressionType lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
103 RegressionCurveHelper::tRegressionType eRet;
104 switch(eRegressionCurveType)
106 case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
107 eRet = RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
108 break;
109 case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
110 eRet = RegressionCurveHelper::REGRESSION_TYPE_LOG;
111 break;
112 case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
113 eRet = RegressionCurveHelper::REGRESSION_TYPE_EXP;
114 break;
115 case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
116 case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
117 eRet = RegressionCurveHelper::REGRESSION_TYPE_POWER;
118 break;
119 default:
120 eRet = RegressionCurveHelper::REGRESSION_TYPE_NONE;
121 break;
123 return eRet;
126 sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
128 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
129 if(xErrorBarProperties.is())
130 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
131 return nStyle;
134 uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
135 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
137 uno::Reference< chart2::data::XDataProvider > xResult;
138 if( spChart2ModelContact.get())
140 uno::Reference< chart2::XChartDocument > xChartDoc(
141 spChart2ModelContact->getChart2Document());
142 if( xChartDoc.is())
143 xResult.set( xChartDoc->getDataProvider());
145 return xResult;
148 void lcl_ConvertRangeFromXML(
149 ::rtl::OUString & rInOutRange,
150 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
152 if( rInOutRange.getLength())
154 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
155 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
156 if( xConverter.is())
158 ::rtl::OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
159 rInOutRange = aResult;
164 void lcl_ConvertRangeToXML(
165 ::rtl::OUString & rInOutRange,
166 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
168 if( rInOutRange.getLength())
170 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
171 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
172 if( xConverter.is())
174 ::rtl::OUString aResult = xConverter->convertRangeToXML( rInOutRange );
175 rInOutRange = aResult;
180 }//anonymous namespace
182 //-----------------------------------------------------------------------------
183 //-----------------------------------------------------------------------------
184 //-----------------------------------------------------------------------------
186 template< typename PROPERTYTYPE >
187 class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
189 public:
190 explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
191 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
192 , tSeriesOrDiagramPropertyType ePropertyType )
193 : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
195 virtual ~WrappedStatisticProperty() {};
198 protected:
199 uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
201 if(!xSeriesPropertySet.is())
202 return 0;
203 uno::Reference< beans::XPropertySet > xErrorBarProperties;
204 xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties;
205 if( !xErrorBarProperties.is() )
207 // todo: use a valid context
208 xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
209 //default in new and old api are different
210 xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(sal_Bool(sal_False)) );
211 xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(sal_Bool(sal_False)) );
212 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
213 xSeriesPropertySet->setPropertyValue( C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProperties ) );
215 return xErrorBarProperties;
220 //-----------------------------------------------------------------------------
221 //-----------------------------------------------------------------------------
222 //-----------------------------------------------------------------------------
223 //PROP_CHART_STATISTIC_CONST_ERROR_LOW
224 class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
226 public:
227 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
228 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
230 explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
231 tSeriesOrDiagramPropertyType ePropertyType );
232 virtual ~WrappedConstantErrorLowProperty();
234 private:
235 mutable Any m_aOuterValue;
238 WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
239 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
240 tSeriesOrDiagramPropertyType ePropertyType )
241 : WrappedStatisticProperty< double >( C2U("ConstantErrorLow")
242 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
245 WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
249 double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
251 double aRet = 0.0;
252 m_aDefaultValue >>= aRet;
253 uno::Reference< beans::XPropertySet > xErrorBarProperties;
254 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
256 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
257 xErrorBarProperties->getPropertyValue( C2U( "NegativeError" )) >>= aRet;
258 else
259 m_aOuterValue >>= aRet;
261 return aRet;
263 void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
265 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
266 if( xErrorBarProperties.is() )
268 m_aOuterValue = uno::makeAny( aNewValue );
269 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
271 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
275 //-----------------------------------------------------------------------------
276 //-----------------------------------------------------------------------------
277 //-----------------------------------------------------------------------------
278 //PROP_CHART_STATISTIC_CONST_ERROR_HIGH
279 class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
281 public:
282 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
283 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
285 explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
286 tSeriesOrDiagramPropertyType ePropertyType );
287 virtual ~WrappedConstantErrorHighProperty();
289 private:
290 mutable Any m_aOuterValue;
293 WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
294 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
295 tSeriesOrDiagramPropertyType ePropertyType )
296 : WrappedStatisticProperty< double >( C2U("ConstantErrorHigh")
297 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
300 WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
304 double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
306 double aRet = 0.0;
307 m_aDefaultValue >>= aRet;
308 uno::Reference< beans::XPropertySet > xErrorBarProperties;
309 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
311 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
312 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
313 else
314 m_aOuterValue >>= aRet;
316 return aRet;
318 void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
320 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
321 if( xErrorBarProperties.is() )
323 m_aOuterValue = uno::makeAny( aNewValue );
324 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
326 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
330 //-----------------------------------------------------------------------------
331 //-----------------------------------------------------------------------------
332 //-----------------------------------------------------------------------------
333 //PROP_CHART_STATISTIC_MEAN_VALUE
334 class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
336 public:
337 virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
338 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const;
340 explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
341 tSeriesOrDiagramPropertyType ePropertyType );
342 virtual ~WrappedMeanValueProperty();
345 WrappedMeanValueProperty::WrappedMeanValueProperty(
346 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
347 tSeriesOrDiagramPropertyType ePropertyType )
348 : WrappedStatisticProperty< sal_Bool >( C2U("MeanValue"), uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType )
351 WrappedMeanValueProperty::~WrappedMeanValueProperty()
355 sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
357 sal_Bool bRet = sal_False;
358 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
359 if( xRegCnt.is() )
360 bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
361 return bRet;
363 void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const
365 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
366 if( xRegCnt.is() )
368 if(aNewValue)
369 RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
370 else
371 RegressionCurveHelper::removeMeanValueLine( xRegCnt );
374 //-----------------------------------------------------------------------------
375 //-----------------------------------------------------------------------------
376 //-----------------------------------------------------------------------------
377 //PROP_CHART_STATISTIC_ERROR_CATEGORY
378 // deprecated, replaced by ErrorBarStyle
379 class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
381 public:
382 virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
383 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const;
385 explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
386 tSeriesOrDiagramPropertyType ePropertyType );
387 virtual ~WrappedErrorCategoryProperty();
390 WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
391 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
392 tSeriesOrDiagramPropertyType ePropertyType )
393 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( C2U("ErrorCategory")
394 , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType )
397 WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
401 ::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
403 ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
404 m_aDefaultValue >>= aRet;
405 uno::Reference< beans::XPropertySet > xErrorBarProperties;
406 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
408 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
409 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
410 switch(nStyle)
412 case ::com::sun::star::chart::ErrorBarStyle::NONE:
413 aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
414 break;
415 case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
416 aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
417 break;
418 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
419 aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
420 break;
421 case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
422 aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
423 break;
424 case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
425 aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
426 break;
427 case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
428 aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
429 break;
430 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
431 break;
432 case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
433 break;
434 default:
435 break;
438 return aRet;
440 void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const
442 if( !xSeriesPropertySet.is() )
443 return;
445 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
446 if( xErrorBarProperties.is() )
448 sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
449 switch(aNewValue)
451 case ::com::sun::star::chart::ChartErrorCategory_NONE:
452 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
453 break;
454 case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
455 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
456 break;
457 case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
458 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
459 break;
460 case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
461 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
462 break;
463 case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
464 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
465 break;
466 case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
467 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
468 break;
469 default:
470 break;
472 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(nNewStyle) );
476 //-----------------------------------------------------------------------------
477 //-----------------------------------------------------------------------------
478 //-----------------------------------------------------------------------------
479 //PROP_CHART_STATISTIC_PERCENT_ERROR
480 class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
482 public:
483 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
484 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
486 explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
487 tSeriesOrDiagramPropertyType ePropertyType );
488 virtual ~WrappedPercentageErrorProperty();
490 private:
491 mutable Any m_aOuterValue;
494 WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
495 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
496 tSeriesOrDiagramPropertyType ePropertyType )
497 : WrappedStatisticProperty< double >( C2U("PercentageError")
498 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
501 WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
505 double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
507 double aRet = 0.0;
508 m_aDefaultValue >>= aRet;
509 uno::Reference< beans::XPropertySet > xErrorBarProperties;
510 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
512 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
513 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
514 else
515 m_aOuterValue >>= aRet;
517 return aRet;
519 void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
521 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
522 if( xErrorBarProperties.is() )
524 m_aOuterValue = uno::makeAny( aNewValue );
525 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
527 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
528 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
533 //-----------------------------------------------------------------------------
534 //-----------------------------------------------------------------------------
535 //-----------------------------------------------------------------------------
536 //PROP_CHART_STATISTIC_ERROR_MARGIN
537 class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
539 public:
540 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
541 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
543 explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
544 tSeriesOrDiagramPropertyType ePropertyType );
545 virtual ~WrappedErrorMarginProperty();
547 private:
548 mutable Any m_aOuterValue;
551 WrappedErrorMarginProperty::WrappedErrorMarginProperty(
552 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
553 tSeriesOrDiagramPropertyType ePropertyType )
554 : WrappedStatisticProperty< double >( C2U("ErrorMargin")
555 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
558 WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
562 double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
564 double aRet = 0.0;
565 m_aDefaultValue >>= aRet;
566 uno::Reference< beans::XPropertySet > xErrorBarProperties;
567 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
569 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
570 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
571 else
572 m_aOuterValue >>= aRet;
574 return aRet;
576 void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
578 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
579 if( xErrorBarProperties.is() )
581 m_aOuterValue = uno::makeAny( aNewValue );
582 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
584 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
585 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
590 //-----------------------------------------------------------------------------
591 //-----------------------------------------------------------------------------
592 //-----------------------------------------------------------------------------
593 //PROP_CHART_STATISTIC_ERROR_INDICATOR
594 class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
596 public:
597 virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
598 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const;
600 explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
601 tSeriesOrDiagramPropertyType ePropertyType );
602 virtual ~WrappedErrorIndicatorProperty();
605 WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
606 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
607 tSeriesOrDiagramPropertyType ePropertyType )
608 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( C2U("ErrorIndicator")
609 , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType )
612 WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
616 ::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
618 ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
619 m_aDefaultValue >>= aRet;
620 uno::Reference< beans::XPropertySet > xErrorBarProperties;
621 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
623 sal_Bool bPositive = sal_False;
624 sal_Bool bNegative = sal_False;
625 xErrorBarProperties->getPropertyValue( C2U( "ShowPositiveError" )) >>= bPositive;
626 xErrorBarProperties->getPropertyValue( C2U( "ShowNegativeError" )) >>= bNegative;
628 if( bPositive && bNegative )
629 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
630 else if( bPositive && !bNegative )
631 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
632 else if( !bPositive && bNegative )
633 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
635 return aRet;
637 void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const
639 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
640 if( xErrorBarProperties.is() )
642 sal_Bool bPositive = sal_False;
643 sal_Bool bNegative = sal_False;
644 switch( aNewValue )
646 case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
647 bPositive = sal_True;
648 bNegative = sal_True;
649 break;
650 case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
651 bPositive = sal_True;
652 break;
653 case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
654 bNegative = sal_True;
655 break;
656 default:
657 break;
660 xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(bPositive) );
661 xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(bNegative) );
666 //-----------------------------------------------------------------------------
667 //-----------------------------------------------------------------------------
668 //-----------------------------------------------------------------------------
669 //PROP_CHART_STATISTIC_ERROR_BAR_STYLE
670 // this is the new constant group that replaces the deprecated enum ChartErrorCategory
671 class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
673 public:
674 virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
675 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const;
677 explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
678 tSeriesOrDiagramPropertyType ePropertyType );
679 virtual ~WrappedErrorBarStyleProperty();
682 WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
683 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
684 tSeriesOrDiagramPropertyType ePropertyType )
685 : WrappedStatisticProperty< sal_Int32 >( C2U("ErrorBarStyle")
686 , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType )
689 WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
693 sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
695 sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
696 m_aDefaultValue >>= nRet;
697 uno::Reference< beans::XPropertySet > xErrorBarProperties;
698 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
700 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nRet;
702 return nRet;
704 void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const
706 if( !xSeriesPropertySet.is() )
707 return;
709 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
710 if( xErrorBarProperties.is() )
712 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny( nNewValue ));
716 //-----------------------------------------------------------------------------
717 //-----------------------------------------------------------------------------
718 //-----------------------------------------------------------------------------
719 //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
720 class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
722 public:
723 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
724 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
726 explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
727 tSeriesOrDiagramPropertyType ePropertyType );
728 virtual ~WrappedErrorBarRangePositiveProperty();
730 private:
731 mutable Any m_aOuterValue;
734 WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
735 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
736 tSeriesOrDiagramPropertyType ePropertyType )
737 : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangePositive")
738 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
741 WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
745 OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
747 OUString aRet;
748 m_aDefaultValue >>= aRet;
749 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
750 if( xSeriesPropertySet.is() &&
751 ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
752 xErrorBarDataSource.is())
754 uno::Reference< chart2::data::XDataSequence > xSeq(
755 StatisticsHelper::getErrorDataSequenceFromDataSource(
756 xErrorBarDataSource, true /* positive */, true /* y-error */ ));
757 if( xSeq.is())
758 aRet = xSeq->getSourceRangeRepresentation();
759 else
760 m_aOuterValue >>= aRet;
762 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
763 return aRet;
766 void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
768 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
769 if( xErrorBarProperties.is() )
771 uno::Reference< chart2::data::XDataProvider > xDataProvider(
772 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
773 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
774 if( xDataSource.is() && xDataProvider.is())
776 OUString aXMLRange( aNewValue );
777 lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
778 StatisticsHelper::setErrorDataSequence(
779 xDataSource, xDataProvider, aNewValue, true /* positive */, true /* y-error */, &aXMLRange );
780 m_aOuterValue <<= aNewValue;
785 //-----------------------------------------------------------------------------
786 //-----------------------------------------------------------------------------
787 //-----------------------------------------------------------------------------
788 //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
789 class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
791 public:
792 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
793 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
795 explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
796 tSeriesOrDiagramPropertyType ePropertyType );
797 virtual ~WrappedErrorBarRangeNegativeProperty();
799 private:
800 mutable Any m_aOuterValue;
803 WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
804 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
805 tSeriesOrDiagramPropertyType ePropertyType )
806 : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangeNegative")
807 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
810 WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
814 OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
816 OUString aRet;
817 m_aDefaultValue >>= aRet;
818 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
819 if( xSeriesPropertySet.is() &&
820 ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
821 xErrorBarDataSource.is())
823 uno::Reference< chart2::data::XDataSequence > xSeq(
824 StatisticsHelper::getErrorDataSequenceFromDataSource(
825 xErrorBarDataSource, false /* positive */, true /* y-error */ ));
826 if( xSeq.is())
827 aRet = xSeq->getSourceRangeRepresentation();
828 else
829 m_aOuterValue >>= aRet;
831 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
832 return aRet;
835 void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
837 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
838 if( xErrorBarProperties.is() )
840 uno::Reference< chart2::data::XDataProvider > xDataProvider(
841 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
842 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
843 if( xDataSource.is() && xDataProvider.is())
845 OUString aXMLRange( aNewValue );
846 lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
847 StatisticsHelper::setErrorDataSequence(
848 xDataSource, xDataProvider, aNewValue, false /* positive */, true /* y-error */, &aXMLRange );
849 m_aOuterValue <<= aNewValue;
854 //-----------------------------------------------------------------------------
855 //-----------------------------------------------------------------------------
856 //-----------------------------------------------------------------------------
857 //PROP_CHART_STATISTIC_REGRESSION_CURVES
858 class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
860 public:
861 virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
862 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const;
864 explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
865 tSeriesOrDiagramPropertyType ePropertyType );
866 virtual ~WrappedRegressionCurvesProperty();
869 WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
870 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
871 tSeriesOrDiagramPropertyType ePropertyType )
872 : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( C2U("RegressionCurves")
873 , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType )
876 WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
880 ::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
882 ::com::sun::star::chart::ChartRegressionCurveType aRet;
883 m_aDefaultValue >>= aRet;
884 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
885 if( xRegCnt.is() )
887 aRet = lcl_getRegressionCurveType(
888 RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
890 return aRet;
892 void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const
894 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
895 if( xRegCnt.is() )
897 RegressionCurveHelper::tRegressionType eNewRegressionType = lcl_getRegressionType( aNewValue );
898 RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
899 if( eNewRegressionType != RegressionCurveHelper::REGRESSION_TYPE_NONE )
900 RegressionCurveHelper::addRegressionCurve( eNewRegressionType, xRegCnt, 0, 0 );
904 //-----------------------------------------------------------------------------
905 //-----------------------------------------------------------------------------
906 //-----------------------------------------------------------------------------
907 //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
908 //PROP_CHART_STATISTIC_ERROR_PROPERTIES
909 //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
910 class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
912 public:
913 virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
914 // properties are read-only, so this method should never be called
915 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, Reference< beans::XPropertySet > xNewValue ) const;
917 enum PropertySetType
919 PROPERTY_SET_TYPE_REGRESSION,
920 PROPERTY_SET_TYPE_ERROR_BAR,
921 PROPERTY_SET_TYPE_MEAN_VALUE
924 explicit WrappedStatisticPropertySetProperty(
925 PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
926 tSeriesOrDiagramPropertyType ePropertyType );
927 virtual ~WrappedStatisticPropertySetProperty();
929 private:
930 PropertySetType m_eType;
933 WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
934 PropertySetType ePropertySetType
935 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
936 , tSeriesOrDiagramPropertyType ePropertyType )
937 : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
938 (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
939 ? C2U("DataRegressionProperties")
940 : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
941 ? C2U("DataErrorProperties")
942 : C2U("DataMeanValueProperties")
943 , uno::Any(), spChart2ModelContact, ePropertyType )
944 , m_eType( ePropertySetType )
947 WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
951 Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
953 Reference< beans::XPropertySet > xResult;
954 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
956 switch( m_eType )
958 case PROPERTY_SET_TYPE_REGRESSION:
959 if( xRegCnt.is() )
960 xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
961 break;
962 case PROPERTY_SET_TYPE_ERROR_BAR:
963 if( xSeriesPropertySet.is())
964 xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult;
965 break;
966 case PROPERTY_SET_TYPE_MEAN_VALUE:
967 if( xRegCnt.is() )
968 xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
969 break;
972 return xResult;
975 void WrappedStatisticPropertySetProperty::setValueToSeries(
976 const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
977 , Reference< beans::XPropertySet > /* xNewValue */ ) const
981 //-----------------------------------------------------------------------------
982 //-----------------------------------------------------------------------------
983 //-----------------------------------------------------------------------------
985 namespace
987 enum
989 //statistic properties
990 PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
991 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
992 PROP_CHART_STATISTIC_MEAN_VALUE,
993 PROP_CHART_STATISTIC_ERROR_CATEGORY,
994 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
995 PROP_CHART_STATISTIC_PERCENT_ERROR,
996 PROP_CHART_STATISTIC_ERROR_MARGIN,
997 PROP_CHART_STATISTIC_ERROR_INDICATOR,
998 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
999 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1000 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1001 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1002 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1003 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
1006 /** @parameter bDataSeriesProperty if true, this property is for a single data
1007 series, if false, it is for the whole diagram, i.e. for all
1008 series
1010 void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
1011 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
1012 , tSeriesOrDiagramPropertyType ePropertyType )
1014 rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
1015 rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
1016 rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
1017 rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
1018 rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
1019 rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
1020 rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
1021 rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
1022 rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
1023 rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
1024 rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
1025 rList.push_back( new WrappedStatisticPropertySetProperty(
1026 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
1027 rList.push_back( new WrappedStatisticPropertySetProperty(
1028 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
1029 rList.push_back( new WrappedStatisticPropertySetProperty(
1030 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
1033 }//anonymous namespace
1035 //static
1036 void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
1038 rOutProperties.push_back(
1039 Property( C2U( "ConstantErrorLow" ),
1040 PROP_CHART_STATISTIC_CONST_ERROR_LOW,
1041 ::getCppuType( reinterpret_cast< double * >(0)),
1042 beans::PropertyAttribute::BOUND
1043 | beans::PropertyAttribute::MAYBEDEFAULT ));
1044 rOutProperties.push_back(
1045 Property( C2U( "ConstantErrorHigh" ),
1046 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
1047 ::getCppuType( reinterpret_cast< double * >(0)),
1048 beans::PropertyAttribute::BOUND
1049 | beans::PropertyAttribute::MAYBEDEFAULT ));
1050 rOutProperties.push_back(
1051 Property( C2U( "MeanValue" ),
1052 PROP_CHART_STATISTIC_MEAN_VALUE,
1053 ::getBooleanCppuType(),
1054 beans::PropertyAttribute::BOUND
1055 | beans::PropertyAttribute::MAYBEDEFAULT ));
1056 rOutProperties.push_back(
1057 Property( C2U( "ErrorCategory" ),
1058 PROP_CHART_STATISTIC_ERROR_CATEGORY,
1059 ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorCategory * >(0)),
1060 beans::PropertyAttribute::BOUND
1061 | beans::PropertyAttribute::MAYBEDEFAULT ));
1062 rOutProperties.push_back(
1063 Property( C2U( "ErrorBarStyle" ),
1064 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
1065 ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
1066 beans::PropertyAttribute::BOUND
1067 | beans::PropertyAttribute::MAYBEDEFAULT ));
1068 rOutProperties.push_back(
1069 Property( C2U( "PercentageError" ),
1070 PROP_CHART_STATISTIC_PERCENT_ERROR,
1071 ::getCppuType( reinterpret_cast< double * >(0)),
1072 beans::PropertyAttribute::BOUND
1073 | beans::PropertyAttribute::MAYBEDEFAULT ));
1074 rOutProperties.push_back(
1075 Property( C2U( "ErrorMargin" ),
1076 PROP_CHART_STATISTIC_ERROR_MARGIN,
1077 ::getCppuType( reinterpret_cast< double * >(0)),
1078 beans::PropertyAttribute::BOUND
1079 | beans::PropertyAttribute::MAYBEDEFAULT ));
1080 rOutProperties.push_back(
1081 Property( C2U( "ErrorIndicator" ),
1082 PROP_CHART_STATISTIC_ERROR_INDICATOR,
1083 ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorIndicatorType * >(0)),
1084 beans::PropertyAttribute::BOUND
1085 | beans::PropertyAttribute::MAYBEDEFAULT ));
1086 rOutProperties.push_back(
1087 Property( C2U( "ErrorBarRangePositive" ),
1088 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
1089 ::getCppuType( reinterpret_cast< OUString * >(0)),
1090 beans::PropertyAttribute::BOUND
1091 | beans::PropertyAttribute::MAYBEDEFAULT ));
1092 rOutProperties.push_back(
1093 Property( C2U( "ErrorBarRangeNegative" ),
1094 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1095 ::getCppuType( reinterpret_cast< OUString * >(0)),
1096 beans::PropertyAttribute::BOUND
1097 | beans::PropertyAttribute::MAYBEDEFAULT ));
1098 rOutProperties.push_back(
1099 Property( C2U( "RegressionCurves" ),
1100 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1101 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartRegressionCurveType * >(0)),
1102 beans::PropertyAttribute::BOUND
1103 | beans::PropertyAttribute::MAYBEDEFAULT ));
1105 rOutProperties.push_back(
1106 Property( C2U( "DataRegressionProperties" ),
1107 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1108 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1109 beans::PropertyAttribute::BOUND
1110 | beans::PropertyAttribute::READONLY
1111 | beans::PropertyAttribute::MAYBEVOID ));
1112 rOutProperties.push_back(
1113 Property( C2U( "DataErrorProperties" ),
1114 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1115 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1116 beans::PropertyAttribute::BOUND
1117 | beans::PropertyAttribute::READONLY
1118 | beans::PropertyAttribute::MAYBEVOID ));
1119 rOutProperties.push_back(
1120 Property( C2U( "DataMeanValueProperties" ),
1121 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
1122 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1123 beans::PropertyAttribute::BOUND
1124 | beans::PropertyAttribute::READONLY
1125 | beans::PropertyAttribute::MAYBEVOID ));
1128 //-----------------------------------------------------------------------------
1129 //-----------------------------------------------------------------------------
1131 //static
1132 void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
1133 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1135 lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
1138 //-----------------------------------------------------------------------------
1139 //-----------------------------------------------------------------------------
1141 //static
1142 void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
1143 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1145 lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
1148 //-----------------------------------------------------------------------------
1149 //-----------------------------------------------------------------------------
1150 //-----------------------------------------------------------------------------
1152 } //namespace wrapper
1153 } //namespace chart
1154 //.............................................................................