1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
22 #include <cppuhelper/implbase.hxx>
23 #include <rtl/ustrbuf.hxx>
25 #include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
27 namespace com
{ namespace sun
{ namespace star
{ namespace util
{ class XNumberFormatsSupplier
; } } } }
28 namespace com
{ namespace sun
{ namespace star
{ namespace util
{ class XNumberFormatter
; } } } }
33 class RegressionCurveCalculator
: public
34 cppu::WeakImplHelper
< css::chart2::XRegressionCurveCalculator
>
37 RegressionCurveCalculator();
38 virtual ~RegressionCurveCalculator() override
;
40 static bool isLinearScaling(
41 const css::uno::Reference
< css::chart2::XScaling
>& xScaling
);
43 static bool isLogarithmicScaling(
44 const css::uno::Reference
< css::chart2::XScaling
>& xScaling
);
47 virtual OUString
ImplGetRepresentation(
48 const css::uno::Reference
< css::util::XNumberFormatter
>& xNumFormatter
,
49 sal_Int32 nNumberFormatKey
, sal_Int32
* pFormulaLength
= nullptr ) const = 0;
51 static OUString
getFormattedString(
52 const css::uno::Reference
< css::util::XNumberFormatter
>& xNumFormatter
,
53 sal_Int32 nNumberFormatKey
,
55 const sal_Int32
* pStringLength
);
57 static void addStringToEquation( OUStringBuffer
& aStrEquation
, sal_Int32
& nLineLength
, OUStringBuffer
const & aAddString
, const sal_Int32
* pMaxLength
);
59 double m_fCorrelationCoeffitient
;
63 double mInterceptValue
;
65 OUString mXName
, mYName
;
67 // ____ XRegressionCurveCalculator ____
68 virtual void SAL_CALL
setRegressionProperties(
70 sal_Bool aForceIntercept
,
71 double aInterceptValue
,
72 sal_Int32 aPeriod
) override
;
74 virtual void SAL_CALL
recalculateRegression(
75 const css::uno::Sequence
< double >& aXValues
,
76 const css::uno::Sequence
< double >& aYValues
) override
= 0;
78 virtual double SAL_CALL
getCurveValue( double x
) override
= 0;
80 virtual css::uno::Sequence
< css::geometry::RealPoint2D
> SAL_CALL
getCurveValues(
83 sal_Int32 nPointCount
,
84 const css::uno::Reference
< css::chart2::XScaling
>& xScalingX
,
85 const css::uno::Reference
< css::chart2::XScaling
>& xScalingY
,
86 sal_Bool bMaySkipPointsInCalculation
) override
;
88 virtual double SAL_CALL
getCorrelationCoefficient() override
;
90 virtual OUString SAL_CALL
getRepresentation() override
;
92 virtual OUString SAL_CALL
getFormattedRepresentation(
93 const css::uno::Reference
< css::util::XNumberFormatsSupplier
>& xNumFmtSupplier
,
94 sal_Int32 nNumberFormatKey
, sal_Int32 nFormulaLength
) override
;
96 virtual void SAL_CALL
setXYNames(
97 const OUString
& aXName
, const OUString
& aYName
) override
;
102 // INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */