1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*de7b3f82SAndrew Rist  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*de7b3f82SAndrew Rist  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19*de7b3f82SAndrew Rist  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CHART_DATASERIES_HXX
24cdf0e10cSrcweir #define _CHART_DATASERIES_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // UNO types
27cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeries.hpp>
28cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSink.hpp>
29cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataSource.hpp>
30cdf0e10cSrcweir #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
31cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
32cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
33cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp>
34cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
37cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // helper classes
40cdf0e10cSrcweir #include "ServiceMacros.hxx"
41cdf0e10cSrcweir #include <cppuhelper/implbase8.hxx>
42cdf0e10cSrcweir #include <comphelper/uno3.hxx>
43cdf0e10cSrcweir #include <osl/mutex.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // STL
46cdf0e10cSrcweir #include <vector>
47cdf0e10cSrcweir #include <map>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include "MutexContainer.hxx"
50cdf0e10cSrcweir #include "OPropertySet.hxx"
51cdf0e10cSrcweir 
52cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace style {
53cdf0e10cSrcweir     class XStyle;
54cdf0e10cSrcweir }}}}
55cdf0e10cSrcweir 
56cdf0e10cSrcweir namespace chart
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 
59cdf0e10cSrcweir namespace impl
60cdf0e10cSrcweir {
61cdf0e10cSrcweir typedef ::cppu::WeakImplHelper8<
62cdf0e10cSrcweir         ::com::sun::star::chart2::XDataSeries,
63cdf0e10cSrcweir         ::com::sun::star::chart2::data::XDataSink,
64cdf0e10cSrcweir         ::com::sun::star::chart2::data::XDataSource,
65cdf0e10cSrcweir         ::com::sun::star::lang::XServiceInfo,
66cdf0e10cSrcweir         ::com::sun::star::chart2::XRegressionCurveContainer,
67cdf0e10cSrcweir         ::com::sun::star::util::XCloneable,
68cdf0e10cSrcweir         ::com::sun::star::util::XModifyBroadcaster,
69cdf0e10cSrcweir         ::com::sun::star::util::XModifyListener >
70cdf0e10cSrcweir     DataSeries_Base;
71cdf0e10cSrcweir }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir class DataSeries :
74cdf0e10cSrcweir     public MutexContainer,
75cdf0e10cSrcweir     public impl::DataSeries_Base,
76cdf0e10cSrcweir     public ::property::OPropertySet
77cdf0e10cSrcweir {
78cdf0e10cSrcweir public:
79cdf0e10cSrcweir     explicit DataSeries(
80cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
81cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
82cdf0e10cSrcweir 	virtual ~DataSeries();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     /// establish methods for factory instatiation
85cdf0e10cSrcweir     APPHELPER_SERVICE_FACTORY_HELPER( DataSeries )
86cdf0e10cSrcweir     /// XServiceInfo declarations
87cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     /// merge XInterface implementations
90cdf0e10cSrcweir     DECLARE_XINTERFACE()
91cdf0e10cSrcweir     /// merge XTypeProvider implementations
92cdf0e10cSrcweir     DECLARE_XTYPEPROVIDER()
93cdf0e10cSrcweir 
94cdf0e10cSrcweir protected:
95cdf0e10cSrcweir     explicit DataSeries( const DataSeries & rOther );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     // late initialization to call after copy-constructing
98cdf0e10cSrcweir     void Init( const DataSeries & rOther );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     // ____ XDataSeries ____
101cdf0e10cSrcweir     // _____________________
102cdf0e10cSrcweir     /// @see ::com::sun::star::chart2::XDataSeries
103cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
104cdf0e10cSrcweir         SAL_CALL getDataPointByIndex( sal_Int32 nIndex )
105cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
106cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
107cdf0e10cSrcweir     virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex )
108cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir     virtual void SAL_CALL resetAllDataPoints()
110cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     // ____ XDataSink ____
113cdf0e10cSrcweir     // ___________________
114cdf0e10cSrcweir     /// @see ::com::sun::star::chart2::data::XDataSink
115cdf0e10cSrcweir     virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData )
116cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     // ____ XDataSource ____
119cdf0e10cSrcweir     // _____________________
120cdf0e10cSrcweir     /// @see ::com::sun::star::chart2::data::XDataSource
121cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
122cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     // ____ OPropertySet ____
125cdf0e10cSrcweir     // ______________________
126cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
127cdf0e10cSrcweir         throw(::com::sun::star::beans::UnknownPropertyException);
128cdf0e10cSrcweir 	virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
129cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue_NoBroadcast
130cdf0e10cSrcweir         ( sal_Int32 nHandle,
131cdf0e10cSrcweir           const ::com::sun::star::uno::Any& rValue )
132cdf0e10cSrcweir 		throw (::com::sun::star::uno::Exception);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     // ____ XPropertySet ____
137cdf0e10cSrcweir     // ______________________
138cdf0e10cSrcweir     /// @see ::com::sun::star::beans::XPropertySet
139cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
140cdf0e10cSrcweir         getPropertySetInfo()
141cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     /// make original interface function visible again
144cdf0e10cSrcweir     using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     // ____ XRegressionCurveContainer ____
147cdf0e10cSrcweir     // ___________________________________
148cdf0e10cSrcweir     /// @see ::com::sun::star::chart2::XRegressionCurveContainer
149cdf0e10cSrcweir     virtual void SAL_CALL addRegressionCurve(
150cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
151cdf0e10cSrcweir             ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
152cdf0e10cSrcweir         throw (::com::sun::star::lang::IllegalArgumentException,
153cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir     virtual void SAL_CALL removeRegressionCurve(
155cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
156cdf0e10cSrcweir             ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
157cdf0e10cSrcweir         throw (::com::sun::star::container::NoSuchElementException,
158cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
159cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
160cdf0e10cSrcweir                 ::com::sun::star::uno::Reference<
161cdf0e10cSrcweir                     ::com::sun::star::chart2::XRegressionCurve > > SAL_CALL getRegressionCurves()
162cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir     virtual void SAL_CALL setRegressionCurves(
164cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence<
165cdf0e10cSrcweir             ::com::sun::star::uno::Reference<
166cdf0e10cSrcweir                 ::com::sun::star::chart2::XRegressionCurve > >& aRegressionCurves )
167cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     // ____ XCloneable ____
170cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
171cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     // ____ XModifyBroadcaster ____
174cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener(
175cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
176cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
177cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener(
178cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
179cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     // ____ XModifyListener ____
182cdf0e10cSrcweir     virtual void SAL_CALL modified(
183cdf0e10cSrcweir         const ::com::sun::star::lang::EventObject& aEvent )
184cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     // ____ XEventListener (base of XModifyListener) ____
187cdf0e10cSrcweir     virtual void SAL_CALL disposing(
188cdf0e10cSrcweir         const ::com::sun::star::lang::EventObject& Source )
189cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     // ____ OPropertySet ____
192cdf0e10cSrcweir     virtual void firePropertyChangeEvent();
193cdf0e10cSrcweir 	using OPropertySet::disposing;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     void fireModifyEvent();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir private:
198cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
199cdf0e10cSrcweir         ::com::sun::star::uno::XComponentContext >
200cdf0e10cSrcweir                         m_xContext;
201cdf0e10cSrcweir     typedef ::std::vector< ::com::sun::star::uno::Reference<
202cdf0e10cSrcweir             ::com::sun::star::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
203cdf0e10cSrcweir     tDataSequenceContainer        m_aDataSequences;
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     typedef ::std::map< sal_Int32,
206cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
207cdf0e10cSrcweir         ::com::sun::star::beans::XPropertySet > > tDataPointAttributeContainer;
208cdf0e10cSrcweir     tDataPointAttributeContainer  m_aAttributedDataPoints;
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     typedef
211cdf0e10cSrcweir         ::std::vector< ::com::sun::star::uno::Reference<
212cdf0e10cSrcweir             ::com::sun::star::chart2::XRegressionCurve > >
213cdf0e10cSrcweir         tRegressionCurveContainerType;
214cdf0e10cSrcweir     tRegressionCurveContainerType m_aRegressionCurves;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
217cdf0e10cSrcweir };
218cdf0e10cSrcweir 
219cdf0e10cSrcweir }  // namespace chart
220cdf0e10cSrcweir 
221cdf0e10cSrcweir // _CHART_DATASERIES_HXX
222cdf0e10cSrcweir #endif
223