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_REGRESSIONEQUATION_HXX
28 #define CHART2_REGRESSIONEQUATION_HXX
29 
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/util/XCloneable.hpp>
32 #include <com/sun/star/util/XModifyBroadcaster.hpp>
33 #include <com/sun/star/util/XModifyListener.hpp>
34 #include <com/sun/star/chart2/XTitle.hpp>
35 
36 #include "MutexContainer.hxx"
37 #include "OPropertySet.hxx"
38 #include "ServiceMacros.hxx"
39 #include "ModifyListenerHelper.hxx"
40 
41 #include <cppuhelper/implbase4.hxx>
42 #include <comphelper/uno3.hxx>
43 
44 namespace chart
45 {
46 
47 namespace impl
48 {
49 typedef ::cppu::WeakImplHelper4<
50         ::com::sun::star::util::XCloneable,
51         ::com::sun::star::util::XModifyBroadcaster,
52         ::com::sun::star::util::XModifyListener,
53         ::com::sun::star::chart2::XTitle >
54     RegressionEquation_Base;
55 }
56 
57 class RegressionEquation :
58         public MutexContainer,
59         public impl::RegressionEquation_Base,
60         public ::property::OPropertySet
61 {
62 public:
63     explicit RegressionEquation(
64         const ::com::sun::star::uno::Reference<
65             ::com::sun::star::uno::XComponentContext > & xContext );
66 	virtual ~RegressionEquation();
67 
68     /// XServiceInfo declarations
69     APPHELPER_XSERVICEINFO_DECL()
70     /// merge XInterface implementations
71  	DECLARE_XINTERFACE()
72     /// establish methods for factory instatiation
73 	APPHELPER_SERVICE_FACTORY_HELPER( RegressionEquation )
74 
75 protected:
76     explicit RegressionEquation( const RegressionEquation & rOther );
77 
78     // ____ OPropertySet ____
79     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
80         throw(::com::sun::star::beans::UnknownPropertyException);
81 
82 	virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
83 
84     // ____ XPropertySet ____
85     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
86         getPropertySetInfo()
87         throw (::com::sun::star::uno::RuntimeException);
88 
89 
90     // ____ XCloneable ____
91     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
92         throw (::com::sun::star::uno::RuntimeException);
93 
94     // ____ XModifyBroadcaster ____
95     virtual void SAL_CALL addModifyListener(
96         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
97         throw (::com::sun::star::uno::RuntimeException);
98     virtual void SAL_CALL removeModifyListener(
99         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
100         throw (::com::sun::star::uno::RuntimeException);
101 
102     // ____ XModifyListener ____
103     virtual void SAL_CALL modified(
104         const ::com::sun::star::lang::EventObject& aEvent )
105         throw (::com::sun::star::uno::RuntimeException);
106 
107     // ____ XEventListener (base of XModifyListener) ____
108     virtual void SAL_CALL disposing(
109         const ::com::sun::star::lang::EventObject& Source )
110         throw (::com::sun::star::uno::RuntimeException);
111 
112     // ____ XTitle ____
113     virtual ::com::sun::star::uno::Sequence<
114         ::com::sun::star::uno::Reference<
115         ::com::sun::star::chart2::XFormattedString > > SAL_CALL getText()
116         throw (::com::sun::star::uno::RuntimeException);
117     virtual void SAL_CALL setText( const ::com::sun::star::uno::Sequence<
118                                    ::com::sun::star::uno::Reference<
119                                    ::com::sun::star::chart2::XFormattedString > >& Strings )
120         throw (::com::sun::star::uno::RuntimeException);
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::Sequence<
131         ::com::sun::star::uno::Reference<
132             ::com::sun::star::chart2::XFormattedString > > m_aStrings;
133 
134     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
135     ::com::sun::star::uno::Reference<
136         ::com::sun::star::uno::XComponentContext >
137                         m_xContext;
138 };
139 
140 } //  namespace chart
141 
142 // CHART2_REGRESSIONEQUATION_HXX
143 #endif
144