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