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 throw(::com::sun::star::beans::UnknownPropertyException); 86 87 // ____ OPropertySet ____ 88 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 89 90 // ____ XPropertySet ____ 91 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 92 getPropertySetInfo() 93 throw (::com::sun::star::uno::RuntimeException); 94 95 // ____ XRegressionCurve ____ 96 virtual ::com::sun::star::uno::Reference< 97 ::com::sun::star::chart2::XRegressionCurveCalculator > SAL_CALL getCalculator() 98 throw (::com::sun::star::uno::RuntimeException); 99 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getEquationProperties() 100 throw (::com::sun::star::uno::RuntimeException); 101 virtual void SAL_CALL setEquationProperties( 102 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xEquationProperties ) 103 throw (::com::sun::star::uno::RuntimeException); 104 105 // ____ XServiceName ____ 106 virtual ::rtl::OUString SAL_CALL getServiceName() 107 throw (::com::sun::star::uno::RuntimeException); 108 109 // ____ XCloneable ____ 110 // not implemented here 111 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 112 // throw (::com::sun::star::uno::RuntimeException); 113 114 // ____ XModifyBroadcaster ____ 115 virtual void SAL_CALL addModifyListener( 116 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 117 throw (::com::sun::star::uno::RuntimeException); 118 virtual void SAL_CALL removeModifyListener( 119 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) 120 throw (::com::sun::star::uno::RuntimeException); 121 122 // ____ XModifyListener ____ 123 virtual void SAL_CALL modified( 124 const ::com::sun::star::lang::EventObject& aEvent ) 125 throw (::com::sun::star::uno::RuntimeException); 126 127 // ____ XEventListener (base of XModifyListener) ____ 128 virtual void SAL_CALL disposing( 129 const ::com::sun::star::lang::EventObject& Source ) 130 throw (::com::sun::star::uno::RuntimeException); 131 132 using ::cppu::OPropertySetHelper::disposing; 133 134 // ____ OPropertySet ____ 135 virtual void firePropertyChangeEvent(); 136 137 void fireModifyEvent(); 138 139 private: 140 ::com::sun::star::uno::Reference< 141 ::com::sun::star::uno::XComponentContext > 142 m_xContext; 143 144 const tCurveType m_eRegressionCurveType; 145 146 ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; 147 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xEquationProperties; 148 }; 149 150 // implementations for factory instantiation 151 152 class MeanValueRegressionCurve : public RegressionCurveModel 153 { 154 public: 155 explicit MeanValueRegressionCurve( 156 const ::com::sun::star::uno::Reference< 157 ::com::sun::star::uno::XComponentContext > & xContext ); 158 explicit MeanValueRegressionCurve( 159 const MeanValueRegressionCurve & rOther ); 160 virtual ~MeanValueRegressionCurve(); 161 162 // ____ XCloneable ____ 163 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 164 throw (::com::sun::star::uno::RuntimeException); 165 166 /// XServiceInfo declarations 167 APPHELPER_XSERVICEINFO_DECL() 168 /// establish methods for factory instatiation 169 APPHELPER_SERVICE_FACTORY_HELPER( MeanValueRegressionCurve ) 170 }; 171 172 class LinearRegressionCurve : public RegressionCurveModel 173 { 174 public: 175 explicit LinearRegressionCurve( 176 const ::com::sun::star::uno::Reference< 177 ::com::sun::star::uno::XComponentContext > & xContext ); 178 explicit LinearRegressionCurve( 179 const LinearRegressionCurve & rOther ); 180 virtual ~LinearRegressionCurve(); 181 182 // ____ XCloneable ____ 183 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 184 throw (::com::sun::star::uno::RuntimeException); 185 186 /// XServiceInfo declarations 187 APPHELPER_XSERVICEINFO_DECL() 188 /// establish methods for factory instatiation 189 APPHELPER_SERVICE_FACTORY_HELPER( LinearRegressionCurve ) 190 }; 191 192 class LogarithmicRegressionCurve : public RegressionCurveModel 193 { 194 public: 195 explicit LogarithmicRegressionCurve( 196 const ::com::sun::star::uno::Reference< 197 ::com::sun::star::uno::XComponentContext > & xContext ); 198 explicit LogarithmicRegressionCurve( 199 const LogarithmicRegressionCurve & rOther ); 200 virtual ~LogarithmicRegressionCurve(); 201 202 // ____ XCloneable ____ 203 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 204 throw (::com::sun::star::uno::RuntimeException); 205 206 /// XServiceInfo declarations 207 APPHELPER_XSERVICEINFO_DECL() 208 /// establish methods for factory instatiation 209 APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicRegressionCurve ) 210 }; 211 212 class ExponentialRegressionCurve : public RegressionCurveModel 213 { 214 public: 215 explicit ExponentialRegressionCurve( 216 const ::com::sun::star::uno::Reference< 217 ::com::sun::star::uno::XComponentContext > & xContext ); 218 explicit ExponentialRegressionCurve( 219 const ExponentialRegressionCurve & rOther ); 220 virtual ~ExponentialRegressionCurve(); 221 222 // ____ XCloneable ____ 223 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 224 throw (::com::sun::star::uno::RuntimeException); 225 226 /// XServiceInfo declarations 227 APPHELPER_XSERVICEINFO_DECL() 228 /// establish methods for factory instatiation 229 APPHELPER_SERVICE_FACTORY_HELPER( ExponentialRegressionCurve ) 230 }; 231 232 class PotentialRegressionCurve : public RegressionCurveModel 233 { 234 public: 235 explicit PotentialRegressionCurve( 236 const ::com::sun::star::uno::Reference< 237 ::com::sun::star::uno::XComponentContext > & xContext ); 238 explicit PotentialRegressionCurve( 239 const PotentialRegressionCurve & rOther ); 240 virtual ~PotentialRegressionCurve(); 241 242 // ____ XCloneable ____ 243 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() 244 throw (::com::sun::star::uno::RuntimeException); 245 246 /// XServiceInfo declarations 247 APPHELPER_XSERVICEINFO_DECL() 248 /// establish methods for factory instatiation 249 APPHELPER_SERVICE_FACTORY_HELPER( PotentialRegressionCurve ) 250 }; 251 252 } // namespace chart 253 254 // CHART2_REGRESSIONCURVEMODEL_HXX 255 #endif 256