Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "RegressionCurveModel.hxx"
21 : #include "macros.hxx"
22 : #include "LinePropertiesHelper.hxx"
23 : #include "RegressionCurveHelper.hxx"
24 : #include "RegressionCalculationHelper.hxx"
25 : #include "RegressionEquation.hxx"
26 : #include "ContainerHelper.hxx"
27 : #include "CloneHelper.hxx"
28 : #include "PropertyHelper.hxx"
29 : #include <cppuhelper/supportsservice.hxx>
30 : #include <com/sun/star/beans/PropertyAttribute.hpp>
31 : #include <rtl/math.hxx>
32 : #include <rtl/ustrbuf.hxx>
33 :
34 : using namespace ::com::sun::star;
35 :
36 : using ::com::sun::star::beans::Property;
37 : using ::osl::MutexGuard;
38 :
39 : namespace
40 : {
41 38 : static const OUString lcl_aImplementationName_MeanValue(
42 19 : "com.sun.star.comp.chart2.MeanValueRegressionCurve" );
43 38 : static const OUString lcl_aImplementationName_Linear(
44 19 : "com.sun.star.comp.chart2.LinearRegressionCurve" );
45 38 : static const OUString lcl_aImplementationName_Logarithmic(
46 19 : "com.sun.star.comp.chart2.LogarithmicRegressionCurve" );
47 38 : static const OUString lcl_aImplementationName_Exponential(
48 19 : "com.sun.star.comp.chart2.ExponentialRegressionCurve" );
49 38 : static const OUString lcl_aImplementationName_Potential(
50 19 : "com.sun.star.comp.chart2.PotentialRegressionCurve" );
51 38 : static const OUString lcl_aImplementationName_Polynomial(
52 19 : "com.sun.star.comp.chart2.PolynomialRegressionCurve" );
53 38 : static const OUString lcl_aImplementationName_MovingAverage(
54 19 : "com.sun.star.comp.chart2.MovingAverageRegressionCurve" );
55 :
56 38 : static const OUString lcl_aServiceName(
57 19 : "com.sun.star.chart2.RegressionCurve" );
58 :
59 : enum
60 : {
61 : PROPERTY_DEGREE,
62 : PROPERTY_PERIOD,
63 : PROPERTY_EXTRAPOLATE_FORWARD,
64 : PROPERTY_EXTRAPOLATE_BACKWARD,
65 : PROPERTY_FORCE_INTERCEPT,
66 : PROPERTY_INTERCEPT_VALUE,
67 : PROPERTY_CURVE_NAME
68 : };
69 :
70 3 : void lcl_AddPropertiesToVector(
71 : ::std::vector< Property > & rOutProperties )
72 : {
73 : rOutProperties.push_back(
74 : Property( "PolynomialDegree",
75 : PROPERTY_DEGREE,
76 3 : cppu::UnoType<sal_Int32>::get(),
77 : beans::PropertyAttribute::BOUND |
78 6 : beans::PropertyAttribute::MAYBEDEFAULT ));
79 :
80 : rOutProperties.push_back(
81 : Property( "MovingAveragePeriod",
82 : PROPERTY_PERIOD,
83 3 : cppu::UnoType<sal_Int32>::get(),
84 : beans::PropertyAttribute::BOUND |
85 6 : beans::PropertyAttribute::MAYBEDEFAULT ));
86 :
87 : rOutProperties.push_back(
88 : Property( "ExtrapolateForward",
89 : PROPERTY_EXTRAPOLATE_FORWARD,
90 3 : cppu::UnoType<double>::get(),
91 : beans::PropertyAttribute::BOUND |
92 6 : beans::PropertyAttribute::MAYBEDEFAULT ));
93 :
94 : rOutProperties.push_back(
95 : Property( "ExtrapolateBackward",
96 : PROPERTY_EXTRAPOLATE_BACKWARD,
97 3 : cppu::UnoType<double>::get(),
98 : beans::PropertyAttribute::BOUND |
99 6 : beans::PropertyAttribute::MAYBEDEFAULT ));
100 :
101 : rOutProperties.push_back(
102 : Property( "ForceIntercept",
103 : PROPERTY_FORCE_INTERCEPT,
104 3 : cppu::UnoType<bool>::get(),
105 : beans::PropertyAttribute::BOUND
106 6 : | beans::PropertyAttribute::MAYBEDEFAULT ));
107 :
108 : rOutProperties.push_back(
109 : Property( "InterceptValue",
110 : PROPERTY_INTERCEPT_VALUE,
111 3 : cppu::UnoType<double>::get(),
112 : beans::PropertyAttribute::BOUND |
113 6 : beans::PropertyAttribute::MAYBEDEFAULT ));
114 :
115 : rOutProperties.push_back(
116 : Property( "CurveName",
117 : PROPERTY_CURVE_NAME,
118 3 : cppu::UnoType<OUString>::get(),
119 3 : beans::PropertyAttribute::BOUND ));
120 3 : }
121 :
122 : struct StaticXXXDefaults_Initializer
123 : {
124 4 : ::chart::tPropertyValueMap* operator()()
125 : {
126 4 : static ::chart::tPropertyValueMap aStaticDefaults;
127 4 : lcl_AddDefaultsToMap( aStaticDefaults );
128 4 : return &aStaticDefaults;
129 : }
130 : private:
131 4 : static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
132 : {
133 4 : ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
134 4 : }
135 : };
136 :
137 : struct StaticXXXDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticXXXDefaults_Initializer >
138 : {
139 : };
140 :
141 : struct StaticRegressionCurveInfoHelper_Initializer
142 : {
143 3 : ::cppu::OPropertyArrayHelper* operator()()
144 : {
145 3 : static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
146 3 : return &aPropHelper;
147 : }
148 :
149 : private:
150 3 : static uno::Sequence< Property > lcl_GetPropertySequence()
151 : {
152 3 : ::std::vector< ::com::sun::star::beans::Property > aProperties;
153 3 : lcl_AddPropertiesToVector( aProperties );
154 3 : ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
155 :
156 : ::std::sort( aProperties.begin(), aProperties.end(),
157 3 : ::chart::PropertyNameLess() );
158 :
159 3 : return ::chart::ContainerHelper::ContainerToSequence( aProperties );
160 : }
161 : };
162 :
163 : struct StaticRegressionCurveInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionCurveInfoHelper_Initializer >
164 : {
165 : };
166 :
167 : struct StaticRegressionCurveInfo_Initializer
168 : {
169 3 : uno::Reference< beans::XPropertySetInfo >* operator()()
170 : {
171 : static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
172 3 : ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionCurveInfoHelper::get() ) );
173 3 : return &xPropertySetInfo;
174 : }
175 : };
176 :
177 : struct StaticRegressionCurveInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionCurveInfo_Initializer >
178 : {
179 : };
180 :
181 : } // anonymous namespace
182 :
183 : namespace chart
184 : {
185 :
186 31 : RegressionCurveModel::RegressionCurveModel(
187 : uno::Reference< uno::XComponentContext > const & xContext,
188 : tCurveType eCurveType ) :
189 : ::property::OPropertySet( m_aMutex ),
190 : m_xContext( xContext ),
191 : m_eRegressionCurveType( eCurveType ),
192 : m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
193 31 : m_xEquationProperties( new RegressionEquation( xContext ))
194 : {
195 : // set 0 line width (default) hard, so that it is always written to XML,
196 : // because the old implementation uses different defaults
197 : setFastPropertyValue_NoBroadcast(
198 31 : LinePropertiesHelper::PROP_LINE_WIDTH, uno::makeAny( sal_Int32( 0 )));
199 31 : ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
200 31 : }
201 :
202 0 : RegressionCurveModel::RegressionCurveModel( const RegressionCurveModel & rOther ) :
203 : MutexContainer(),
204 : impl::RegressionCurveModel_Base(),
205 : ::property::OPropertySet( rOther, m_aMutex ),
206 : m_xContext( rOther.m_xContext ),
207 : m_eRegressionCurveType( rOther.m_eRegressionCurveType ),
208 0 : m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
209 : {
210 0 : m_xEquationProperties.set( CloneHelper::CreateRefClone< uno::Reference< beans::XPropertySet > >()( rOther.m_xEquationProperties ));
211 0 : ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
212 0 : }
213 :
214 30 : RegressionCurveModel::~RegressionCurveModel()
215 30 : {}
216 :
217 : // ____ XRegressionCurve ____
218 : uno::Reference< chart2::XRegressionCurveCalculator > SAL_CALL
219 60 : RegressionCurveModel::getCalculator()
220 : throw (uno::RuntimeException, std::exception)
221 : {
222 60 : return RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( getServiceName());
223 : }
224 :
225 103 : uno::Reference< beans::XPropertySet > SAL_CALL RegressionCurveModel::getEquationProperties()
226 : throw (uno::RuntimeException, std::exception)
227 : {
228 103 : return m_xEquationProperties;
229 : }
230 :
231 12 : void SAL_CALL RegressionCurveModel::setEquationProperties( const uno::Reference< beans::XPropertySet >& xEquationProperties )
232 : throw (uno::RuntimeException, std::exception)
233 : {
234 12 : if( xEquationProperties.is())
235 : {
236 8 : if( m_xEquationProperties.is())
237 8 : ModifyListenerHelper::removeListener( m_xEquationProperties, m_xModifyEventForwarder );
238 :
239 8 : m_xEquationProperties.set( xEquationProperties );
240 8 : ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder );
241 8 : fireModifyEvent();
242 : }
243 12 : }
244 :
245 : // ____ XServiceName ____
246 214 : OUString SAL_CALL RegressionCurveModel::getServiceName()
247 : throw (uno::RuntimeException, std::exception)
248 : {
249 214 : switch( m_eRegressionCurveType )
250 : {
251 : case CURVE_TYPE_MEAN_VALUE:
252 96 : return OUString("com.sun.star.chart2.MeanValueRegressionCurve");
253 : case CURVE_TYPE_LINEAR:
254 42 : return OUString("com.sun.star.chart2.LinearRegressionCurve");
255 : case CURVE_TYPE_LOGARITHM:
256 0 : return OUString("com.sun.star.chart2.LogarithmicRegressionCurve");
257 : case CURVE_TYPE_EXPONENTIAL:
258 0 : return OUString("com.sun.star.chart2.ExponentialRegressionCurve");
259 : case CURVE_TYPE_POWER:
260 0 : return OUString("com.sun.star.chart2.PotentialRegressionCurve");
261 : case CURVE_TYPE_POLYNOMIAL:
262 38 : return OUString("com.sun.star.chart2.PolynomialRegressionCurve");
263 : case CURVE_TYPE_MOVING_AVERAGE:
264 38 : return OUString("com.sun.star.chart2.MovingAverageRegressionCurve");
265 : }
266 :
267 0 : return OUString();
268 : }
269 :
270 : // ____ XModifyBroadcaster ____
271 24 : void SAL_CALL RegressionCurveModel::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
272 : throw (uno::RuntimeException, std::exception)
273 : {
274 : try
275 : {
276 24 : uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
277 24 : xBroadcaster->addModifyListener( aListener );
278 : }
279 0 : catch( const uno::Exception & ex )
280 : {
281 : ASSERT_EXCEPTION( ex );
282 : }
283 24 : }
284 :
285 23 : void SAL_CALL RegressionCurveModel::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
286 : throw (uno::RuntimeException, std::exception)
287 : {
288 : try
289 : {
290 23 : uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
291 23 : xBroadcaster->removeModifyListener( aListener );
292 : }
293 0 : catch( const uno::Exception & ex )
294 : {
295 : ASSERT_EXCEPTION( ex );
296 : }
297 23 : }
298 :
299 : // ____ XModifyListener ____
300 0 : void SAL_CALL RegressionCurveModel::modified( const lang::EventObject& aEvent )
301 : throw (uno::RuntimeException, std::exception)
302 : {
303 0 : m_xModifyEventForwarder->modified( aEvent );
304 0 : }
305 :
306 : // ____ XEventListener (base of XModifyListener) ____
307 0 : void SAL_CALL RegressionCurveModel::disposing( const lang::EventObject& /* Source */ )
308 : throw (uno::RuntimeException, std::exception)
309 : {
310 : // nothing
311 0 : }
312 :
313 : // ____ OPropertySet ____
314 71 : void RegressionCurveModel::firePropertyChangeEvent()
315 : {
316 71 : fireModifyEvent();
317 71 : }
318 :
319 79 : void RegressionCurveModel::fireModifyEvent()
320 : {
321 79 : m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
322 79 : }
323 :
324 : // ____ OPropertySet ____
325 782 : uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const
326 : throw(beans::UnknownPropertyException)
327 : {
328 782 : const tPropertyValueMap& rStaticDefaults = *StaticXXXDefaults::get();
329 782 : tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
330 782 : if( aFound == rStaticDefaults.end() )
331 371 : return uno::Any();
332 411 : return (*aFound).second;
333 : }
334 :
335 2003 : ::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper()
336 : {
337 2003 : return *StaticRegressionCurveInfoHelper::get();
338 : }
339 :
340 : // ____ XPropertySet ____
341 43 : uno::Reference< beans::XPropertySetInfo > SAL_CALL RegressionCurveModel::getPropertySetInfo()
342 : throw (uno::RuntimeException, std::exception)
343 : {
344 43 : return *StaticRegressionCurveInfo::get();
345 : }
346 :
347 : // needed by MSC compiler
348 : using impl::RegressionCurveModel_Base;
349 :
350 4210 : IMPLEMENT_FORWARD_XINTERFACE2( RegressionCurveModel, RegressionCurveModel_Base, OPropertySet )
351 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( RegressionCurveModel, RegressionCurveModel_Base, OPropertySet )
352 :
353 : // implementations
354 :
355 5 : MeanValueRegressionCurve::MeanValueRegressionCurve(
356 : const uno::Reference< uno::XComponentContext > & xContext )
357 5 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_MEAN_VALUE )
358 5 : {}
359 0 : MeanValueRegressionCurve::MeanValueRegressionCurve(
360 : const MeanValueRegressionCurve & rOther ) :
361 0 : RegressionCurveModel( rOther )
362 0 : {}
363 8 : MeanValueRegressionCurve::~MeanValueRegressionCurve()
364 8 : {}
365 2 : uno::Sequence< OUString > MeanValueRegressionCurve::getSupportedServiceNames_Static()
366 : {
367 2 : uno::Sequence< OUString > aServices( 2 );
368 2 : aServices[ 0 ] = lcl_aServiceName;
369 2 : aServices[ 1 ] = "com.sun.star.chart2.MeanValueRegressionCurve";
370 2 : return aServices;
371 : }
372 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
373 1 : OUString SAL_CALL MeanValueRegressionCurve::getImplementationName()
374 : throw( css::uno::RuntimeException, std::exception )
375 : {
376 1 : return getImplementationName_Static();
377 : }
378 :
379 1 : OUString MeanValueRegressionCurve::getImplementationName_Static()
380 : {
381 1 : return lcl_aImplementationName_MeanValue;
382 : }
383 :
384 1 : sal_Bool SAL_CALL MeanValueRegressionCurve::supportsService( const OUString& rServiceName )
385 : throw( css::uno::RuntimeException, std::exception )
386 : {
387 1 : return cppu::supportsService(this, rServiceName);
388 : }
389 :
390 2 : css::uno::Sequence< OUString > SAL_CALL MeanValueRegressionCurve::getSupportedServiceNames()
391 : throw( css::uno::RuntimeException, std::exception )
392 : {
393 2 : return getSupportedServiceNames_Static();
394 : }
395 :
396 0 : uno::Reference< util::XCloneable > SAL_CALL MeanValueRegressionCurve::createClone()
397 : throw (uno::RuntimeException, std::exception)
398 : {
399 0 : return uno::Reference< util::XCloneable >( new MeanValueRegressionCurve( *this ));
400 : }
401 :
402 9 : LinearRegressionCurve::LinearRegressionCurve(
403 : const uno::Reference< uno::XComponentContext > & xContext )
404 9 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_LINEAR )
405 9 : {}
406 0 : LinearRegressionCurve::LinearRegressionCurve(
407 : const LinearRegressionCurve & rOther ) :
408 0 : RegressionCurveModel( rOther )
409 0 : {}
410 18 : LinearRegressionCurve::~LinearRegressionCurve()
411 18 : {}
412 1 : uno::Sequence< OUString > LinearRegressionCurve::getSupportedServiceNames_Static()
413 : {
414 1 : uno::Sequence< OUString > aServices( 2 );
415 1 : aServices[ 0 ] = lcl_aServiceName;
416 1 : aServices[ 1 ] = "com.sun.star.chart2.LinearRegressionCurve";
417 1 : return aServices;
418 : }
419 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
420 1 : OUString SAL_CALL LinearRegressionCurve::getImplementationName()
421 : throw( css::uno::RuntimeException, std::exception )
422 : {
423 1 : return getImplementationName_Static();
424 : }
425 :
426 1 : OUString LinearRegressionCurve::getImplementationName_Static()
427 : {
428 1 : return lcl_aImplementationName_Linear;
429 : }
430 :
431 0 : sal_Bool SAL_CALL LinearRegressionCurve::supportsService( const OUString& rServiceName )
432 : throw( css::uno::RuntimeException, std::exception )
433 : {
434 0 : return cppu::supportsService(this, rServiceName);
435 : }
436 :
437 1 : css::uno::Sequence< OUString > SAL_CALL LinearRegressionCurve::getSupportedServiceNames()
438 : throw( css::uno::RuntimeException, std::exception )
439 : {
440 1 : return getSupportedServiceNames_Static();
441 : }
442 :
443 0 : uno::Reference< util::XCloneable > SAL_CALL LinearRegressionCurve::createClone()
444 : throw (uno::RuntimeException, std::exception)
445 : {
446 0 : return uno::Reference< util::XCloneable >( new LinearRegressionCurve( *this ));
447 : }
448 :
449 1 : LogarithmicRegressionCurve::LogarithmicRegressionCurve(
450 : const uno::Reference< uno::XComponentContext > & xContext )
451 1 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_LOGARITHM )
452 1 : {}
453 0 : LogarithmicRegressionCurve::LogarithmicRegressionCurve(
454 : const LogarithmicRegressionCurve & rOther ) :
455 0 : RegressionCurveModel( rOther )
456 0 : {}
457 2 : LogarithmicRegressionCurve::~LogarithmicRegressionCurve()
458 2 : {}
459 1 : uno::Sequence< OUString > LogarithmicRegressionCurve::getSupportedServiceNames_Static()
460 : {
461 1 : uno::Sequence< OUString > aServices( 2 );
462 1 : aServices[ 0 ] = lcl_aServiceName;
463 1 : aServices[ 1 ] = "com.sun.star.chart2.LogarithmicRegressionCurve";
464 1 : return aServices;
465 : }
466 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
467 1 : OUString SAL_CALL LogarithmicRegressionCurve::getImplementationName()
468 : throw( css::uno::RuntimeException, std::exception )
469 : {
470 1 : return getImplementationName_Static();
471 : }
472 :
473 1 : OUString LogarithmicRegressionCurve::getImplementationName_Static()
474 : {
475 1 : return lcl_aImplementationName_Logarithmic;
476 : }
477 :
478 0 : sal_Bool SAL_CALL LogarithmicRegressionCurve::supportsService( const OUString& rServiceName )
479 : throw( css::uno::RuntimeException, std::exception )
480 : {
481 0 : return cppu::supportsService(this, rServiceName);
482 : }
483 :
484 1 : css::uno::Sequence< OUString > SAL_CALL LogarithmicRegressionCurve::getSupportedServiceNames()
485 : throw( css::uno::RuntimeException, std::exception )
486 : {
487 1 : return getSupportedServiceNames_Static();
488 : }
489 :
490 0 : uno::Reference< util::XCloneable > SAL_CALL LogarithmicRegressionCurve::createClone()
491 : throw (uno::RuntimeException, std::exception)
492 : {
493 0 : return uno::Reference< util::XCloneable >( new LogarithmicRegressionCurve( *this ));
494 : }
495 :
496 1 : ExponentialRegressionCurve::ExponentialRegressionCurve(
497 : const uno::Reference< uno::XComponentContext > & xContext )
498 1 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_EXPONENTIAL )
499 1 : {}
500 0 : ExponentialRegressionCurve::ExponentialRegressionCurve(
501 : const ExponentialRegressionCurve & rOther ) :
502 0 : RegressionCurveModel( rOther )
503 0 : {}
504 2 : ExponentialRegressionCurve::~ExponentialRegressionCurve()
505 2 : {}
506 1 : uno::Sequence< OUString > ExponentialRegressionCurve::getSupportedServiceNames_Static()
507 : {
508 1 : uno::Sequence< OUString > aServices( 2 );
509 1 : aServices[ 0 ] = lcl_aServiceName;
510 1 : aServices[ 1 ] = "com.sun.star.chart2.ExponentialRegressionCurve";
511 1 : return aServices;
512 : }
513 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
514 1 : OUString SAL_CALL ExponentialRegressionCurve::getImplementationName()
515 : throw( css::uno::RuntimeException, std::exception )
516 : {
517 1 : return getImplementationName_Static();
518 : }
519 :
520 1 : OUString ExponentialRegressionCurve::getImplementationName_Static()
521 : {
522 1 : return lcl_aImplementationName_Exponential;
523 : }
524 :
525 0 : sal_Bool SAL_CALL ExponentialRegressionCurve::supportsService( const OUString& rServiceName )
526 : throw( css::uno::RuntimeException, std::exception )
527 : {
528 0 : return cppu::supportsService(this, rServiceName);
529 : }
530 :
531 1 : css::uno::Sequence< OUString > SAL_CALL ExponentialRegressionCurve::getSupportedServiceNames()
532 : throw( css::uno::RuntimeException, std::exception )
533 : {
534 1 : return getSupportedServiceNames_Static();
535 : }
536 :
537 0 : uno::Reference< util::XCloneable > SAL_CALL ExponentialRegressionCurve::createClone()
538 : throw (uno::RuntimeException, std::exception)
539 : {
540 0 : return uno::Reference< util::XCloneable >( new ExponentialRegressionCurve( *this ));
541 : }
542 :
543 1 : PotentialRegressionCurve::PotentialRegressionCurve(
544 : const uno::Reference< uno::XComponentContext > & xContext )
545 1 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_POWER )
546 1 : {}
547 0 : PotentialRegressionCurve::PotentialRegressionCurve(
548 : const PotentialRegressionCurve & rOther ) :
549 0 : RegressionCurveModel( rOther )
550 0 : {}
551 2 : PotentialRegressionCurve::~PotentialRegressionCurve()
552 2 : {}
553 1 : uno::Sequence< OUString > PotentialRegressionCurve::getSupportedServiceNames_Static()
554 : {
555 1 : uno::Sequence< OUString > aServices( 2 );
556 1 : aServices[ 0 ] = lcl_aServiceName;
557 1 : aServices[ 1 ] = "com.sun.star.chart2.PotentialRegressionCurve";
558 1 : return aServices;
559 : }
560 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
561 1 : OUString SAL_CALL PotentialRegressionCurve::getImplementationName()
562 : throw( css::uno::RuntimeException, std::exception )
563 : {
564 1 : return getImplementationName_Static();
565 : }
566 :
567 1 : OUString PotentialRegressionCurve::getImplementationName_Static()
568 : {
569 1 : return lcl_aImplementationName_Potential;
570 : }
571 :
572 0 : sal_Bool SAL_CALL PotentialRegressionCurve::supportsService( const OUString& rServiceName )
573 : throw( css::uno::RuntimeException, std::exception )
574 : {
575 0 : return cppu::supportsService(this, rServiceName);
576 : }
577 :
578 1 : css::uno::Sequence< OUString > SAL_CALL PotentialRegressionCurve::getSupportedServiceNames()
579 : throw( css::uno::RuntimeException, std::exception )
580 : {
581 1 : return getSupportedServiceNames_Static();
582 : }
583 :
584 0 : uno::Reference< util::XCloneable > SAL_CALL PotentialRegressionCurve::createClone()
585 : throw (uno::RuntimeException, std::exception)
586 : {
587 0 : return uno::Reference< util::XCloneable >( new PotentialRegressionCurve( *this ));
588 : }
589 :
590 7 : PolynomialRegressionCurve::PolynomialRegressionCurve(
591 : const uno::Reference< uno::XComponentContext > & xContext )
592 7 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_POLYNOMIAL )
593 7 : {}
594 0 : PolynomialRegressionCurve::PolynomialRegressionCurve(
595 : const PolynomialRegressionCurve & rOther ) :
596 0 : RegressionCurveModel( rOther )
597 0 : {}
598 14 : PolynomialRegressionCurve::~PolynomialRegressionCurve()
599 14 : {}
600 1 : uno::Sequence< OUString > PolynomialRegressionCurve::getSupportedServiceNames_Static()
601 : {
602 1 : uno::Sequence< OUString > aServices( 2 );
603 1 : aServices[ 0 ] = lcl_aServiceName;
604 1 : aServices[ 1 ] = "com.sun.star.chart2.PolynomialRegressionCurve";
605 1 : return aServices;
606 : }
607 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
608 1 : OUString SAL_CALL PolynomialRegressionCurve::getImplementationName()
609 : throw( css::uno::RuntimeException, std::exception )
610 : {
611 1 : return getImplementationName_Static();
612 : }
613 :
614 1 : OUString PolynomialRegressionCurve::getImplementationName_Static()
615 : {
616 1 : return lcl_aImplementationName_Polynomial;
617 : }
618 :
619 0 : sal_Bool SAL_CALL PolynomialRegressionCurve::supportsService( const OUString& rServiceName )
620 : throw( css::uno::RuntimeException, std::exception )
621 : {
622 0 : return cppu::supportsService(this, rServiceName);
623 : }
624 :
625 1 : css::uno::Sequence< OUString > SAL_CALL PolynomialRegressionCurve::getSupportedServiceNames()
626 : throw( css::uno::RuntimeException, std::exception )
627 : {
628 1 : return getSupportedServiceNames_Static();
629 : }
630 :
631 0 : uno::Reference< util::XCloneable > SAL_CALL PolynomialRegressionCurve::createClone()
632 : throw (uno::RuntimeException, std::exception)
633 : {
634 0 : return uno::Reference< util::XCloneable >( new PolynomialRegressionCurve( *this ));
635 : }
636 :
637 7 : MovingAverageRegressionCurve::MovingAverageRegressionCurve(
638 : const uno::Reference< uno::XComponentContext > & xContext )
639 7 : : RegressionCurveModel( xContext, RegressionCurveModel::CURVE_TYPE_MOVING_AVERAGE )
640 7 : {}
641 0 : MovingAverageRegressionCurve::MovingAverageRegressionCurve(
642 : const MovingAverageRegressionCurve & rOther ) :
643 0 : RegressionCurveModel( rOther )
644 0 : {}
645 14 : MovingAverageRegressionCurve::~MovingAverageRegressionCurve()
646 14 : {}
647 1 : uno::Sequence< OUString > MovingAverageRegressionCurve::getSupportedServiceNames_Static()
648 : {
649 1 : uno::Sequence< OUString > aServices( 2 );
650 1 : aServices[ 0 ] = lcl_aServiceName;
651 1 : aServices[ 1 ] = "com.sun.star.chart2.MovingAverageRegressionCurve";
652 1 : return aServices;
653 : }
654 : // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
655 1 : OUString SAL_CALL MovingAverageRegressionCurve::getImplementationName()
656 : throw( css::uno::RuntimeException, std::exception )
657 : {
658 1 : return getImplementationName_Static();
659 : }
660 :
661 1 : OUString MovingAverageRegressionCurve::getImplementationName_Static()
662 : {
663 1 : return lcl_aImplementationName_MovingAverage;
664 : }
665 :
666 0 : sal_Bool SAL_CALL MovingAverageRegressionCurve::supportsService( const OUString& rServiceName )
667 : throw( css::uno::RuntimeException, std::exception )
668 : {
669 0 : return cppu::supportsService(this, rServiceName);
670 : }
671 :
672 1 : css::uno::Sequence< OUString > SAL_CALL MovingAverageRegressionCurve::getSupportedServiceNames()
673 : throw( css::uno::RuntimeException, std::exception )
674 : {
675 1 : return getSupportedServiceNames_Static();
676 : }
677 :
678 0 : uno::Reference< util::XCloneable > SAL_CALL MovingAverageRegressionCurve::createClone()
679 : throw (uno::RuntimeException, std::exception)
680 : {
681 0 : return uno::Reference< util::XCloneable >( new MovingAverageRegressionCurve( *this ));
682 : }
683 :
684 : } // namespace chart
685 :
686 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
687 1 : com_sun_star_comp_chart2_ExponentialRegressionCurve_get_implementation(css::uno::XComponentContext *context,
688 : css::uno::Sequence<css::uno::Any> const &)
689 : {
690 1 : return cppu::acquire(new ::chart::ExponentialRegressionCurve(context));
691 : }
692 :
693 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
694 9 : com_sun_star_comp_chart2_LinearRegressionCurve_get_implementation(css::uno::XComponentContext *context,
695 : css::uno::Sequence<css::uno::Any> const &)
696 : {
697 9 : return cppu::acquire(new ::chart::LinearRegressionCurve(context));
698 : }
699 :
700 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
701 1 : com_sun_star_comp_chart2_LogarithmicRegressionCurve_get_implementation(css::uno::XComponentContext *context,
702 : css::uno::Sequence<css::uno::Any> const &)
703 : {
704 1 : return cppu::acquire(new ::chart::LogarithmicRegressionCurve(context));
705 : }
706 :
707 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
708 1 : com_sun_star_comp_chart2_MeanValueRegressionCurve_get_implementation(css::uno::XComponentContext *context,
709 : css::uno::Sequence<css::uno::Any> const &)
710 : {
711 1 : return cppu::acquire(new ::chart::MeanValueRegressionCurve(context));
712 : }
713 :
714 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
715 1 : com_sun_star_comp_chart2_PotentialRegressionCurve_get_implementation(css::uno::XComponentContext *context,
716 : css::uno::Sequence<css::uno::Any> const &)
717 : {
718 1 : return cppu::acquire(new ::chart::PotentialRegressionCurve(context));
719 : }
720 :
721 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
722 7 : com_sun_star_comp_chart2_PolynomialRegressionCurve_get_implementation(css::uno::XComponentContext *context,
723 : css::uno::Sequence<css::uno::Any> const &)
724 : {
725 7 : return cppu::acquire(new ::chart::PolynomialRegressionCurve(context));
726 : }
727 :
728 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
729 7 : com_sun_star_comp_chart2_MovingAverageRegressionCurve_get_implementation(css::uno::XComponentContext *context,
730 : css::uno::Sequence<css::uno::Any> const &)
731 : {
732 7 : return cppu::acquire(new ::chart::MovingAverageRegressionCurve(context));
733 57 : }
734 :
735 :
736 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|