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