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 : #ifndef CHART2_REGRESSIONCURVEMODEL_HXX
20 : #define CHART2_REGRESSIONCURVEMODEL_HXX
21 :
22 : #include "MutexContainer.hxx"
23 : #include "OPropertySet.hxx"
24 : #include "ServiceMacros.hxx"
25 : #include "ModifyListenerHelper.hxx"
26 :
27 : #include <cppuhelper/implbase6.hxx>
28 : #include <comphelper/uno3.hxx>
29 :
30 : #include <com/sun/star/chart2/XRegressionCurve.hpp>
31 :
32 : #include <com/sun/star/uno/XComponentContext.hpp>
33 : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : #include <com/sun/star/lang/XServiceName.hpp>
35 : #include <com/sun/star/util/XCloneable.hpp>
36 :
37 : namespace chart
38 : {
39 :
40 : namespace impl
41 : {
42 : typedef ::cppu::WeakImplHelper6<
43 : ::com::sun::star::lang::XServiceInfo,
44 : ::com::sun::star::lang::XServiceName,
45 : ::com::sun::star::chart2::XRegressionCurve,
46 : ::com::sun::star::util::XCloneable,
47 : ::com::sun::star::util::XModifyBroadcaster,
48 : ::com::sun::star::util::XModifyListener >
49 : RegressionCurveModel_Base;
50 : }
51 :
52 : class RegressionCurveModel :
53 : public MutexContainer,
54 : public impl::RegressionCurveModel_Base,
55 : public ::property::OPropertySet
56 : {
57 : public:
58 : enum tCurveType
59 : {
60 : CURVE_TYPE_MEAN_VALUE,
61 : CURVE_TYPE_LINEAR,
62 : CURVE_TYPE_LOGARITHM,
63 : CURVE_TYPE_EXPONENTIAL,
64 : CURVE_TYPE_POWER
65 : };
66 :
67 : RegressionCurveModel( ::com::sun::star::uno::Reference<
68 : ::com::sun::star::uno::XComponentContext > const & xContext,
69 : tCurveType eCurveType );
70 : RegressionCurveModel( const RegressionCurveModel & rOther );
71 : virtual ~RegressionCurveModel();
72 :
73 : /// merge XInterface implementations
74 : DECLARE_XINTERFACE()
75 : /// merge XTypeProvider implementations
76 : DECLARE_XTYPEPROVIDER()
77 :
78 : protected:
79 : // ____ OPropertySet ____
80 : virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
81 : throw(::com::sun::star::beans::UnknownPropertyException);
82 :
83 : // ____ OPropertySet ____
84 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
85 :
86 : // ____ XPropertySet ____
87 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
88 : getPropertySetInfo()
89 : throw (::com::sun::star::uno::RuntimeException);
90 :
91 : // ____ XRegressionCurve ____
92 : virtual ::com::sun::star::uno::Reference<
93 : ::com::sun::star::chart2::XRegressionCurveCalculator > SAL_CALL getCalculator()
94 : throw (::com::sun::star::uno::RuntimeException);
95 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getEquationProperties()
96 : throw (::com::sun::star::uno::RuntimeException);
97 : virtual void SAL_CALL setEquationProperties(
98 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xEquationProperties )
99 : throw (::com::sun::star::uno::RuntimeException);
100 :
101 : // ____ XServiceName ____
102 : virtual ::rtl::OUString SAL_CALL getServiceName()
103 : throw (::com::sun::star::uno::RuntimeException);
104 :
105 : // ____ XCloneable ____
106 : // not implemented here
107 : // virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
108 : // throw (::com::sun::star::uno::RuntimeException);
109 :
110 : // ____ XModifyBroadcaster ____
111 : virtual void SAL_CALL addModifyListener(
112 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
113 : throw (::com::sun::star::uno::RuntimeException);
114 : virtual void SAL_CALL removeModifyListener(
115 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
116 : throw (::com::sun::star::uno::RuntimeException);
117 :
118 : // ____ XModifyListener ____
119 : virtual void SAL_CALL modified(
120 : const ::com::sun::star::lang::EventObject& aEvent )
121 : throw (::com::sun::star::uno::RuntimeException);
122 :
123 : // ____ XEventListener (base of XModifyListener) ____
124 : virtual void SAL_CALL disposing(
125 : const ::com::sun::star::lang::EventObject& Source )
126 : throw (::com::sun::star::uno::RuntimeException);
127 :
128 : using ::cppu::OPropertySetHelper::disposing;
129 :
130 : // ____ OPropertySet ____
131 : virtual void firePropertyChangeEvent();
132 :
133 : void fireModifyEvent();
134 :
135 : private:
136 : ::com::sun::star::uno::Reference<
137 : ::com::sun::star::uno::XComponentContext >
138 : m_xContext;
139 :
140 : const tCurveType m_eRegressionCurveType;
141 :
142 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
143 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xEquationProperties;
144 : };
145 :
146 : // implementations for factory instantiation
147 :
148 : class MeanValueRegressionCurve : public RegressionCurveModel
149 : {
150 : public:
151 : explicit MeanValueRegressionCurve(
152 : const ::com::sun::star::uno::Reference<
153 : ::com::sun::star::uno::XComponentContext > & xContext );
154 : explicit MeanValueRegressionCurve(
155 : const MeanValueRegressionCurve & rOther );
156 : virtual ~MeanValueRegressionCurve();
157 :
158 : // ____ XCloneable ____
159 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
160 : throw (::com::sun::star::uno::RuntimeException);
161 :
162 : /// XServiceInfo declarations
163 : APPHELPER_XSERVICEINFO_DECL()
164 : /// establish methods for factory instatiation
165 0 : APPHELPER_SERVICE_FACTORY_HELPER( MeanValueRegressionCurve )
166 : };
167 :
168 : class LinearRegressionCurve : public RegressionCurveModel
169 : {
170 : public:
171 : explicit LinearRegressionCurve(
172 : const ::com::sun::star::uno::Reference<
173 : ::com::sun::star::uno::XComponentContext > & xContext );
174 : explicit LinearRegressionCurve(
175 : const LinearRegressionCurve & rOther );
176 : virtual ~LinearRegressionCurve();
177 :
178 : // ____ XCloneable ____
179 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
180 : throw (::com::sun::star::uno::RuntimeException);
181 :
182 : /// XServiceInfo declarations
183 : APPHELPER_XSERVICEINFO_DECL()
184 : /// establish methods for factory instatiation
185 0 : APPHELPER_SERVICE_FACTORY_HELPER( LinearRegressionCurve )
186 : };
187 :
188 : class LogarithmicRegressionCurve : public RegressionCurveModel
189 : {
190 : public:
191 : explicit LogarithmicRegressionCurve(
192 : const ::com::sun::star::uno::Reference<
193 : ::com::sun::star::uno::XComponentContext > & xContext );
194 : explicit LogarithmicRegressionCurve(
195 : const LogarithmicRegressionCurve & rOther );
196 : virtual ~LogarithmicRegressionCurve();
197 :
198 : // ____ XCloneable ____
199 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
200 : throw (::com::sun::star::uno::RuntimeException);
201 :
202 : /// XServiceInfo declarations
203 : APPHELPER_XSERVICEINFO_DECL()
204 : /// establish methods for factory instatiation
205 0 : APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicRegressionCurve )
206 : };
207 :
208 : class ExponentialRegressionCurve : public RegressionCurveModel
209 : {
210 : public:
211 : explicit ExponentialRegressionCurve(
212 : const ::com::sun::star::uno::Reference<
213 : ::com::sun::star::uno::XComponentContext > & xContext );
214 : explicit ExponentialRegressionCurve(
215 : const ExponentialRegressionCurve & rOther );
216 : virtual ~ExponentialRegressionCurve();
217 :
218 : // ____ XCloneable ____
219 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
220 : throw (::com::sun::star::uno::RuntimeException);
221 :
222 : /// XServiceInfo declarations
223 : APPHELPER_XSERVICEINFO_DECL()
224 : /// establish methods for factory instatiation
225 0 : APPHELPER_SERVICE_FACTORY_HELPER( ExponentialRegressionCurve )
226 : };
227 :
228 : class PotentialRegressionCurve : public RegressionCurveModel
229 : {
230 : public:
231 : explicit PotentialRegressionCurve(
232 : const ::com::sun::star::uno::Reference<
233 : ::com::sun::star::uno::XComponentContext > & xContext );
234 : explicit PotentialRegressionCurve(
235 : const PotentialRegressionCurve & rOther );
236 : virtual ~PotentialRegressionCurve();
237 :
238 : // ____ XCloneable ____
239 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
240 : throw (::com::sun::star::uno::RuntimeException);
241 :
242 : /// XServiceInfo declarations
243 : APPHELPER_XSERVICEINFO_DECL()
244 : /// establish methods for factory instatiation
245 0 : APPHELPER_SERVICE_FACTORY_HELPER( PotentialRegressionCurve )
246 : };
247 :
248 : } // namespace chart
249 :
250 : // CHART2_REGRESSIONCURVEMODEL_HXX
251 : #endif
252 :
253 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|