LCOV - code coverage report
Current view: top level - chart2/source/controller/chartapiwrapper - WrappedStatisticProperties.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 371 452 82.1 %
Date: 2014-11-03 Functions: 90 102 88.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "WrappedStatisticProperties.hxx"
      21             : #include "WrappedSeriesOrDiagramProperty.hxx"
      22             : #include "macros.hxx"
      23             : #include "FastPropertyIdRanges.hxx"
      24             : #include "RegressionCurveHelper.hxx"
      25             : #include "DiagramHelper.hxx"
      26             : #include "ErrorBar.hxx"
      27             : #include "StatisticsHelper.hxx"
      28             : #include <unonames.hxx>
      29             : 
      30             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      31             : #include <com/sun/star/chart/ChartErrorCategory.hpp>
      32             : #include <com/sun/star/chart/ErrorBarStyle.hpp>
      33             : #include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
      34             : #include <com/sun/star/chart/ChartRegressionCurveType.hpp>
      35             : #include <com/sun/star/chart2/data/XDataProvider.hpp>
      36             : #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : using ::com::sun::star::uno::Any;
      40             : using ::com::sun::star::uno::Reference;
      41             : using ::com::sun::star::uno::Sequence;
      42             : using ::com::sun::star::beans::Property;
      43             : 
      44             : namespace chart
      45             : {
      46             : namespace wrapper
      47             : {
      48             : 
      49             : namespace
      50             : {
      51             : 
      52        3756 : Any lcl_getRegressionDefault()
      53             : {
      54        3756 :     Any aRet;
      55        3756 :     aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
      56        3756 :     return aRet;
      57             : }
      58             : 
      59           0 : ::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType(SvxChartRegress eRegressionType)
      60             : {
      61           0 :     ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
      62           0 :     switch(eRegressionType)
      63             :     {
      64             :         case CHREGRESS_LINEAR:
      65           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
      66           0 :             break;
      67             :         case CHREGRESS_LOG:
      68           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
      69           0 :             break;
      70             :         case CHREGRESS_EXP:
      71           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
      72           0 :             break;
      73             :         case CHREGRESS_POWER:
      74           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
      75           0 :             break;
      76             :         case CHREGRESS_POLYNOMIAL:
      77           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL;
      78           0 :             break;
      79             :         /*case CHREGRESS_MOVING_AVERAGE:
      80             :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_MOVING_AVERAGE;
      81             :             break;*/
      82             :         default:
      83           0 :             eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
      84           0 :             break;
      85             :     }
      86           0 :     return eRet;
      87             : }
      88             : 
      89           0 : SvxChartRegress lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
      90             : {
      91             :     SvxChartRegress eRet;
      92           0 :     switch (eRegressionCurveType)
      93             :     {
      94             :         case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
      95           0 :             eRet = CHREGRESS_LINEAR;
      96           0 :             break;
      97             :         case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
      98           0 :             eRet = CHREGRESS_LOG;
      99           0 :             break;
     100             :         case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
     101           0 :             eRet = CHREGRESS_EXP;
     102           0 :             break;
     103             :         case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
     104             :         //case ::com::sun::star::chart::ChartRegressionCurveType_MOVING_AVERAGE:
     105             :         case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
     106           0 :             eRet = CHREGRESS_POWER;
     107           0 :             break;
     108             :         default:
     109           0 :             eRet = CHREGRESS_NONE;
     110           0 :             break;
     111             :     }
     112           0 :     return eRet;
     113             : }
     114             : 
     115         142 : sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
     116             : {
     117         142 :     sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
     118         142 :     if(xErrorBarProperties.is())
     119         142 :         xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nStyle;
     120         142 :     return nStyle;
     121             : }
     122             : 
     123          56 : uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
     124             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     125             : {
     126          56 :     uno::Reference< chart2::data::XDataProvider > xResult;
     127          56 :     if( spChart2ModelContact.get())
     128             :     {
     129             :         uno::Reference< chart2::XChartDocument > xChartDoc(
     130          56 :             spChart2ModelContact->getChart2Document());
     131          56 :         if( xChartDoc.is())
     132          56 :             xResult.set( xChartDoc->getDataProvider());
     133             :     }
     134          56 :     return xResult;
     135             : }
     136             : 
     137          12 : void lcl_ConvertRangeFromXML(
     138             :     OUString & rInOutRange,
     139             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     140             : {
     141          12 :     if( !rInOutRange.isEmpty())
     142             :     {
     143             :         uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
     144          12 :             lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
     145          12 :         if( xConverter.is())
     146             :         {
     147          12 :             OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
     148          12 :             rInOutRange = aResult;
     149          12 :         }
     150             :     }
     151          12 : }
     152             : 
     153        9936 : void lcl_ConvertRangeToXML(
     154             :     OUString & rInOutRange,
     155             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
     156             : {
     157        9936 :     if( !rInOutRange.isEmpty())
     158             :     {
     159             :         uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
     160          32 :             lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
     161          32 :         if( xConverter.is())
     162             :         {
     163          32 :             OUString aResult = xConverter->convertRangeToXML( rInOutRange );
     164          32 :             rInOutRange = aResult;
     165          32 :         }
     166             :     }
     167        9936 : }
     168             : 
     169             : }//anonymous namespace
     170             : 
     171             : template< typename PROPERTYTYPE >
     172             : class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
     173             : {
     174             : public:
     175       52584 :     explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
     176             :                               , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
     177             :                               , tSeriesOrDiagramPropertyType ePropertyType )
     178       52584 :             : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
     179       52584 :     {}
     180       52584 :     virtual ~WrappedStatisticProperty() {};
     181             : 
     182             : protected:
     183         150 :     uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     184             :     {
     185         150 :         if(!xSeriesPropertySet.is())
     186           0 :             return 0;
     187         150 :         uno::Reference< beans::XPropertySet > xErrorBarProperties;
     188         150 :         xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties;
     189         150 :         if( !xErrorBarProperties.is() )
     190             :         {
     191             :             // todo: use a valid context
     192          36 :             xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
     193             :             //default in new and old api are different
     194          36 :             xErrorBarProperties->setPropertyValue( "ShowPositiveError" , uno::makeAny(false) );
     195          36 :             xErrorBarProperties->setPropertyValue( "ShowNegativeError" , uno::makeAny(false) );
     196          36 :             xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
     197          36 :             xSeriesPropertySet->setPropertyValue( CHART_UNONAME_ERRORBAR_Y , uno::makeAny( xErrorBarProperties ) );
     198             :         }
     199         150 :         return xErrorBarProperties;
     200             :     }
     201             : 
     202             : };
     203             : 
     204             : //PROP_CHART_STATISTIC_CONST_ERROR_LOW
     205             : class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
     206             : {
     207             : public:
     208             :     virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     209             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
     210             : 
     211             :     explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     212             :                                               tSeriesOrDiagramPropertyType ePropertyType );
     213             :     virtual ~WrappedConstantErrorLowProperty();
     214             : 
     215             : private:
     216             :     mutable Any m_aOuterValue;
     217             : };
     218             : 
     219        3756 : WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
     220             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     221             :     tSeriesOrDiagramPropertyType ePropertyType )
     222             :         : WrappedStatisticProperty< double >( "ConstantErrorLow"
     223        3756 :             , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType  )
     224             : {
     225        3756 : }
     226        7512 : WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
     227             : {
     228        7512 : }
     229             : 
     230          18 : double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     231             : {
     232          18 :     double aRet = 0.0;
     233          18 :     m_aDefaultValue >>= aRet;
     234          18 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     235          18 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     236             :     {
     237           6 :         if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     238           0 :             xErrorBarProperties->getPropertyValue( "NegativeError" ) >>= aRet;
     239             :         else
     240           6 :             m_aOuterValue >>= aRet;
     241             :     }
     242          18 :     return aRet;
     243             : }
     244             : 
     245           6 : void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
     246             : {
     247           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     248           6 :     if( xErrorBarProperties.is() )
     249             :     {
     250           6 :         m_aOuterValue = uno::makeAny( aNewValue );
     251           6 :         if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     252             :         {
     253           0 :             xErrorBarProperties->setPropertyValue( "NegativeError", m_aOuterValue );
     254             :         }
     255           6 :     }
     256           6 : }
     257             : 
     258             : //PROP_CHART_STATISTIC_CONST_ERROR_HIGH
     259             : class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
     260             : {
     261             : public:
     262             :     virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     263             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
     264             : 
     265             :     explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     266             :                                                tSeriesOrDiagramPropertyType ePropertyType );
     267             :     virtual ~WrappedConstantErrorHighProperty();
     268             : 
     269             : private:
     270             :     mutable Any m_aOuterValue;
     271             : };
     272             : 
     273        3756 : WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
     274             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     275             :     tSeriesOrDiagramPropertyType ePropertyType )
     276             :         : WrappedStatisticProperty< double >( "ConstantErrorHigh"
     277        3756 :             , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType  )
     278             : {
     279        3756 : }
     280        7512 : WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
     281             : {
     282        7512 : }
     283             : 
     284          18 : double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     285             : {
     286          18 :     double aRet = 0.0;
     287          18 :     m_aDefaultValue >>= aRet;
     288          18 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     289          18 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     290             :     {
     291          18 :         if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     292           0 :             xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
     293             :         else
     294          18 :             m_aOuterValue >>= aRet;
     295             :     }
     296          18 :     return aRet;
     297             : }
     298             : 
     299           6 : void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
     300             : {
     301           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     302           6 :     if( xErrorBarProperties.is() )
     303             :     {
     304           6 :         m_aOuterValue = uno::makeAny( aNewValue );
     305           6 :         if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     306             :         {
     307           0 :             xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
     308             :         }
     309           6 :     }
     310           6 : }
     311             : 
     312             : //PROP_CHART_STATISTIC_MEAN_VALUE
     313             : class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
     314             : {
     315             : public:
     316             :     virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     317             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Bool& aNewValue ) const SAL_OVERRIDE;
     318             : 
     319             :     explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     320             :                                        tSeriesOrDiagramPropertyType ePropertyType );
     321             :     virtual ~WrappedMeanValueProperty();
     322             : };
     323             : 
     324        3756 : WrappedMeanValueProperty::WrappedMeanValueProperty(
     325             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     326             :     tSeriesOrDiagramPropertyType ePropertyType )
     327        3756 :         : WrappedStatisticProperty< sal_Bool >( "MeanValue", uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType  )
     328             : {
     329        3756 : }
     330        7512 : WrappedMeanValueProperty::~WrappedMeanValueProperty()
     331             : {
     332        7512 : }
     333             : 
     334        7446 : sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     335             : {
     336        7446 :     bool bRet = false;
     337        7446 :     uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
     338        7446 :     if( xRegCnt.is() )
     339        7446 :         bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
     340        7446 :     return bRet;
     341             : }
     342             : 
     343         546 : void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Bool& aNewValue ) const
     344             : {
     345         546 :     uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
     346         546 :     if( xRegCnt.is() )
     347             :     {
     348         546 :         if(aNewValue)
     349           8 :             RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
     350             :         else
     351         538 :             RegressionCurveHelper::removeMeanValueLine( xRegCnt );
     352         546 :     }
     353         546 : }
     354             : 
     355             : //PROP_CHART_STATISTIC_ERROR_CATEGORY
     356             : // deprecated, replaced by ErrorBarStyle
     357             : class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
     358             : {
     359             : public:
     360             :     virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     361             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorCategory& aNewValue ) const SAL_OVERRIDE;
     362             : 
     363             :     explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     364             :                                            tSeriesOrDiagramPropertyType ePropertyType );
     365             :     virtual ~WrappedErrorCategoryProperty();
     366             : };
     367             : 
     368        3756 : WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
     369             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     370             :     tSeriesOrDiagramPropertyType ePropertyType )
     371             :         : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( "ErrorCategory"
     372        3756 :             , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType  )
     373             : {
     374        3756 : }
     375        7512 : WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
     376             : {
     377        7512 : }
     378             : 
     379          18 : ::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     380             : {
     381          18 :     ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
     382          18 :     m_aDefaultValue >>= aRet;
     383          18 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     384          18 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     385             :     {
     386          18 :         sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
     387          18 :         xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nStyle;
     388          18 :         switch(nStyle)
     389             :         {
     390             :             case ::com::sun::star::chart::ErrorBarStyle::NONE:
     391          12 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
     392          12 :                 break;
     393             :             case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
     394           0 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
     395           0 :                 break;
     396             :             case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
     397           0 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
     398           0 :                 break;
     399             :             case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
     400           0 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
     401           0 :                 break;
     402             :             case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
     403           6 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
     404           6 :                 break;
     405             :             case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
     406           0 :                 aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
     407           0 :                 break;
     408             :             case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
     409           0 :                 break;
     410             :             case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
     411           0 :                 break;
     412             :             default:
     413           0 :                 break;
     414             :         }
     415             :     }
     416          18 :     return aRet;
     417             : }
     418           6 : void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorCategory& aNewValue ) const
     419             : {
     420           6 :     if( !xSeriesPropertySet.is() )
     421           6 :         return;
     422             : 
     423           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     424           6 :     if( xErrorBarProperties.is() )
     425             :     {
     426           6 :         sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
     427           6 :         switch(aNewValue)
     428             :         {
     429             :             case ::com::sun::star::chart::ChartErrorCategory_NONE:
     430           0 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
     431           0 :                 break;
     432             :             case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
     433           0 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
     434           0 :                 break;
     435             :             case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
     436           0 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
     437           0 :                 break;
     438             :             case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
     439           0 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
     440           0 :                 break;
     441             :             case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
     442           6 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
     443           6 :                 break;
     444             :             case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
     445           0 :                 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
     446           0 :                 break;
     447             :             default:
     448           0 :                 break;
     449             :         }
     450           6 :         xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny(nNewStyle) );
     451           6 :     }
     452             : }
     453             : 
     454             : //PROP_CHART_STATISTIC_PERCENT_ERROR
     455             : class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
     456             : {
     457             : public:
     458             :     virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     459             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
     460             : 
     461             :     explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     462             :                                              tSeriesOrDiagramPropertyType ePropertyType );
     463             :     virtual ~WrappedPercentageErrorProperty();
     464             : 
     465             : private:
     466             :     mutable Any m_aOuterValue;
     467             : };
     468             : 
     469        3756 : WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
     470             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     471             :     tSeriesOrDiagramPropertyType ePropertyType )
     472             :         : WrappedStatisticProperty< double >( "PercentageError"
     473        3756 :             , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType  )
     474             : {
     475        3756 : }
     476        7512 : WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
     477             : {
     478        7512 : }
     479             : 
     480        4978 : double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     481             : {
     482        4978 :     double aRet = 0.0;
     483        4978 :     m_aDefaultValue >>= aRet;
     484        4978 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     485        4978 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     486             :     {
     487          26 :         if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     488          18 :             xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
     489             :         else
     490           8 :             m_aOuterValue >>= aRet;
     491             :     }
     492        4978 :     return aRet;
     493             : }
     494          30 : void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
     495             : {
     496          30 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     497          30 :     if( xErrorBarProperties.is() )
     498             :     {
     499          30 :         m_aOuterValue = uno::makeAny( aNewValue );
     500          30 :         if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
     501             :         {
     502          12 :             xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
     503          12 :             xErrorBarProperties->setPropertyValue( "NegativeError" , m_aOuterValue );
     504             :         }
     505          30 :     }
     506          30 : }
     507             : 
     508             : //PROP_CHART_STATISTIC_ERROR_MARGIN
     509             : class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
     510             : {
     511             : public:
     512             :     virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     513             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const SAL_OVERRIDE;
     514             : 
     515             :     explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     516             :                                          tSeriesOrDiagramPropertyType ePropertyType );
     517             :     virtual ~WrappedErrorMarginProperty();
     518             : 
     519             : private:
     520             :     mutable Any m_aOuterValue;
     521             : };
     522             : 
     523        3756 : WrappedErrorMarginProperty::WrappedErrorMarginProperty(
     524             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     525             :     tSeriesOrDiagramPropertyType ePropertyType )
     526             :         : WrappedStatisticProperty< double >( "ErrorMargin"
     527        3756 :             , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType  )
     528             : {
     529        3756 : }
     530        7512 : WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
     531             : {
     532        7512 : }
     533             : 
     534        4978 : double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     535             : {
     536        4978 :     double aRet = 0.0;
     537        4978 :     m_aDefaultValue >>= aRet;
     538        4978 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     539        4978 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     540             :     {
     541          26 :         if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
     542           0 :             xErrorBarProperties->getPropertyValue( "PositiveError" ) >>= aRet;
     543             :         else
     544          26 :             m_aOuterValue >>= aRet;
     545             :     }
     546        4978 :     return aRet;
     547             : }
     548          24 : void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const double& aNewValue ) const
     549             : {
     550          24 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     551          24 :     if( xErrorBarProperties.is() )
     552             :     {
     553          24 :         m_aOuterValue = uno::makeAny( aNewValue );
     554          24 :         if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
     555             :         {
     556           0 :             xErrorBarProperties->setPropertyValue( "PositiveError" , m_aOuterValue );
     557           0 :             xErrorBarProperties->setPropertyValue( "NegativeError" , m_aOuterValue );
     558             :         }
     559          24 :     }
     560          24 : }
     561             : 
     562             : //PROP_CHART_STATISTIC_ERROR_INDICATOR
     563             : class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
     564             : {
     565             : public:
     566             :     virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     567             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorIndicatorType& aNewValue ) const SAL_OVERRIDE;
     568             : 
     569             :     explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     570             :                                             tSeriesOrDiagramPropertyType ePropertyType );
     571             :     virtual ~WrappedErrorIndicatorProperty();
     572             : };
     573             : 
     574        3756 : WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
     575             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     576             :     tSeriesOrDiagramPropertyType ePropertyType )
     577             :         : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( "ErrorIndicator"
     578        3756 :             , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType  )
     579             : {
     580        3756 : }
     581        7512 : WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
     582             : {
     583        7512 : }
     584             : 
     585          18 : ::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     586             : {
     587          18 :     ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
     588          18 :     m_aDefaultValue >>= aRet;
     589          18 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     590          18 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     591             :     {
     592          18 :         bool bPositive = false;
     593          18 :         bool bNegative = false;
     594          18 :         xErrorBarProperties->getPropertyValue( "ShowPositiveError" ) >>= bPositive;
     595          18 :         xErrorBarProperties->getPropertyValue( "ShowNegativeError" ) >>= bNegative;
     596             : 
     597          18 :         if( bPositive && bNegative )
     598           6 :             aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
     599          12 :         else if( bPositive && !bNegative )
     600           0 :             aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
     601          12 :         else if( !bPositive && bNegative )
     602           0 :             aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
     603             :     }
     604          18 :     return aRet;
     605             : }
     606           6 : void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartErrorIndicatorType& aNewValue ) const
     607             : {
     608           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     609           6 :     if( xErrorBarProperties.is() )
     610             :     {
     611           6 :         bool bPositive = false;
     612           6 :         bool bNegative = false;
     613           6 :         switch( aNewValue )
     614             :         {
     615             :             case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
     616           6 :                 bPositive = true;
     617           6 :                 bNegative = true;
     618           6 :                 break;
     619             :             case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
     620           0 :                 bPositive = true;
     621           0 :                 break;
     622             :             case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
     623           0 :                 bNegative = true;
     624           0 :                 break;
     625             :             default:
     626           0 :                 break;
     627             :         }
     628             : 
     629           6 :         xErrorBarProperties->setPropertyValue( "ShowPositiveError" , uno::makeAny(bPositive) );
     630           6 :         xErrorBarProperties->setPropertyValue( "ShowNegativeError" , uno::makeAny(bNegative) );
     631           6 :     }
     632           6 : }
     633             : 
     634             : //PROP_CHART_STATISTIC_ERROR_BAR_STYLE
     635             : // this is the new constant group that replaces the deprecated enum ChartErrorCategory
     636             : class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
     637             : {
     638             : public:
     639             :     virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     640             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Int32& nNewValue ) const SAL_OVERRIDE;
     641             : 
     642             :     explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
     643             :                                            tSeriesOrDiagramPropertyType ePropertyType );
     644             :     virtual ~WrappedErrorBarStyleProperty();
     645             : };
     646             : 
     647        3756 : WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
     648             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     649             :     tSeriesOrDiagramPropertyType ePropertyType )
     650             :         : WrappedStatisticProperty< sal_Int32 >( "ErrorBarStyle"
     651        3756 :             , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType  )
     652             : {
     653        3756 : }
     654        7512 : WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
     655             : {
     656        7512 : }
     657             : 
     658        4968 : sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     659             : {
     660        4968 :     sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
     661        4968 :     m_aDefaultValue >>= nRet;
     662        4968 :     uno::Reference< beans::XPropertySet > xErrorBarProperties;
     663        4968 :     if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarProperties ) && xErrorBarProperties.is())
     664             :     {
     665          16 :         xErrorBarProperties->getPropertyValue( "ErrorBarStyle" ) >>= nRet;
     666             :     }
     667        4968 :     return nRet;
     668             : }
     669          60 : void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const sal_Int32& nNewValue ) const
     670             : {
     671          60 :     if( !xSeriesPropertySet.is() )
     672          60 :         return;
     673             : 
     674          60 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     675          60 :     if( xErrorBarProperties.is() )
     676             :     {
     677          60 :         xErrorBarProperties->setPropertyValue( "ErrorBarStyle" , uno::makeAny( nNewValue ));
     678          60 :     }
     679             : }
     680             : 
     681             : //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
     682             : class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
     683             : {
     684             : public:
     685             :     virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     686             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const SAL_OVERRIDE;
     687             : 
     688             :     explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     689             :                                                    tSeriesOrDiagramPropertyType ePropertyType );
     690             :     virtual ~WrappedErrorBarRangePositiveProperty();
     691             : 
     692             : private:
     693             :     mutable Any m_aOuterValue;
     694             : };
     695             : 
     696        3756 : WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
     697             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     698             :     tSeriesOrDiagramPropertyType ePropertyType )
     699             :         : WrappedStatisticProperty< OUString >( "ErrorBarRangePositive"
     700        3756 :             , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType  )
     701             : {
     702        3756 : }
     703        7512 : WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
     704             : {
     705        7512 : }
     706             : 
     707        4968 : OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     708             : {
     709        4968 :     OUString aRet;
     710        4968 :     m_aDefaultValue >>= aRet;
     711        9936 :     uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
     712       24840 :     if( xSeriesPropertySet.is() &&
     713       29808 :         ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarDataSource ) &&
     714        4968 :         xErrorBarDataSource.is())
     715             :     {
     716             :         uno::Reference< chart2::data::XDataSequence > xSeq(
     717             :             StatisticsHelper::getErrorDataSequenceFromDataSource(
     718          16 :                 xErrorBarDataSource, true /* positive */, true /* y-error */ ));
     719          16 :         if( xSeq.is())
     720          16 :             aRet = xSeq->getSourceRangeRepresentation();
     721             :         else
     722           0 :             m_aOuterValue >>= aRet;
     723             :     }
     724        4968 :     lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
     725        9936 :     return aRet;
     726             : }
     727             : 
     728           6 : void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const
     729             : {
     730           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     731           6 :     if( xErrorBarProperties.is() )
     732             :     {
     733             :         uno::Reference< chart2::data::XDataProvider > xDataProvider(
     734           6 :             lcl_getDataProviderFromContact( m_spChart2ModelContact ));
     735          12 :         uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
     736           6 :         if( xDataSource.is() && xDataProvider.is())
     737             :         {
     738           6 :             OUString aTmp( aNewValue );
     739          12 :             OUString aXMLRange( aNewValue );
     740           6 :             lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact );
     741             :             StatisticsHelper::setErrorDataSequence(
     742           6 :                 xDataSource, xDataProvider, aTmp, true /* positive */, true /* y-error */, &aXMLRange );
     743          12 :             m_aOuterValue <<= aTmp;
     744           6 :         }
     745           6 :     }
     746           6 : }
     747             : 
     748             : //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
     749             : class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
     750             : {
     751             : public:
     752             :     virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     753             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const SAL_OVERRIDE;
     754             : 
     755             :     explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     756             :                                                    tSeriesOrDiagramPropertyType ePropertyType );
     757             :     virtual ~WrappedErrorBarRangeNegativeProperty();
     758             : 
     759             : private:
     760             :     mutable Any m_aOuterValue;
     761             : };
     762             : 
     763        3756 : WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
     764             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     765             :     tSeriesOrDiagramPropertyType ePropertyType )
     766             :         : WrappedStatisticProperty< OUString >( "ErrorBarRangeNegative"
     767        3756 :             , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType  )
     768             : {
     769        3756 : }
     770        7512 : WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
     771             : {
     772        7512 : }
     773             : 
     774        4968 : OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     775             : {
     776        4968 :     OUString aRet;
     777        4968 :     m_aDefaultValue >>= aRet;
     778        9936 :     uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
     779       24840 :     if( xSeriesPropertySet.is() &&
     780       29808 :         ( xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xErrorBarDataSource ) &&
     781        4968 :         xErrorBarDataSource.is())
     782             :     {
     783             :         uno::Reference< chart2::data::XDataSequence > xSeq(
     784             :             StatisticsHelper::getErrorDataSequenceFromDataSource(
     785          16 :                 xErrorBarDataSource, false /* positive */, true /* y-error */ ));
     786          16 :         if( xSeq.is())
     787          16 :             aRet = xSeq->getSourceRangeRepresentation();
     788             :         else
     789           0 :             m_aOuterValue >>= aRet;
     790             :     }
     791        4968 :     lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
     792        9936 :     return aRet;
     793             : }
     794             : 
     795           6 : void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const OUString& aNewValue ) const
     796             : {
     797           6 :     uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
     798           6 :     if( xErrorBarProperties.is() )
     799             :     {
     800             :         uno::Reference< chart2::data::XDataProvider > xDataProvider(
     801           6 :             lcl_getDataProviderFromContact( m_spChart2ModelContact ));
     802          12 :         uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
     803           6 :         if( xDataSource.is() && xDataProvider.is())
     804             :         {
     805           6 :             OUString aTmp( aNewValue );
     806          12 :             OUString aXMLRange( aNewValue );
     807           6 :             lcl_ConvertRangeFromXML( aTmp, m_spChart2ModelContact );
     808             :             StatisticsHelper::setErrorDataSequence(
     809           6 :                 xDataSource, xDataProvider, aTmp, false /* positive */, true /* y-error */, &aXMLRange );
     810          12 :             m_aOuterValue <<= aTmp;
     811           6 :         }
     812           6 :     }
     813           6 : }
     814             : 
     815             : //PROP_CHART_STATISTIC_REGRESSION_CURVES
     816             : class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
     817             : {
     818             : public:
     819             :     virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     820             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartRegressionCurveType & aNewValue ) const SAL_OVERRIDE;
     821             : 
     822             :     explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     823             :                                               tSeriesOrDiagramPropertyType ePropertyType );
     824             :     virtual ~WrappedRegressionCurvesProperty();
     825             : };
     826             : 
     827        3756 : WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
     828             :     ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     829             :     tSeriesOrDiagramPropertyType ePropertyType )
     830             :         : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( "RegressionCurves"
     831        3756 :         , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType  )
     832             : {
     833        3756 : }
     834             : 
     835        7512 : WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
     836             : {
     837        7512 : }
     838             : 
     839           0 : ::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     840             : {
     841             :     ::com::sun::star::chart::ChartRegressionCurveType aRet;
     842           0 :     m_aDefaultValue >>= aRet;
     843           0 :     uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
     844           0 :     if( xRegCnt.is() )
     845             :     {
     846             :         aRet = lcl_getRegressionCurveType(
     847           0 :             RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
     848             :     }
     849           0 :     return aRet;
     850             : }
     851         520 : void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const ::com::sun::star::chart::ChartRegressionCurveType& aNewValue ) const
     852             : {
     853         520 :     uno::Reference< chart2::XRegressionCurveContainer > xRegressionCurveContainer( xSeriesPropertySet, uno::UNO_QUERY );
     854        1040 :     uno::Reference< chart2::XRegressionCurve > xRegressionCurve( xSeriesPropertySet, uno::UNO_QUERY );
     855             : 
     856         520 :     if( xRegressionCurveContainer.is() && xRegressionCurve.is() )
     857             :     {
     858           0 :         SvxChartRegress eNewRegressionType = lcl_getRegressionType( aNewValue );
     859             : 
     860             :         RegressionCurveHelper::changeRegressionCurveType(
     861             :                         eNewRegressionType,
     862             :                         xRegressionCurveContainer,
     863             :                         xRegressionCurve,
     864           0 :                         uno::Reference< uno::XComponentContext >());
     865         520 :     }
     866         520 : }
     867             : 
     868             : //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
     869             : //PROP_CHART_STATISTIC_ERROR_PROPERTIES
     870             : //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
     871             : class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
     872             : {
     873             : public:
     874             :     virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const SAL_OVERRIDE;
     875             :     // properties are read-only, so this method should never be called
     876             :     virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, const Reference< beans::XPropertySet > & xNewValue ) const SAL_OVERRIDE;
     877             : 
     878             :     enum PropertySetType
     879             :     {
     880             :         PROPERTY_SET_TYPE_REGRESSION,
     881             :         PROPERTY_SET_TYPE_ERROR_BAR,
     882             :         PROPERTY_SET_TYPE_MEAN_VALUE
     883             :     };
     884             : 
     885             :     explicit WrappedStatisticPropertySetProperty(
     886             :         PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
     887             :         tSeriesOrDiagramPropertyType ePropertyType );
     888             :     virtual ~WrappedStatisticPropertySetProperty();
     889             : 
     890             : private:
     891             :     PropertySetType m_eType;
     892             : };
     893             : 
     894       11268 : WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
     895             :     PropertySetType ePropertySetType
     896             :     , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
     897             :     , tSeriesOrDiagramPropertyType ePropertyType )
     898             :         : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
     899             :             (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
     900             :             ? OUString("DataRegressionProperties")
     901             :             : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
     902             :               ? OUString("DataErrorProperties")
     903             :               : OUString("DataMeanValueProperties")
     904             :             , uno::Any(), spChart2ModelContact, ePropertyType  )
     905       11268 :         , m_eType( ePropertySetType )
     906             : {
     907       11268 : }
     908       22536 : WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
     909             : {
     910       22536 : }
     911             : 
     912          14 : Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
     913             : {
     914          14 :     Reference< beans::XPropertySet > xResult;
     915          28 :     uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
     916             : 
     917          14 :     switch( m_eType )
     918             :     {
     919             :         case PROPERTY_SET_TYPE_REGRESSION:
     920           0 :             if( xRegCnt.is() )
     921           0 :                 xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
     922           0 :             break;
     923             :         case PROPERTY_SET_TYPE_ERROR_BAR:
     924          12 :             if( xSeriesPropertySet.is())
     925          12 :                 xSeriesPropertySet->getPropertyValue( CHART_UNONAME_ERRORBAR_Y ) >>= xResult;
     926          12 :             break;
     927             :         case PROPERTY_SET_TYPE_MEAN_VALUE:
     928           2 :             if( xRegCnt.is() )
     929           2 :                 xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
     930           2 :             break;
     931             :     }
     932             : 
     933          28 :     return xResult;
     934             : }
     935             : 
     936           0 : void WrappedStatisticPropertySetProperty::setValueToSeries(
     937             :     const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
     938             :     , const Reference< beans::XPropertySet >& /* xNewValue */ ) const
     939             : {
     940           0 : }
     941             : 
     942             : namespace
     943             : {
     944             : enum
     945             : {
     946             :     //statistic properties
     947             :     PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
     948             :     PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
     949             :     PROP_CHART_STATISTIC_MEAN_VALUE,
     950             :     PROP_CHART_STATISTIC_ERROR_CATEGORY,
     951             :     PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
     952             :     PROP_CHART_STATISTIC_PERCENT_ERROR,
     953             :     PROP_CHART_STATISTIC_ERROR_MARGIN,
     954             :     PROP_CHART_STATISTIC_ERROR_INDICATOR,
     955             :     PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
     956             :     PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
     957             :     PROP_CHART_STATISTIC_REGRESSION_CURVES,
     958             :     PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
     959             :     PROP_CHART_STATISTIC_ERROR_PROPERTIES,
     960             :     PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
     961             : };
     962             : 
     963             : /** @parameter bDataSeriesProperty if true, this property is for a single data
     964             :                series, if false, it is for the whole diagram, i.e. for all
     965             :                series
     966             :  */
     967        3756 : void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
     968             :             , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
     969             :             , tSeriesOrDiagramPropertyType ePropertyType )
     970             : {
     971        3756 :     rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
     972        3756 :     rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
     973        3756 :     rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
     974        3756 :     rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
     975        3756 :     rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
     976        3756 :     rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
     977        3756 :     rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
     978        3756 :     rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
     979        3756 :     rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
     980        3756 :     rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
     981        3756 :     rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
     982             :     rList.push_back( new WrappedStatisticPropertySetProperty(
     983        3756 :                          WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
     984             :     rList.push_back( new WrappedStatisticPropertySetProperty(
     985        3756 :                          WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR,  spChart2ModelContact, ePropertyType ) );
     986             :     rList.push_back( new WrappedStatisticPropertySetProperty(
     987        3756 :                          WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
     988        3756 : }
     989             : 
     990             : }//anonymous namespace
     991             : 
     992          48 : void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
     993             : {
     994             :     rOutProperties.push_back(
     995             :         Property( "ConstantErrorLow",
     996             :                   PROP_CHART_STATISTIC_CONST_ERROR_LOW,
     997          48 :                   cppu::UnoType<double>::get(),
     998             :                   beans::PropertyAttribute::BOUND
     999          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1000             :     rOutProperties.push_back(
    1001             :         Property( "ConstantErrorHigh",
    1002             :                   PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
    1003          48 :                   cppu::UnoType<double>::get(),
    1004             :                   beans::PropertyAttribute::BOUND
    1005          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1006             :     rOutProperties.push_back(
    1007             :         Property( "MeanValue",
    1008             :                   PROP_CHART_STATISTIC_MEAN_VALUE,
    1009          48 :                   ::getBooleanCppuType(),
    1010             :                   beans::PropertyAttribute::BOUND
    1011          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1012             :     rOutProperties.push_back(
    1013             :         Property( "ErrorCategory",
    1014             :                   PROP_CHART_STATISTIC_ERROR_CATEGORY,
    1015          48 :                   cppu::UnoType<com::sun::star::chart::ChartErrorCategory>::get(),
    1016             :                   beans::PropertyAttribute::BOUND
    1017          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1018             :     rOutProperties.push_back(
    1019             :         Property( "ErrorBarStyle",
    1020             :                   PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
    1021          48 :                   cppu::UnoType<sal_Int32>::get(),
    1022             :                   beans::PropertyAttribute::BOUND
    1023          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1024             :     rOutProperties.push_back(
    1025             :         Property( "PercentageError",
    1026             :                   PROP_CHART_STATISTIC_PERCENT_ERROR,
    1027          48 :                   cppu::UnoType<double>::get(),
    1028             :                   beans::PropertyAttribute::BOUND
    1029          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1030             :     rOutProperties.push_back(
    1031             :         Property( "ErrorMargin",
    1032             :                   PROP_CHART_STATISTIC_ERROR_MARGIN,
    1033          48 :                   cppu::UnoType<double>::get(),
    1034             :                   beans::PropertyAttribute::BOUND
    1035          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1036             :     rOutProperties.push_back(
    1037             :         Property( "ErrorIndicator",
    1038             :                   PROP_CHART_STATISTIC_ERROR_INDICATOR,
    1039          48 :                   cppu::UnoType<com::sun::star::chart::ChartErrorIndicatorType>::get(),
    1040             :                   beans::PropertyAttribute::BOUND
    1041          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1042             :     rOutProperties.push_back(
    1043             :         Property( "ErrorBarRangePositive",
    1044             :                   PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
    1045          48 :                   cppu::UnoType<OUString>::get(),
    1046             :                   beans::PropertyAttribute::BOUND
    1047          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1048             :     rOutProperties.push_back(
    1049             :         Property( "ErrorBarRangeNegative",
    1050             :                   PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
    1051          48 :                   cppu::UnoType<OUString>::get(),
    1052             :                   beans::PropertyAttribute::BOUND
    1053          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1054             :     rOutProperties.push_back(
    1055             :         Property( "RegressionCurves",
    1056             :                   PROP_CHART_STATISTIC_REGRESSION_CURVES,
    1057          48 :                   cppu::UnoType<com::sun::star::chart::ChartRegressionCurveType>::get(),
    1058             :                   beans::PropertyAttribute::BOUND
    1059          96 :                   | beans::PropertyAttribute::MAYBEDEFAULT ));
    1060             : 
    1061             :     rOutProperties.push_back(
    1062             :         Property( "DataRegressionProperties",
    1063             :                   PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
    1064          48 :                   cppu::UnoType<beans::XPropertySet>::get(),
    1065             :                   beans::PropertyAttribute::BOUND
    1066             :                   | beans::PropertyAttribute::READONLY
    1067          96 :                   | beans::PropertyAttribute::MAYBEVOID ));
    1068             :     rOutProperties.push_back(
    1069             :         Property( "DataErrorProperties",
    1070             :                   PROP_CHART_STATISTIC_ERROR_PROPERTIES,
    1071          48 :                   cppu::UnoType<beans::XPropertySet>::get(),
    1072             :                   beans::PropertyAttribute::BOUND
    1073             :                   | beans::PropertyAttribute::READONLY
    1074          96 :                   | beans::PropertyAttribute::MAYBEVOID ));
    1075             :     rOutProperties.push_back(
    1076             :         Property( "DataMeanValueProperties",
    1077             :                   PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
    1078          48 :                   cppu::UnoType<beans::XPropertySet>::get(),
    1079             :                   beans::PropertyAttribute::BOUND
    1080             :                   | beans::PropertyAttribute::READONLY
    1081          96 :                   | beans::PropertyAttribute::MAYBEVOID ));
    1082          48 : }
    1083             : 
    1084        3176 : void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
    1085             :                                     , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
    1086             : {
    1087        3176 :     lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
    1088        3176 : }
    1089             : 
    1090         580 : void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
    1091             :                                     , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
    1092             : {
    1093         580 :     lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM  );
    1094         580 : }
    1095             : 
    1096             : } //namespace wrapper
    1097         102 : } //namespace chart
    1098             : 
    1099             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10