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 INCLUDED_CHART2_SOURCE_MODEL_INC_DATASERIES_HXX
20 : #define INCLUDED_CHART2_SOURCE_MODEL_INC_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 1122 : 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 : /// @see ::com::sun::star::chart2::XDataSeries
94 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
95 : SAL_CALL getDataPointByIndex( sal_Int32 nIndex )
96 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
97 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex )
99 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : virtual void SAL_CALL resetAllDataPoints()
101 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 :
103 : // ____ XDataSink ____
104 : /// @see ::com::sun::star::chart2::data::XDataSink
105 : virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData )
106 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 :
108 : // ____ XDataSource ____
109 : /// @see ::com::sun::star::chart2::data::XDataSource
110 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences()
111 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 :
113 : // ____ OPropertySet ____
114 : virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
115 : throw (css::beans::UnknownPropertyException,
116 : css::uno::RuntimeException) SAL_OVERRIDE;
117 : virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const SAL_OVERRIDE;
118 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast
119 : ( sal_Int32 nHandle,
120 : const ::com::sun::star::uno::Any& rValue )
121 : throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
122 :
123 : virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
124 :
125 : // ____ XPropertySet ____
126 : /// @see ::com::sun::star::beans::XPropertySet
127 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
128 : getPropertySetInfo()
129 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 :
131 : /// make original interface function visible again
132 : using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue;
133 :
134 : // ____ XRegressionCurveContainer ____
135 : /// @see ::com::sun::star::chart2::XRegressionCurveContainer
136 : virtual void SAL_CALL addRegressionCurve(
137 : const ::com::sun::star::uno::Reference<
138 : ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
139 : throw (::com::sun::star::lang::IllegalArgumentException,
140 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 : virtual void SAL_CALL removeRegressionCurve(
142 : const ::com::sun::star::uno::Reference<
143 : ::com::sun::star::chart2::XRegressionCurve >& aRegressionCurve )
144 : throw (::com::sun::star::container::NoSuchElementException,
145 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 : virtual ::com::sun::star::uno::Sequence<
147 : ::com::sun::star::uno::Reference<
148 : ::com::sun::star::chart2::XRegressionCurve > > SAL_CALL getRegressionCurves()
149 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 : virtual void SAL_CALL setRegressionCurves(
151 : const ::com::sun::star::uno::Sequence<
152 : ::com::sun::star::uno::Reference<
153 : ::com::sun::star::chart2::XRegressionCurve > >& aRegressionCurves )
154 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 :
156 : // ____ XCloneable ____
157 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
158 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : // ____ XModifyBroadcaster ____
161 : virtual void SAL_CALL addModifyListener(
162 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
163 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 : virtual void SAL_CALL removeModifyListener(
165 : const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
166 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 :
168 : // ____ XModifyListener ____
169 : virtual void SAL_CALL modified(
170 : const ::com::sun::star::lang::EventObject& aEvent )
171 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 :
173 : // ____ XEventListener (base of XModifyListener) ____
174 : virtual void SAL_CALL disposing(
175 : const ::com::sun::star::lang::EventObject& Source )
176 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 :
178 : // ____ OPropertySet ____
179 : virtual void firePropertyChangeEvent() SAL_OVERRIDE;
180 : using OPropertySet::disposing;
181 :
182 : void fireModifyEvent();
183 :
184 : private:
185 : ::com::sun::star::uno::Reference<
186 : ::com::sun::star::uno::XComponentContext >
187 : m_xContext;
188 : typedef ::std::vector< ::com::sun::star::uno::Reference<
189 : ::com::sun::star::chart2::data::XLabeledDataSequence > > tDataSequenceContainer;
190 : tDataSequenceContainer m_aDataSequences;
191 :
192 : typedef ::std::map< sal_Int32,
193 : ::com::sun::star::uno::Reference<
194 : ::com::sun::star::beans::XPropertySet > > tDataPointAttributeContainer;
195 : tDataPointAttributeContainer m_aAttributedDataPoints;
196 :
197 : typedef
198 : ::std::vector< ::com::sun::star::uno::Reference<
199 : ::com::sun::star::chart2::XRegressionCurve > >
200 : tRegressionCurveContainerType;
201 : tRegressionCurveContainerType m_aRegressionCurves;
202 :
203 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
204 : };
205 :
206 : } // namespace chart
207 :
208 : // INCLUDED_CHART2_SOURCE_MODEL_INC_DATASERIES_HXX
209 : #endif
210 :
211 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|