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