1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef CHART2_REGRESSIONCURVECALCULATOR_HXX
24 #define CHART2_REGRESSIONCURVECALCULATOR_HXX
25 
26 #include <cppuhelper/implbase1.hxx>
27 
28 #include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
29 #include <com/sun/star/util/XNumberFormatter.hpp>
30 
31 namespace chart
32 {
33 
34 class RegressionCurveCalculator : public
35     ::cppu::WeakImplHelper1< ::com::sun::star::chart2::XRegressionCurveCalculator >
36 {
37 public:
38 	RegressionCurveCalculator();
39 	virtual ~RegressionCurveCalculator();
40 
41     static bool isLinearScaling(
42         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
43     static bool isLogarithmicScaling(
44         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
45 
46 protected:
47     virtual ::rtl::OUString ImplGetRepresentation(
48         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
49         ::sal_Int32 nNumberFormatKey ) const = 0;
50 
51     ::rtl::OUString getFormattedString(
52         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
53         ::sal_Int32 nNumberFormatKey,
54         double fNumber ) const;
55 
56     double m_fCorrelationCoeffitient;
57 
58     // ____ XRegressionCurveCalculator ____
59     virtual void SAL_CALL recalculateRegression(
60         const ::com::sun::star::uno::Sequence< double >& aXValues,
61         const ::com::sun::star::uno::Sequence< double >& aYValues )
62         throw (::com::sun::star::uno::RuntimeException) = 0;
63     virtual double SAL_CALL getCurveValue( double x )
64         throw (::com::sun::star::lang::IllegalArgumentException,
65                ::com::sun::star::uno::RuntimeException) = 0;
66 
67     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
68         double min,
69         double max,
70         ::sal_Int32 nPointCount,
71         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
72         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
73         ::sal_Bool bMaySkipPointsInCalculation )
74         throw (::com::sun::star::lang::IllegalArgumentException,
75                ::com::sun::star::uno::RuntimeException);
76     virtual double SAL_CALL getCorrelationCoefficient()
77         throw (::com::sun::star::uno::RuntimeException);
78     virtual ::rtl::OUString SAL_CALL getRepresentation()
79         throw (::com::sun::star::uno::RuntimeException);
80     virtual ::rtl::OUString SAL_CALL getFormattedRepresentation(
81         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumFmtSupplier,
82         ::sal_Int32 nNumberFormatKey )
83         throw (::com::sun::star::uno::RuntimeException);
84 };
85 
86 } //  namespace chart
87 
88 // CHART2_REGRESSIONCURVECALCULATOR_HXX
89 #endif
90