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