1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CHART2_REGRESSIONCURVECALCULATOR_HXX
28 #define CHART2_REGRESSIONCURVECALCULATOR_HXX
29 
30 #include <cppuhelper/implbase1.hxx>
31 
32 #include <com/sun/star/chart2/XRegressionCurveCalculator.hpp>
33 #include <com/sun/star/util/XNumberFormatter.hpp>
34 
35 namespace chart
36 {
37 
38 class RegressionCurveCalculator : public
39     ::cppu::WeakImplHelper1< ::com::sun::star::chart2::XRegressionCurveCalculator >
40 {
41 public:
42 	RegressionCurveCalculator();
43 	virtual ~RegressionCurveCalculator();
44 
45     static bool isLinearScaling(
46         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
47     static bool isLogarithmicScaling(
48         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling );
49 
50 protected:
51     virtual ::rtl::OUString ImplGetRepresentation(
52         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
53         ::sal_Int32 nNumberFormatKey ) const = 0;
54 
55     ::rtl::OUString getFormattedString(
56         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter,
57         ::sal_Int32 nNumberFormatKey,
58         double fNumber ) const;
59 
60     double m_fCorrelationCoeffitient;
61 
62     // ____ XRegressionCurveCalculator ____
63     virtual void SAL_CALL recalculateRegression(
64         const ::com::sun::star::uno::Sequence< double >& aXValues,
65         const ::com::sun::star::uno::Sequence< double >& aYValues )
66         throw (::com::sun::star::uno::RuntimeException) = 0;
67     virtual double SAL_CALL getCurveValue( double x )
68         throw (::com::sun::star::lang::IllegalArgumentException,
69                ::com::sun::star::uno::RuntimeException) = 0;
70 
71     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues(
72         double min,
73         double max,
74         ::sal_Int32 nPointCount,
75         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX,
76         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY,
77         ::sal_Bool bMaySkipPointsInCalculation )
78         throw (::com::sun::star::lang::IllegalArgumentException,
79                ::com::sun::star::uno::RuntimeException);
80     virtual double SAL_CALL getCorrelationCoefficient()
81         throw (::com::sun::star::uno::RuntimeException);
82     virtual ::rtl::OUString SAL_CALL getRepresentation()
83         throw (::com::sun::star::uno::RuntimeException);
84     virtual ::rtl::OUString SAL_CALL getFormattedRepresentation(
85         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumFmtSupplier,
86         ::sal_Int32 nNumberFormatKey )
87         throw (::com::sun::star::uno::RuntimeException);
88 };
89 
90 } //  namespace chart
91 
92 // CHART2_REGRESSIONCURVECALCULATOR_HXX
93 #endif
94