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