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