Update ooo320-m1
[ooovba.git] / chart2 / source / controller / chartapiwrapper / WrappedStatisticProperties.cxx
blobeaea5b16f58646cfb15a93210bacef3c575d4ed8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WrappedStatisticProperties.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "WrappedStatisticProperties.hxx"
35 #include "WrappedSeriesOrDiagramProperty.hxx"
36 #include "macros.hxx"
37 #include "FastPropertyIdRanges.hxx"
38 #include "RegressionCurveHelper.hxx"
39 #include "DiagramHelper.hxx"
40 #include "ErrorBar.hxx"
41 #include "StatisticsHelper.hxx"
43 #include <com/sun/star/beans/PropertyAttribute.hpp>
44 #include <com/sun/star/chart/ChartErrorCategory.hpp>
45 #include <com/sun/star/chart/ErrorBarStyle.hpp>
46 #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
47 #include <com/sun/star/chart/ChartRegressionCurveType.hpp>
48 #include <com/sun/star/chart2/data/XDataProvider.hpp>
49 #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
51 using namespace ::com::sun::star;
52 using ::com::sun::star::uno::Any;
53 using ::com::sun::star::uno::Reference;
54 using ::com::sun::star::uno::Sequence;
55 using ::com::sun::star::beans::Property;
56 using ::rtl::OUString;
58 //.............................................................................
59 namespace chart
61 namespace wrapper
64 namespace
67 Any lcl_getRegressionDefault()
69 Any aRet;
70 aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
71 return aRet;
74 //-----------------------------------------------------------------------------
75 //-----------------------------------------------------------------------------
77 ::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType( RegressionCurveHelper::tRegressionType eRegressionType )
79 ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
80 switch(eRegressionType)
82 case RegressionCurveHelper::REGRESSION_TYPE_LINEAR:
83 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
84 break;
85 case RegressionCurveHelper::REGRESSION_TYPE_LOG:
86 eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
87 break;
88 case RegressionCurveHelper::REGRESSION_TYPE_EXP:
89 eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
90 break;
91 case RegressionCurveHelper::REGRESSION_TYPE_POWER:
92 eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
93 break;
94 default:
95 eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
96 break;
98 return eRet;
101 //-----------------------------------------------------------------------------
102 //-----------------------------------------------------------------------------
104 RegressionCurveHelper::tRegressionType lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
106 RegressionCurveHelper::tRegressionType eRet;
107 switch(eRegressionCurveType)
109 case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
110 eRet = RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
111 break;
112 case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
113 eRet = RegressionCurveHelper::REGRESSION_TYPE_LOG;
114 break;
115 case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
116 eRet = RegressionCurveHelper::REGRESSION_TYPE_EXP;
117 break;
118 case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
119 case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
120 eRet = RegressionCurveHelper::REGRESSION_TYPE_POWER;
121 break;
122 default:
123 eRet = RegressionCurveHelper::REGRESSION_TYPE_NONE;
124 break;
126 return eRet;
129 sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
131 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
132 if(xErrorBarProperties.is())
133 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
134 return nStyle;
137 uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
138 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
140 uno::Reference< chart2::data::XDataProvider > xResult;
141 if( spChart2ModelContact.get())
143 uno::Reference< chart2::XChartDocument > xChartDoc(
144 spChart2ModelContact->getChart2Document());
145 if( xChartDoc.is())
146 xResult.set( xChartDoc->getDataProvider());
148 return xResult;
151 void lcl_ConvertRangeFromXML(
152 ::rtl::OUString & rInOutRange,
153 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
155 if( rInOutRange.getLength())
157 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
158 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
159 if( xConverter.is())
161 ::rtl::OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
162 rInOutRange = aResult;
167 void lcl_ConvertRangeToXML(
168 ::rtl::OUString & rInOutRange,
169 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
171 if( rInOutRange.getLength())
173 uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
174 lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
175 if( xConverter.is())
177 ::rtl::OUString aResult = xConverter->convertRangeToXML( rInOutRange );
178 rInOutRange = aResult;
183 }//anonymous namespace
185 //-----------------------------------------------------------------------------
186 //-----------------------------------------------------------------------------
187 //-----------------------------------------------------------------------------
189 template< typename PROPERTYTYPE >
190 class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
192 public:
193 explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
194 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
195 , tSeriesOrDiagramPropertyType ePropertyType )
196 : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
198 virtual ~WrappedStatisticProperty() {};
201 protected:
202 uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
204 if(!xSeriesPropertySet.is())
205 return 0;
206 uno::Reference< beans::XPropertySet > xErrorBarProperties;
207 xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties;
208 if( !xErrorBarProperties.is() )
210 // todo: use a valid context
211 xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
212 //default in new and old api are different
213 xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(sal_Bool(sal_False)) );
214 xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(sal_Bool(sal_False)) );
215 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
216 xSeriesPropertySet->setPropertyValue( C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProperties ) );
218 return xErrorBarProperties;
223 //-----------------------------------------------------------------------------
224 //-----------------------------------------------------------------------------
225 //-----------------------------------------------------------------------------
226 //PROP_CHART_STATISTIC_CONST_ERROR_LOW
227 class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
229 public:
230 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
231 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
233 explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
234 tSeriesOrDiagramPropertyType ePropertyType );
235 virtual ~WrappedConstantErrorLowProperty();
237 private:
238 mutable Any m_aOuterValue;
241 WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
242 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
243 tSeriesOrDiagramPropertyType ePropertyType )
244 : WrappedStatisticProperty< double >( C2U("ConstantErrorLow")
245 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
248 WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
252 double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
254 double aRet = 0.0;
255 m_aDefaultValue >>= aRet;
256 uno::Reference< beans::XPropertySet > xErrorBarProperties;
257 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
259 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
260 xErrorBarProperties->getPropertyValue( C2U( "NegativeError" )) >>= aRet;
261 else
262 m_aOuterValue >>= aRet;
264 return aRet;
266 void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
268 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
269 if( xErrorBarProperties.is() )
271 m_aOuterValue = uno::makeAny( aNewValue );
272 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
274 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
278 //-----------------------------------------------------------------------------
279 //-----------------------------------------------------------------------------
280 //-----------------------------------------------------------------------------
281 //PROP_CHART_STATISTIC_CONST_ERROR_HIGH
282 class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
284 public:
285 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
286 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
288 explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
289 tSeriesOrDiagramPropertyType ePropertyType );
290 virtual ~WrappedConstantErrorHighProperty();
292 private:
293 mutable Any m_aOuterValue;
296 WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
297 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
298 tSeriesOrDiagramPropertyType ePropertyType )
299 : WrappedStatisticProperty< double >( C2U("ConstantErrorHigh")
300 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
303 WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
307 double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
309 double aRet = 0.0;
310 m_aDefaultValue >>= aRet;
311 uno::Reference< beans::XPropertySet > xErrorBarProperties;
312 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
314 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
315 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
316 else
317 m_aOuterValue >>= aRet;
319 return aRet;
321 void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
323 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
324 if( xErrorBarProperties.is() )
326 m_aOuterValue = uno::makeAny( aNewValue );
327 if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
329 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
333 //-----------------------------------------------------------------------------
334 //-----------------------------------------------------------------------------
335 //-----------------------------------------------------------------------------
336 //PROP_CHART_STATISTIC_MEAN_VALUE
337 class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
339 public:
340 virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
341 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const;
343 explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
344 tSeriesOrDiagramPropertyType ePropertyType );
345 virtual ~WrappedMeanValueProperty();
348 WrappedMeanValueProperty::WrappedMeanValueProperty(
349 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
350 tSeriesOrDiagramPropertyType ePropertyType )
351 : WrappedStatisticProperty< sal_Bool >( C2U("MeanValue"), uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType )
354 WrappedMeanValueProperty::~WrappedMeanValueProperty()
358 sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
360 sal_Bool bRet = sal_False;
361 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
362 if( xRegCnt.is() )
363 bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
364 return bRet;
366 void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const
368 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
369 if( xRegCnt.is() )
371 if(aNewValue)
372 RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
373 else
374 RegressionCurveHelper::removeMeanValueLine( xRegCnt );
377 //-----------------------------------------------------------------------------
378 //-----------------------------------------------------------------------------
379 //-----------------------------------------------------------------------------
380 //PROP_CHART_STATISTIC_ERROR_CATEGORY
381 // deprecated, replaced by ErrorBarStyle
382 class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
384 public:
385 virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
386 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const;
388 explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
389 tSeriesOrDiagramPropertyType ePropertyType );
390 virtual ~WrappedErrorCategoryProperty();
393 WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
394 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
395 tSeriesOrDiagramPropertyType ePropertyType )
396 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( C2U("ErrorCategory")
397 , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType )
400 WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
404 ::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
406 ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
407 m_aDefaultValue >>= aRet;
408 uno::Reference< beans::XPropertySet > xErrorBarProperties;
409 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
411 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
412 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
413 switch(nStyle)
415 case ::com::sun::star::chart::ErrorBarStyle::NONE:
416 aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
417 break;
418 case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
419 aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
420 break;
421 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
422 aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
423 break;
424 case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
425 aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
426 break;
427 case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
428 aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
429 break;
430 case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
431 aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
432 break;
433 case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
434 break;
435 case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
436 break;
437 default:
438 break;
441 return aRet;
443 void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const
445 if( !xSeriesPropertySet.is() )
446 return;
448 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
449 if( xErrorBarProperties.is() )
451 sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
452 switch(aNewValue)
454 case ::com::sun::star::chart::ChartErrorCategory_NONE:
455 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
456 break;
457 case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
458 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
459 break;
460 case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
461 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
462 break;
463 case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
464 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
465 break;
466 case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
467 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
468 break;
469 case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
470 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
471 break;
472 default:
473 break;
475 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(nNewStyle) );
479 //-----------------------------------------------------------------------------
480 //-----------------------------------------------------------------------------
481 //-----------------------------------------------------------------------------
482 //PROP_CHART_STATISTIC_PERCENT_ERROR
483 class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
485 public:
486 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
487 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
489 explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
490 tSeriesOrDiagramPropertyType ePropertyType );
491 virtual ~WrappedPercentageErrorProperty();
493 private:
494 mutable Any m_aOuterValue;
497 WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
498 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
499 tSeriesOrDiagramPropertyType ePropertyType )
500 : WrappedStatisticProperty< double >( C2U("PercentageError")
501 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
504 WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
508 double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
510 double aRet = 0.0;
511 m_aDefaultValue >>= aRet;
512 uno::Reference< beans::XPropertySet > xErrorBarProperties;
513 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
515 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
516 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
517 else
518 m_aOuterValue >>= aRet;
520 return aRet;
522 void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
524 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
525 if( xErrorBarProperties.is() )
527 m_aOuterValue = uno::makeAny( aNewValue );
528 if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
530 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
531 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
536 //-----------------------------------------------------------------------------
537 //-----------------------------------------------------------------------------
538 //-----------------------------------------------------------------------------
539 //PROP_CHART_STATISTIC_ERROR_MARGIN
540 class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
542 public:
543 virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
544 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
546 explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
547 tSeriesOrDiagramPropertyType ePropertyType );
548 virtual ~WrappedErrorMarginProperty();
550 private:
551 mutable Any m_aOuterValue;
554 WrappedErrorMarginProperty::WrappedErrorMarginProperty(
555 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
556 tSeriesOrDiagramPropertyType ePropertyType )
557 : WrappedStatisticProperty< double >( C2U("ErrorMargin")
558 , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
561 WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
565 double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
567 double aRet = 0.0;
568 m_aDefaultValue >>= aRet;
569 uno::Reference< beans::XPropertySet > xErrorBarProperties;
570 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
572 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
573 xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
574 else
575 m_aOuterValue >>= aRet;
577 return aRet;
579 void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
581 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
582 if( xErrorBarProperties.is() )
584 m_aOuterValue = uno::makeAny( aNewValue );
585 if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
587 xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
588 xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
593 //-----------------------------------------------------------------------------
594 //-----------------------------------------------------------------------------
595 //-----------------------------------------------------------------------------
596 //PROP_CHART_STATISTIC_ERROR_INDICATOR
597 class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
599 public:
600 virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
601 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const;
603 explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
604 tSeriesOrDiagramPropertyType ePropertyType );
605 virtual ~WrappedErrorIndicatorProperty();
608 WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
609 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
610 tSeriesOrDiagramPropertyType ePropertyType )
611 : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( C2U("ErrorIndicator")
612 , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType )
615 WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
619 ::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
621 ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
622 m_aDefaultValue >>= aRet;
623 uno::Reference< beans::XPropertySet > xErrorBarProperties;
624 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
626 sal_Bool bPositive = sal_False;
627 sal_Bool bNegative = sal_False;
628 xErrorBarProperties->getPropertyValue( C2U( "ShowPositiveError" )) >>= bPositive;
629 xErrorBarProperties->getPropertyValue( C2U( "ShowNegativeError" )) >>= bNegative;
631 if( bPositive && bNegative )
632 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
633 else if( bPositive && !bNegative )
634 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
635 else if( !bPositive && bNegative )
636 aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
638 return aRet;
640 void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const
642 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
643 if( xErrorBarProperties.is() )
645 sal_Bool bPositive = sal_False;
646 sal_Bool bNegative = sal_False;
647 switch( aNewValue )
649 case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
650 bPositive = sal_True;
651 bNegative = sal_True;
652 break;
653 case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
654 bPositive = sal_True;
655 break;
656 case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
657 bNegative = sal_True;
658 break;
659 default:
660 break;
663 xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(bPositive) );
664 xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(bNegative) );
669 //-----------------------------------------------------------------------------
670 //-----------------------------------------------------------------------------
671 //-----------------------------------------------------------------------------
672 //PROP_CHART_STATISTIC_ERROR_BAR_STYLE
673 // this is the new constant group that replaces the deprecated enum ChartErrorCategory
674 class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
676 public:
677 virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
678 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const;
680 explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
681 tSeriesOrDiagramPropertyType ePropertyType );
682 virtual ~WrappedErrorBarStyleProperty();
685 WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
686 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
687 tSeriesOrDiagramPropertyType ePropertyType )
688 : WrappedStatisticProperty< sal_Int32 >( C2U("ErrorBarStyle")
689 , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType )
692 WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
696 sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
698 sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
699 m_aDefaultValue >>= nRet;
700 uno::Reference< beans::XPropertySet > xErrorBarProperties;
701 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
703 xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nRet;
705 return nRet;
707 void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const
709 if( !xSeriesPropertySet.is() )
710 return;
712 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
713 if( xErrorBarProperties.is() )
715 xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny( nNewValue ));
719 //-----------------------------------------------------------------------------
720 //-----------------------------------------------------------------------------
721 //-----------------------------------------------------------------------------
722 //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
723 class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
725 public:
726 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
727 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
729 explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
730 tSeriesOrDiagramPropertyType ePropertyType );
731 virtual ~WrappedErrorBarRangePositiveProperty();
733 private:
734 mutable Any m_aOuterValue;
737 WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
738 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
739 tSeriesOrDiagramPropertyType ePropertyType )
740 : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangePositive")
741 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
744 WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
748 OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
750 OUString aRet;
751 m_aDefaultValue >>= aRet;
752 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
753 if( xSeriesPropertySet.is() &&
754 ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
755 xErrorBarDataSource.is())
757 uno::Reference< chart2::data::XDataSequence > xSeq(
758 StatisticsHelper::getErrorDataSequenceFromDataSource(
759 xErrorBarDataSource, true /* positive */, true /* y-error */ ));
760 if( xSeq.is())
761 aRet = xSeq->getSourceRangeRepresentation();
762 else
763 m_aOuterValue >>= aRet;
765 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
766 return aRet;
769 void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
771 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
772 if( xErrorBarProperties.is() )
774 uno::Reference< chart2::data::XDataProvider > xDataProvider(
775 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
776 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
777 if( xDataSource.is() && xDataProvider.is())
779 OUString aXMLRange( aNewValue );
780 lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
781 StatisticsHelper::setErrorDataSequence(
782 xDataSource, xDataProvider, aNewValue, true /* positive */, true /* y-error */, &aXMLRange );
783 m_aOuterValue <<= aNewValue;
788 //-----------------------------------------------------------------------------
789 //-----------------------------------------------------------------------------
790 //-----------------------------------------------------------------------------
791 //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
792 class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
794 public:
795 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
796 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
798 explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
799 tSeriesOrDiagramPropertyType ePropertyType );
800 virtual ~WrappedErrorBarRangeNegativeProperty();
802 private:
803 mutable Any m_aOuterValue;
806 WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
807 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
808 tSeriesOrDiagramPropertyType ePropertyType )
809 : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangeNegative")
810 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
813 WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
817 OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
819 OUString aRet;
820 m_aDefaultValue >>= aRet;
821 uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
822 if( xSeriesPropertySet.is() &&
823 ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
824 xErrorBarDataSource.is())
826 uno::Reference< chart2::data::XDataSequence > xSeq(
827 StatisticsHelper::getErrorDataSequenceFromDataSource(
828 xErrorBarDataSource, false /* positive */, true /* y-error */ ));
829 if( xSeq.is())
830 aRet = xSeq->getSourceRangeRepresentation();
831 else
832 m_aOuterValue >>= aRet;
834 lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
835 return aRet;
838 void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
840 uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
841 if( xErrorBarProperties.is() )
843 uno::Reference< chart2::data::XDataProvider > xDataProvider(
844 lcl_getDataProviderFromContact( m_spChart2ModelContact ));
845 uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
846 if( xDataSource.is() && xDataProvider.is())
848 OUString aXMLRange( aNewValue );
849 lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
850 StatisticsHelper::setErrorDataSequence(
851 xDataSource, xDataProvider, aNewValue, false /* positive */, true /* y-error */, &aXMLRange );
852 m_aOuterValue <<= aNewValue;
857 //-----------------------------------------------------------------------------
858 //-----------------------------------------------------------------------------
859 //-----------------------------------------------------------------------------
860 //PROP_CHART_STATISTIC_REGRESSION_CURVES
861 class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
863 public:
864 virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
865 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const;
867 explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
868 tSeriesOrDiagramPropertyType ePropertyType );
869 virtual ~WrappedRegressionCurvesProperty();
872 WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
873 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
874 tSeriesOrDiagramPropertyType ePropertyType )
875 : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( C2U("RegressionCurves")
876 , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType )
879 WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
883 ::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
885 ::com::sun::star::chart::ChartRegressionCurveType aRet;
886 m_aDefaultValue >>= aRet;
887 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
888 if( xRegCnt.is() )
890 aRet = lcl_getRegressionCurveType(
891 RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
893 return aRet;
895 void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const
897 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
898 if( xRegCnt.is() )
900 RegressionCurveHelper::tRegressionType eNewRegressionType = lcl_getRegressionType( aNewValue );
901 RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
902 if( eNewRegressionType != RegressionCurveHelper::REGRESSION_TYPE_NONE )
903 RegressionCurveHelper::addRegressionCurve( eNewRegressionType, xRegCnt, 0, 0 );
907 //-----------------------------------------------------------------------------
908 //-----------------------------------------------------------------------------
909 //-----------------------------------------------------------------------------
910 //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
911 //PROP_CHART_STATISTIC_ERROR_PROPERTIES
912 //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
913 class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
915 public:
916 virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
917 // properties are read-only, so this method should never be called
918 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, Reference< beans::XPropertySet > xNewValue ) const;
920 enum PropertySetType
922 PROPERTY_SET_TYPE_REGRESSION,
923 PROPERTY_SET_TYPE_ERROR_BAR,
924 PROPERTY_SET_TYPE_MEAN_VALUE
927 explicit WrappedStatisticPropertySetProperty(
928 PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
929 tSeriesOrDiagramPropertyType ePropertyType );
930 virtual ~WrappedStatisticPropertySetProperty();
932 private:
933 PropertySetType m_eType;
936 WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
937 PropertySetType ePropertySetType
938 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
939 , tSeriesOrDiagramPropertyType ePropertyType )
940 : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
941 (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
942 ? C2U("DataRegressionProperties")
943 : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
944 ? C2U("DataErrorProperties")
945 : C2U("DataMeanValueProperties")
946 , uno::Any(), spChart2ModelContact, ePropertyType )
947 , m_eType( ePropertySetType )
950 WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
954 Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
956 Reference< beans::XPropertySet > xResult;
957 uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
959 switch( m_eType )
961 case PROPERTY_SET_TYPE_REGRESSION:
962 if( xRegCnt.is() )
963 xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
964 break;
965 case PROPERTY_SET_TYPE_ERROR_BAR:
966 if( xSeriesPropertySet.is())
967 xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult;
968 break;
969 case PROPERTY_SET_TYPE_MEAN_VALUE:
970 if( xRegCnt.is() )
971 xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
972 break;
975 return xResult;
978 void WrappedStatisticPropertySetProperty::setValueToSeries(
979 const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
980 , Reference< beans::XPropertySet > /* xNewValue */ ) const
982 OSL_ENSURE( false, "Trying to set a read-only property" );
985 //-----------------------------------------------------------------------------
986 //-----------------------------------------------------------------------------
987 //-----------------------------------------------------------------------------
989 namespace
991 enum
993 //statistic properties
994 PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
995 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
996 PROP_CHART_STATISTIC_MEAN_VALUE,
997 PROP_CHART_STATISTIC_ERROR_CATEGORY,
998 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
999 PROP_CHART_STATISTIC_PERCENT_ERROR,
1000 PROP_CHART_STATISTIC_ERROR_MARGIN,
1001 PROP_CHART_STATISTIC_ERROR_INDICATOR,
1002 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
1003 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1004 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1005 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1006 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1007 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
1010 /** @parameter bDataSeriesProperty if true, this property is for a single data
1011 series, if false, it is for the whole diagram, i.e. for all
1012 series
1014 void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
1015 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
1016 , tSeriesOrDiagramPropertyType ePropertyType )
1018 rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
1019 rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
1020 rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
1021 rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
1022 rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
1023 rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
1024 rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
1025 rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
1026 rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
1027 rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
1028 rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
1029 rList.push_back( new WrappedStatisticPropertySetProperty(
1030 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
1031 rList.push_back( new WrappedStatisticPropertySetProperty(
1032 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
1033 rList.push_back( new WrappedStatisticPropertySetProperty(
1034 WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
1037 }//anonymous namespace
1039 //static
1040 void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
1042 rOutProperties.push_back(
1043 Property( C2U( "ConstantErrorLow" ),
1044 PROP_CHART_STATISTIC_CONST_ERROR_LOW,
1045 ::getCppuType( reinterpret_cast< double * >(0)),
1046 beans::PropertyAttribute::BOUND
1047 | beans::PropertyAttribute::MAYBEDEFAULT ));
1048 rOutProperties.push_back(
1049 Property( C2U( "ConstantErrorHigh" ),
1050 PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
1051 ::getCppuType( reinterpret_cast< double * >(0)),
1052 beans::PropertyAttribute::BOUND
1053 | beans::PropertyAttribute::MAYBEDEFAULT ));
1054 rOutProperties.push_back(
1055 Property( C2U( "MeanValue" ),
1056 PROP_CHART_STATISTIC_MEAN_VALUE,
1057 ::getBooleanCppuType(),
1058 beans::PropertyAttribute::BOUND
1059 | beans::PropertyAttribute::MAYBEDEFAULT ));
1060 rOutProperties.push_back(
1061 Property( C2U( "ErrorCategory" ),
1062 PROP_CHART_STATISTIC_ERROR_CATEGORY,
1063 ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorCategory * >(0)),
1064 beans::PropertyAttribute::BOUND
1065 | beans::PropertyAttribute::MAYBEDEFAULT ));
1066 rOutProperties.push_back(
1067 Property( C2U( "ErrorBarStyle" ),
1068 PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
1069 ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
1070 beans::PropertyAttribute::BOUND
1071 | beans::PropertyAttribute::MAYBEDEFAULT ));
1072 rOutProperties.push_back(
1073 Property( C2U( "PercentageError" ),
1074 PROP_CHART_STATISTIC_PERCENT_ERROR,
1075 ::getCppuType( reinterpret_cast< double * >(0)),
1076 beans::PropertyAttribute::BOUND
1077 | beans::PropertyAttribute::MAYBEDEFAULT ));
1078 rOutProperties.push_back(
1079 Property( C2U( "ErrorMargin" ),
1080 PROP_CHART_STATISTIC_ERROR_MARGIN,
1081 ::getCppuType( reinterpret_cast< double * >(0)),
1082 beans::PropertyAttribute::BOUND
1083 | beans::PropertyAttribute::MAYBEDEFAULT ));
1084 rOutProperties.push_back(
1085 Property( C2U( "ErrorIndicator" ),
1086 PROP_CHART_STATISTIC_ERROR_INDICATOR,
1087 ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorIndicatorType * >(0)),
1088 beans::PropertyAttribute::BOUND
1089 | beans::PropertyAttribute::MAYBEDEFAULT ));
1090 rOutProperties.push_back(
1091 Property( C2U( "ErrorBarRangePositive" ),
1092 PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
1093 ::getCppuType( reinterpret_cast< OUString * >(0)),
1094 beans::PropertyAttribute::BOUND
1095 | beans::PropertyAttribute::MAYBEDEFAULT ));
1096 rOutProperties.push_back(
1097 Property( C2U( "ErrorBarRangeNegative" ),
1098 PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
1099 ::getCppuType( reinterpret_cast< OUString * >(0)),
1100 beans::PropertyAttribute::BOUND
1101 | beans::PropertyAttribute::MAYBEDEFAULT ));
1102 rOutProperties.push_back(
1103 Property( C2U( "RegressionCurves" ),
1104 PROP_CHART_STATISTIC_REGRESSION_CURVES,
1105 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartRegressionCurveType * >(0)),
1106 beans::PropertyAttribute::BOUND
1107 | beans::PropertyAttribute::MAYBEDEFAULT ));
1109 rOutProperties.push_back(
1110 Property( C2U( "DataRegressionProperties" ),
1111 PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
1112 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1113 beans::PropertyAttribute::BOUND
1114 | beans::PropertyAttribute::READONLY
1115 | beans::PropertyAttribute::MAYBEVOID ));
1116 rOutProperties.push_back(
1117 Property( C2U( "DataErrorProperties" ),
1118 PROP_CHART_STATISTIC_ERROR_PROPERTIES,
1119 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1120 beans::PropertyAttribute::BOUND
1121 | beans::PropertyAttribute::READONLY
1122 | beans::PropertyAttribute::MAYBEVOID ));
1123 rOutProperties.push_back(
1124 Property( C2U( "DataMeanValueProperties" ),
1125 PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
1126 ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
1127 beans::PropertyAttribute::BOUND
1128 | beans::PropertyAttribute::READONLY
1129 | beans::PropertyAttribute::MAYBEVOID ));
1132 //-----------------------------------------------------------------------------
1133 //-----------------------------------------------------------------------------
1135 //static
1136 void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
1137 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1139 lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
1142 //-----------------------------------------------------------------------------
1143 //-----------------------------------------------------------------------------
1145 //static
1146 void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
1147 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
1149 lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
1152 //-----------------------------------------------------------------------------
1153 //-----------------------------------------------------------------------------
1154 //-----------------------------------------------------------------------------
1156 } //namespace wrapper
1157 } //namespace chart
1158 //.............................................................................